map master_card to mastercard

This commit is contained in:
David Remer 2020-09-28 12:13:19 +03:00
parent 8478a7e18a
commit fed6df2578

View file

@ -121,10 +121,13 @@ class ApproveOrderEndpoint implements EndpointInterface {
} }
if ( $order->payment_source() && $order->payment_source()->card() ) { if ( $order->payment_source() && $order->payment_source()->card() ) {
if ( if ( $this->settings->has( 'disable_cards' ) ) {
$this->settings->has( 'disable_cards' ) $disabled_cards = (array) $this->settings->get( 'disable_cards' );
&& in_array( strtolower( $order->payment_source()->card()->brand() ), (array) $this->settings->get( 'disable_cards' ), true ) if ( in_array( 'mastercard', $disabled_cards, true ) ) {
) { $disabled_cards[] = 'master_card';
}
$card = strtolower( $order->payment_source()->card()->brand() );
if ( in_array( $card, $disabled_cards, true ) ) {
throw new RuntimeException( throw new RuntimeException(
__( __(
'Unfortunately, we do not accept this card.', 'Unfortunately, we do not accept this card.',
@ -133,6 +136,7 @@ class ApproveOrderEndpoint implements EndpointInterface {
100 100
); );
} }
}
$proceed = $this->threed_secure->proceed_with_order( $order ); $proceed = $this->threed_secure->proceed_with_order( $order );
if ( ThreeDSecure::RETRY === $proceed ) { if ( ThreeDSecure::RETRY === $proceed ) {
throw new RuntimeException( throw new RuntimeException(