Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
immortalist
/
wp-content
/
plugins
/
woocommerce
/
src
/
Internal
/
Admin
/
Settings
/
PaymentsProviders
:
Affirm.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php declare( strict_types=1 ); namespace Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders; use Automattic\WooCommerce\Internal\Logging\SafeGlobalFunctionProxy; use Throwable; use WC_Payment_Gateway; defined( 'ABSPATH' ) || exit; /** * Affirm payment gateway provider class. * * This class handles all the custom logic for the Affirm payment gateway provider. */ class Affirm extends PaymentGateway { /** * Check if the payment gateway needs setup. * * @param WC_Payment_Gateway $payment_gateway The payment gateway object. * * @return bool True if the payment gateway needs setup, false otherwise. */ 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 ); } }