mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge pull request #3088 from woocommerce/PCP-4197-no-acdc-eligibility-hide-online-card-payments
No ACDC eligibility: Hide "Online Card Payments" (4197, 4148)
This commit is contained in:
commit
d1a82e801c
3 changed files with 30 additions and 18 deletions
|
@ -3,7 +3,7 @@ import { useCallback } from '@wordpress/element';
|
||||||
|
|
||||||
import SettingsCard from '../../../ReusableComponents/SettingsCard';
|
import SettingsCard from '../../../ReusableComponents/SettingsCard';
|
||||||
import { PaymentMethodsBlock } from '../../../ReusableComponents/SettingsBlocks';
|
import { PaymentMethodsBlock } from '../../../ReusableComponents/SettingsBlocks';
|
||||||
import { PaymentHooks } from '../../../../data';
|
import { CommonHooks, OnboardingHooks, PaymentHooks } from '../../../../data';
|
||||||
import { useActiveModal } from '../../../../data/common/hooks';
|
import { useActiveModal } from '../../../../data/common/hooks';
|
||||||
import Modal from '../Components/Payment/Modal';
|
import Modal from '../Components/Payment/Modal';
|
||||||
|
|
||||||
|
@ -45,6 +45,9 @@ const TabPaymentMethods = () => {
|
||||||
[ changePaymentSettings, setActiveModal, setPersistent ]
|
[ changePaymentSettings, setActiveModal, setPersistent ]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const merchant = CommonHooks.useMerchant();
|
||||||
|
const { canUseCardPayments } = OnboardingHooks.useFlags();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ppcp-r-payment-methods">
|
<div className="ppcp-r-payment-methods">
|
||||||
<PaymentMethodCard
|
<PaymentMethodCard
|
||||||
|
@ -58,20 +61,22 @@ const TabPaymentMethods = () => {
|
||||||
methods={ methods.paypal }
|
methods={ methods.paypal }
|
||||||
onTriggerModal={ setActiveModal }
|
onTriggerModal={ setActiveModal }
|
||||||
/>
|
/>
|
||||||
<PaymentMethodCard
|
{ merchant.isBusinessSeller && canUseCardPayments && (
|
||||||
id="ppcp-card-payments-card"
|
<PaymentMethodCard
|
||||||
title={ __(
|
id="ppcp-card-payments-card"
|
||||||
'Online Card Payments',
|
title={ __(
|
||||||
'woocommerce-paypal-payments'
|
'Online Card Payments',
|
||||||
) }
|
'woocommerce-paypal-payments'
|
||||||
description={ __(
|
) }
|
||||||
'Select your preferred card payment options for efficient payment processing.',
|
description={ __(
|
||||||
'woocommerce-paypal-payments'
|
'Select your preferred card payment options for efficient payment processing.',
|
||||||
) }
|
'woocommerce-paypal-payments'
|
||||||
icon="icon-checkout-online-methods.svg"
|
) }
|
||||||
methods={ methods.cardPayment }
|
icon="icon-checkout-online-methods.svg"
|
||||||
onTriggerModal={ setActiveModal }
|
methods={ methods.cardPayment }
|
||||||
/>
|
onTriggerModal={ setActiveModal }
|
||||||
|
/>
|
||||||
|
) }
|
||||||
<PaymentMethodCard
|
<PaymentMethodCard
|
||||||
id="ppcp-alternative-payments-card"
|
id="ppcp-alternative-payments-card"
|
||||||
title={ __(
|
title={ __(
|
||||||
|
|
|
@ -308,8 +308,9 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
||||||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||||
assert( $dcc_applies instanceof DCCApplies );
|
assert( $dcc_applies instanceof DCCApplies );
|
||||||
|
|
||||||
// Unset BCDC if merchant is eligible for ACDC.
|
// Unset BCDC if merchant is eligible for ACDC and country is eligible for card fields.
|
||||||
if ( $dcc_product_status->is_active() && ! $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) {
|
$card_fields_eligible = $container->get( 'card-fields.eligible' );
|
||||||
|
if ( $dcc_product_status->is_active() && $card_fields_eligible ) {
|
||||||
unset( $payment_methods[ CardButtonGateway::ID ] );
|
unset( $payment_methods[ CardButtonGateway::ID ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,6 +367,9 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
||||||
return $methods;
|
return $methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$card_button_gateway = $container->get( 'wcgateway.card-button-gateway' );
|
||||||
|
assert( $card_button_gateway instanceof CardButtonGateway );
|
||||||
|
|
||||||
$googlepay_gateway = $container->get( 'googlepay.wc-gateway' );
|
$googlepay_gateway = $container->get( 'googlepay.wc-gateway' );
|
||||||
assert( $googlepay_gateway instanceof WC_Payment_Gateway );
|
assert( $googlepay_gateway instanceof WC_Payment_Gateway );
|
||||||
|
|
||||||
|
@ -375,6 +379,7 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
||||||
$axo_gateway = $container->get( 'axo.gateway' );
|
$axo_gateway = $container->get( 'axo.gateway' );
|
||||||
assert( $axo_gateway instanceof WC_Payment_Gateway );
|
assert( $axo_gateway instanceof WC_Payment_Gateway );
|
||||||
|
|
||||||
|
$methods[] = $card_button_gateway;
|
||||||
$methods[] = $googlepay_gateway;
|
$methods[] = $googlepay_gateway;
|
||||||
$methods[] = $applepay_gateway;
|
$methods[] = $applepay_gateway;
|
||||||
$methods[] = $axo_gateway;
|
$methods[] = $axo_gateway;
|
||||||
|
@ -400,6 +405,8 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
add_filter( 'woocommerce_paypal_payments_card_button_gateway_should_register_gateway', '__return_true' );
|
||||||
|
|
||||||
add_filter(
|
add_filter(
|
||||||
'woocommerce_paypal_payments_credit_card_gateway_form_fields',
|
'woocommerce_paypal_payments_credit_card_gateway_form_fields',
|
||||||
function( array $form_fields ) {
|
function( array $form_fields ) {
|
||||||
|
|
|
@ -648,7 +648,7 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
||||||
$methods[] = $container->get( 'wcgateway.credit-card-gateway' );
|
$methods[] = $container->get( 'wcgateway.credit-card-gateway' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $paypal_gateway_enabled && $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) {
|
if ( $paypal_gateway_enabled && apply_filters( 'woocommerce_paypal_payments_card_button_gateway_should_register_gateway', $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) ) {
|
||||||
$methods[] = $container->get( 'wcgateway.card-button-gateway' );
|
$methods[] = $container->get( 'wcgateway.card-button-gateway' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue