ALY, Country_Code::IRELAND, Country_Code::DENMARK, Country_Code::FINLAND, Country_Code::NORWAY, Country_Code::SWEDEN, Country_Code::FRANCE, ]; if ( null === $account_country ) { return $all_supported_countries; } $account_country = strtoupper( $account_country ); // Countries in the EEA can transact across all other EEA countries. // This includes Switzerland and the UK who aren't strictly in the EU. $eea_extended_countries = array_merge( WC_Payments_Utils::get_european_economic_area_countries(), [ Country_Code::SWITZERLAND, Country_Code::UNITED_KINGDOM ] ); // If the merchant is NOT in the EEA/UK/Switzerland, apply strict domestic restriction. if ( ! in_array( $account_country, $eea_extended_countries, true ) ) { // Non-EEA merchants can only accept domestic transactions. if ( in_array( $account_country, $all_supported_countries, true ) ) { return [ $account_country ]; } return $all_supported_countries; } // Merchant is in EEA/UK/Switzerland - apply cross-border currency logic. $store_currency = strtoupper( \get_woocommerce_currency() ); $limits = self::get_limits_per_currency(); // If the store currency is not supported by Klarna, return no countries. if ( ! isset( $limits[ $store_currency ] ) ) { return [ 'NONE_SUPPORTED' ]; } // Only countries that support the store's currency are eligible. $countries_supporting_currency = array_keys( $limits[ $store_currency ] ); return array_values( array_intersect( $eea_extended_countries, $countries_supporting_currency ) ); } /** * Get the payment method capabilities * * @return string[] */ public static function get_capabilities(): array { return [ PaymentMethodCapability::BUY_NOW_PAY_LATER, PaymentMethodCapability::REFUNDS, PaymentMethodCapability::DOMESTIC_TRANSACTIONS_ONLY, ]; } /** * Get the URL for the payment method's icon * * @param string|null $account_country Optional. The merchant's account country. * * @return string */ public static function get_icon_url( ?string $account_country = null ): string { return plugins_url( 'assets/images/payment-methods/klarna-pill.svg', WCPAY_PLUGIN_FILE ); } /** * Get the URL for the payment method's dark mode icon * * @param string|null $account_country Optional. The merchant's account country. * * @return string Returns regular icon URL if no dark mode icon exists */ public static function get_dark_icon_url( ?string $account_country = null ): string { return self::get_icon_url( $account_country ); } /** * Get the URL for the payment method's settings icon * * @param string|null $account_country Optional. The merchant's account country. * * @return string */ public static function get_settings_icon_url( ?string $account_country = null ): string { return plugins_url( 'assets/images/payment-methods/klarna.svg', WCPAY_PLUGIN_FILE ); } /** * Get the testing instructions for the payment method * * @param string $account_country The merchant's account country. * @return string HTML string containing testing instructions */ public static function get_testing_instructions( string $account_country ): string { return ''; } /** * Get the currency limits for the payment method * * @return array> */ public static function get_limits_per_currency(): array { return [ Currency_Code::UNITED_STATES_DOLLAR => [ Country_Code::UNITED_STATES => [ 'min' => 100, 'max' => 1000000, ], // Represents USD 1 - 10,000 USD. ], Currency_Code::POUND_STERLING => [ Country_Code::UNITED_KINGDOM => [ 'min' => 100, 'max' => 500000, ], // Represents GBP 1 - 5,000 GBP. ], Currency_Code::EURO => [ Country_Code::AUSTRIA => [ 'min' => 100, 'max' => 1000000, ], // Represents EUR 1 - 10,000 EUR. Country_Code::BELGIUM => [ 'min' => 100, 'max' => 1000000, ], // Represents EUR 1 - 10,000 EUR. Country_Code::GERMANY => [ 'min' => 100, 'max' => 1000000, ], // Represents EUR 1 - 10,000 EUR. Country_Code::NETHERLANDS => [ 'min' => 100, 'max' => 500000, ], // Represents EUR 1 - 5,000 EUR. Country_Code::FINLAND => [ 'min' => 100, 'max' => 1000000, ], // Represents EUR 1 - 10,000 EUR. Country_Code::SPAIN => [ 'min' => 100, 'max' => 1000000, ], // Represents EUR 1 - 10,000 EUR. Country_Code::IRELAND => [ 'min' => 100, 'max' => 400000, ], // Represents EUR 1 - 4,000 EUR. Country_Code::ITALY => [ 'min' => 100, 'max' => 400000, ], // Represents EUR 1 - 4,000 EUR. Country_Code::FRANCE => [ 'min' => 100, 'max' => 400000, ], // Represents EUR 1 - 4,000 EUR. ], Currency_Code::DANISH_KRONE => [ Country_Code::DENMARK => [ 'min' => 100, 'max' => 10000000, ], // Represents DKK 1 - 100,000 DKK. ], Currency_Code::NORWEGIAN_KRONE => [ Country_Code::NORWAY => [ 'min' => 100, 'max' => 10000000, ], // Represents NOK 1 - 100,000 NOK. ], Currency_Code::SWEDISH_KRONA => [ Country_Code::SWEDEN => [ 'min' => 100, 'max' => 10000000, ], // Represents SEK 1 - 100,000 SEK. ], ]; } /** * Whether this payment method is available for the given currency and country * * @param string $currency The currency code to check. * @param string $account_country The merchant's account country. * * @return bool */ public static function is_available_for( string $currency, string $account_country ): bool { return PaymentMethodUtils::is_available_for( self::get_supported_currencies(), self::get_supported_countries( $account_country ), $currency, $account_country ); } /** * Get the minimum amount for this payment method for a given currency and country * * @param string $currency The currency code. * @param string $country The country code. * * @return int|null The minimum amount or null if no minimum. */ public static function get_minimum_amount( string $currency, string $country ): ?int { $limits = self::get_limits_per_currency(); if ( isset( $limits[ $currency ][ $country ]['min'] ) ) { return $limits[ $currency ][ $country ]['min']; } return null; } /** * Get the maximum amount for this payment method for a given currency and country * * @param string $currency The currency code. * @param string $country The country code. * * @return int|null The maximum amount or null if no maximum. */ public static function get_maximum_amount( string $currency, string $country ): ?int { $limits = self::get_limits_per_currency(); if ( isset( $limits[ $currency ][ $country ]['max'] ) ) { return $limits[ $currency ][ $country ]['max']; } return null; } }
Fatal error: Uncaught InvalidArgumentException: Payment method definition class "WCPay\PaymentMethods\Configs\Definitions\KlarnaDefinition" does not exist. in /home/sanattv/public_html/sanat.tv/wp-content/plugins/woocommerce-payments/includes/payment-methods/Configs/Registry/PaymentMethodDefinitionRegistry.php:129 Stack trace: #0 /home/sanattv/public_html/sanat.tv/wp-content/plugins/woocommerce-payments/includes/payment-methods/Configs/Registry/PaymentMethodDefinitionRegistry.php(103): WCPay\PaymentMethods\Configs\Registry\PaymentMethodDefinitionRegistry->register_payment_method('WCPay\\PaymentMe...') #1 /home/sanattv/public_html/sanat.tv/wp-content/plugins/woocommerce-payments/includes/class-wc-payments.php(618): WCPay\PaymentMethods\Configs\Registry\PaymentMethodDefinitionRegistry->init() #2 /home/sanattv/public_html/sanat.tv/wp-content/plugins/woocommerce-payments/woocommerce-payments.php(165): WC_Payments::init() #3 /home/sanattv/public_html/sanat.tv/wp-includes/class-wp-hook.php(341): wcpay_init('') #4 /home/sanattv/public_html/sanat.tv/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #5 /home/sanattv/public_html/sanat.tv/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #6 /home/sanattv/public_html/sanat.tv/wp-settings.php(622): do_action('plugins_loaded') #7 /home/sanattv/public_html/sanat.tv/wp-config.php(84): require_once('/home/sanattv/p...') #8 /home/sanattv/public_html/sanat.tv/wp-load.php(50): require_once('/home/sanattv/p...') #9 /home/sanattv/public_html/sanat.tv/wp-blog-header.php(13): require_once('/home/sanattv/p...') #10 /home/sanattv/public_html/sanat.tv/index.php(17): require('/home/sanattv/p...') #11 {main} thrown in /home/sanattv/public_html/sanat.tv/wp-content/plugins/woocommerce-payments/includes/payment-methods/Configs/Registry/PaymentMethodDefinitionRegistry.php on line 129