Update only allowed cards

This commit is contained in:
Emili Castells Guasch 2024-02-12 15:19:16 +01:00
parent 8f7c7b2eb2
commit 78da47a505
2 changed files with 29 additions and 2 deletions

View file

@ -25,6 +25,13 @@ class RealTimeAccountUpdaterHelper {
* @return void
*/
public function update_wc_token_from_paypal_response( stdClass $order, WC_Payment_Token $token ): void {
if (
$token->get_type() !== 'CC'
|| ! in_array( $token->get_card_type(), array( 'VISA', 'MASTERCARD' ), true )
) {
return;
}
$expiry = $order->payment_source->card->expiry ?? '';
$wc_expiry = $token->get_expiry_month() . '-' . $token->get_expiry_year();