mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
♻️ More reliable eligibility-check
Eligibility better aligns with the ApplePay SDK logic and will not insert a hidden button anymore.
This commit is contained in:
parent
09308f15b6
commit
c15715a02f
1 changed files with 17 additions and 2 deletions
|
@ -163,11 +163,26 @@ class ApplePayButton {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this.buttonConfig.is_admin ) {
|
if ( CONTEXT.Preview === this.context ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !! ( this.applePayConfig.isEligible && window.ApplePaySession );
|
/**
|
||||||
|
* Ensure the ApplePaySession is available and accepts payments
|
||||||
|
* This check is required when using Apple Pay SDK v1; canMakePayments() returns false
|
||||||
|
* if the current device is not liked to iCloud or the Apple Wallet is not available
|
||||||
|
* for a different reason.
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
if ( ! window.ApplePaySession?.canMakePayments() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch ( error ) {
|
||||||
|
console.warn( error );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !! this.applePayConfig.isEligible;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue