Commit 81edc2eb25 for woocommerce
commit 81edc2eb2527e0c6a0efa0382f5d2c4d69688221
Author: Vlad Olaru <vlad.olaru@automattic.com>
Date: Mon Nov 3 09:05:24 2025 +0200
[Payments NOX] Allow payment gateways to provide context links (#61681)
* refac: Move provider link type constants to PaymentsProviders
* Only use suggestion details when they are provided
* Add fetching provider links from the gateway
* Lint fixes
* test: Update fake gateway to include provider links
* test: Improve payment gateway tests coverage
* test: Improve payments providers coverage
* Add changelog
* Better defensive coding
* test: Improve cleanup and coverage
* test: Avoid linting errors
* Use sanitization util
* Add country code validation and logging
* Check for scalar before trying to cast to string
* Avoid regex
* Avoid array call
* Deduplicate provider links
* test: Update provider links related tests
* test: Better cleanup
* test: Improve coverage
---------
Co-authored-by: Cvetan Cvetanov <cvetan.cvetanov@automattic.com>
diff --git a/plugins/woocommerce/changelog/update-WOOPLUG-5743-allow-gateways-to-provide-links b/plugins/woocommerce/changelog/update-WOOPLUG-5743-allow-gateways-to-provide-links
new file mode 100644
index 0000000000..7d70bc544e
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-WOOPLUG-5743-allow-gateways-to-provide-links
@@ -0,0 +1,4 @@
+Significance: minor
+Type: update
+
+Payment gateways can now implement get_provider_links() to provide contextual provider links for the Payments settings page.
diff --git a/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php b/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php
index f9359b6452..976ab401d3 100644
--- a/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php
+++ b/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php
@@ -81,6 +81,17 @@ class PaymentsProviders {
public const CATEGORY_CRYPTO = 'crypto';
public const CATEGORY_PSP = 'psp';
+ /*
+ * The provider link types.
+ *
+ * These are hints for the UI to determine if and how to display the link.
+ */
+ public const LINK_TYPE_SUPPORT = 'support';
+ public const LINK_TYPE_DOCS = 'documentation';
+ public const LINK_TYPE_ABOUT = 'about';
+ public const LINK_TYPE_TERMS = 'terms';
+ public const LINK_TYPE_PRICING = 'pricing';
+
/**
* The map of gateway IDs to their respective provider classes.
*
@@ -1249,13 +1260,13 @@ class PaymentsProviders {
$gateway_details['image'] = $suggestion['image'];
}
- if ( empty( $gateway_details['links'] ) ) {
+ if ( empty( $gateway_details['links'] ) && ! empty( $suggestion['links'] ) ) {
$gateway_details['links'] = $suggestion['links'];
}
- if ( empty( $gateway_details['tags'] ) ) {
+ if ( empty( $gateway_details['tags'] ) && ! empty( $suggestion['tags'] ) ) {
$gateway_details['tags'] = $suggestion['tags'];
}
- if ( empty( $gateway_details['plugin'] ) ) {
+ if ( empty( $gateway_details['plugin'] ) && ! empty( $suggestion['plugin'] ) ) {
$gateway_details['plugin'] = $suggestion['plugin'];
}
if ( empty( $gateway_details['_incentive'] ) && ! empty( $suggestion['_incentive'] ) ) {
@@ -1274,7 +1285,7 @@ class PaymentsProviders {
if ( is_array( $plugin_data ) && ! empty( $plugin_data['PluginURI'] ) ) {
$gateway_details['links'] = array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => self::LINK_TYPE_ABOUT,
'url' => esc_url( $plugin_data['PluginURI'] ),
),
);
@@ -1284,7 +1295,7 @@ class PaymentsProviders {
// Fallback to constructing the WPORG plugin URI from the normalized plugin slug.
$gateway_details['links'] = array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => self::LINK_TYPE_ABOUT,
'url' => 'https://wordpress.org/plugins/' . $normalized_plugin_slug,
),
);
diff --git a/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php b/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php
index 646a692d6f..868590d4fb 100644
--- a/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php
+++ b/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php
@@ -57,6 +57,7 @@ class PaymentGateway {
'description' => $this->get_description( $gateway ),
'icon' => $this->get_icon( $gateway ),
'supports' => $this->get_supports_list( $gateway ),
+ 'links' => $this->get_provider_links( $gateway, $country_code ),
'state' => array(
'enabled' => $this->is_enabled( $gateway ),
'account_connected' => $this->is_account_connected( $gateway ),
@@ -226,6 +227,123 @@ class PaymentGateway {
return array_values( array_unique( $sanitized_list ) );
}
+ /**
+ * Get the provider links list.
+ *
+ * These are contextual, in general external links aimed to help the user learn more about the payment provider and
+ * reach out for help.
+ *
+ * Each link is an associative array with '_type' and 'url' keys.
+ * The type is a string indicating the type of link, e.g., 'documentation', 'support', 'pricing', etc.
+ * The only accepted types are the ones documented in the PaymentsProviders::LINK_TYPE_* constants.
+ *
+ * Example:
+ * array(
+ * array(
+ * '_type' => 'documentation',
+ * 'url' => 'https://example.com/docs',
+ * ),
+ * array(
+ * '_type' => 'support',
+ * 'url' => 'https://example.com/support',
+ * ),
+ * );
+ *
+ * @param WC_Payment_Gateway $payment_gateway The payment gateway object.
+ * @param string $country_code Optional. The country code for which the providers are being requested.
+ * This should be an ISO 3166-1 alpha-2 country code.
+ * If invalid, it will be ignored.
+ *
+ * @return array The provider links list. Empty array if none are available or an error occurs.
+ */
+ public function get_provider_links( WC_Payment_Gateway $payment_gateway, string $country_code = '' ): array {
+ $country_code = strtoupper( sanitize_text_field( $country_code ) );
+ // Validate the country code format - expect ISO 3166-1 alpha-2.
+ if ( strlen( $country_code ) !== 2 || ! ctype_upper( $country_code ) ) {
+ // Log so we can investigate.
+ SafeGlobalFunctionProxy::wc_get_logger()->debug(
+ 'Received invalid country code when getting provider links. Ignoring it.',
+ array(
+ 'gateway' => $payment_gateway->id,
+ 'source' => 'settings-payments',
+ 'country' => $country_code,
+ )
+ );
+
+ $country_code = '';
+ }
+
+ $provider_links = array();
+
+ try {
+ // Try to get the links list from the payment gateway if it provides such method.
+ if ( method_exists( $payment_gateway, 'get_provider_links' ) &&
+ is_callable( array( $payment_gateway, 'get_provider_links' ) ) ) {
+
+ $provider_links = call_user_func(
+ array( $payment_gateway, 'get_provider_links' ),
+ $country_code
+ );
+
+ // Validate and normalize the links list.
+ $accepted_types = array(
+ PaymentsProviders::LINK_TYPE_ABOUT,
+ PaymentsProviders::LINK_TYPE_DOCS,
+ PaymentsProviders::LINK_TYPE_SUPPORT,
+ PaymentsProviders::LINK_TYPE_PRICING,
+ PaymentsProviders::LINK_TYPE_TERMS,
+ );
+ $validated_links = array();
+ if ( is_array( $provider_links ) ) {
+ foreach ( $provider_links as $link ) {
+ if ( ! is_array( $link ) ) {
+ continue;
+ }
+
+ $type = ( isset( $link['_type'] ) && is_scalar( $link['_type'] ) ) ? sanitize_key( (string) $link['_type'] ) : '';
+ if ( empty( $type ) || ! in_array( $type, $accepted_types, true ) ) {
+ continue;
+ }
+ if ( empty( $link['url'] ) || ! is_string( $link['url'] ) || ! wc_is_valid_url( $link['url'] ) ) {
+ continue;
+ }
+
+ $url = sanitize_url( $link['url'] );
+
+ // Create a unique key for deduplication (type + URL).
+ $link_key = $type . '|' . $url;
+
+ // Skip if we already have this exact link.
+ if ( isset( $validated_links[ $link_key ] ) ) {
+ continue;
+ }
+
+ $validated_links[ $link_key ] = array(
+ '_type' => $type,
+ 'url' => $url,
+ );
+ }
+ }
+
+ $provider_links = array_values( $validated_links );
+ }
+ } catch ( Throwable $e ) {
+ // Do nothing but log so we can investigate.
+ SafeGlobalFunctionProxy::wc_get_logger()->debug(
+ 'Failed to get provider links: ' . $e->getMessage(),
+ array(
+ 'gateway' => $payment_gateway->id,
+ 'source' => 'settings-payments',
+ 'exception' => $e,
+ )
+ );
+
+ return array();
+ }
+
+ return $provider_links;
+ }
+
/**
* Check if the payment gateway is enabled.
*
diff --git a/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php b/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php
index 72c3ea4edd..7dd116fdc4 100644
--- a/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php
+++ b/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php
@@ -7,6 +7,7 @@ defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile;
use Automattic\WooCommerce\Internal\Admin\Settings\Payments;
+use Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders;
use Automattic\WooCommerce\Internal\Utilities\ArrayUtil;
/**
@@ -79,17 +80,6 @@ class PaymentsExtensionSuggestions {
*/
const PLUGIN_TYPE_WPORG = 'wporg';
- /*
- * The extension link types.
- *
- * These are hints for the UI to determine if and how to display the link.
- */
- const LINK_TYPE_PRICING = 'pricing';
- const LINK_TYPE_ABOUT = 'about';
- const LINK_TYPE_TERMS = 'terms';
- const LINK_TYPE_DOCS = 'documentation';
- const LINK_TYPE_SUPPORT = 'support';
-
/*
* Extension tags.
*
@@ -163,11 +153,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://squareup.com/ca/en/pricing',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://squareup.com/ca/en/legal/general/ua',
),
),
@@ -178,7 +168,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/en-ca/pricing/',
),
),
@@ -191,11 +181,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/ca/business/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/ca/legal/',
),
),
@@ -243,11 +233,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://squareup.com/gb/en/pricing',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://squareup.com/gb/en/legal/general/ua',
),
),
@@ -261,11 +251,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/uk/business/payment-methods/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/uk/terms-and-conditions/',
),
),
@@ -277,11 +267,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.affirm.com/en-gb/business',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.affirm.com/en-gb/terms',
),
),
@@ -292,11 +282,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/uk/business/payment-methods/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/uk/terms-and-conditions/',
),
),
@@ -350,7 +340,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/en-ie/pricing/',
),
),
@@ -360,11 +350,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/at/verkaeufer/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/at/agb/',
),
),
@@ -377,11 +367,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/at/verkaeufer/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/at/agb/',
),
),
@@ -407,7 +397,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/en-ie/pricing/',
),
),
@@ -419,11 +409,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/be/fr/entreprise/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/be/fr/conditions-generales/',
),
),
@@ -469,7 +459,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/en-ie/pricing/',
),
),
@@ -488,7 +478,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/en-ie/pricing/',
),
),
@@ -509,11 +499,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/cz/firmy/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/cz/obchodni-podminky/',
),
),
@@ -531,7 +521,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/da-dk/priser/',
),
),
@@ -541,11 +531,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/dk/erhverv/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/dk/vilkar/',
),
),
@@ -558,11 +548,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/dk/erhverv/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/dk/vilkar/',
),
),
@@ -579,7 +569,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/en-ie/pricing/',
),
),
@@ -598,7 +588,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/en-ie/pricing/',
),
),
@@ -608,11 +598,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/fi/yritys/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/fi/ehdot/',
),
),
@@ -624,11 +614,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/fi/yritys/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/fi/ehdot/',
),
),
@@ -652,11 +642,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://squareup.com/fr/fr/pricing',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://squareup.com/fr/fr/legal/general/ua',
),
),
@@ -670,7 +660,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/fr-fr/tarifs/',
),
),
@@ -682,11 +672,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/fr/entreprise/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/fr/legal/',
),
),
@@ -727,7 +717,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/de-de/preise/',
),
),
@@ -737,11 +727,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/de/verkaeufer/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/de/agb/',
),
),
@@ -754,11 +744,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/de/verkaeufer/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/de/agb/',
),
),
@@ -777,11 +767,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/gr/business/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/gr/oroi-kai-proypotheseis/',
),
),
@@ -824,11 +814,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/hu/uzlet/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/hu/jogi-informaciok/',
),
),
@@ -856,11 +846,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://squareup.com/ie/en/pricing',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://squareup.com/ie/en/legal/general/ua',
),
),
@@ -876,11 +866,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/ie/business/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/ie/terms-and-conditions/',
),
),
@@ -908,11 +898,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/it/aziende/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/it/legal/',
),
),
@@ -1012,11 +1002,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/nl/zakelijk/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/nl/voorwaarden/',
),
),
@@ -1028,11 +1018,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/nl/zakelijk/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/nl/voorwaarden/',
),
),
@@ -1056,11 +1046,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/no/bedrift/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/no/vilkar/',
),
),
@@ -1072,11 +1062,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/no/bedrift/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/no/vilkar/',
),
),
@@ -1096,11 +1086,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/pl/biznes/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/pl/zasady-i-warunki/',
),
),
@@ -1121,11 +1111,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/pt/empresa/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/pt/termos-e-condicoes/',
),
),
@@ -1144,11 +1134,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/ro/companii/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/ro/aspecte-juridice/',
),
),
@@ -1194,11 +1184,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/sk/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/sk/zmluvne-podmienky/',
),
),
@@ -1221,11 +1211,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://squareup.com/es/es/pricing',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://squareup.com/es/es/legal/general/ua',
),
),
@@ -1242,11 +1232,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/es/empresa/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/es/legal/',
),
),
@@ -1271,11 +1261,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/international/enterprise/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/se/villkor/',
),
),
@@ -1297,11 +1287,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/ch/fr/entreprise/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/ch/fr/conditions-generales-de-vente/',
),
),
@@ -1576,11 +1566,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/mx/negocios/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/mx/terminos-y-condiciones/',
),
),
@@ -1746,11 +1736,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://squareup.com/au/en/pricing',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://squareup.com/au/en/legal/general/ua',
),
),
@@ -1763,7 +1753,7 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/en-au/pricing/',
),
),
@@ -1776,11 +1766,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/au/business/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/au/legal/',
),
),
@@ -1913,11 +1903,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://squareup.com/jp/ja/pricing',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://squareup.com/jp/ja/legal/general/ua',
),
),
@@ -2025,11 +2015,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://eway.io/nz/online-payments/#pricing',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://eway.io/docs/eWAY-Terms-and-Conditions-NZ.pdf',
),
),
@@ -2043,11 +2033,11 @@ class PaymentsExtensionSuggestions {
'_merge_on_type' => array(
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/nz/business/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/nz/legal/',
),
),
@@ -3265,23 +3255,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.airwallex.com/pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/airwallexpayments/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.airwallex.com/terms/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://www.airwallex.com/docs/payments__plugins__woocommerce__install-the-woocommerce-plugin',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://help.airwallex.com/',
),
),
@@ -3297,19 +3287,19 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/antom-payments/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://global.alipay.com/docs/ac/Platform/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/antom-payment/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=antom-payments',
),
),
@@ -3326,15 +3316,15 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/mercado-pago-checkout/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/mercado-pago/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=mercado-pago-checkout',
),
),
@@ -3351,23 +3341,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.mollie.com/pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/mollie-payments-for-woocommerce/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.mollie.com/user-agreement',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/mollie-payments-for-woocommerce/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://discord.com/invite/mollie',
),
),
@@ -3384,23 +3374,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://payfast.io/fees/',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/payfast-payment-gateway/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://payfast.io/legal/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/payfast-payment-gateway/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=payfast-payment-gateway',
),
),
@@ -3417,23 +3407,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://paymob.com/en/pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/paymob/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://paymob.com/en/policy',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/paymob-for-woocommerce/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=paymob',
),
),
@@ -3450,23 +3440,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.paypal.com/webapps/mpp/merchant-fees',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/woocommerce-paypal-payments/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.paypal.com/legalhub/home',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/woocommerce-paypal-payments/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=woocommerce-paypal-payments',
),
),
@@ -3484,23 +3474,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.paypal.com/webapps/mpp/merchant-fees#advanced_cd_payments',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/woocommerce-paypal-payments/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.paypal.com/legalhub/home',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/woocommerce-paypal-payments/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=woocommerce-paypal-payments',
),
),
@@ -3518,23 +3508,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.payoneer.com/about/pricing/',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/payoneer-checkout/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.payoneer.com/legal-agreements/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://checkoutdocs.payoneer.com/docs/about-woocommerce-integration',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://checkoutdocs.payoneer.com/docs/troubleshoot-woocommerce',
),
),
@@ -3551,23 +3541,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://paystack.com/pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/paystack/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://paystack.com/terms',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/paystack/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://support.paystack.com/en/articles/2130754',
),
),
@@ -3583,23 +3573,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.paytrail.com/en/pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/paytrail/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.paytrail.com/en/terms-conditions',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/paytrail-for-woocommerce/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://www.paytrail.com/en/customer-service#merchants',
),
),
@@ -3616,23 +3606,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://payu.in/pricing/',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/payu-india/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://payu.in/payu-terms-and-conditions/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://payu.in/plugins/payment-gateway-for-woocommerce-plugin',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://help.payu.in/',
),
),
@@ -3649,23 +3639,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://razorpay.com/pricing/',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/razorpay-for-woocommerce/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://razorpay.com/terms/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://razorpay.com/docs/payment-gateway/ecommerce-plugins/woocommerce/woocommerce-pg/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://razorpay.com/support/',
),
),
@@ -3682,23 +3672,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://squareup.com/pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/square/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://squareup.com/legal/general/ua',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/woocommerce-square/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=square',
),
),
@@ -3716,23 +3706,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://stripe.com/pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/stripe/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://stripe.com/legal/connect-account',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/stripe',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=stripe',
),
),
@@ -3749,23 +3739,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://tilopay.com/tarifas',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://tilopay.com/tilopay-checkout',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://tilopay.com/terminos-condiciones',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://tilopay.com/documentacion/plataforma-woocommerce',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://cst.support.tilopay.com/servicedesk/customer/portals',
),
),
@@ -3782,23 +3772,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.viva.com/pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/viva-com-smart-for-woocommerce/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.viva.com/terms-portal',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/viva-com-smart-for-woocommerce/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=viva-com-smart-for-woocommerce',
),
),
@@ -3815,23 +3805,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://woocommerce.com/document/woopayments/fees-and-debits/',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/payments/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://woocommerce.com/document/woopayments/our-policies/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/woopayments/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=woopayments',
),
),
@@ -3849,23 +3839,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://pay.amazon.com/help/201212280',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/pay-with-amazon/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://pay.amazon.com/help/201212430',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/amazon-payments-advanced/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=pay-with-amazon',
),
),
@@ -3883,23 +3873,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.affirm.com/business',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/woocommerce-gateway-affirm/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.affirm.com/terms',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/woocommerce-gateway-affirm/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=woocommerce-gateway-affirm',
),
),
@@ -3917,23 +3907,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.afterpay.com/for-retailers',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/afterpay/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.afterpay.com/terms-of-service',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/afterpay/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=afterpay',
),
),
@@ -3949,23 +3939,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.clearpay.co.uk/en-GB/for-retailers',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/clearpay/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.clearpay.co.uk/terms-of-service',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/clearpay/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=clearpay',
),
),
@@ -3982,23 +3972,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/us/business/payment-methods/',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/klarna-payments/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/us/legal/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/klarna-payments/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=klarna-payments',
),
),
@@ -4014,23 +4004,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/us/business/payment-methods/',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/klarna-checkout/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/us/legal/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/klarna-checkout/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=klarna-checkout',
),
),
@@ -4046,23 +4036,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.hel.io/pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/helio-pay/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://info.docs.hel.io/terms-of-service',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/helio-pay/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=helio-pay',
),
),
@@ -4078,23 +4068,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://monei.com/pricing/',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://monei.com/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://monei.com/legal-notice/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://support.monei.com/hc/en-us/articles/360017801677-Get-started-with-MONEI',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://support.monei.com/hc/en-us/requests/new',
),
),
@@ -4110,23 +4100,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.eway.com.au/online-payments/#pricing',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/eway/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.eway.com.au/docs/eWAY-Terms-and-Conditions-AU.pdf',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/eway/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=eway',
),
),
@@ -4142,15 +4132,15 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/visa-acceptance-solutions/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/visa-acceptance-solutions/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=visa-acceptance-solutions',
),
),
@@ -4166,23 +4156,23 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://gocardless.com/pricing/',
),
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/gocardless/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://gocardless.com/legal/',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/gocardless/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=gocardless',
),
),
@@ -4198,19 +4188,19 @@ class PaymentsExtensionSuggestions {
),
'links' => array(
array(
- '_type' => self::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/nexi-checkout/',
),
array(
- '_type' => self::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://support.nets.eu/document/nets-easy-general-terms-and-conditions-2022',
),
array(
- '_type' => self::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/nexi-checkout/',
),
array(
- '_type' => self::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://developer.nexigroup.com/nexi-checkout/en-EU/support/',
),
),
diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/Mocks/FakePaymentGateway.php b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/Mocks/FakePaymentGateway.php
index 6a66210eeb..88194e15f4 100644
--- a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/Mocks/FakePaymentGateway.php
+++ b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/Mocks/FakePaymentGateway.php
@@ -58,6 +58,13 @@ class FakePaymentGateway extends \WC_Payment_Gateway {
*/
public $plugin_file = 'fake-plugin-slug/fake-plugin-file';
+ /**
+ * The provider links list.
+ *
+ * @var array
+ */
+ public $provider_links = array();
+
/**
* The recommended payment methods list.
*
@@ -201,6 +208,9 @@ class FakePaymentGateway extends \WC_Payment_Gateway {
* @return array List of recommended payment methods for the given country.
*/
public function get_recommended_payment_methods( string $country_code = '' ) {
+ // Test stub does not vary by country.
+ unset( $country_code );
+
return $this->recommended_payment_methods;
}
@@ -277,4 +287,22 @@ class FakePaymentGateway extends \WC_Payment_Gateway {
public function is_in_test_mode_onboarding() {
return $this->test_mode_onboarding;
}
+
+ /**
+ * Get the provider links list.
+ *
+ * @param string $country_code Optional. The country code for which the providers are being requested.
+ *
+ * @return array The provider links list.
+ */
+ public function get_provider_links( string $country_code = '' ): array {
+ // Test stub does not vary by country.
+ unset( $country_code );
+
+ if ( isset( $this->provider_links ) ) {
+ return $this->provider_links;
+ }
+
+ return array();
+ }
}
diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/PaymentGatewayTest.php b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/PaymentGatewayTest.php
index ffaa6a2033..663fcfa15c 100644
--- a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/PaymentGatewayTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/PaymentGatewayTest.php
@@ -121,6 +121,7 @@ class PaymentGatewayTest extends WC_Unit_Test_Case {
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim…',
'icon' => 'https://example.com/icon.png',
'supports' => array( 'products', 'something', 'bogus' ),
+ 'links' => array(),
'state' => array(
'enabled' => true,
'account_connected' => true,
@@ -930,6 +931,731 @@ class PaymentGatewayTest extends WC_Unit_Test_Case {
$this->assertEquals( '', $this->sut->get_plugin_file( $fake_gateway ) );
}
+ /**
+ * Test get_provider_links with valid links.
+ */
+ public function test_get_provider_links_with_valid_links() {
+ // Arrange - Test all accepted link types.
+ $fake_gateway = new FakePaymentGateway(
+ 'gateway1',
+ array(
+ 'provider_links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
+ 'url' => 'https://example.com/about',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://example.com/docs',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://example.com/support',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
+ 'url' => 'https://example.com/pricing',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
+ 'url' => 'https://example.com/terms',
+ ),
+ ),
+ )
+ );
+
+ // Act.
+ $links = $this->sut->get_provider_links( $fake_gateway, 'US' );
+
+ // Assert.
+ $this->assertCount( 5, $links );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_ABOUT, $links[0]['_type'] );
+ $this->assertEquals( 'https://example.com/about', $links[0]['url'] );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_DOCS, $links[1]['_type'] );
+ $this->assertEquals( 'https://example.com/docs', $links[1]['url'] );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_SUPPORT, $links[2]['_type'] );
+ $this->assertEquals( 'https://example.com/support', $links[2]['url'] );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_PRICING, $links[3]['_type'] );
+ $this->assertEquals( 'https://example.com/pricing', $links[3]['url'] );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_TERMS, $links[4]['_type'] );
+ $this->assertEquals( 'https://example.com/terms', $links[4]['url'] );
+ }
+
+ /**
+ * Test get_provider_links without provider_links set.
+ */
+ public function test_get_provider_links_without_provider_links() {
+ // Arrange - Create a gateway without provider_links set.
+ $fake_gateway = new FakePaymentGateway( 'gateway1', array() );
+
+ // Act.
+ $links = $this->sut->get_provider_links( $fake_gateway );
+
+ // Assert.
+ $this->assertEquals( array(), $links );
+ }
+
+ /**
+ * Test get_provider_links when the method is not defined on the gateway.
+ */
+ public function test_get_provider_links_when_method_not_defined() {
+ // Arrange - Create a mock gateway without the get_provider_links method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ // Set the id property that might be used in error logging.
+ $gateway->id = 'test_gateway';
+
+ // Act.
+ $links = $this->sut->get_provider_links( $gateway );
+
+ // Assert - Should return empty array when method doesn't exist.
+ $this->assertEquals( array(), $links );
+ }
+
+ /**
+ * Test that when a gateway implements get_provider_links, the method gets called and returned links are used.
+ */
+ public function test_get_provider_links_method_is_called_and_links_are_used() {
+ // Arrange - Create a mock gateway with the get_provider_links method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'get_provider_links' ) )
+ ->getMock();
+
+ // Set the id property that might be used in error logging.
+ $gateway->id = 'test_gateway';
+
+ // Expected links to be returned by the mock.
+ $expected_links = array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://example.com/documentation',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://example.com/support-page',
+ ),
+ );
+
+ // Expect the get_provider_links method to be called once with the country code 'US'.
+ $gateway->expects( $this->once() )
+ ->method( 'get_provider_links' )
+ ->with( 'US' )
+ ->willReturn( $expected_links );
+
+ // Act.
+ $links = $this->sut->get_provider_links( $gateway, 'US' );
+
+ // Assert - Verify the links returned match what the gateway method provided.
+ $this->assertCount( 2, $links );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_DOCS, $links[0]['_type'] );
+ $this->assertEquals( 'https://example.com/documentation', $links[0]['url'] );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_SUPPORT, $links[1]['_type'] );
+ $this->assertEquals( 'https://example.com/support-page', $links[1]['url'] );
+ }
+
+ /**
+ * Test get_provider_links with invalid link types.
+ */
+ public function test_get_provider_links_with_invalid_types() {
+ // Arrange.
+ $fake_gateway = new FakePaymentGateway(
+ 'gateway1',
+ array(
+ 'provider_links' => array(
+ array(
+ '_type' => 'invalid_type',
+ 'url' => 'https://example.com/invalid',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://example.com/support',
+ ),
+ array(
+ // Missing _type.
+ 'url' => 'https://example.com/no-type',
+ ),
+ array(
+ '_type' => '', // Empty type.
+ 'url' => 'https://example.com/empty-type',
+ ),
+ ),
+ )
+ );
+
+ // Act.
+ $links = $this->sut->get_provider_links( $fake_gateway );
+
+ // Assert - Only the valid one should remain.
+ $this->assertCount( 1, $links );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_SUPPORT, $links[0]['_type'] );
+ $this->assertEquals( 'https://example.com/support', $links[0]['url'] );
+ }
+
+ /**
+ * Test get_provider_links with invalid URLs.
+ */
+ public function test_get_provider_links_with_invalid_urls() {
+ // Arrange.
+ $fake_gateway = new FakePaymentGateway(
+ 'gateway1',
+ array(
+ 'provider_links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
+ 'url' => 'not_a_valid_url',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://example.com/docs',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ // Missing url.
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
+ 'url' => '', // Empty URL.
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
+ 'url' => 123, // Wrong type.
+ ),
+ ),
+ )
+ );
+
+ // Act.
+ $links = $this->sut->get_provider_links( $fake_gateway );
+
+ // Assert - Only the valid one should remain.
+ $this->assertCount( 1, $links );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_DOCS, $links[0]['_type'] );
+ $this->assertEquals( 'https://example.com/docs', $links[0]['url'] );
+ }
+
+ /**
+ * Test get_provider_links with non-array items.
+ */
+ public function test_get_provider_links_with_non_array_items() {
+ // Arrange.
+ $fake_gateway = new FakePaymentGateway(
+ 'gateway1',
+ array(
+ 'provider_links' => array(
+ 'not_an_array',
+ 123,
+ true,
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://example.com/support',
+ ),
+ null,
+ ),
+ )
+ );
+
+ // Act.
+ $links = $this->sut->get_provider_links( $fake_gateway );
+
+ // Assert - Only the valid one should remain.
+ $this->assertCount( 1, $links );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_SUPPORT, $links[0]['_type'] );
+ $this->assertEquals( 'https://example.com/support', $links[0]['url'] );
+ }
+
+ /**
+ * Test get_provider_links with non-array return value.
+ */
+ public function test_get_provider_links_with_non_array_return() {
+ // Arrange.
+ $fake_gateway = new FakePaymentGateway(
+ 'gateway1',
+ array(
+ 'provider_links' => 'not_an_array',
+ )
+ );
+
+ // Act.
+ $links = $this->sut->get_provider_links( $fake_gateway );
+
+ // Assert.
+ $this->assertEquals( array(), $links );
+ }
+
+ /**
+ * Test get_provider_links with empty array.
+ */
+ public function test_get_provider_links_with_empty_array() {
+ // Arrange.
+ $fake_gateway = new FakePaymentGateway(
+ 'gateway1',
+ array(
+ 'provider_links' => array(),
+ )
+ );
+
+ // Act.
+ $links = $this->sut->get_provider_links( $fake_gateway );
+
+ // Assert.
+ $this->assertEquals( array(), $links );
+ }
+
+ /**
+ * Test get_provider_links URL sanitization.
+ */
+ public function test_get_provider_links_url_sanitization() {
+ // Arrange.
+ $fake_gateway = new FakePaymentGateway(
+ 'gateway1',
+ array(
+ 'provider_links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://example.com/support?param=value&special=<script>alert("xss")</script>',
+ ),
+ ),
+ )
+ );
+
+ // Act.
+ $links = $this->sut->get_provider_links( $fake_gateway );
+
+ // Assert - URL should be escaped.
+ $this->assertCount( 1, $links );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_SUPPORT, $links[0]['_type'] );
+ $this->assertStringContainsString( 'https://example.com/support', $links[0]['url'] );
+ $this->assertStringNotContainsString( '<script>', $links[0]['url'] );
+ }
+
+ /**
+ * Test get_provider_links includes in get_details.
+ */
+ public function test_get_provider_links_in_get_details() {
+ // Arrange.
+ $fake_gateway = new FakePaymentGateway(
+ 'gateway1',
+ array(
+ 'plugin_slug' => 'test-gateway',
+ 'plugin_file' => 'test-gateway/test-gateway.php',
+ 'provider_links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://example.com/docs',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://example.com/support',
+ ),
+ ),
+ )
+ );
+
+ // Act.
+ $details = $this->sut->get_details( $fake_gateway );
+
+ // Assert - Links should be included.
+ $this->assertArrayHasKey( 'links', $details );
+ $this->assertCount( 2, $details['links'] );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_DOCS, $details['links'][0]['_type'] );
+ $this->assertEquals( 'https://example.com/docs', $details['links'][0]['url'] );
+ $this->assertEquals( PaymentsProviders::LINK_TYPE_SUPPORT, $details['links'][1]['_type'] );
+ $this->assertEquals( 'https://example.com/support', $details['links'][1]['url'] );
+ }
+
+ /**
+ * Test that when a gateway implements needs_setup(), the method gets called and returned value is used.
+ */
+ public function test_needs_setup_method_is_called() {
+ // Arrange - Create a mock gateway with the needs_setup method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->onlyMethods( array( 'needs_setup' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the needs_setup method to be called once and return true.
+ $gateway->expects( $this->once() )
+ ->method( 'needs_setup' )
+ ->willReturn( true );
+
+ // Act.
+ $result = $this->sut->needs_setup( $gateway );
+
+ // Assert.
+ $this->assertTrue( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_test_mode(), the method gets called and returned value is used.
+ */
+ public function test_is_test_mode_method_is_called() {
+ // Arrange - Create a mock gateway with the is_test_mode method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_test_mode' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the is_test_mode method to be called once and return true.
+ $gateway->expects( $this->once() )
+ ->method( 'is_test_mode' )
+ ->willReturn( true );
+
+ // Act.
+ $result = $this->sut->is_in_test_mode( $gateway );
+
+ // Assert.
+ $this->assertTrue( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_in_test_mode(), the method gets called and returned value is used.
+ */
+ public function test_is_in_test_mode_method_is_called() {
+ // Arrange - Create a mock gateway with the is_in_test_mode method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_in_test_mode' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the is_in_test_mode method to be called once and return true.
+ $gateway->expects( $this->once() )
+ ->method( 'is_in_test_mode' )
+ ->willReturn( true );
+
+ // Act.
+ $result = $this->sut->is_in_test_mode( $gateway );
+
+ // Assert.
+ $this->assertTrue( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_dev_mode(), the method gets called and returned value is used.
+ */
+ public function test_is_dev_mode_method_is_called() {
+ // Arrange - Create a mock gateway with the is_dev_mode method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_dev_mode' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the is_dev_mode method to be called once and return true.
+ $gateway->expects( $this->once() )
+ ->method( 'is_dev_mode' )
+ ->willReturn( true );
+
+ // Act.
+ $result = $this->sut->is_in_dev_mode( $gateway );
+
+ // Assert.
+ $this->assertTrue( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_in_dev_mode(), the method gets called and returned value is used.
+ */
+ public function test_is_in_dev_mode_method_is_called() {
+ // Arrange - Create a mock gateway with the is_in_dev_mode method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_in_dev_mode' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the is_in_dev_mode method to be called once and return true.
+ $gateway->expects( $this->once() )
+ ->method( 'is_in_dev_mode' )
+ ->willReturn( true );
+
+ // Act.
+ $result = $this->sut->is_in_dev_mode( $gateway );
+
+ // Assert.
+ $this->assertTrue( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_account_connected(), the method gets called and returned value is used.
+ */
+ public function test_is_account_connected_method_is_called() {
+ // Arrange - Create a mock gateway with the is_account_connected method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_account_connected' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the is_account_connected method to be called once and return false.
+ $gateway->expects( $this->once() )
+ ->method( 'is_account_connected' )
+ ->willReturn( false );
+
+ // Act.
+ $result = $this->sut->is_account_connected( $gateway );
+
+ // Assert.
+ $this->assertFalse( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_connected(), the method gets called and returned value is used.
+ */
+ public function test_is_connected_method_is_called() {
+ // Arrange - Create a mock gateway with the is_connected method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_connected' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the is_connected method to be called once and return false.
+ $gateway->expects( $this->once() )
+ ->method( 'is_connected' )
+ ->willReturn( false );
+
+ // Act.
+ $result = $this->sut->is_account_connected( $gateway );
+
+ // Assert.
+ $this->assertFalse( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_onboarding_started(), the method gets called and returned value is used.
+ */
+ public function test_is_onboarding_started_method_is_called() {
+ // Arrange - Create a mock gateway with the is_onboarding_started method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_onboarding_started' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the is_onboarding_started method to be called once and return false.
+ $gateway->expects( $this->once() )
+ ->method( 'is_onboarding_started' )
+ ->willReturn( false );
+
+ // Act.
+ $result = $this->sut->is_onboarding_started( $gateway );
+
+ // Assert.
+ $this->assertFalse( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_onboarding_completed(), the method gets called and returned value is used.
+ */
+ public function test_is_onboarding_completed_method_is_called() {
+ // Arrange - Create a mock gateway with both methods for onboarding.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_onboarding_started', 'is_onboarding_completed' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect is_onboarding_started to return true (prerequisite).
+ $gateway->expects( $this->once() )
+ ->method( 'is_onboarding_started' )
+ ->willReturn( true );
+
+ // Expect the is_onboarding_completed method to be called once and return true.
+ $gateway->expects( $this->once() )
+ ->method( 'is_onboarding_completed' )
+ ->willReturn( true );
+
+ // Act.
+ $result = $this->sut->is_onboarding_completed( $gateway );
+
+ // Assert.
+ $this->assertTrue( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_account_partially_onboarded(), the method gets called and returned value is used.
+ */
+ public function test_is_account_partially_onboarded_method_is_called() {
+ // Arrange - Create a mock gateway with the is_account_partially_onboarded method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_onboarding_started', 'is_account_partially_onboarded' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect is_onboarding_started to return true (prerequisite).
+ $gateway->expects( $this->once() )
+ ->method( 'is_onboarding_started' )
+ ->willReturn( true );
+
+ // Expect the is_account_partially_onboarded method to be called once and return true.
+ // When partially onboarded, is_onboarding_completed should return false (inverted).
+ $gateway->expects( $this->once() )
+ ->method( 'is_account_partially_onboarded' )
+ ->willReturn( true );
+
+ // Act.
+ $result = $this->sut->is_onboarding_completed( $gateway );
+
+ // Assert - Should be false because partially onboarded.
+ $this->assertFalse( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_test_mode_onboarding(), the method gets called and returned value is used.
+ */
+ public function test_is_test_mode_onboarding_method_is_called() {
+ // Arrange - Create a mock gateway with the is_test_mode_onboarding method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_test_mode_onboarding' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the is_test_mode_onboarding method to be called once and return true.
+ $gateway->expects( $this->once() )
+ ->method( 'is_test_mode_onboarding' )
+ ->willReturn( true );
+
+ // Act.
+ $result = $this->sut->is_in_test_mode_onboarding( $gateway );
+
+ // Assert.
+ $this->assertTrue( $result );
+ }
+
+ /**
+ * Test that when a gateway implements is_in_test_mode_onboarding(), the method gets called and returned value is used.
+ */
+ public function test_is_in_test_mode_onboarding_method_is_called() {
+ // Arrange - Create a mock gateway with the is_in_test_mode_onboarding method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'is_in_test_mode_onboarding' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the is_in_test_mode_onboarding method to be called once and return true.
+ $gateway->expects( $this->once() )
+ ->method( 'is_in_test_mode_onboarding' )
+ ->willReturn( true );
+
+ // Act.
+ $result = $this->sut->is_in_test_mode_onboarding( $gateway );
+
+ // Assert.
+ $this->assertTrue( $result );
+ }
+
+ /**
+ * Test that when a gateway implements get_settings_url(), the method gets called and returned URL is used.
+ */
+ public function test_get_settings_url_method_is_called() {
+ // Arrange - Create a mock gateway with the get_settings_url method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'get_settings_url' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the get_settings_url method to be called once and return a valid URL.
+ $gateway->expects( $this->once() )
+ ->method( 'get_settings_url' )
+ ->willReturn( 'https://example.com/gateway-settings' );
+
+ // Act.
+ $result = $this->sut->get_settings_url( $gateway );
+
+ // Assert - Should return the URL with the 'from' parameter added.
+ $this->assertStringContainsString( 'https://example.com/gateway-settings', $result );
+ $this->assertStringContainsString( 'from=' . Payments::FROM_PAYMENTS_SETTINGS, $result );
+ }
+
+ /**
+ * Test that when a gateway implements get_connection_url(), the method gets called and returned URL is used.
+ */
+ public function test_get_connection_url_method_is_called() {
+ // Arrange - Create a mock gateway with the get_connection_url method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'get_connection_url' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expect the get_connection_url method to be called once with a return URL parameter.
+ $gateway->expects( $this->once() )
+ ->method( 'get_connection_url' )
+ ->with( $this->stringContains( 'admin.php?page=wc-settings' ) )
+ ->willReturn( 'https://example.com/onboard' );
+
+ // Act.
+ $result = $this->sut->get_onboarding_url( $gateway );
+
+ // Assert.
+ $this->assertEquals( 'https://example.com/onboard', $result );
+ }
+
+ /**
+ * Test that when a gateway implements get_recommended_payment_methods(), the method gets called and returned data is used.
+ */
+ public function test_get_recommended_payment_methods_method_is_called() {
+ // Arrange - Create a mock gateway with the get_recommended_payment_methods method.
+ $gateway = $this->getMockBuilder( 'WC_Payment_Gateway' )
+ ->disableOriginalConstructor()
+ ->addMethods( array( 'get_recommended_payment_methods' ) )
+ ->getMock();
+
+ $gateway->id = 'test_gateway';
+
+ // Expected payment methods to be returned by the mock.
+ $expected_methods = array(
+ array(
+ 'id' => 'card',
+ 'title' => 'Credit Card',
+ ),
+ array(
+ 'id' => 'bank_transfer',
+ 'title' => 'Bank Transfer',
+ ),
+ );
+
+ // Expect the get_recommended_payment_methods method to be called once with country code 'GB'.
+ $gateway->expects( $this->once() )
+ ->method( 'get_recommended_payment_methods' )
+ ->with( 'GB' )
+ ->willReturn( $expected_methods );
+
+ // Act.
+ $result = $this->sut->get_recommended_payment_methods( $gateway, 'GB' );
+
+ // Assert - Verify the methods returned are properly processed.
+ $this->assertCount( 2, $result );
+ $this->assertEquals( 'card', $result[0]['id'] );
+ $this->assertEquals( 'Credit Card', $result[0]['title'] );
+ $this->assertEquals( 'bank_transfer', $result[1]['id'] );
+ $this->assertEquals( 'Bank Transfer', $result[1]['title'] );
+ }
+
/**
* Test get_recommended_payment_methods.
*/
diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/WooPaymentsTest.php b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/WooPaymentsTest.php
index 2188f10d50..c1546cae48 100644
--- a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/WooPaymentsTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/WooPaymentsTest.php
@@ -149,6 +149,7 @@ class WooPaymentsTest extends WC_Unit_Test_Case {
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim…',
'icon' => 'https://example.com/icon.png',
'supports' => array( 'products', 'something', 'bogus' ),
+ 'links' => array(),
'state' => array(
'enabled' => true,
'account_connected' => true,
diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProvidersTest.php b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProvidersTest.php
index 11a1912e6e..63c0309682 100644
--- a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProvidersTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProvidersTest.php
@@ -40,6 +40,13 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
*/
protected $store_admin_id;
+ /**
+ * The previous store currency value to restore in tearDown.
+ *
+ * @var string|null
+ */
+ private $prev_currency;
+
/**
* Set up test.
*/
@@ -49,6 +56,9 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
$this->store_admin_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
wp_set_current_user( $this->store_admin_id );
+ // Save the current currency to restore in tearDown.
+ $this->prev_currency = get_option( 'woocommerce_currency', null );
+
$this->mock_extension_suggestions = $this->getMockBuilder( ExtensionSuggestions::class )
->disableOriginalConstructor()
->getMock();
@@ -57,6 +67,26 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
$this->sut->init( $this->mock_extension_suggestions, wc_get_container()->get( LegacyProxy::class ) );
}
+ /**
+ * Tear down test.
+ */
+ public function tearDown(): void {
+ // Reset gateways/hooks and controller memo between tests.
+ remove_all_actions( 'wc_payment_gateways_initialized' );
+ WC()->payment_gateways()->payment_gateways = array();
+ WC()->payment_gateways()->init();
+ if ( isset( $this->sut ) ) {
+ $this->sut->reset_memo();
+ }
+
+ // Restore the previous currency to prevent test leakage.
+ if ( null !== $this->prev_currency ) {
+ update_option( 'woocommerce_currency', $this->prev_currency );
+ }
+
+ parent::tearDown();
+ }
+
/**
* Test getting payment gateways.
*/
@@ -83,7 +113,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
);
// Clean up.
- $this->sut->reset_memo();
+ $this->unload_core_paypal_pg();
}
/**
@@ -402,6 +432,41 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'method_description' => '',
'plugin_slug' => 'woocommerce-payments',
'plugin_file' => 'woocommerce-payments/woocommerce-payments.php',
+ 'provider_links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://woocommerce.com/docs/woocommerce-payments/',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://woocommerce.com/my-account/create-a-ticket/',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
+ 'url' => 'https://woocommerce.com/terms-conditions/',
+ ),
+ // Invalid link entries to test validation. These should be filtered out.
+ array(
+ // Missing '_type' field.
+ 'url' => 'https://example.com/missing-type/',
+ ),
+ array(
+ // Missing 'url' field.
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
+ ),
+ array(
+ '_type' => '',
+ 'url' => 'https://example.com/empty-type/',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
+ 'url' => '',
+ ),
+ // Invalid link, not an array at all.
+ 'not_an_array',
+ // Invalid link with no data.
+ array(),
+ ),
'recommended_payment_methods' => array(
// Basic PM.
array(
@@ -464,6 +529,27 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
$this->assertSame( 'Accept payments with WooPayments.', $gateway_details['description'] );
$this->assertArrayHasKey( 'supports', $gateway_details, 'Gateway `supports` entry is missing' );
$this->assertIsList( $gateway_details['supports'], 'Gateway `supports` entry is not a list' );
+ $this->assertArrayHasKey( 'links', $gateway_details, 'Gateway `links` entry is missing' );
+ $this->assertIsArray( $gateway_details['links'], 'Gateway `links` entry is not an array' );
+ $this->assertCount( 3, $gateway_details['links'], 'Gateway `links` should have 3 entries' );
+
+ // Validate each link has the required structure.
+ foreach ( $gateway_details['links'] as $link ) {
+ $this->assertIsArray( $link, 'Each link entry should be an array' );
+ $this->assertArrayHasKey( '_type', $link, 'Link entry should have `_type` field' );
+ $this->assertArrayHasKey( 'url', $link, 'Link entry should have `url` field' );
+ $this->assertNotEmpty( $link['_type'], 'Link `_type` should not be empty' );
+ $this->assertNotEmpty( $link['url'], 'Link `url` should not be empty' );
+ }
+
+ // Validate the specific link types and URLs.
+ $this->assertSame( PaymentsProviders::LINK_TYPE_DOCS, $gateway_details['links'][0]['_type'], 'First link should be DOCS type' );
+ $this->assertSame( 'https://woocommerce.com/docs/woocommerce-payments/', $gateway_details['links'][0]['url'], 'First link URL should match' );
+ $this->assertSame( PaymentsProviders::LINK_TYPE_SUPPORT, $gateway_details['links'][1]['_type'], 'Second link should be SUPPORT type' );
+ $this->assertSame( 'https://woocommerce.com/my-account/create-a-ticket/', $gateway_details['links'][1]['url'], 'Second link URL should match' );
+ $this->assertSame( PaymentsProviders::LINK_TYPE_TERMS, $gateway_details['links'][2]['_type'], 'Third link should be TERMS type' );
+ $this->assertSame( 'https://woocommerce.com/terms-conditions/', $gateway_details['links'][2]['url'], 'Third link URL should match' );
+
$this->assertArrayHasKey( 'state', $gateway_details, 'Gateway `state` entry is missing' );
$this->assertArrayHasKey( 'enabled', $gateway_details['state'], 'Gateway `state[enabled]` entry is missing' );
$this->assertTrue( $gateway_details['state']['enabled'], 'Gateway `state[enabled]` entry is not true' );
@@ -576,6 +662,251 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
delete_option( 'mollie-payments-for-woocommerce_test_api_key' );
}
+ /**
+ * Test that get_payment_gateway_details fills in suggestion details.
+ */
+ public function test_get_payment_gateway_details_fills_in_suggestion_details() {
+ // Arrange.
+ $plugin_slug = 'woocommerce-gateway-stripe';
+ $fake_gateway = new FakePaymentGateway(
+ 'stripe',
+ array(
+ 'enabled' => true,
+ 'title' => 'Basic Gateway Title',
+ 'method_title' => 'Basic Gateway Method Title',
+ 'description' => 'Basic gateway description',
+ 'method_description' => '',
+ 'plugin_slug' => $plugin_slug,
+ 'plugin_file' => 'woocommerce-gateway-stripe/woocommerce-gateway-stripe.php',
+ ),
+ );
+
+ // Mock a suggestion with rich details.
+ $suggestion = array(
+ 'id' => 'stripe',
+ '_priority' => 1,
+ '_type' => ExtensionSuggestions::TYPE_PSP,
+ 'title' => 'Stripe - Suggestion Title',
+ 'description' => 'Stripe - Suggestion Description',
+ 'plugin' => array(
+ '_type' => ExtensionSuggestions::PLUGIN_TYPE_WPORG,
+ 'slug' => $plugin_slug,
+ ),
+ 'icon' => 'http://example.com/stripe-icon.png',
+ 'image' => 'http://example.com/stripe-image.png',
+ 'short_description' => 'Short description from suggestion',
+ 'links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://stripe.com/docs',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://stripe.com/support',
+ ),
+ ),
+ 'tags' => array( 'recommended', 'popular' ),
+ '_incentive' => array(
+ 'description' => 'Special offer',
+ ),
+ );
+
+ $this->mock_extension_suggestions
+ ->expects( $this->once() )
+ ->method( 'get_by_plugin_slug' )
+ ->with( $plugin_slug )
+ ->willReturn( $suggestion );
+
+ // Act.
+ $gateway_details = $this->sut->get_payment_gateway_details( $fake_gateway, 0, 'US' );
+
+ // Assert that suggestion details are filled in.
+ $this->assertArrayHasKey( '_suggestion_id', $gateway_details, 'Gateway details should have _suggestion_id' );
+ $this->assertSame( 'stripe', $gateway_details['_suggestion_id'], 'Suggestion ID should match' );
+
+ // Verify title and description are filled in from suggestion.
+ $this->assertSame( 'Stripe - Suggestion Title', $gateway_details['title'], 'Title should be filled from suggestion' );
+ $this->assertSame( 'Stripe - Suggestion Description', $gateway_details['description'], 'Description should be filled from suggestion' );
+
+ // Verify icon and image are filled in from suggestion.
+ $this->assertArrayHasKey( 'icon', $gateway_details, 'Gateway details should have icon' );
+ $this->assertSame( 'http://example.com/stripe-icon.png', $gateway_details['icon'], 'Icon should be filled from suggestion' );
+ $this->assertArrayHasKey( 'image', $gateway_details, 'Gateway details should have image' );
+ $this->assertSame( 'http://example.com/stripe-image.png', $gateway_details['image'], 'Image should be filled from suggestion' );
+
+ // Verify links are filled in from suggestion.
+ $this->assertArrayHasKey( 'links', $gateway_details, 'Gateway details should have links' );
+ $this->assertIsArray( $gateway_details['links'], 'Links should be an array' );
+ $this->assertCount( 2, $gateway_details['links'], 'Should have 2 links from suggestion' );
+ $this->assertSame( PaymentsProviders::LINK_TYPE_DOCS, $gateway_details['links'][0]['_type'], 'First link should be DOCS type' );
+ $this->assertSame( 'https://stripe.com/docs', $gateway_details['links'][0]['url'], 'First link URL should match' );
+ $this->assertSame( PaymentsProviders::LINK_TYPE_SUPPORT, $gateway_details['links'][1]['_type'], 'Second link should be SUPPORT type' );
+ $this->assertSame( 'https://stripe.com/support', $gateway_details['links'][1]['url'], 'Second link URL should match' );
+
+ // Verify tags are filled in from suggestion.
+ $this->assertArrayHasKey( 'tags', $gateway_details, 'Gateway details should have tags' );
+ $this->assertIsArray( $gateway_details['tags'], 'Tags should be an array' );
+ $this->assertCount( 2, $gateway_details['tags'], 'Should have 2 tags from suggestion' );
+ $this->assertContains( 'recommended', $gateway_details['tags'], 'Tags should contain recommended' );
+ $this->assertContains( 'popular', $gateway_details['tags'], 'Tags should contain popular' );
+
+ // Verify incentive is filled in from suggestion.
+ $this->assertArrayHasKey( '_incentive', $gateway_details, 'Gateway details should have _incentive' );
+ $this->assertIsArray( $gateway_details['_incentive'], '_incentive should be an array' );
+ $this->assertSame( 'Special offer', $gateway_details['_incentive']['description'], 'Incentive description should match' );
+ }
+
+ /**
+ * Test that get_payment_gateway_details does not override gateway details with those from the suggestion
+ * when they exist.
+ */
+ public function test_get_payment_gateway_details_does_not_override_existing_details_with_suggestion_ones() {
+ // Arrange.
+ $plugin_slug = 'woocommerce-gateway-stripe';
+ $gateway_links = array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://gateway.com/docs',
+ ),
+ );
+ $fake_gateway = new FakePaymentGateway(
+ 'stripe',
+ array(
+ 'enabled' => true,
+ 'plugin_slug' => $plugin_slug,
+ 'plugin_file' => 'woocommerce-gateway-stripe/woocommerce-gateway-stripe.php',
+ 'provider_links' => $gateway_links,
+ ),
+ );
+
+ // Mock a suggestion with different links, plugin slug, tags, and incentive.
+ $suggestion = array(
+ 'id' => 'stripe',
+ '_priority' => 1,
+ '_type' => ExtensionSuggestions::TYPE_PSP,
+ 'title' => 'Stripe',
+ 'plugin' => array(
+ '_type' => ExtensionSuggestions::PLUGIN_TYPE_WPORG,
+ 'slug' => 'different-plugin-slug',
+ ),
+ 'links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://suggestion.com/support',
+ ),
+ ),
+ 'tags' => array( 'suggested-tag' ),
+ '_incentive' => array(
+ 'description' => 'Suggestion incentive',
+ ),
+ );
+
+ $this->mock_extension_suggestions
+ ->expects( $this->once() )
+ ->method( 'get_by_plugin_slug' )
+ ->with( $plugin_slug )
+ ->willReturn( $suggestion );
+
+ // Act.
+ $gateway_details = $this->sut->get_payment_gateway_details( $fake_gateway, 0, 'US' );
+
+ // Assert that gateway's own links are preserved (not overridden by suggestion).
+ $this->assertArrayHasKey( 'links', $gateway_details, 'Gateway details should have links' );
+ $this->assertCount( 1, $gateway_details['links'], 'Should have 1 link from gateway, not suggestion' );
+ $this->assertSame( PaymentsProviders::LINK_TYPE_DOCS, $gateway_details['links'][0]['_type'], 'Link type should be from gateway' );
+ $this->assertSame( 'https://gateway.com/docs', $gateway_details['links'][0]['url'], 'Link URL should be from gateway, not suggestion' );
+
+ // Assert that gateway's plugin details are preserved (not overridden by suggestion).
+ $this->assertArrayHasKey( 'plugin', $gateway_details, 'Gateway details should have plugin' );
+ $this->assertArrayHasKey( 'slug', $gateway_details['plugin'], 'Plugin should have slug' );
+ $this->assertSame( $plugin_slug, $gateway_details['plugin']['slug'], 'Plugin slug should be from gateway, not suggestion' );
+
+ // Assert that tags are filled from suggestion since gateway doesn't provide them.
+ $this->assertArrayHasKey( 'tags', $gateway_details, 'Gateway details should have tags' );
+ $this->assertIsArray( $gateway_details['tags'], 'Tags should be an array' );
+ $this->assertCount( 1, $gateway_details['tags'], 'Should have 1 tag from suggestion' );
+ $this->assertContains( 'suggested-tag', $gateway_details['tags'], 'Tags should contain suggested tag' );
+
+ // Assert that _incentive is filled from suggestion since gateway doesn't provide it.
+ $this->assertArrayHasKey( '_incentive', $gateway_details, 'Gateway details should have _incentive' );
+ $this->assertIsArray( $gateway_details['_incentive'], '_incentive should be an array' );
+ $this->assertSame( 'Suggestion incentive', $gateway_details['_incentive']['description'], 'Incentive description should be from suggestion' );
+ }
+
+ /**
+ * Test that get_payment_gateway_details does not override title for excluded gateways.
+ */
+ public function test_get_payment_gateway_details_does_not_override_excluded_gateway_titles() {
+ // Arrange.
+ $plugin_slug = 'woocommerce-gateway-paypal';
+ $gateway_links = array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://paypal-gateway.com/docs',
+ ),
+ );
+ $fake_gateway = new FakePaymentGateway(
+ 'ppcp-gateway',
+ array(
+ 'enabled' => true,
+ 'title' => 'PayPal Gateway Original Title',
+ 'method_title' => 'PayPal Gateway Original Method Title',
+ 'description' => 'PayPal gateway original description',
+ 'method_description' => '',
+ 'plugin_slug' => $plugin_slug,
+ 'plugin_file' => 'woocommerce-gateway-paypal/woocommerce-gateway-paypal.php',
+ 'provider_links' => $gateway_links,
+ ),
+ );
+
+ // Mock a PayPal full-stack suggestion (which is in the exclusion list).
+ $suggestion = array(
+ 'id' => ExtensionSuggestions::PAYPAL_FULL_STACK,
+ '_priority' => 1,
+ '_type' => ExtensionSuggestions::TYPE_PSP,
+ 'title' => 'PayPal - Suggestion Title (Should Not Override)',
+ 'description' => 'PayPal - Suggestion Description (Should Not Override)',
+ 'plugin' => array(
+ '_type' => ExtensionSuggestions::PLUGIN_TYPE_WPORG,
+ 'slug' => $plugin_slug,
+ ),
+ 'icon' => 'http://example.com/paypal-icon.png',
+ 'links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://suggestion.com/support',
+ ),
+ ),
+ );
+
+ $this->mock_extension_suggestions
+ ->expects( $this->once() )
+ ->method( 'get_by_plugin_slug' )
+ ->with( $plugin_slug )
+ ->willReturn( $suggestion );
+
+ // Act.
+ $gateway_details = $this->sut->get_payment_gateway_details( $fake_gateway, 0, 'US' );
+
+ // Assert that title and description are NOT overridden for excluded gateways.
+ $this->assertSame( 'PayPal Gateway Original Method Title', $gateway_details['title'], 'Title should NOT be overridden for PayPal full-stack' );
+ $this->assertSame( 'PayPal gateway original description', $gateway_details['description'], 'Description should NOT be overridden for PayPal full-stack' );
+
+ // Assert that gateway's own links are preserved (not overridden by suggestion).
+ $this->assertArrayHasKey( 'links', $gateway_details, 'Gateway details should have links' );
+ $this->assertCount( 1, $gateway_details['links'], 'Should have 1 link from gateway, not suggestion' );
+ $this->assertSame( PaymentsProviders::LINK_TYPE_DOCS, $gateway_details['links'][0]['_type'], 'Link type should be from gateway' );
+ $this->assertSame( 'https://paypal-gateway.com/docs', $gateway_details['links'][0]['url'], 'Link URL should be from gateway, not suggestion' );
+
+ // But icon should still be filled in from suggestion.
+ $this->assertArrayHasKey( 'icon', $gateway_details, 'Gateway details should have icon' );
+ $this->assertSame( 'http://example.com/paypal-icon.png', $gateway_details['icon'], 'Icon should be filled from suggestion' );
+
+ // And suggestion ID should be attached.
+ $this->assertArrayHasKey( '_suggestion_id', $gateway_details, 'Gateway details should have _suggestion_id' );
+ $this->assertSame( ExtensionSuggestions::PAYPAL_FULL_STACK, $gateway_details['_suggestion_id'], 'Suggestion ID should match' );
+ }
+
/**
* Test getting the plugin slug of a payment gateway instance.
*/
@@ -596,6 +927,9 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
// Assert.
// The PayPal gateway is a core gateway, so the slug is 'woocommerce'.
$this->assertSame( 'woocommerce', $slug );
+
+ // Clean up.
+ $this->unload_core_paypal_pg();
}
/**
@@ -643,7 +977,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -664,7 +998,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 2',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url2',
),
),
@@ -685,7 +1019,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 3',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url3',
),
),
@@ -706,7 +1040,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 4',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url4',
),
),
@@ -727,7 +1061,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 5',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url5',
),
),
@@ -842,7 +1176,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -863,7 +1197,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 2',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url2',
),
),
@@ -884,7 +1218,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 3',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url3',
),
),
@@ -905,7 +1239,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 4',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url4',
),
),
@@ -926,7 +1260,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 5',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url5',
),
),
@@ -955,6 +1289,9 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
$this->assertSame( 'suggestion2', $suggestions['preferred'][1]['id'] );
// The rest are in the other list, ordered by priority.
$this->assertSame( array( 'suggestion3', 'suggestion4', 'suggestion5' ), array_column( $suggestions['other'], 'id' ) );
+
+ // Clean up.
+ $this->unload_core_paypal_pg();
}
/**
@@ -979,7 +1316,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1000,7 +1337,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 2',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url2',
),
),
@@ -1021,7 +1358,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 3',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url3',
),
),
@@ -1042,7 +1379,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 4',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url4',
),
),
@@ -1063,7 +1400,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 5',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url5',
),
),
@@ -1130,7 +1467,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1151,7 +1488,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 2',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url2',
),
),
@@ -1172,7 +1509,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 3',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url3',
),
),
@@ -1193,7 +1530,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 4',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url4',
),
),
@@ -1214,7 +1551,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 5',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url5',
),
),
@@ -1243,6 +1580,9 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
// The rest are in the other list, ordered by priority.
$this->assertCount( 3, $suggestions['other'] );
$this->assertSame( array( 'suggestion1', 'suggestion2', 'suggestion4' ), array_column( $suggestions['other'], 'id' ) );
+
+ // Clean up.
+ delete_user_meta( $this->store_admin_id, Payments::PAYMENTS_NOX_PROFILE_KEY );
}
/**
@@ -1269,7 +1609,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1290,7 +1630,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 2',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url2',
),
),
@@ -1311,7 +1651,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 3',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url3',
),
),
@@ -1332,7 +1672,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 4',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url4',
),
),
@@ -1353,7 +1693,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => 'short description 5',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url5',
),
),
@@ -1384,6 +1724,9 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
$this->assertSame( 'suggestion3', $suggestions['other'][0]['id'] );
// Suggestion4 is not present because a suggestion with the same plugin slug is already present (preferred APM).
// Suggestion5 is not present because a suggestion with the same plugin slug is already present (preferred PSP).
+
+ // Clean up.
+ $this->unload_core_paypal_pg();
}
/**
@@ -1426,7 +1769,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1475,7 +1818,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1534,7 +1877,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1600,7 +1943,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1679,7 +2022,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1739,7 +2082,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1804,7 +2147,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1874,7 +2217,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -1941,7 +2284,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -2006,7 +2349,7 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
$this->expectExceptionMessage( 'Invalid suggestion ID.' );
// Act.
- $result = $this->sut->hide_extension_suggestion( $suggestion_id );
+ $this->sut->hide_extension_suggestion( $suggestion_id );
}
/**
@@ -2069,9 +2412,6 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
$expect_option_update ? 'Expected order map option to BE updated but it was not.' : 'Expected order map option to NOT BE updated but it was.'
);
$this->assertSame( $expected_order_map, get_option( PaymentsProviders::PROVIDERS_ORDER_OPTION ) );
-
- // Clean up.
- $this->unmock_payment_gateways();
}
/**
@@ -2103,9 +2443,6 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
);
$this->assertSame( $expected_gateway_ids, $actual_gateway_ids );
-
- // Clean up.
- $this->unmock_payment_gateways();
}
/**
@@ -2299,17 +2636,6 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
$this->sut->reset_memo();
}
- /**
- * Unmock the payment gateways.
- */
- protected function unmock_payment_gateways() {
- remove_all_actions( 'wc_payment_gateways_initialized' );
- WC()->payment_gateways()->payment_gateways = array();
- WC()->payment_gateways()->init();
-
- $this->sut->reset_memo();
- }
-
/**
* Data provider for the test_update_payment_providers_order_map.
*
@@ -5193,6 +5519,191 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
);
}
+ /**
+ * Test that provider link types with mixed case are normalized to lowercase.
+ *
+ * @return void
+ */
+ public function test_provider_links_normalize_mixed_case_types(): void {
+ // Arrange - Create a fake gateway that provides links with mixed-case types.
+ $fake_gateway = new FakePaymentGateway(
+ 'test_gateway',
+ array(
+ 'enabled' => true,
+ 'method_title' => 'Test Gateway',
+ 'plugin_slug' => 'test-plugin',
+ 'plugin_file' => 'test-plugin/test-plugin',
+ 'provider_links' => array(
+ array(
+ '_type' => 'Documentation', // Mixed case - should normalize to 'documentation'.
+ 'url' => 'https://example.com/docs',
+ ),
+ array(
+ '_type' => 'SUPPORT', // All caps - should normalize to 'support'.
+ 'url' => 'https://example.com/support',
+ ),
+ array(
+ '_type' => 'aBOut', // Random mixed - should normalize to 'about'.
+ 'url' => 'https://example.com/about',
+ ),
+ ),
+ ),
+ );
+
+ // Act.
+ $gateway_details = $this->sut->get_payment_gateway_base_details( $fake_gateway, 0 );
+
+ // Assert.
+ $this->assertArrayHasKey( 'links', $gateway_details, 'Gateway should have links' );
+ $this->assertIsArray( $gateway_details['links'], 'Links should be an array' );
+ $this->assertCount( 3, $gateway_details['links'], 'Should have 3 valid links' );
+
+ // Verify all types are normalized to lowercase.
+ $this->assertSame( PaymentsProviders::LINK_TYPE_DOCS, $gateway_details['links'][0]['_type'], 'First link type should be normalized to lowercase' );
+ $this->assertSame( 'https://example.com/docs', $gateway_details['links'][0]['url'], 'First link URL should match' );
+
+ $this->assertSame( PaymentsProviders::LINK_TYPE_SUPPORT, $gateway_details['links'][1]['_type'], 'Second link type should be normalized to lowercase' );
+ $this->assertSame( 'https://example.com/support', $gateway_details['links'][1]['url'], 'Second link URL should match' );
+
+ $this->assertSame( PaymentsProviders::LINK_TYPE_ABOUT, $gateway_details['links'][2]['_type'], 'Third link type should be normalized to lowercase' );
+ $this->assertSame( 'https://example.com/about', $gateway_details['links'][2]['url'], 'Third link URL should match' );
+ }
+
+ /**
+ * Test that provider links with disallowed URL schemes are filtered out.
+ *
+ * @return void
+ */
+ public function test_provider_links_filter_disallowed_url_schemes(): void {
+ // Arrange - Create a fake gateway with various URL schemes.
+ $fake_gateway = new FakePaymentGateway(
+ 'test_gateway',
+ array(
+ 'enabled' => true,
+ 'method_title' => 'Test Gateway',
+ 'plugin_slug' => 'test-plugin',
+ 'plugin_file' => 'test-plugin/test-plugin',
+ 'provider_links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://example.com/docs', // Valid HTTPS URL.
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'javascript:alert(1)', // Disallowed scheme - XSS attempt.
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
+ 'url' => 'data:text/html,<script>alert(1)</script>', // Disallowed scheme.
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
+ 'url' => 'http://example.com/pricing', // Valid HTTP URL.
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
+ 'url' => 'vbscript:msgbox(1)', // Disallowed scheme.
+ ),
+ ),
+ ),
+ );
+
+ // Act.
+ $gateway_details = $this->sut->get_payment_gateway_base_details( $fake_gateway, 0 );
+
+ // Assert.
+ $this->assertArrayHasKey( 'links', $gateway_details, 'Gateway should have links' );
+ $this->assertIsArray( $gateway_details['links'], 'Links should be an array' );
+ $this->assertCount( 2, $gateway_details['links'], 'Should have 2 valid links (3 malicious links filtered out)' );
+
+ // Verify only the valid HTTP/HTTPS links are included.
+ $this->assertSame( PaymentsProviders::LINK_TYPE_DOCS, $gateway_details['links'][0]['_type'], 'First link should be docs' );
+ $this->assertSame( 'https://example.com/docs', $gateway_details['links'][0]['url'], 'First link URL should be HTTPS' );
+
+ $this->assertSame( PaymentsProviders::LINK_TYPE_PRICING, $gateway_details['links'][1]['_type'], 'Second link should be pricing' );
+ $this->assertSame( 'http://example.com/pricing', $gateway_details['links'][1]['url'], 'Second link URL should be HTTP' );
+
+ // Verify that no javascript:, data:, or vbscript: URLs made it through.
+ foreach ( $gateway_details['links'] as $link ) {
+ $this->assertStringNotContainsString( 'javascript:', $link['url'], 'No javascript: URLs should be present' );
+ $this->assertStringNotContainsString( 'data:', $link['url'], 'No data: URLs should be present' );
+ $this->assertStringNotContainsString( 'vbscript:', $link['url'], 'No vbscript: URLs should be present' );
+ }
+ }
+
+ /**
+ * Test that provider links are deduplicated by type and URL combination.
+ *
+ * @return void
+ */
+ public function test_provider_links_deduplicate_by_type_and_url(): void {
+ // Arrange - Create a fake gateway with duplicate links (same type + URL).
+ $fake_gateway = new FakePaymentGateway(
+ 'test_gateway',
+ array(
+ 'enabled' => true,
+ 'method_title' => 'Test Gateway',
+ 'plugin_slug' => 'test-plugin',
+ 'plugin_file' => 'test-plugin/test-plugin',
+ 'provider_links' => array(
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://example.com/docs',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://example.com/docs', // Exact duplicate - should be removed.
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
+ 'url' => 'https://example.com/other-docs', // Same type, different URL - should be kept.
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://example.com/docs', // Different type, same URL as first - should be kept.
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://example.com/support',
+ ),
+ array(
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
+ 'url' => 'https://example.com/support', // Exact duplicate - should be removed.
+ ),
+ ),
+ ),
+ );
+
+ // Act.
+ $gateway_details = $this->sut->get_payment_gateway_base_details( $fake_gateway, 0 );
+
+ // Assert.
+ $this->assertArrayHasKey( 'links', $gateway_details, 'Gateway should have links' );
+ $this->assertIsArray( $gateway_details['links'], 'Links should be an array' );
+ $this->assertCount( 4, $gateway_details['links'], 'Should have 4 unique links (2 duplicates removed)' );
+
+ // Verify the deduplicated links are in the expected order (first occurrence kept).
+ $this->assertSame( PaymentsProviders::LINK_TYPE_DOCS, $gateway_details['links'][0]['_type'], 'First link should be docs' );
+ $this->assertSame( 'https://example.com/docs', $gateway_details['links'][0]['url'], 'First link URL' );
+
+ $this->assertSame( PaymentsProviders::LINK_TYPE_DOCS, $gateway_details['links'][1]['_type'], 'Second link should be docs with different URL' );
+ $this->assertSame( 'https://example.com/other-docs', $gateway_details['links'][1]['url'], 'Second link URL' );
+
+ $this->assertSame( PaymentsProviders::LINK_TYPE_SUPPORT, $gateway_details['links'][2]['_type'], 'Third link should be support with same URL as first docs' );
+ $this->assertSame( 'https://example.com/docs', $gateway_details['links'][2]['url'], 'Third link URL' );
+
+ $this->assertSame( PaymentsProviders::LINK_TYPE_SUPPORT, $gateway_details['links'][3]['_type'], 'Fourth link should be support' );
+ $this->assertSame( 'https://example.com/support', $gateway_details['links'][3]['url'], 'Fourth link URL' );
+
+ // Additional verification - ensure we don't have any duplicate type+URL combinations.
+ $seen_combinations = array();
+ foreach ( $gateway_details['links'] as $link ) {
+ $combination = $link['_type'] . '|' . $link['url'];
+ $this->assertArrayNotHasKey( $combination, $seen_combinations, 'Each type+URL combination should be unique' );
+ $seen_combinations[ $combination ] = true;
+ }
+ }
+
/**
* Load the WC core PayPal gateway but not enable it.
*
@@ -5238,4 +5749,14 @@ class PaymentsProvidersTest extends WC_Unit_Test_Case {
// Reset the controller memo to pick up the new gateway details.
$this->sut->reset_memo();
}
+
+ /**
+ * Cleanup the core PayPal gateway.
+ */
+ private function unload_core_paypal_pg() {
+ delete_option( 'woocommerce_paypal_settings' );
+ delete_option( 'woocommerce_currency' );
+
+ $this->sut->reset_memo();
+ }
}
diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsTest.php b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsTest.php
index 219daa44ff..fa83d7f94f 100644
--- a/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsTest.php
@@ -289,7 +289,7 @@ class PaymentsTest extends WC_Unit_Test_Case {
'short_description' => null,
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url1',
),
),
@@ -310,7 +310,7 @@ class PaymentsTest extends WC_Unit_Test_Case {
'short_description' => 'short description 2',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url2',
),
),
@@ -333,7 +333,7 @@ class PaymentsTest extends WC_Unit_Test_Case {
'short_description' => 'short description 5',
'links' => array(
array(
- '_type' => ExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'url5',
),
),
diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestionsTest.php b/plugins/woocommerce/tests/php/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestionsTest.php
index 83eee962e9..bd2c244ee7 100644
--- a/plugins/woocommerce/tests/php/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestionsTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestionsTest.php
@@ -4,6 +4,7 @@ declare( strict_types=1 );
namespace Automattic\WooCommerce\Tests\Internal\Admin\Suggestions;
use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile;
+use Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders;
use Automattic\WooCommerce\Internal\Admin\Suggestions\PaymentsExtensionSuggestionIncentives;
use Automattic\WooCommerce\Internal\Admin\Suggestions\PaymentsExtensionSuggestions;
use WC_Unit_Test_Case;
@@ -723,24 +724,24 @@ class PaymentsExtensionSuggestionsTest extends WC_Unit_Test_Case {
array(
// These are coming from the per-country details.
array(
- '_type' => PaymentsExtensionSuggestions::LINK_TYPE_PRICING,
+ '_type' => PaymentsProviders::LINK_TYPE_PRICING,
'url' => 'https://www.klarna.com/mx/negocios/',
),
array(
- '_type' => PaymentsExtensionSuggestions::LINK_TYPE_TERMS,
+ '_type' => PaymentsProviders::LINK_TYPE_TERMS,
'url' => 'https://www.klarna.com/mx/terminos-y-condiciones/',
),
// These are base details for the suggestion.
array(
- '_type' => PaymentsExtensionSuggestions::LINK_TYPE_ABOUT,
+ '_type' => PaymentsProviders::LINK_TYPE_ABOUT,
'url' => 'https://woocommerce.com/products/klarna-payments/',
),
array(
- '_type' => PaymentsExtensionSuggestions::LINK_TYPE_DOCS,
+ '_type' => PaymentsProviders::LINK_TYPE_DOCS,
'url' => 'https://woocommerce.com/document/klarna-payments/',
),
array(
- '_type' => PaymentsExtensionSuggestions::LINK_TYPE_SUPPORT,
+ '_type' => PaymentsProviders::LINK_TYPE_SUPPORT,
'url' => 'https://woocommerce.com/my-account/contact-support/?select=klarna-payments',
),
),