mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Delete WC payment token if it does not exist for user
This commit is contained in:
parent
2c8aecde76
commit
4f9800079f
2 changed files with 3 additions and 0 deletions
|
@ -256,6 +256,7 @@ class RenewalHandler {
|
||||||
$customer_tokens = $this->payment_tokens_endpoint->payment_tokens_for_customer( $customer_id );
|
$customer_tokens = $this->payment_tokens_endpoint->payment_tokens_for_customer( $customer_id );
|
||||||
foreach ( $wc_tokens as $token ) {
|
foreach ( $wc_tokens as $token ) {
|
||||||
if ( ! in_array( $token->get_token(), $customer_tokens, true ) ) {
|
if ( ! in_array( $token->get_token(), $customer_tokens, true ) ) {
|
||||||
|
$token->delete();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,8 @@ class VaultPaymentTokenCreated implements RequestHandler {
|
||||||
return $this->success_response();
|
return $this->success_response();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->logger->info(wc_print_r($request['resource'], true));
|
||||||
|
|
||||||
$customer_id = null !== $request['resource'] && isset( $request['resource']['customer_id'] )
|
$customer_id = null !== $request['resource'] && isset( $request['resource']['customer_id'] )
|
||||||
? $request['resource']['customer_id']
|
? $request['resource']['customer_id']
|
||||||
: '';
|
: '';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue