mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Ensure no wc payment token is created if user id does not exist
This commit is contained in:
parent
56a6c4ce32
commit
93514a798a
1 changed files with 12 additions and 0 deletions
|
@ -132,6 +132,10 @@ class WooCommercePaymentTokens {
|
|||
string $email
|
||||
): int {
|
||||
|
||||
if ( $customer_id === 0 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$wc_tokens = WC_Payment_Tokens::get_customer_tokens( $customer_id, PayPalGateway::ID );
|
||||
if ( $this->payment_token_helper->token_exist( $wc_tokens, $token, PaymentTokenVenmo::class ) ) {
|
||||
return 0;
|
||||
|
@ -178,6 +182,10 @@ class WooCommercePaymentTokens {
|
|||
string $token
|
||||
): int {
|
||||
|
||||
if ( $customer_id === 0 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$wc_tokens = WC_Payment_Tokens::get_customer_tokens( $customer_id, PayPalGateway::ID );
|
||||
if ( $this->payment_token_helper->token_exist( $wc_tokens, $token, PaymentTokenApplePay::class ) ) {
|
||||
return 0;
|
||||
|
@ -216,6 +224,10 @@ class WooCommercePaymentTokens {
|
|||
* @return int
|
||||
*/
|
||||
public function create_payment_token_card( int $customer_id, stdClass $payment_token ): int {
|
||||
if ( $customer_id === 0 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$wc_tokens = WC_Payment_Tokens::get_customer_tokens( $customer_id, CreditCardGateway::ID );
|
||||
if ( $this->payment_token_helper->token_exist( $wc_tokens, $payment_token->id ) ) {
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue