WooPayments
5 days ago
Affirm.php
1 year ago
AfterpayClearpay.php
1 year ago
Airwallex.php
1 year ago
AmazonPay.php
1 year ago
Antom.php
1 year ago
Eway.php
11 months ago
GoCardless.php
1 year ago
Helcim.php
2 weeks ago
HelioPay.php
1 year ago
Klarna.php
1 year ago
Komoju.php
2 weeks ago
KustomCheckout.php
1 week ago
Mastercard.php
2 weeks ago
MercadoPago.php
1 year ago
Mollie.php
2 weeks ago
Monei.php
1 year ago
NexiCheckout.php
11 months ago
PayPal.php
1 year ago
PayUIndia.php
1 year ago
Payfast.php
1 year ago
PaymentGateway.php
5 months ago
Paymob.php
1 year ago
Payoneer.php
1 year ago
Paystack.php
1 year ago
Paytrail.php
1 year ago
PseudoWCPaymentGateway.php
1 year ago
Razorpay.php
1 year ago
Stripe.php
1 year ago
Tilopay.php
1 year ago
Visa.php
11 months ago
Vivacom.php
1 year ago
WCCore.php
9 months ago
WooPayments.php
9 months ago
Klarna.php
48 lines
| 1 | <?php |
| 2 | declare( strict_types=1 ); |
| 3 | |
| 4 | namespace Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders; |
| 5 | |
| 6 | use Automattic\WooCommerce\Internal\Logging\SafeGlobalFunctionProxy; |
| 7 | use Throwable; |
| 8 | use WC_Payment_Gateway; |
| 9 | |
| 10 | defined( 'ABSPATH' ) || exit; |
| 11 | |
| 12 | /** |
| 13 | * Klarna payment gateway provider class. |
| 14 | * |
| 15 | * This class handles all the custom logic for the Klarna payment gateway provider. |
| 16 | */ |
| 17 | class Klarna extends PaymentGateway { |
| 18 | |
| 19 | /** |
| 20 | * Check if the payment gateway needs setup. |
| 21 | * |
| 22 | * @param WC_Payment_Gateway $payment_gateway The payment gateway object. |
| 23 | * |
| 24 | * @return bool True if the payment gateway needs setup, false otherwise. |
| 25 | */ |
| 26 | public function needs_setup( WC_Payment_Gateway $payment_gateway ): bool { |
| 27 | try { |
| 28 | if ( class_exists( '\KP_Settings_Page' ) && |
| 29 | is_callable( '\KP_Settings_Page::get_setting_status' ) ) { |
| 30 | |
| 31 | return ! wc_string_to_bool( \KP_Settings_Page::get_setting_status( 'credentials' ) ); |
| 32 | } |
| 33 | } catch ( Throwable $e ) { |
| 34 | // Do nothing but log so we can investigate. |
| 35 | SafeGlobalFunctionProxy::wc_get_logger()->debug( |
| 36 | 'Failed to determine if gateway needs setup: ' . $e->getMessage(), |
| 37 | array( |
| 38 | 'gateway' => $payment_gateway->id, |
| 39 | 'source' => 'settings-payments', |
| 40 | 'exception' => $e, |
| 41 | ) |
| 42 | ); |
| 43 | } |
| 44 | |
| 45 | return parent::needs_setup( $payment_gateway ); |
| 46 | } |
| 47 | } |
| 48 |