mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
✨ Consolidate ACDC logic in CardFieldsModule
This commit is contained in:
parent
433e7f7c8b
commit
901e7761e1
2 changed files with 19 additions and 1 deletions
|
@ -225,7 +225,7 @@ class DisabledFundingSources {
|
||||||
* Filters the final list of disabled funding sources.
|
* Filters the final list of disabled funding sources.
|
||||||
*/
|
*/
|
||||||
$disable_funding = apply_filters(
|
$disable_funding = apply_filters(
|
||||||
'woocommerce_paypal_payments_disabled_funding_sources',
|
'woocommerce_paypal_payments_sdk_disabled_funding_hook',
|
||||||
$disable_funding
|
$disable_funding
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,24 @@ class CardFieldsModule implements ServiceModule, ExtendingModule, ExecutableModu
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
'woocommerce_paypal_payments_sdk_disabled_funding_hook',
|
||||||
|
static function ( array $disable_funding ) use ( $c ) {
|
||||||
|
$dcc_config = $c->get( 'wcgateway.configuration.card-configuration' );
|
||||||
|
assert( $dcc_config instanceof CardPaymentsConfiguration );
|
||||||
|
|
||||||
|
if ( ! $dcc_config->is_acdc_enabled() ) {
|
||||||
|
return $disable_funding;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For ACDC payments we need the funding source "card"!
|
||||||
|
return array_filter(
|
||||||
|
$disable_funding,
|
||||||
|
static fn( string $funding_source ) => $funding_source !== 'card'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
add_filter(
|
add_filter(
|
||||||
'woocommerce_credit_card_form_fields',
|
'woocommerce_credit_card_form_fields',
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue