Do not return stored tokens in meta but call the endpoint each time

This commit is contained in:
dinamiko 2021-03-29 11:57:03 +02:00
parent 179b1b2b81
commit 5afbfb0e3b
4 changed files with 3911 additions and 8 deletions

View file

@ -223,9 +223,8 @@ class SmartButton implements SmartButtonInterface {
$tokens = $payment_token_repository->all_for_user_id( 1 );
if ( $tokens && $this->tokens_contains_card( $tokens ) ) {
$output = sprintf(
'<select id="saved-credit-card" name="saved_credit_card"><option value="">%s</option>',
'<p class="form-row form-row-wide"><label>Or select a saved Credit Card payment</label><select id="saved-credit-card" name="saved_credit_card"><option value="">%s</option>',
esc_html__( 'Choose a saved payment', 'woocommerce-paypal-payments' )
);
foreach ( $tokens as $token ) {
@ -238,7 +237,7 @@ class SmartButton implements SmartButtonInterface {
);
}
}
$output .= '</select>';
$output .= '</select></p>';
$default_fields['saved-credit-card'] = $output;
}