mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
validate if credit card can be used in a country
This commit is contained in:
parent
fed6df2578
commit
82be811271
6 changed files with 298 additions and 11 deletions
|
@ -12,6 +12,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway;
|
|||
use Dhii\Data\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\ApplicationContext;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\OrderTablePaymentStatusColumn;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\PaymentStatusOrderDetail;
|
||||
|
@ -1581,6 +1582,25 @@ return array(
|
|||
if ( 'GB' === $country ) {
|
||||
unset( $fields['disable_funding']['options']['card'] );
|
||||
}
|
||||
|
||||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||
/**
|
||||
* Depending on your store location, some credit cards can't be used.
|
||||
* Here, we filter them out.
|
||||
*
|
||||
* The DCC Applies object.
|
||||
*
|
||||
* @var DccApplies $dcc_applies
|
||||
*/
|
||||
$card_options = $fields['disable_cards']['options'];
|
||||
foreach ( $card_options as $card => $label ) {
|
||||
if ( $dcc_applies->can_process_card( $card ) ) {
|
||||
continue;
|
||||
}
|
||||
unset( $card_options[ $card ] );
|
||||
}
|
||||
$fields['disable_cards']['options'] = $card_options;
|
||||
$fields['card_icons']['options'] = $card_options;
|
||||
return $fields;
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue