mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Do not return stored tokens in meta but call the endpoint each time
This commit is contained in:
parent
179b1b2b81
commit
5afbfb0e3b
4 changed files with 3911 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -79,11 +79,6 @@ class PaymentTokenRepository {
|
|||
* @return PaymentToken[]
|
||||
*/
|
||||
public function all_for_user_id( int $id ) {
|
||||
$tokens = get_user_meta( $id, self::USER_META, true );
|
||||
if ( $tokens ) {
|
||||
return (array) $tokens;
|
||||
}
|
||||
|
||||
$tokens_array = array();
|
||||
try {
|
||||
$tokens = $this->endpoint->for_user( $id );
|
||||
|
|
3908
modules/ppcp-wc-gateway/yarn.lock
Normal file
3908
modules/ppcp-wc-gateway/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue