mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge pull request #8 from woocommerce/issue-4-disable-card
Prevents DCC payments of disabled card brands
This commit is contained in:
commit
ce870122f2
8 changed files with 200 additions and 423 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;
|
||||
|
@ -1597,6 +1598,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;
|
||||
},
|
||||
|
||||
|
|
|
@ -427,19 +427,6 @@ class SettingsRenderer {
|
|||
'paypal-payments-for-woocommerce'
|
||||
);
|
||||
?>
|
||||
|
||||
<a
|
||||
href="https://developer.paypal.com/docs/platforms/checkout/reference/country-availability-advanced-cards/"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
<?php
|
||||
esc_html_e(
|
||||
'Click here to see, in which countries this option is currently available.',
|
||||
'paypal-payments-for-woocommerce'
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue