Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
Affirm::needs_setup
Check if the payment gateway needs setup.
Method of the class: Affirm{}
No Hooks.
Returns
true|false. True if the payment gateway needs setup, false otherwise.
Usage
$Affirm = new Affirm(); $Affirm->needs_setup( $payment_gateway ): bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
Affirm::needs_setup() Affirm::needs setup code WC 10.8.1
public function needs_setup( WC_Payment_Gateway $payment_gateway ): bool {
try {
if ( is_callable( array( $payment_gateway, 'isValidForUse' ) ) ) {
return ! wc_string_to_bool( $payment_gateway->isValidForUse() );
}
} catch ( Throwable $e ) {
// Do nothing but log so we can investigate.
SafeGlobalFunctionProxy::wc_get_logger()->debug(
'Failed to determine if gateway needs setup: ' . $e->getMessage(),
array(
'gateway' => $payment_gateway->id,
'source' => 'settings-payments',
'exception' => $e,
)
);
}
return parent::needs_setup( $payment_gateway );
}