Skip to content

Commit

Permalink
Display saved Bacs token correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
asumaran committed Jan 29, 2025
1 parent f50c31c commit 5f6de5f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ public function set_last4( $last4 ) {
$this->set_prop( 'last4', $last4 );
}

public function get_last4( $context = 'view' ) {
return $this->get_prop( 'last4', $context );
}

public function set_payment_method_type( $type ) {
$this->set_prop( 'payment_method_type', $type );
}

public function get_payment_method_type( $context = 'view' ) {
return $this->get_prop( 'payment_method_type', $context );
}
}

11 changes: 11 additions & 0 deletions includes/payment-tokens/class-wc-stripe-payment-tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ public function get_account_saved_payment_methods_list_item( $item, $payment_tok
$item['method']['last4'] = $payment_token->get_last4();
$item['method']['brand'] = esc_html__( 'SEPA IBAN', 'woocommerce-gateway-stripe' );
break;
case WC_Stripe_Payment_Methods::BACS_DEBIT:
$item['method']['last4'] = $payment_token->get_last4();
$item['method']['brand'] = esc_html__( 'Bacs Direct Debit', 'woocommerce-gateway-stripe' );
break;
case WC_Stripe_Payment_Methods::CASHAPP_PAY:
$item['method']['brand'] = esc_html__( 'Cash App Pay', 'woocommerce-gateway-stripe' );
break;
Expand Down Expand Up @@ -523,6 +527,13 @@ private function add_token_to_user( $payment_method, WC_Stripe_Customer $custome
$token->set_fingerprint( $payment_method->card->fingerprint );
break;

case WC_Stripe_UPE_Payment_Method_Bacs::STRIPE_ID:
$token = new WC_Payment_Token_Bacs();
$token->set_token( $payment_method->id );
$token->set_last4( $payment_method->bacs_debit->last4 );
$token->set_fingerprint( $payment_method->bacs_debit->fingerprint );
$token->set_payment_method_type( $payment_method_type );
break;
case WC_Stripe_UPE_Payment_Method_Link::STRIPE_ID:
$token = new WC_Payment_Token_Link();
$token->set_email( $payment_method->link->email );
Expand Down

0 comments on commit 5f6de5f

Please sign in to comment.