mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
🐛 Fix init errors “No API configuration...”
Caused by calling `reinit()` before the invoking `init()` first. New condition in `reinit()` ensures that the button configuration is present.
This commit is contained in:
parent
843403cbdc
commit
966b76102c
2 changed files with 63 additions and 47 deletions
|
@ -472,18 +472,6 @@ export default class PaymentButton {
|
|||
return this.methodId === getCurrentPaymentMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current button instance has valid and complete configuration details.
|
||||
* Used during initialization to decide if the button can be initialized or should be skipped.
|
||||
*
|
||||
* Can be implemented by the derived class.
|
||||
*
|
||||
* @return {boolean} True indicates the config is valid and initialization can continue.
|
||||
*/
|
||||
get isConfigValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flags a preview button without actual payment logic.
|
||||
*
|
||||
|
@ -640,6 +628,19 @@ export default class PaymentButton {
|
|||
this.#logger.error( ...args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current button instance has valid and complete configuration details.
|
||||
* Used during initialization to decide if the button can be initialized or should be skipped.
|
||||
*
|
||||
* Can be implemented by the derived class.
|
||||
*
|
||||
* @param {boolean} [silent=false] - Set to true to suppress console errors.
|
||||
* @return {boolean} True indicates the config is valid and initialization can continue.
|
||||
*/
|
||||
validateConfiguration( silent = false ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
applyButtonStyles( buttonConfig, ppcpConfig = null ) {
|
||||
if ( ! ppcpConfig ) {
|
||||
ppcpConfig = this.ppcpConfig;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue