mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Ensure customer id exist before using it
This commit is contained in:
parent
dc850fca7d
commit
fa33db8191
1 changed files with 4 additions and 1 deletions
|
@ -39,8 +39,11 @@ class PaymentMethodTokensChecker {
|
|||
* @return bool
|
||||
*/
|
||||
public function has_paypal_payment_token( string $customer_id ): bool {
|
||||
$tokens = $this->payment_method_tokens_endpoint->payment_tokens_for_customer( $customer_id );
|
||||
if ( ! $customer_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tokens = $this->payment_method_tokens_endpoint->payment_tokens_for_customer( $customer_id );
|
||||
foreach ( $tokens as $token ) {
|
||||
$payment_source = $token['payment_source']->name() ?? '';
|
||||
if ( $payment_source === 'paypal' ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue