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 { PaymentMethodsBlock } from '../../../ReusableComponents/SettingsBlocks';
|
||||
import { PaymentHooks } from '../../../../data';
|
||||
import { CommonHooks, OnboardingHooks, PaymentHooks } from '../../../../data';
|
||||
import { useActiveModal } from '../../../../data/common/hooks';
|
||||
import Modal from '../Components/Payment/Modal';
|
||||
|
||||
|
@ -45,6 +45,9 @@ const TabPaymentMethods = () => {
|
|||
[ changePaymentSettings, setActiveModal, setPersistent ]
|
||||
);
|
||||
|
||||
const merchant = CommonHooks.useMerchant();
|
||||
const { canUseCardPayments } = OnboardingHooks.useFlags();
|
||||
|
||||
return (
|
||||
<div className="ppcp-r-payment-methods">
|
||||
<PaymentMethodCard
|
||||
|
@ -58,20 +61,22 @@ const TabPaymentMethods = () => {
|
|||
methods={ methods.paypal }
|
||||
onTriggerModal={ setActiveModal }
|
||||
/>
|
||||
<PaymentMethodCard
|
||||
id="ppcp-card-payments-card"
|
||||
title={ __(
|
||||
'Online Card Payments',
|
||||
'woocommerce-paypal-payments'
|
||||
) }
|
||||
description={ __(
|
||||
'Select your preferred card payment options for efficient payment processing.',
|
||||
'woocommerce-paypal-payments'
|
||||
) }
|
||||
icon="icon-checkout-online-methods.svg"
|
||||
methods={ methods.cardPayment }
|
||||
onTriggerModal={ setActiveModal }
|
||||
/>
|
||||
{ merchant.isBusinessSeller && canUseCardPayments && (
|
||||
<PaymentMethodCard
|
||||
id="ppcp-card-payments-card"
|
||||
title={ __(
|
||||
'Online Card Payments',
|
||||
'woocommerce-paypal-payments'
|
||||
) }
|
||||
description={ __(
|
||||
'Select your preferred card payment options for efficient payment processing.',
|
||||
'woocommerce-paypal-payments'
|
||||
) }
|
||||
icon="icon-checkout-online-methods.svg"
|
||||
methods={ methods.cardPayment }
|
||||
onTriggerModal={ setActiveModal }
|
||||
/>
|
||||
) }
|
||||
<PaymentMethodCard
|
||||
id="ppcp-alternative-payments-card"
|
||||
title={ __(
|
||||
|
|
|
@ -308,8 +308,9 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
|||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||
assert( $dcc_applies instanceof DCCApplies );
|
||||
|
||||
// Unset BCDC if merchant is eligible for ACDC.
|
||||
if ( $dcc_product_status->is_active() && ! $container->get( 'wcgateway.settings.allow_card_button_gateway' ) ) {
|
||||
// Unset BCDC if merchant is eligible for ACDC and country is eligible for card fields.
|
||||
$card_fields_eligible = $container->get( 'card-fields.eligible' );
|
||||
if ( $dcc_product_status->is_active() && $card_fields_eligible ) {
|
||||
unset( $payment_methods[ CardButtonGateway::ID ] );
|
||||
}
|
||||
|
||||
|
@ -366,6 +367,9 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
|||
return $methods;
|
||||
}
|
||||
|
||||
$card_button_gateway = $container->get( 'wcgateway.card-button-gateway' );
|
||||
assert( $card_button_gateway instanceof CardButtonGateway );
|
||||
|
||||
$googlepay_gateway = $container->get( 'googlepay.wc-gateway' );
|
||||
assert( $googlepay_gateway instanceof WC_Payment_Gateway );
|
||||
|
||||
|
@ -375,6 +379,7 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
|||
$axo_gateway = $container->get( 'axo.gateway' );
|
||||
assert( $axo_gateway instanceof WC_Payment_Gateway );
|
||||
|
||||
$methods[] = $card_button_gateway;
|
||||
$methods[] = $googlepay_gateway;
|
||||
$methods[] = $applepay_gateway;
|
||||
$methods[] = $axo_gateway;
|
||||
|
@ -400,6 +405,8 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
|||
2
|
||||
);
|
||||
|
||||
add_filter( 'woocommerce_paypal_payments_card_button_gateway_should_register_gateway', '__return_true' );
|
||||
|
||||
add_filter(
|
||||
'woocommerce_paypal_payments_credit_card_gateway_form_fields',
|
||||
function( array $form_fields ) {
|
||||
|
|
|
@ -648,7 +648,7 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
|||
$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' );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue