diff --git a/composer.json b/composer.json
index 5914ca225..4b8f575d3 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"name": "skyverge/wc-plugin-framework",
"description": "The official SkyVerge WooCommerce plugin framework",
- "version": "5.15.12",
+ "version": "6.0.0",
"license": "GPL-3.0",
"minimum-stability": "dev",
"prefer-stable": true,
@@ -35,12 +35,12 @@
"woocommerce/class-sv-wp-admin-message-handler.php"
],
"psr-4": {
- "SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\": "woocommerce/"
+ "SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\": "woocommerce/"
}
},
"autoload-dev": {
"psr-4": {
- "SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Tests\\": "tests/"
+ "SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Tests\\": "tests/"
}
},
"config": {
diff --git a/package-lock.json b/package-lock.json
index 9dba728bf..09496183d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "wc-plugin-framework",
- "version": "5.15.12",
+ "version": "6.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wc-plugin-framework",
- "version": "5.15.12",
+ "version": "6.0.0",
"license": "GPL-3.0",
"devDependencies": {
"@parcel/transformer-coffeescript": "^2.13.3",
diff --git a/package.json b/package.json
index f6d3f6a4a..88fdc661f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "wc-plugin-framework",
- "version": "5.15.12",
+ "version": "6.0.0",
"title": "WooCommerce Plugin Framework",
"author": "SkyVerge Team",
"homepage": "https://github.com/skyverge/wc-plugin-framework#readme",
diff --git a/tests/TestCase.php b/tests/TestCase.php
index c0f559337..d1ab8912f 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -1,6 +1,6 @@
get_new_request_instance( $is_cacheable );
@@ -357,7 +357,7 @@ public function provider_get_request_cache_lifetime(): array {
*
* @throws ReflectionException
*/
- public function test_get_request_data_for_broadcast( bool $is_cacheable, bool $force_refresh = null, bool $should_cache = null ) {
+ public function test_get_request_data_for_broadcast( bool $is_cacheable, ?bool $force_refresh = null, ?bool $should_cache = null ) {
$request = $this->get_new_request_instance( $is_cacheable );
diff --git a/tests/integration/DependenciesTest.php b/tests/integration/DependenciesTest.php
index b10602d58..100e2fa98 100644
--- a/tests/integration/DependenciesTest.php
+++ b/tests/integration/DependenciesTest.php
@@ -3,7 +3,7 @@
/**
* Tests for the SV_WC_Plugin_Dependencies class.
*
- * @see \SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Plugin_Dependencies
+ * @see \SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Plugin_Dependencies
*/
class DependenciesTest extends \Codeception\TestCase\WPTestCase {
@@ -31,7 +31,7 @@ protected function _after() {
/**
- * @see \SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Plugin_Dependencies::get_active_scripts_optimization_plugins()
+ * @see \SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Plugin_Dependencies::get_active_scripts_optimization_plugins()
*/
public function test_get_active_scripts_optimization_plugins() {
@@ -40,7 +40,7 @@ public function test_get_active_scripts_optimization_plugins() {
/**
- * @see \SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Plugin_Dependencies::is_scripts_optimization_plugin_active()
+ * @see \SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Plugin_Dependencies::is_scripts_optimization_plugin_active()
*/
public function test_is_scripts_optimization_plugin_active() {
diff --git a/tests/integration/HelperTest.php b/tests/integration/HelperTest.php
index ef340720d..5c234f46a 100644
--- a/tests/integration/HelperTest.php
+++ b/tests/integration/HelperTest.php
@@ -1,11 +1,11 @@
assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Plugin_Dependencies', $this->get_plugin()->get_dependency_handler() );
+ $this->assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Plugin_Dependencies', $this->get_plugin()->get_dependency_handler() );
}
@@ -161,7 +161,7 @@ public function test_get_dependency_handler() {
*/
public function test_get_lifecycle_handler() {
- $this->assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v5_15_12\Plugin\Lifecycle', $this->get_plugin()->get_lifecycle_handler() );
+ $this->assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v6_0_0\Plugin\Lifecycle', $this->get_plugin()->get_lifecycle_handler() );
}
diff --git a/tests/integration/REST_API/Controllers/SettingsTest.php b/tests/integration/REST_API/Controllers/SettingsTest.php
index 74e49bc11..82bbabfec 100644
--- a/tests/integration/REST_API/Controllers/SettingsTest.php
+++ b/tests/integration/REST_API/Controllers/SettingsTest.php
@@ -1,14 +1,14 @@
render_js();
$this->assertStringContainsString( 'function load_gateway_test_plugin_payment_methods_handler', $wc_queued_js );
- $this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_payment_methods_handler_v5_15_12_loaded\', load_gateway_test_plugin_payment_methods_handler );', $wc_queued_js );
+ $this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_payment_methods_handler_v6_0_0_loaded\', load_gateway_test_plugin_payment_methods_handler );', $wc_queued_js );
}
diff --git a/tests/integration/payment-gateway/PaymentFormTest.php b/tests/integration/payment-gateway/PaymentFormTest.php
index cc9418657..c7c71aafe 100644
--- a/tests/integration/payment-gateway/PaymentFormTest.php
+++ b/tests/integration/payment-gateway/PaymentFormTest.php
@@ -1,11 +1,11 @@
get_plugin()->get_gateway()->get_payment_form_instance()->render_js();
$this->assertStringContainsString( 'function load_test_gateway_payment_form_handler', $wc_queued_js );
- $this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_payment_form_handler_v5_15_12_loaded\', load_test_gateway_payment_form_handler );', $wc_queued_js );
+ $this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_payment_form_handler_v6_0_0_loaded\', load_test_gateway_payment_form_handler );', $wc_queued_js );
}
diff --git a/tests/integration/payment-gateway/SV_WC_Payment_Gateway_Payment_Token_Test.php b/tests/integration/payment-gateway/SV_WC_Payment_Gateway_Payment_Token_Test.php
index bf865051f..cb9b1feb3 100644
--- a/tests/integration/payment-gateway/SV_WC_Payment_Gateway_Payment_Token_Test.php
+++ b/tests/integration/payment-gateway/SV_WC_Payment_Gateway_Payment_Token_Test.php
@@ -1,11 +1,11 @@
invokeArgs( $frontend_instance, [[]] );
$this->assertStringContainsString( 'function load_test_gateway_apple_pay_handler', $wc_queued_js );
- $this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_apple_pay_handler_v5_15_12_loaded\', load_test_gateway_apple_pay_handler );', $wc_queued_js );
+ $this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_apple_pay_handler_v6_0_0_loaded\', load_test_gateway_apple_pay_handler );', $wc_queued_js );
}
diff --git a/tests/unit/API/CacheableRequestTraitTest.php b/tests/unit/API/CacheableRequestTraitTest.php
index a16186b8c..ce95c0dce 100644
--- a/tests/unit/API/CacheableRequestTraitTest.php
+++ b/tests/unit/API/CacheableRequestTraitTest.php
@@ -1,9 +1,9 @@
\SkyVerge\WooCommerce\PluginFramework\v5_15_12\Country_Helper::class,
- PaymentFormContextChecker::class => \SkyVerge\WooCommerce\PluginFramework\v5_15_12\PaymentFormContextChecker::class,
+ Country_Helper::class => \SkyVerge\WooCommerce\PluginFramework\v6_0_0\Country_Helper::class,
+ PaymentFormContextChecker::class => \SkyVerge\WooCommerce\PluginFramework\v6_0_0\PaymentFormContextChecker::class,
];
foreach ($aliases as $alias) {
diff --git a/tests/unit/HelperTest.php b/tests/unit/HelperTest.php
index 91e5f8f37..759817b0d 100644
--- a/tests/unit/HelperTest.php
+++ b/tests/unit/HelperTest.php
@@ -1,20 +1,20 @@
js_handler_base_class_name );
+ return sprintf( '%s_v6_0_0', $this->js_handler_base_class_name );
}
diff --git a/woocommerce/Helpers/ArrayHelper.php b/woocommerce/Helpers/ArrayHelper.php
index bf1e05bb8..3e1eaf536 100644
--- a/woocommerce/Helpers/ArrayHelper.php
+++ b/woocommerce/Helpers/ArrayHelper.php
@@ -22,7 +22,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Helpers;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Helpers;
use ArrayAccess;
diff --git a/woocommerce/Helpers/NumberHelper.php b/woocommerce/Helpers/NumberHelper.php
index f9e45b5c8..6452710cf 100644
--- a/woocommerce/Helpers/NumberHelper.php
+++ b/woocommerce/Helpers/NumberHelper.php
@@ -22,7 +22,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Helpers;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Helpers;
class NumberHelper
{
diff --git a/woocommerce/Helpers/OrderHelper.php b/woocommerce/Helpers/OrderHelper.php
new file mode 100644
index 000000000..3d2862234
--- /dev/null
+++ b/woocommerce/Helpers/OrderHelper.php
@@ -0,0 +1,145 @@
+\n"
+"Language-Team: plugins@godaddy.com\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"POT-Creation-Date: 2025-05-27T15:45:03+00:00\n"
+"POT-Creation-Date: 2025-08-07T20:15:01+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.12.0\n"
"X-Domain: woocommerce-plugin-framework\n"
diff --git a/woocommerce/payment-gateway/Blocks/Gateway_Blocks_Handler.php b/woocommerce/payment-gateway/Blocks/Gateway_Blocks_Handler.php
index 75c7bb7ea..91d83a30a 100644
--- a/woocommerce/payment-gateway/Blocks/Gateway_Blocks_Handler.php
+++ b/woocommerce/payment-gateway/Blocks/Gateway_Blocks_Handler.php
@@ -1,13 +1,13 @@
|null
+ */
+ private static ?\WeakMap $map = null; // phpcs:ignore PHPCompatibility.Classes.NewClasses.weakmapFound -- conditionally used for PHP 8.0+
+
+ /**
+ * Sets a property on the order object.
+ *
+ * Stores a dynamic property either using WeakMap (PHP 8.0+) or direct property
+ * access (PHP 7.4+). The storage method is automatically determined based on
+ * PHP version and WeakMap availability.
+ *
+ * @since x.x.x
+ *
+ * @param \WC_Order $order The order object to store data on.
+ * @param string $key The property key.
+ * @param mixed $value The value to store.
+ * @return void
+ *
+ * @example
+ * ```php
+ * Dynamic_Props::set($order, 'customer_id', 123);
+ * Dynamic_Props::set($order, 'payment_total', '99.99');
+ * ```
+ */
+ public static function set( \WC_Order &$order, string $key, $value ): void {
+ if ( self::use_weak_map() ) {
+ self::init_weak_map();
+ if ( ! isset( self::$map[ $order ] ) ) {
+ self::$map[ $order ] = new \stdClass();
+ }
+ self::$map[ $order ]->{ $key } = $value;
+ } else {
+ $order->{ $key } = $value;
+ }
+ }
+
+ /**
+ * Gets a property from the order object.
+ *
+ * Retrieves a stored dynamic property using the appropriate storage method
+ * based on PHP version. Supports nested property access.
+ *
+ * @since x.x.x
+ *
+ * @param \WC_Order $order The order object to retrieve data from.
+ * @param string $key The property key.
+ * @param string $nested_key Optional. The nested property key. Default null.
+ * @param mixed $default Optional. Default value if not found. Default null.
+ * @return mixed The stored value or default if not found.
+ *
+ * @example
+ * ```php
+ * $customer_id = Dynamic_Props::get($order, 'customer_id');
+ * $total = Dynamic_Props::get($order, 'payment_total');
+ * $token = Dynamic_Props::get($order, 'payment', 'token', 'DEFAULT_TOKEN');
+ * ```
+ */
+ public static function get( \WC_Order $order, string $key, $nested_key = null, $default = null ) {
+ if ( self::use_weak_map() ) {
+ self::init_weak_map();
+ if ( is_null( $nested_key ) ) {
+ return self::$map[ $order ]->{ $key } ?? $default;
+ } else {
+ return self::$map[ $order ]->{ $key }->{ $nested_key } ?? $default;
+ }
+ }
+ if ( is_null( $nested_key ) ) {
+ return $order->{ $key } ?? $default;
+ } else {
+ return $order->{ $key }->{ $nested_key } ?? $default;
+ }
+ }
+
+ /**
+ * Unsets a property on the order object.
+ *
+ * Removes a stored dynamic property using the appropriate storage method
+ * based on PHP version.
+ *
+ * @since x.x.x
+ *
+ * @param \WC_Order $order The order object to unset data from.
+ * @param string $key The property key to remove.
+ * @return void
+ */
+ public static function unset( \WC_Order &$order, string $key ): void {
+ if ( self::use_weak_map() ) {
+ self::init_weak_map();
+ unset( self::$map[ $order ]->{ $key } );
+ } else {
+ unset( $order->{ $key } );
+ }
+ }
+
+ /**
+ * Checks if Dynamic_Props class should be used based on the filter.
+ *
+ * @return bool True if Dynamic_Props class should be used, false otherwise.
+ */
+ private static function use_dynamic_props_class(): bool {
+ static $use_dynamic_props_class = null;
+ if ( null === $use_dynamic_props_class ) {
+ /**
+ * Filters whether to use Dynamic_Props class for storing order data.
+ *
+ * @since x.x.x
+ *
+ * @var bool Whether to Dynamic_Props class for storing order data.
+ */
+ $use_dynamic_props_class = apply_filters( 'sv_wc_plugin_framework_use_dynamic_props_class', false );
+ }
+ return $use_dynamic_props_class;
+ }
+
+ /**
+ * Checks if WeakMap should be used based on PHP version.
+ *
+ * Determines whether to use WeakMap storage based on PHP version (8.0+)
+ * and WeakMap class availability. Result is cached for performance.
+ *
+ * @since x.x.x
+ * @return bool True if WeakMap should be used, false otherwise.
+ */
+ private static function use_weak_map(): bool {
+ static $use_weak_map = null;
+
+ if ( null === $use_weak_map ) {
+ $use_weak_map = version_compare( PHP_VERSION, '8.0', '>=' ) && self::use_dynamic_props_class();
+ }
+
+ return $use_weak_map;
+ }
+
+ /**
+ * Initializes WeakMap storage if not already initialized.
+ *
+ * Ensures the WeakMap storage is initialized only once when needed.
+ * This lazy initialization helps with performance and memory usage.
+ *
+ * @since x.x.x
+ * @return void
+ */
+ private static function init_weak_map(): void {
+ if ( null === self::$map ) {
+ // phpcs:ignore PHPCompatibility.Classes.NewClasses.weakmapFound -- conditionally used for PHP 8.0+
+ self::$map = new \WeakMap();
+ }
+ }
+}
diff --git a/woocommerce/payment-gateway/External_Checkout/Admin.php b/woocommerce/payment-gateway/External_Checkout/Admin.php
index 3b299ef7c..a1e96ba88 100644
--- a/woocommerce/payment-gateway/External_Checkout/Admin.php
+++ b/woocommerce/payment-gateway/External_Checkout/Admin.php
@@ -22,9 +22,9 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Helper;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Helper;
defined( 'ABSPATH' ) or exit;
diff --git a/woocommerce/payment-gateway/External_Checkout/External_Checkout.php b/woocommerce/payment-gateway/External_Checkout/External_Checkout.php
index ca25df558..1693d3245 100644
--- a/woocommerce/payment-gateway/External_Checkout/External_Checkout.php
+++ b/woocommerce/payment-gateway/External_Checkout/External_Checkout.php
@@ -22,10 +22,10 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway_Plugin;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway_Plugin;
defined( 'ABSPATH' ) or exit;
diff --git a/woocommerce/payment-gateway/External_Checkout/Frontend.php b/woocommerce/payment-gateway/External_Checkout/Frontend.php
index d0962588b..e42fd6243 100644
--- a/woocommerce/payment-gateway/External_Checkout/Frontend.php
+++ b/woocommerce/payment-gateway/External_Checkout/Frontend.php
@@ -23,17 +23,17 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Blocks\Blocks_Handler;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Handlers\Script_Handler;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Helper;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway_Plugin;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Blocks\Blocks_Handler;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Handlers\Script_Handler;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Helper;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway_Plugin;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Payment_Gateway\\External_Checkout\\Frontend' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Payment_Gateway\\External_Checkout\\Frontend' ) ) :
/**
@@ -380,7 +380,7 @@ public function enqueue_scripts() {
return;
}
- wp_enqueue_style( 'sv-wc-external-checkout-v5_15_12', $this->get_handler()->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/sv-wc-payment-gateway-external-checkout.css', array(), $this->get_handler()->get_plugin()->get_version() ); // TODO: min
+ wp_enqueue_style( 'sv-wc-external-checkout-v6_0_0', $this->get_handler()->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/sv-wc-payment-gateway-external-checkout.css', array(), $this->get_handler()->get_plugin()->get_version() ); // TODO: min
}
diff --git a/woocommerce/payment-gateway/External_Checkout/Google_Pay/AJAX.php b/woocommerce/payment-gateway/External_Checkout/Google_Pay/AJAX.php
index 8dad3b2f0..0fc93d689 100644
--- a/woocommerce/payment-gateway/External_Checkout/Google_Pay/AJAX.php
+++ b/woocommerce/payment-gateway/External_Checkout/Google_Pay/AJAX.php
@@ -22,14 +22,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Google_Pay;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Google_Pay;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Helper;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway_Exception;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Helper;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway_Exception;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Payment_Gateway\\External_Checkout\\Google_Pay\\AJAX' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Payment_Gateway\\External_Checkout\\Google_Pay\\AJAX' ) ) :
/**
diff --git a/woocommerce/payment-gateway/External_Checkout/Google_Pay/Admin.php b/woocommerce/payment-gateway/External_Checkout/Google_Pay/Admin.php
index 1235a1ec7..debf20ec9 100755
--- a/woocommerce/payment-gateway/External_Checkout/Google_Pay/Admin.php
+++ b/woocommerce/payment-gateway/External_Checkout/Google_Pay/Admin.php
@@ -22,13 +22,13 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Google_Pay;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Google_Pay;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Helper;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Helper;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Payment_Gateway\\External_Checkout\\Google_Pay\\Admin' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Payment_Gateway\\External_Checkout\\Google_Pay\\Admin' ) ) :
/**
@@ -37,7 +37,7 @@
* @since 5.10.0
*/
#[\AllowDynamicProperties]
-class Admin extends \SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Admin {
+class Admin extends \SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Admin {
/** @var Google_Pay the Google Pay handler instance */
diff --git a/woocommerce/payment-gateway/External_Checkout/Google_Pay/Frontend.php b/woocommerce/payment-gateway/External_Checkout/Google_Pay/Frontend.php
index aaadfdb3b..e480073d7 100644
--- a/woocommerce/payment-gateway/External_Checkout/Google_Pay/Frontend.php
+++ b/woocommerce/payment-gateway/External_Checkout/Google_Pay/Frontend.php
@@ -22,14 +22,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Google_Pay;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Google_Pay;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway_Exception;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway_Plugin;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway_Exception;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway_Plugin;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Payment_Gateway\\External_Checkout\\Google_Pay\\Frontend' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Payment_Gateway\\External_Checkout\\Google_Pay\\Frontend' ) ) :
/**
@@ -38,7 +38,7 @@
* @since 5.10.0
*/
#[\AllowDynamicProperties]
-class Frontend extends \SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Frontend {
+class Frontend extends \SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Frontend {
/** @var string JS handler base class name, without the FW version */
@@ -102,7 +102,7 @@ public function enqueue_scripts() {
$version = $gateway->get_plugin()->get_assets_version( $gateway->get_id() );
wp_enqueue_script( 'google-pay-js-library', 'https://pay.google.com/gp/p/js/pay.js', [], $version, true );
- wp_enqueue_script( 'sv-wc-google-pay-v5_15_12', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/dist/frontend/sv-wc-payment-gateway-google-pay.js', [ 'google-pay-js-library', 'jquery' ], $version, true );
+ wp_enqueue_script( 'sv-wc-google-pay-v6_0_0', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/dist/frontend/sv-wc-payment-gateway-google-pay.js', [ 'google-pay-js-library', 'jquery' ], $version, true );
}
diff --git a/woocommerce/payment-gateway/External_Checkout/Google_Pay/Google_Pay.php b/woocommerce/payment-gateway/External_Checkout/Google_Pay/Google_Pay.php
index 266a6a6c5..c35767a8a 100755
--- a/woocommerce/payment-gateway/External_Checkout/Google_Pay/Google_Pay.php
+++ b/woocommerce/payment-gateway/External_Checkout/Google_Pay/Google_Pay.php
@@ -22,17 +22,17 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Google_Pay;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Google_Pay;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\External_Checkout;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Orders;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway_Exception;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway_Helper;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway_Plugin;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\External_Checkout;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Orders;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway_Exception;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway_Helper;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway_Plugin;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Payment_Gateway\\External_Checkout\\Google_Pay\\Google_Pay' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Payment_Gateway\\External_Checkout\\Google_Pay\\Google_Pay' ) ) :
/**
@@ -680,7 +680,7 @@ public function get_supported_networks() {
$accepted_card_types = ( $this->get_processing_gateway() ) ? $this->get_processing_gateway()->get_card_types() : [];
- $accepted_card_types = array_map( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Helper::normalize_card_type', $accepted_card_types );
+ $accepted_card_types = array_map( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Helper::normalize_card_type', $accepted_card_types );
$valid_networks = [
SV_WC_Payment_Gateway_Helper::CARD_TYPE_AMEX => 'AMEX',
diff --git a/woocommerce/payment-gateway/External_Checkout/Orders.php b/woocommerce/payment-gateway/External_Checkout/Orders.php
index 51c0c45dc..3a0013bb9 100644
--- a/woocommerce/payment-gateway/External_Checkout/Orders.php
+++ b/woocommerce/payment-gateway/External_Checkout/Orders.php
@@ -22,9 +22,9 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12 as Framework;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0 as Framework;
defined( 'ABSPATH' ) or exit;
diff --git a/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-request.php b/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-request.php
index 1458fd292..499c53041 100644
--- a/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-request.php
+++ b/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-request.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Apple_Pay_API_Request' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Apple_Pay_API_Request' ) ) :
/**
diff --git a/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-response.php b/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-response.php
index 1da06e6c7..847c7acd6 100644
--- a/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-response.php
+++ b/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-response.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Apple_Pay_API_Response' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Apple_Pay_API_Response' ) ) :
/**
diff --git a/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api.php b/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api.php
index 3c27aa3b9..d60f87aae 100644
--- a/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api.php
+++ b/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Apple_Pay_API' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Apple_Pay_API' ) ) :
/**
@@ -58,7 +58,7 @@ public function __construct( SV_WC_Payment_Gateway $gateway ) {
$this->set_request_content_type_header( 'application/json' );
$this->set_request_accept_header( 'application/json' );
- $this->set_response_handler( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Apple_Pay_API_Response' );
+ $this->set_response_handler( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Apple_Pay_API_Response' );
}
diff --git a/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-payment-response.php b/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-payment-response.php
index da0b99f06..967d86ca6 100644
--- a/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-payment-response.php
+++ b/woocommerce/payment-gateway/External_Checkout/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-payment-response.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Apple_Pay_Payment_Response' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Apple_Pay_Payment_Response' ) ) :
/**
diff --git a/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php b/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php
index cd559e406..62b1f589c 100755
--- a/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php
+++ b/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php
@@ -22,13 +22,13 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Admin;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Admin;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Apple_Pay_Admin' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Apple_Pay_Admin' ) ) :
/**
diff --git a/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-ajax.php b/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-ajax.php
index eed7cc6ec..0c54d94f0 100644
--- a/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-ajax.php
+++ b/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-ajax.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Apple_Pay_AJAX' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Apple_Pay_AJAX' ) ) :
/**
diff --git a/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php b/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php
index 19885a24d..60b542b18 100644
--- a/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php
+++ b/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Apple_Pay_Frontend' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Apple_Pay_Frontend' ) ) :
/**
@@ -35,7 +35,7 @@
* @since 4.7.0
*/
#[\AllowDynamicProperties]
-class SV_WC_Payment_Gateway_Apple_Pay_Frontend extends \SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Frontend {
+class SV_WC_Payment_Gateway_Apple_Pay_Frontend extends \SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Frontend {
/** @var string JS handler base class name, without the FW version */
@@ -116,9 +116,9 @@ public function enqueue_scripts() {
$gateway = $this->get_gateway();
$version = $gateway->get_plugin()->get_assets_version( $gateway->get_id() );
- wp_enqueue_style( 'sv-wc-apple-pay-v5_15_12', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/sv-wc-payment-gateway-apple-pay.css', [], $version ); // TODO: min
+ wp_enqueue_style( 'sv-wc-apple-pay-v6_0_0', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/sv-wc-payment-gateway-apple-pay.css', [], $version ); // TODO: min
- wp_enqueue_script( 'sv-wc-apple-pay-v5_15_12', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/dist/frontend/sv-wc-payment-gateway-apple-pay.js', [ 'jquery' ], $version, true );
+ wp_enqueue_script( 'sv-wc-apple-pay-v6_0_0', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/dist/frontend/sv-wc-payment-gateway-apple-pay.js', [ 'jquery' ], $version, true );
}
diff --git a/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay.php b/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay.php
index 6b2106f19..06a9cc494 100755
--- a/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay.php
+++ b/woocommerce/payment-gateway/External_Checkout/apple-pay/class-sv-wc-payment-gateway-apple-pay.php
@@ -22,13 +22,13 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Orders;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Orders;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Apple_Pay' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Apple_Pay' ) ) :
/**
@@ -940,7 +940,7 @@ public function get_supported_networks() {
$accepted_card_types = ( $this->get_processing_gateway() ) ? $this->get_processing_gateway()->get_card_types() : array();
- $accepted_card_types = array_map( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Helper::normalize_card_type', $accepted_card_types );
+ $accepted_card_types = array_map( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Helper::normalize_card_type', $accepted_card_types );
$valid_networks = array(
SV_WC_Payment_Gateway_Helper::CARD_TYPE_AMEX => 'amex',
diff --git a/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php b/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php
index 988e87c23..01680922f 100644
--- a/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php
+++ b/woocommerce/payment-gateway/Handlers/Abstract_Hosted_Payment_Handler.php
@@ -22,11 +22,12 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\Handlers;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Handlers;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12 as FrameworkBase;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0 as FrameworkBase;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Helpers\OrderHelper;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Payment_Gateway\\Handlers\\Abstract_Hosted_Payment_Handler' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Payment_Gateway\\Handlers\\Abstract_Hosted_Payment_Handler' ) ) :
/**
@@ -194,7 +195,7 @@ public function handle_transaction_response_request() {
* @param \WC_Order|null $order order object, if any
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object, if any
*/
- protected function do_transaction_response_complete( \WC_Order $order = null, FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
+ protected function do_transaction_response_complete( ?\WC_Order $order = null, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
$this->do_transaction_request_response( $response, $this->get_gateway()->get_return_url( $order ) );
}
@@ -210,7 +211,7 @@ protected function do_transaction_response_complete( \WC_Order $order = null, Fr
* @param string $user_message user-facing message
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object, if any
*/
- protected function do_transaction_response_failed( \WC_Order $order = null, $message = '', $user_message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
+ protected function do_transaction_response_failed( ?\WC_Order $order = null, $message = '', $user_message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
$this->get_gateway()->add_debug_message( $message, 'error' );
@@ -235,7 +236,7 @@ protected function do_transaction_response_failed( \WC_Order $order = null, $mes
* @param string $message error message, for logging
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object, if any
*/
- protected function do_transaction_response_invalid( \WC_Order $order = null, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
+ protected function do_transaction_response_invalid( ?\WC_Order $order = null, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
$this->get_gateway()->add_debug_message( $message, 'error' );
@@ -264,7 +265,7 @@ protected function do_transaction_response_invalid( \WC_Order $order = null, $me
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response
* @param string $url
*/
- protected function do_transaction_request_response( FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null, $url = '' ) {
+ protected function do_transaction_request_response( ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null, $url = '' ) {
// if this is an IPN handler
if ( $this->is_ipn() ) {
@@ -325,20 +326,25 @@ protected function get_order_from_response( FrameworkBase\SV_WC_Payment_Gateway_
$order = $this->get_gateway()->get_order( $order );
- $order->payment->account_number = $response->get_account_number();
+ $payment = OrderHelper::get_payment( $order );
+
+ $payment->account_number = $response->get_account_number();
if ( $response instanceof FrameworkBase\SV_WC_Payment_Gateway_API_Payment_Notification_Credit_Card_Response ) {
- $order->payment->exp_month = $response->get_exp_month();
- $order->payment->exp_year = $response->get_exp_year();
- $order->payment->card_type = $response->get_card_type();
+ $payment->exp_month = $response->get_exp_month();
+ $payment->exp_year = $response->get_exp_year();
+ $payment->card_type = $response->get_card_type();
} elseif ( $response instanceof FrameworkBase\SV_WC_Payment_Gateway_API_Payment_Notification_eCheck_Response ) {
- $order->payment->account_type = $response->get_account_type();
- $order->payment->check_number = $response->get_check_number();
+ $payment->account_type = $response->get_account_type();
+ $payment->check_number = $response->get_check_number();
}
+ // Set payment info on the order object.
+ OrderHelper::set_payment( $order, $payment );
+
return $order;
}
diff --git a/woocommerce/payment-gateway/Handlers/Abstract_Payment_Handler.php b/woocommerce/payment-gateway/Handlers/Abstract_Payment_Handler.php
index 7c7db045a..79e6c61fe 100644
--- a/woocommerce/payment-gateway/Handlers/Abstract_Payment_Handler.php
+++ b/woocommerce/payment-gateway/Handlers/Abstract_Payment_Handler.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\Handlers;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Handlers;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12 as FrameworkBase;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0 as FrameworkBase;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Payment_Gateway\\Handlers\\Abstract_Payment_Handler' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Payment_Gateway\\Handlers\\Abstract_Payment_Handler' ) ) :
/**
@@ -288,7 +288,7 @@ protected function process_order_transaction_held( \WC_Order $order, FrameworkBa
* @param string $message failure message
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response response object
*/
- protected function process_order_transaction_failed( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
+ protected function process_order_transaction_failed( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
$this->mark_order_as_failed( $order, $message, $response );
}
@@ -305,7 +305,7 @@ protected function process_order_transaction_failed( \WC_Order $order, $message
* @param \WC_Order $order order object
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Customer_Response|FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object
*/
- public function mark_order_as_paid( \WC_Order $order, FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
+ public function mark_order_as_paid( \WC_Order $order, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
$this->get_gateway()->add_transaction_data( $order, $response );
@@ -343,7 +343,7 @@ public function mark_order_as_paid( \WC_Order $order, FrameworkBase\SV_WC_Paymen
* @param string $message message for the order note
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response API response object
*/
- public function mark_order_as_approved( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
+ public function mark_order_as_approved( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
$order->add_order_note( $message );
}
@@ -360,7 +360,7 @@ public function mark_order_as_approved( \WC_Order $order, $message = '', Framewo
* @param string $message order note message
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response
*/
- public function mark_order_as_held( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
+ public function mark_order_as_held( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
/* translators: Example: "Authorize.Net Transaction Held for Review". Placeholder: %s - Payment gateway title */
$order_note = sprintf( __( '%s Transaction Held for Review', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title() );
@@ -390,7 +390,7 @@ public function mark_order_as_held( \WC_Order $order, $message = '', FrameworkBa
*
* @return string
*/
- public function get_held_order_status( \WC_Order $order, $response = null ) {
+ public function get_held_order_status( \WC_Order $order, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
/**
* Held Order Status Filter.
@@ -431,7 +431,7 @@ public function get_held_order_status( \WC_Order $order, $response = null ) {
* @param string $message order note message
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response
*/
- public function mark_order_as_failed( \WC_Order $order, $message = '', FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
+ public function mark_order_as_failed( \WC_Order $order, $message = '', ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
/* translators: Placeholders: %s - payment gateway title */
$order_note = sprintf( esc_html__( '%s Payment Failed', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title() );
@@ -458,7 +458,7 @@ public function mark_order_as_failed( \WC_Order $order, $message = '', Framework
* @param string $message order note message
* @param FrameworkBase\SV_WC_Payment_Gateway_API_Response|null $response
*/
- public function mark_order_as_cancelled( \WC_Order $order, $message, FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
+ public function mark_order_as_cancelled( \WC_Order $order, $message, ?FrameworkBase\SV_WC_Payment_Gateway_API_Response $response = null ) {
/* translators: Placeholders: %s - payment gateway title */
$order_note = sprintf( __( '%s Transaction Cancelled', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title() );
diff --git a/woocommerce/payment-gateway/Handlers/Capture.php b/woocommerce/payment-gateway/Handlers/Capture.php
index 33b298ab2..3a125eaa1 100644
--- a/woocommerce/payment-gateway/Handlers/Capture.php
+++ b/woocommerce/payment-gateway/Handlers/Capture.php
@@ -22,13 +22,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\Handlers;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Handlers;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12 as Framework;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0 as Framework;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Dynamic_Props;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Payment_Gateway\\Handlers\\Capture' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Payment_Gateway\\Handlers\\Capture' ) ) :
/**
@@ -189,7 +190,7 @@ public function perform_capture( \WC_Order $order, $amount = null ) {
/* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - transaction amount. Definitions: Capture, as in capture funds from a credit card. */
__( '%1$s Capture of %2$s Approved', 'woocommerce-plugin-framework' ),
$this->get_gateway()->get_method_title(),
- wc_price( $order->capture->amount, [
+ wc_price( Dynamic_Props::get( $order, 'capture', 'amount' ), [
'currency' => $order->get_currency()
] )
);
@@ -255,7 +256,7 @@ public function perform_capture( \WC_Order $order, $amount = null ) {
*/
public function do_capture_success( \WC_Order $order, Framework\SV_WC_Payment_Gateway_API_Response $response ) {
- $total_captured = (float) $this->get_gateway()->get_order_meta( $order, 'capture_total' ) + (float) $order->capture->amount;
+ $total_captured = (float) $this->get_gateway()->get_order_meta( $order, 'capture_total' ) + (float) Dynamic_Props::get( $order, 'capture', 'amount' );
$this->get_gateway()->update_order_meta( $order, 'capture_total', Framework\SV_WC_Helper::number_format( $total_captured ) );
$this->get_gateway()->update_order_meta( $order, 'charge_captured', $this->get_gateway()->supports_credit_card_partial_capture() && $this->get_gateway()->is_partial_capture_enabled() && $total_captured < (float) $this->get_order_capture_maximum( $order ) ? 'partial' : 'yes' );
diff --git a/woocommerce/payment-gateway/PaymentFormContextChecker.php b/woocommerce/payment-gateway/PaymentFormContextChecker.php
index 8a6345514..e76d997fd 100644
--- a/woocommerce/payment-gateway/PaymentFormContextChecker.php
+++ b/woocommerce/payment-gateway/PaymentFormContextChecker.php
@@ -1,9 +1,9 @@
e)}init(){if(1===e(this.container).children().length&&e(this.wrapper).hide(),this.is_available()&&(e("form.cart").length?this.init_product_page():e("form.woocommerce-cart-form").length?this.init_cart_page():e("form.woocommerce-checkout").length&&this.init_checkout_page(),this.ui_element))return this.payment_request&&(e(this.button).show(),e(this.wrapper).show()),e(document.body).on("click",".sv-wc-apple-pay-button",e=>{e.preventDefault(),this.block_ui();try{return this.session=this.get_new_session(this.payment_request),this.session.onvalidatemerchant=e=>this.on_validate_merchant(e),this.session.onpaymentmethodselected=e=>this.on_payment_method_selected(e),this.session.onshippingcontactselected=e=>this.on_shipping_contact_selected(e),this.session.onshippingmethodselected=e=>this.on_shipping_method_selected(e),this.session.onpaymentauthorized=e=>this.on_payment_authorized(e),this.session.oncancel=e=>this.on_cancel_payment(e),this.session.begin()}catch(e){return this.fail_payment(e)}})}init_product_page(){return this.ui_element=e("form.cart")}init_cart_page(){return this.ui_element=e("form.woocommerce-cart-form").parents("div.woocommerce"),e(document.body).on("updated_cart_totals",()=>this.reset_payment_request())}init_checkout_page(){return this.ui_element=e("form.woocommerce-checkout"),e(document.body).on("updated_checkout",()=>this.reset_payment_request())}get_new_session(e){return new ApplePaySession(this.get_sdk_version(),e)}get_sdk_version(){return 2}on_validate_merchant(e){return this.validate_merchant(e.validationURL).then(e=>(e=JSON.parse(e),this.session.completeMerchantValidation(e)),e=>(this.session.abort(),this.fail_payment("Merchant could no be validated. "+e.message)))}validate_merchant(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_validate_merchant`,nonce:this.validate_nonce,merchant_id:this.merchant_id,url:t},e.post(this.ajax_url,n,e=>e.success?s(e.data):i(e.data))})}on_payment_method_selected(t){return new Promise((t,s)=>{var i;return i={action:`wc_${this.gateway_id}_apple_pay_recalculate_totals`,nonce:this.recalculate_totals_nonce},e.post(this.ajax_url,i,e=>e.success?(i=e.data,t(this.session.completePaymentMethodSelection(i.total,i.line_items))):(console.error("[Apple Pay] Error selecting a shipping contact. "+e.data.message),s(this.session.completePaymentMethodSelection(this.payment_request.total,this.payment_request.lineItems))))})}on_shipping_contact_selected(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_recalculate_totals`,nonce:this.recalculate_totals_nonce,contact:t.shippingContact},e.post(this.ajax_url,n,e=>e.success?(n=e.data,s(this.session.completeShippingContactSelection(ApplePaySession.STATUS_SUCCESS,n.shipping_methods,n.total,n.line_items))):(console.error("[Apple Pay] Error selecting a shipping contact. "+e.data.message),i(this.session.completeShippingContactSelection(ApplePaySession.STATUS_FAILURE,[],this.payment_request.total,this.payment_request.lineItems))))})}on_shipping_method_selected(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_recalculate_totals`,nonce:this.recalculate_totals_nonce,method:t.shippingMethod.identifier},e.post(this.ajax_url,n,e=>e.success?(n=e.data,s(this.session.completeShippingMethodSelection(ApplePaySession.STATUS_SUCCESS,n.total,n.line_items))):(console.error("[Apple Pay] Error selecting a shipping method. "+e.data.message),i(this.session.completeShippingMethodSelection(ApplePaySession.STATUS_FAILURE,this.payment_request.total,this.payment_request.lineItems))))})}on_payment_authorized(e){return this.process_authorization(e.payment).then(e=>(this.set_payment_status(!0),this.complete_purchase(e)),e=>(this.set_payment_status(!1),this.fail_payment("Payment could no be processed. "+e.message)))}process_authorization(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_process_payment`,nonce:this.process_nonce,payment:JSON.stringify(t)},e.post(this.ajax_url,n,e=>e.success?s(e.data):i(e.data))})}on_cancel_payment(e){return this.unblock_ui()}complete_purchase(e){return window.location=e.redirect}fail_payment(e){return console.error("[Apple Pay] "+e),this.unblock_ui(),this.render_errors([this.generic_error])}set_payment_status(e){var t;return t=e?ApplePaySession.STATUS_SUCCESS:ApplePaySession.STATUS_FAILURE,this.session.completePayment(t)}reset_payment_request(t={}){return this.block_ui(),this.get_payment_request(t).then(t=>(e(this.button).show(),e(this.wrapper).show(),this.payment_request=JSON.parse(t),this.unblock_ui()),t=>(console.error("[Apple Pay] Could not build payment request. "+t.message),e(this.button).hide(),1===e(this.container).children().length&&e(this.wrapper).hide(),this.unblock_ui()))}get_payment_request(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_get_payment_request`},e.extend(t,n),e.post(this.ajax_url,t,e=>e.success?s(e.data):i(e.data))})}render_errors(t){return e(".woocommerce-error, .woocommerce-message").remove(),this.ui_element.prepend('
"),this.ui_element.removeClass("processing").unblock(),e("html, body").animate({scrollTop:this.ui_element.offset().top-100},1e3)}block_ui(){return this.ui_element.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblock_ui(){return this.ui_element.unblock()}},e(document.body).trigger("sv_wc_apple_pay_handler_v5_15_12_loaded")})}).call({});
+(function(){jQuery(function(e){return window.SV_WC_Apple_Pay_Handler_v6_0_0=class{constructor(e){this.init_product_page=this.init_product_page.bind(this),this.init_cart_page=this.init_cart_page.bind(this),this.init_checkout_page=this.init_checkout_page.bind(this),this.on_validate_merchant=this.on_validate_merchant.bind(this),this.validate_merchant=this.validate_merchant.bind(this),this.on_payment_method_selected=this.on_payment_method_selected.bind(this),this.on_shipping_contact_selected=this.on_shipping_contact_selected.bind(this),this.on_shipping_method_selected=this.on_shipping_method_selected.bind(this),this.on_payment_authorized=this.on_payment_authorized.bind(this),this.process_authorization=this.process_authorization.bind(this),this.on_cancel_payment=this.on_cancel_payment.bind(this),this.reset_payment_request=this.reset_payment_request.bind(this),this.get_payment_request=this.get_payment_request.bind(this),this.gateway_id=e.gateway_id,this.gateway_slug=e.gateway_slug,this.merchant_id=e.merchant_id,this.ajax_url=e.ajax_url,this.validate_nonce=e.validate_nonce,this.recalculate_totals_nonce=e.recalculate_totals_nonce,this.process_nonce=e.process_nonce,this.payment_request=e.payment_request,this.generic_error=e.generic_error,this.wrapper=".sv-wc-external-checkout",this.container=".buttons-container",this.button=".sv-wc-apple-pay-button"}is_available(){return!!window.ApplePaySession&&ApplePaySession.canMakePaymentsWithActiveCard(this.merchant_id).then(e=>e)}init(){if(1===e(this.container).children().length&&e(this.wrapper).hide(),this.is_available()&&(e("form.cart").length?this.init_product_page():e("form.woocommerce-cart-form").length?this.init_cart_page():e("form.woocommerce-checkout").length&&this.init_checkout_page(),this.ui_element))return this.payment_request&&(e(this.button).show(),e(this.wrapper).show()),e(document.body).on("click",".sv-wc-apple-pay-button",e=>{e.preventDefault(),this.block_ui();try{return this.session=this.get_new_session(this.payment_request),this.session.onvalidatemerchant=e=>this.on_validate_merchant(e),this.session.onpaymentmethodselected=e=>this.on_payment_method_selected(e),this.session.onshippingcontactselected=e=>this.on_shipping_contact_selected(e),this.session.onshippingmethodselected=e=>this.on_shipping_method_selected(e),this.session.onpaymentauthorized=e=>this.on_payment_authorized(e),this.session.oncancel=e=>this.on_cancel_payment(e),this.session.begin()}catch(e){return this.fail_payment(e)}})}init_product_page(){return this.ui_element=e("form.cart")}init_cart_page(){return this.ui_element=e("form.woocommerce-cart-form").parents("div.woocommerce"),e(document.body).on("updated_cart_totals",()=>this.reset_payment_request())}init_checkout_page(){return this.ui_element=e("form.woocommerce-checkout"),e(document.body).on("updated_checkout",()=>this.reset_payment_request())}get_new_session(e){return new ApplePaySession(this.get_sdk_version(),e)}get_sdk_version(){return 2}on_validate_merchant(e){return this.validate_merchant(e.validationURL).then(e=>(e=JSON.parse(e),this.session.completeMerchantValidation(e)),e=>(this.session.abort(),this.fail_payment("Merchant could no be validated. "+e.message)))}validate_merchant(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_validate_merchant`,nonce:this.validate_nonce,merchant_id:this.merchant_id,url:t},e.post(this.ajax_url,n,e=>e.success?s(e.data):i(e.data))})}on_payment_method_selected(t){return new Promise((t,s)=>{var i;return i={action:`wc_${this.gateway_id}_apple_pay_recalculate_totals`,nonce:this.recalculate_totals_nonce},e.post(this.ajax_url,i,e=>e.success?(i=e.data,t(this.session.completePaymentMethodSelection(i.total,i.line_items))):(console.error("[Apple Pay] Error selecting a shipping contact. "+e.data.message),s(this.session.completePaymentMethodSelection(this.payment_request.total,this.payment_request.lineItems))))})}on_shipping_contact_selected(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_recalculate_totals`,nonce:this.recalculate_totals_nonce,contact:t.shippingContact},e.post(this.ajax_url,n,e=>e.success?(n=e.data,s(this.session.completeShippingContactSelection(ApplePaySession.STATUS_SUCCESS,n.shipping_methods,n.total,n.line_items))):(console.error("[Apple Pay] Error selecting a shipping contact. "+e.data.message),i(this.session.completeShippingContactSelection(ApplePaySession.STATUS_FAILURE,[],this.payment_request.total,this.payment_request.lineItems))))})}on_shipping_method_selected(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_recalculate_totals`,nonce:this.recalculate_totals_nonce,method:t.shippingMethod.identifier},e.post(this.ajax_url,n,e=>e.success?(n=e.data,s(this.session.completeShippingMethodSelection(ApplePaySession.STATUS_SUCCESS,n.total,n.line_items))):(console.error("[Apple Pay] Error selecting a shipping method. "+e.data.message),i(this.session.completeShippingMethodSelection(ApplePaySession.STATUS_FAILURE,this.payment_request.total,this.payment_request.lineItems))))})}on_payment_authorized(e){return this.process_authorization(e.payment).then(e=>(this.set_payment_status(!0),this.complete_purchase(e)),e=>(this.set_payment_status(!1),this.fail_payment("Payment could no be processed. "+e.message)))}process_authorization(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_process_payment`,nonce:this.process_nonce,payment:JSON.stringify(t)},e.post(this.ajax_url,n,e=>e.success?s(e.data):i(e.data))})}on_cancel_payment(e){return this.unblock_ui()}complete_purchase(e){return window.location=e.redirect}fail_payment(e){return console.error("[Apple Pay] "+e),this.unblock_ui(),this.render_errors([this.generic_error])}set_payment_status(e){var t;return t=e?ApplePaySession.STATUS_SUCCESS:ApplePaySession.STATUS_FAILURE,this.session.completePayment(t)}reset_payment_request(t={}){return this.block_ui(),this.get_payment_request(t).then(t=>(e(this.button).show(),e(this.wrapper).show(),this.payment_request=JSON.parse(t),this.unblock_ui()),t=>(console.error("[Apple Pay] Could not build payment request. "+t.message),e(this.button).hide(),1===e(this.container).children().length&&e(this.wrapper).hide(),this.unblock_ui()))}get_payment_request(t){return new Promise((s,i)=>{var n;return n={action:`wc_${this.gateway_id}_apple_pay_get_payment_request`},e.extend(t,n),e.post(this.ajax_url,t,e=>e.success?s(e.data):i(e.data))})}render_errors(t){return e(".woocommerce-error, .woocommerce-message").remove(),this.ui_element.prepend('"),this.ui_element.removeClass("processing").unblock(),e("html, body").animate({scrollTop:this.ui_element.offset().top-100},1e3)}block_ui(){return this.ui_element.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblock_ui(){return this.ui_element.unblock()}},e(document.body).trigger("sv_wc_apple_pay_handler_v6_0_0_loaded")})}).call({});
//# sourceMappingURL=sv-wc-payment-gateway-apple-pay.js.map
diff --git a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-apple-pay.js.map b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-apple-pay.js.map
index 74cfc9ee8..1efade3fd 100644
--- a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-apple-pay.js.map
+++ b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-apple-pay.js.map
@@ -1 +1 @@
-{"mappings":"ACOG,CAAA,WAEH,OAAO,SAAE,CAAF,EAibN,OA1aM,OAAO,gCAAA,CAAb,MAMC,YAAc,CAAD,CAAA,CAoFb,IAAA,CAAA,iBAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,IAAA,CAAA,IAAA,EAQA,IAAA,CAAA,cAAA,CAAA,IAAA,CAAA,cAAA,CAAA,IAAA,CAAA,IAAA,EAaA,IAAA,CAAA,kBAAA,CAAA,IAAA,CAAA,kBAAA,CAAA,IAAA,CAAA,IAAA,EAiCA,IAAA,CAAA,oBAAA,CAAA,IAAA,CAAA,oBAA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AL,IAtBqB,CA4BvB,oBAAuB,CAAF,CAArB,CAAiC,OAAA,IAAI,QAAQ,CAAE,EAAS,KAE1D,IAAA,EAOG,OAPA,EAAY,CACX,OAAU,CAAA,GAAA,EAAO,IAAC,CAAA,UAAR,CAAA,8BAAA,CAAV,AADW,EAIZ,EAAE,MAAF,CAAS,EAAM,GAGf,EAAE,IAAF,CAAO,IAAC,CAAA,QAAR,CAAkB,EAAM,AAAE,GAEzB,AAAG,EAAS,OAAZ,CACC,EAAQ,EAAS,IAAjB,EAEA,EAAO,EAAS,IAAhB,EAd0C,EAAxB,CAoBrB,cAAiB,CAAF,CAAA,CAYd,OATA,EAAG,4CAA6C,MAAhD,GAGA,IAAC,CAAA,UAAU,CAAC,OAAZ,CAAoB,qCAAuC,EAAO,IAAP,CAAa,aAAgB,cAGxF,IAAC,CAAA,UAAU,CAAC,WAAZ,CAAyB,cAAe,OAAxC,GAGA,EAAG,cAAe,OAAlB,CAA2B,CAAE,UAAW,IAAC,CAAA,UAAU,CAAC,MAAZ,GAAqB,GAArB,CAA2B,GAAxC,EAA+C,IAZ5D,CAkBf,UAAA,CAAa,OAAA,IAAC,CAAA,UAAU,CAAC,KAAZ,CAAmB,CAAA,QAAS,KAAM,WAAY,CAAA,WAAY,OAAQ,QAAS,EAA7B,CAA3B,EAAtB,CAMV,YAAA,CAAe,OAAA,IAAC,CAAA,UAAU,CAAC,OAAZ,EAAH,CAtab,EA0aA,EAAG,SAAS,IAAZ,EAAmB,OAAnB,CAA4B,0CAjbtB,E,C,E,I,C,C","sources":["","woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-apple-pay.coffee"],"sourcesContent":["(() => {\nvar $83dab3ad15da905a$exports = {};\n(function() {\n /*\n WooCommerce Apple Pay Handler\n Version 4.7.0\n\n Copyright (c) 2016, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n */ jQuery(function($) {\n \"use strict\";\n // The WooCommerce Apple Pay handler base class.\n // @since 4.7.0\n window.SV_WC_Apple_Pay_Handler_v5_15_12 = class SV_WC_Apple_Pay_Handler_v5_15_12 {\n // Constructs the handler.\n // @since 4.7.0\n constructor(args){\n // Initializes the product page.\n // @since 5.6.0\n this.init_product_page = this.init_product_page.bind(this);\n // Initializes the cart page.\n // @since 5.6.0\n this.init_cart_page = this.init_cart_page.bind(this);\n // Initializes the checkout page.\n // @since 5.6.0\n this.init_checkout_page = this.init_checkout_page.bind(this);\n // The callback for after the merchant data is validated.\n // @since 4.7.0\n this.on_validate_merchant = this.on_validate_merchant.bind(this);\n // Validates the merchant data.\n // @since 4.7.0\n // @return object\n this.validate_merchant = this.validate_merchant.bind(this);\n // Fires after a payment method has been selected.\n // @since 4.7.0\n this.on_payment_method_selected = this.on_payment_method_selected.bind(this);\n // Fires after a shipping contact has been selected.\n // @since 4.7.0\n this.on_shipping_contact_selected = this.on_shipping_contact_selected.bind(this);\n // Fires after a shipping method has been selected.\n // @since 4.7.0\n this.on_shipping_method_selected = this.on_shipping_method_selected.bind(this);\n // The callback for after the payment data is authorized.\n // @since 4.7.0\n this.on_payment_authorized = this.on_payment_authorized.bind(this);\n // Processes the transaction data.\n // @since 4.7.0\n this.process_authorization = this.process_authorization.bind(this);\n // The callback for when the payment card is cancelled/dismissed.\n // @since 4.7.0\n this.on_cancel_payment = this.on_cancel_payment.bind(this);\n // Resets the payment request via AJAX.\n // Extending handlers can call this on change events to refresh the data.\n // @since 4.7.0\n this.reset_payment_request = this.reset_payment_request.bind(this);\n // Gets the payment request via AJAX.\n // @since 4.7.0\n this.get_payment_request = this.get_payment_request.bind(this);\n this.gateway_id = args.gateway_id;\n this.gateway_slug = args.gateway_slug;\n this.merchant_id = args.merchant_id;\n this.ajax_url = args.ajax_url;\n this.validate_nonce = args.validate_nonce;\n this.recalculate_totals_nonce = args.recalculate_totals_nonce;\n this.process_nonce = args.process_nonce;\n this.payment_request = args.payment_request;\n this.generic_error = args.generic_error;\n this.wrapper = '.sv-wc-external-checkout';\n this.container = '.buttons-container';\n this.button = '.sv-wc-apple-pay-button';\n }\n // Determines if Apple Pay is available.\n // @since 4.7.0\n // @return bool\n is_available() {\n if (!window.ApplePaySession) return false;\n return ApplePaySession.canMakePaymentsWithActiveCard(this.merchant_id).then((canMakePayments)=>{\n return canMakePayments;\n });\n }\n // Initializes the handler.\n // @since 4.7.0\n init() {\n // hide the wrapper if Apple Pay is the only button\n if ($(this.container).children().length === 1) $(this.wrapper).hide();\n if (!this.is_available()) return;\n // initialize for the various pages\n if ($('form.cart').length) this.init_product_page();\n else if ($('form.woocommerce-cart-form').length) this.init_cart_page();\n else if ($('form.woocommerce-checkout').length) this.init_checkout_page();\n // bail if no UI was initialized\n if (!this.ui_element) return;\n if (this.payment_request) {\n $(this.button).show();\n $(this.wrapper).show();\n }\n return $(document.body).on('click', '.sv-wc-apple-pay-button', (e)=>{\n var error;\n e.preventDefault();\n this.block_ui();\n try {\n this.session = this.get_new_session(this.payment_request);\n // set the payment card events\n this.session.onvalidatemerchant = (event)=>{\n return this.on_validate_merchant(event);\n };\n this.session.onpaymentmethodselected = (event)=>{\n return this.on_payment_method_selected(event);\n };\n this.session.onshippingcontactselected = (event)=>{\n return this.on_shipping_contact_selected(event);\n };\n this.session.onshippingmethodselected = (event)=>{\n return this.on_shipping_method_selected(event);\n };\n this.session.onpaymentauthorized = (event)=>{\n return this.on_payment_authorized(event);\n };\n this.session.oncancel = (event)=>{\n return this.on_cancel_payment(event);\n };\n return this.session.begin();\n } catch (error1) {\n error = error1;\n return this.fail_payment(error);\n }\n });\n }\n init_product_page() {\n return this.ui_element = $('form.cart');\n }\n init_cart_page() {\n this.ui_element = $('form.woocommerce-cart-form').parents('div.woocommerce');\n // re-init if the cart totals are updated\n return $(document.body).on('updated_cart_totals', ()=>{\n return this.reset_payment_request();\n });\n }\n init_checkout_page() {\n this.ui_element = $('form.woocommerce-checkout');\n return $(document.body).on('updated_checkout', ()=>{\n // re-init if the checkout is updated\n return this.reset_payment_request();\n });\n }\n // Gets a new Apple Pay session.\n // @since 5.6.0\n // @param [Object] payment_request payment request object\n // @return ApplePaySession\n get_new_session(payment_request) {\n return new ApplePaySession(this.get_sdk_version(), payment_request);\n }\n // Gets the Apple SDK version to use.\n // @since 5.6.0\n // @return int\n get_sdk_version() {\n return 2;\n }\n on_validate_merchant(event) {\n return this.validate_merchant(event.validationURL).then((merchant_session)=>{\n merchant_session = JSON.parse(merchant_session);\n return this.session.completeMerchantValidation(merchant_session);\n }, (response)=>{\n this.session.abort();\n return this.fail_payment('Merchant could no be validated. ' + response.message);\n });\n }\n validate_merchant(url) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n 'action': `wc_${this.gateway_id}_apple_pay_validate_merchant`,\n 'nonce': this.validate_nonce,\n 'merchant_id': this.merchant_id,\n 'url': url\n };\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) return resolve(response.data);\n else return reject(response.data);\n });\n });\n }\n on_payment_method_selected(event) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n 'action': `wc_${this.gateway_id}_apple_pay_recalculate_totals`,\n 'nonce': this.recalculate_totals_nonce\n };\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) {\n data = response.data;\n return resolve(this.session.completePaymentMethodSelection(data.total, data.line_items));\n } else {\n console.error('[Apple Pay] Error selecting a shipping contact. ' + response.data.message);\n return reject(this.session.completePaymentMethodSelection(this.payment_request.total, this.payment_request.lineItems));\n }\n });\n });\n }\n on_shipping_contact_selected(event) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n 'action': `wc_${this.gateway_id}_apple_pay_recalculate_totals`,\n 'nonce': this.recalculate_totals_nonce,\n 'contact': event.shippingContact\n };\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) {\n data = response.data;\n return resolve(this.session.completeShippingContactSelection(ApplePaySession.STATUS_SUCCESS, data.shipping_methods, data.total, data.line_items));\n } else {\n console.error('[Apple Pay] Error selecting a shipping contact. ' + response.data.message);\n return reject(this.session.completeShippingContactSelection(ApplePaySession.STATUS_FAILURE, [], this.payment_request.total, this.payment_request.lineItems));\n }\n });\n });\n }\n on_shipping_method_selected(event) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n 'action': `wc_${this.gateway_id}_apple_pay_recalculate_totals`,\n 'nonce': this.recalculate_totals_nonce,\n 'method': event.shippingMethod.identifier\n };\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) {\n data = response.data;\n return resolve(this.session.completeShippingMethodSelection(ApplePaySession.STATUS_SUCCESS, data.total, data.line_items));\n } else {\n console.error('[Apple Pay] Error selecting a shipping method. ' + response.data.message);\n return reject(this.session.completeShippingMethodSelection(ApplePaySession.STATUS_FAILURE, this.payment_request.total, this.payment_request.lineItems));\n }\n });\n });\n }\n on_payment_authorized(event) {\n return this.process_authorization(event.payment).then((response)=>{\n this.set_payment_status(true);\n return this.complete_purchase(response);\n }, (response)=>{\n this.set_payment_status(false);\n return this.fail_payment('Payment could no be processed. ' + response.message);\n });\n }\n process_authorization(payment) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n action: `wc_${this.gateway_id}_apple_pay_process_payment`,\n nonce: this.process_nonce,\n payment: JSON.stringify(payment)\n };\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) return resolve(response.data);\n else return reject(response.data);\n });\n });\n }\n on_cancel_payment(event) {\n return this.unblock_ui();\n }\n // Completes the purchase based on the gateway result.\n // @since 4.7.0\n complete_purchase(response) {\n return window.location = response.redirect;\n }\n // Fails the purchase based on the gateway result.\n // @since 4.7.0\n fail_payment(error) {\n console.error('[Apple Pay] ' + error);\n this.unblock_ui();\n return this.render_errors([\n this.generic_error\n ]);\n }\n // Sets the Apple Pay payment status depending on the gateway result.\n // @since 4.7.0\n set_payment_status(success) {\n var status;\n if (success) status = ApplePaySession.STATUS_SUCCESS;\n else status = ApplePaySession.STATUS_FAILURE;\n return this.session.completePayment(status);\n }\n reset_payment_request(data = {}) {\n this.block_ui();\n return this.get_payment_request(data).then((response)=>{\n $(this.button).show();\n $(this.wrapper).show();\n this.payment_request = JSON.parse(response);\n return this.unblock_ui();\n }, (response)=>{\n console.error('[Apple Pay] Could not build payment request. ' + response.message);\n $(this.button).hide();\n // hide the wrapper if Apple Pay is the only button\n if ($(this.container).children().length === 1) $(this.wrapper).hide();\n return this.unblock_ui();\n });\n }\n get_payment_request(data) {\n return new Promise((resolve, reject)=>{\n var base_data;\n base_data = {\n 'action': `wc_${this.gateway_id}_apple_pay_get_payment_request`\n };\n $.extend(data, base_data);\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) return resolve(response.data);\n else return reject(response.data);\n });\n });\n }\n // Renders any new errors and bring them into the viewport.\n // @since 4.7.0\n render_errors(errors) {\n // hide and remove any previous errors\n $('.woocommerce-error, .woocommerce-message').remove();\n // add errors\n this.ui_element.prepend('');\n // unblock UI\n this.ui_element.removeClass('processing').unblock();\n // scroll to top\n return $('html, body').animate({\n scrollTop: this.ui_element.offset().top - 100\n }, 1000);\n }\n // Blocks the payment form UI.\n // @since 4.7.0\n block_ui() {\n return this.ui_element.block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n // Unblocks the payment form UI.\n // @since 4.7.0\n unblock_ui() {\n return this.ui_element.unblock();\n }\n };\n // dispatch loaded event\n return $(document.body).trigger('sv_wc_apple_pay_handler_v5_15_12_loaded');\n });\n}).call($83dab3ad15da905a$exports);\n\n})();\n//# sourceMappingURL=sv-wc-payment-gateway-apple-pay.js.map\n","###\n WooCommerce Apple Pay Handler\n Version 4.7.0\n\n Copyright (c) 2016, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n###\n\njQuery ( $ ) ->\n\n\t\"use strict\"\n\n\t# The WooCommerce Apple Pay handler base class.\n\t#\n\t# @since 4.7.0\n\tclass window.SV_WC_Apple_Pay_Handler_v5_15_12\n\n\n\t\t# Constructs the handler.\n\t\t#\n\t\t# @since 4.7.0\n\t\tconstructor: (args) ->\n\n\t\t\t@gateway_id = args.gateway_id\n\t\t\t@gateway_slug = args.gateway_slug\n\t\t\t@merchant_id = args.merchant_id\n\t\t\t@ajax_url = args.ajax_url\n\t\t\t@validate_nonce = args.validate_nonce\n\t\t\t@recalculate_totals_nonce = args.recalculate_totals_nonce\n\t\t\t@process_nonce = args.process_nonce\n\t\t\t@payment_request = args.payment_request\n\t\t\t@generic_error = args.generic_error\n\n\t\t\t@wrapper = '.sv-wc-external-checkout'\n\t\t\t@container = '.buttons-container'\n\t\t\t@button = '.sv-wc-apple-pay-button'\n\n\n\t\t# Determines if Apple Pay is available.\n\t\t#\n\t\t# @since 4.7.0\n\t\t# @return bool\n\t\tis_available: ->\n\n\t\t\treturn false unless window.ApplePaySession\n\n\t\t\tApplePaySession.canMakePaymentsWithActiveCard( @merchant_id ).then ( canMakePayments ) =>\n\n\t\t\t\treturn canMakePayments\n\n\n\t\t# Initializes the handler.\n\t\t#\n\t\t# @since 4.7.0\n\t\tinit: ->\n\n\t\t\t# hide the wrapper if Apple Pay is the only button\n\t\t\tif $( @container ).children().length is 1\n\t\t\t\t$( @wrapper ).hide()\n\n\t\t\treturn unless this.is_available()\n\n\t\t\t# initialize for the various pages\n\t\t\tif $( 'form.cart' ).length\n\t\t\t\tthis.init_product_page()\n\t\t\telse if $( 'form.woocommerce-cart-form' ).length\n\t\t\t\tthis.init_cart_page()\n\t\t\telse if $( 'form.woocommerce-checkout' ).length\n\t\t\t\tthis.init_checkout_page()\n\n\t\t\t# bail if no UI was initialized\n\t\t\treturn unless @ui_element\n\n\t\t\tif @payment_request\n\t\t\t\t$( @button ).show()\n\t\t\t\t$( @wrapper ).show()\n\n\t\t\t$( document.body ).on 'click', '.sv-wc-apple-pay-button', ( e ) =>\n\n\t\t\t\te.preventDefault()\n\n\t\t\t\tthis.block_ui()\n\n\t\t\t\ttry\n\n\t\t\t\t\t@session = this.get_new_session( @payment_request )\n\n\t\t\t\t\t# set the payment card events\n\t\t\t\t\t@session.onvalidatemerchant = ( event ) => this.on_validate_merchant( event )\n\t\t\t\t\t@session.onpaymentmethodselected = ( event ) => this.on_payment_method_selected( event )\n\t\t\t\t\t@session.onshippingcontactselected = ( event ) => this.on_shipping_contact_selected( event )\n\t\t\t\t\t@session.onshippingmethodselected = ( event ) => this.on_shipping_method_selected( event )\n\t\t\t\t\t@session.onpaymentauthorized = ( event ) => this.on_payment_authorized( event )\n\t\t\t\t\t@session.oncancel = ( event ) => this.on_cancel_payment( event )\n\n\t\t\t\t\t@session.begin()\n\n\t\t\t\tcatch error\n\n\t\t\t\t\tthis.fail_payment( error )\n\n\n\t\t# Initializes the product page.\n\t\t#\n\t\t# @since 5.6.0\n\t\tinit_product_page: =>\n\n\t\t\t@ui_element = $( 'form.cart' )\n\n\n\t\t# Initializes the cart page.\n\t\t#\n\t\t# @since 5.6.0\n\t\tinit_cart_page: =>\n\n\t\t\t@ui_element = $( 'form.woocommerce-cart-form' ).parents( 'div.woocommerce' )\n\n\t\t\t# re-init if the cart totals are updated\n\t\t\t$( document.body ).on 'updated_cart_totals', =>\n\n\t\t\t\tthis.reset_payment_request()\n\n\n\t\t# Initializes the checkout page.\n\t\t#\n\t\t# @since 5.6.0\n\t\tinit_checkout_page: =>\n\n\t\t\t@ui_element = $( 'form.woocommerce-checkout' )\n\n\t\t\t$( document.body ).on 'updated_checkout', =>\n\n\t\t\t\t# re-init if the checkout is updated\n\t\t\t\tthis.reset_payment_request()\n\n\n\t\t# Gets a new Apple Pay session.\n\t\t#\n\t\t# @since 5.6.0\n\t\t#\n\t\t# @param [Object] payment_request payment request object\n\t\t# @return ApplePaySession\n\t\tget_new_session: ( payment_request ) ->\n\n\t\t\treturn new ApplePaySession( this.get_sdk_version(), payment_request )\n\n\n\t\t# Gets the Apple SDK version to use.\n\t\t#\n\t\t# @since 5.6.0\n\t\t# @return int\n\t\tget_sdk_version: ->\n\n\t\t\treturn 2\n\n\n\t\t# The callback for after the merchant data is validated.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_validate_merchant: ( event ) =>\n\n\t\t\tthis.validate_merchant( event.validationURL ).then ( merchant_session ) =>\n\n\t\t\t\tmerchant_session = JSON.parse( merchant_session )\n\n\t\t\t\t@session.completeMerchantValidation( merchant_session )\n\n\t\t\t, ( response ) =>\n\n\t\t\t\t@session.abort()\n\n\t\t\t\tthis.fail_payment 'Merchant could no be validated. ' + response.message\n\n\n\t\t# Validates the merchant data.\n\t\t#\n\t\t# @since 4.7.0\n\t\t# @return object\n\t\tvalidate_merchant: ( url ) => new Promise ( resolve, reject ) =>\n\n\t\t\tdata = {\n\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_validate_merchant\",\n\t\t\t\t'nonce': @validate_nonce,\n\t\t\t\t'merchant_id': @merchant_id,\n\t\t\t\t'url': url\n\t\t\t}\n\n\t\t\t# retrieve a payment request object\n\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\tif response.success\n\t\t\t\t\tresolve response.data\n\t\t\t\telse\n\t\t\t\t\treject response.data\n\n\n\t\t# Fires after a payment method has been selected.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_payment_method_selected: ( event ) =>\n\n\t\t\tnew Promise ( resolve, reject ) =>\n\n\t\t\t\tdata = {\n\t\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_recalculate_totals\",\n\t\t\t\t\t'nonce': @recalculate_totals_nonce,\n\t\t\t\t}\n\n\t\t\t\t# retrieve a payment request object\n\t\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\t\tif response.success\n\n\t\t\t\t\t\tdata = response.data\n\n\t\t\t\t\t\tresolve @session.completePaymentMethodSelection( data.total, data.line_items )\n\n\t\t\t\t\telse\n\n\t\t\t\t\t\tconsole.error '[Apple Pay] Error selecting a shipping contact. ' + response.data.message\n\n\t\t\t\t\t\treject @session.completePaymentMethodSelection( @payment_request.total, @payment_request.lineItems )\n\n\n\t\t# Fires after a shipping contact has been selected.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_shipping_contact_selected: ( event ) =>\n\n\t\t\tnew Promise ( resolve, reject ) =>\n\n\t\t\t\tdata = {\n\t\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_recalculate_totals\",\n\t\t\t\t\t'nonce': @recalculate_totals_nonce,\n\t\t\t\t\t'contact': event.shippingContact\n\t\t\t\t}\n\n\t\t\t\t# retrieve a payment request object\n\t\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\t\tif response.success\n\n\t\t\t\t\t\tdata = response.data\n\n\t\t\t\t\t\tresolve @session.completeShippingContactSelection( ApplePaySession.STATUS_SUCCESS, data.shipping_methods, data.total, data.line_items )\n\n\t\t\t\t\telse\n\n\t\t\t\t\t\tconsole.error '[Apple Pay] Error selecting a shipping contact. ' + response.data.message\n\n\t\t\t\t\t\treject @session.completeShippingContactSelection( ApplePaySession.STATUS_FAILURE, [], @payment_request.total, @payment_request.lineItems )\n\n\n\t\t# Fires after a shipping method has been selected.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_shipping_method_selected: ( event ) =>\n\n\t\t\tnew Promise ( resolve, reject ) =>\n\n\t\t\t\tdata = {\n\t\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_recalculate_totals\",\n\t\t\t\t\t'nonce': @recalculate_totals_nonce,\n\t\t\t\t\t'method': event.shippingMethod.identifier\n\t\t\t\t}\n\n\t\t\t\t# retrieve a payment request object\n\t\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\t\tif response.success\n\n\t\t\t\t\t\tdata = response.data\n\n\t\t\t\t\t\tresolve @session.completeShippingMethodSelection( ApplePaySession.STATUS_SUCCESS, data.total, data.line_items )\n\n\t\t\t\t\telse\n\n\t\t\t\t\t\tconsole.error '[Apple Pay] Error selecting a shipping method. ' + response.data.message\n\n\t\t\t\t\t\treject @session.completeShippingMethodSelection( ApplePaySession.STATUS_FAILURE, @payment_request.total, @payment_request.lineItems )\n\n\n\t\t# The callback for after the payment data is authorized.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_payment_authorized: ( event ) =>\n\n\t\t\tthis.process_authorization( event.payment ).then ( response ) =>\n\n\t\t\t\tthis.set_payment_status( true )\n\n\t\t\t\tthis.complete_purchase( response )\n\n\t\t\t, ( response ) =>\n\n\t\t\t\tthis.set_payment_status( false )\n\n\t\t\t\tthis.fail_payment 'Payment could no be processed. ' + response.message\n\n\n\t\t# Processes the transaction data.\n\t\t#\n\t\t# @since 4.7.0\n\t\tprocess_authorization: ( payment ) => new Promise ( resolve, reject ) =>\n\n\t\t\tdata = {\n\t\t\t\taction: \"wc_#{ @gateway_id }_apple_pay_process_payment\",\n\t\t\t\tnonce: @process_nonce,\n\t\t\t\tpayment: JSON.stringify( payment )\n\t\t\t}\n\n\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\tif response.success\n\t\t\t\t\tresolve response.data\n\t\t\t\telse\n\t\t\t\t\treject response.data\n\n\n\t\t# The callback for when the payment card is cancelled/dismissed.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_cancel_payment: ( event ) =>\n\n\t\t\tthis.unblock_ui()\n\n\n\t\t# Completes the purchase based on the gateway result.\n\t\t#\n\t\t# @since 4.7.0\n\t\tcomplete_purchase: ( response ) ->\n\n\t\t\twindow.location = response.redirect\n\n\n\t\t# Fails the purchase based on the gateway result.\n\t\t#\n\t\t# @since 4.7.0\n\t\tfail_payment: ( error ) ->\n\n\t\t\tconsole.error '[Apple Pay] ' + error\n\n\t\t\tthis.unblock_ui()\n\n\t\t\tthis.render_errors( [ @generic_error ] )\n\n\n\t\t# Sets the Apple Pay payment status depending on the gateway result.\n\t\t#\n\t\t# @since 4.7.0\n\t\tset_payment_status: ( success ) ->\n\n\t\t\tif success\n\t\t\t\tstatus = ApplePaySession.STATUS_SUCCESS\n\t\t\telse\n\t\t\t\tstatus = ApplePaySession.STATUS_FAILURE\n\n\t\t\t@session.completePayment( status )\n\n\n\t\t# Resets the payment request via AJAX.\n\t\t#\n\t\t# Extending handlers can call this on change events to refresh the data.\n\t\t#\n\t\t# @since 4.7.0\n\t\treset_payment_request: ( data = {} ) =>\n\n\t\t\tthis.block_ui()\n\n\t\t\tthis.get_payment_request( data ).then ( response ) =>\n\n\t\t\t\t$( @button ).show()\n\t\t\t\t$( @wrapper ).show()\n\n\t\t\t\t@payment_request = JSON.parse( response )\n\n\t\t\t\tthis.unblock_ui()\n\n\t\t\t, ( response ) =>\n\n\t\t\t\tconsole.error '[Apple Pay] Could not build payment request. ' + response.message\n\n\t\t\t\t$( @button ).hide()\n\t\t\t\t# hide the wrapper if Apple Pay is the only button\n\t\t\t\tif $( @container ).children().length is 1\n\t\t\t\t\t$( @wrapper ).hide()\n\n\t\t\t\tthis.unblock_ui()\n\n\n\t\t# Gets the payment request via AJAX.\n\t\t#\n\t\t# @since 4.7.0\n\t\tget_payment_request: ( data ) => new Promise ( resolve, reject ) =>\n\n\t\t\tbase_data = {\n\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_get_payment_request\"\n\t\t\t}\n\n\t\t\t$.extend data, base_data\n\n\t\t\t# retrieve a payment request object\n\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\tif response.success\n\t\t\t\t\tresolve response.data\n\t\t\t\telse\n\t\t\t\t\treject response.data\n\n\n\t\t# Renders any new errors and bring them into the viewport.\n\t\t#\n\t\t# @since 4.7.0\n\t\trender_errors: ( errors ) ->\n\n\t\t\t# hide and remove any previous errors\n\t\t\t$( '.woocommerce-error, .woocommerce-message' ).remove()\n\n\t\t\t# add errors\n\t\t\t@ui_element.prepend '- ' + errors.join( '
- ' ) + '
'\n\n\t\t\t# unblock UI\n\t\t\t@ui_element.removeClass( 'processing' ).unblock()\n\n\t\t\t# scroll to top\n\t\t\t$( 'html, body' ).animate( { scrollTop: @ui_element.offset().top - 100 }, 1000 )\n\n\n\t\t# Blocks the payment form UI.\n\t\t#\n\t\t# @since 4.7.0\n\t\tblock_ui: -> @ui_element.block( message: null, overlayCSS: background: '#fff', opacity: 0.6 )\n\n\n\t\t# Unblocks the payment form UI.\n\t\t#\n\t\t# @since 4.7.0\n\t\tunblock_ui: -> @ui_element.unblock()\n\n\n\t# dispatch loaded event\n\t$( document.body ).trigger( 'sv_wc_apple_pay_handler_v5_15_12_loaded' )\n"],"names":["jQuery","$","window","SV_WC_Apple_Pay_Handler_v5_15_12","constructor","args","init_product_page","bind","init_cart_page","init_checkout_page","on_validate_merchant","validate_merchant","on_payment_method_selected","on_shipping_contact_selected","on_shipping_method_selected","on_payment_authorized","process_authorization","on_cancel_payment","reset_payment_request","get_payment_request","gateway_id","gateway_slug","merchant_id","ajax_url","validate_nonce","recalculate_totals_nonce","process_nonce","payment_request","generic_error","wrapper","container","button","is_available","ApplePaySession","canMakePaymentsWithActiveCard","then","canMakePayments","init","children","length","hide","ui_element","show","document","body","on","e","preventDefault","block_ui","session","get_new_session","onvalidatemerchant","event","onpaymentmethodselected","onshippingcontactselected","onshippingmethodselected","onpaymentauthorized","oncancel","begin","error1","fail_payment","parents","get_sdk_version","validationURL","merchant_session","JSON","parse","completeMerchantValidation","response","abort","message","url","Promise","resolve","reject","data","post","success","completePaymentMethodSelection","total","line_items","console","error","lineItems","shippingContact","completeShippingContactSelection","STATUS_SUCCESS","shipping_methods","STATUS_FAILURE","shippingMethod","identifier","completeShippingMethodSelection","payment","set_payment_status","complete_purchase","action","nonce","stringify","unblock_ui","location","redirect","render_errors","status","completePayment","base_data","extend","errors","remove","prepend","join","removeClass","unblock","animate","scrollTop","offset","top","block","overlayCSS","background","opacity","trigger","call"],"version":3,"file":"sv-wc-payment-gateway-apple-pay.js.map"}
\ No newline at end of file
+{"mappings":"ACOG,CAAA,WAEH,OAAO,SAAE,CAAF,EAibN,OA1aM,OAAO,8BAAA,CAAb,MAMC,YAAc,CAAD,CAAA,CAoFb,IAAA,CAAA,iBAAA,CAAA,IAAA,CAAA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-apple-pay.coffee"],"sourcesContent":["(() => {\nvar $83dab3ad15da905a$exports = {};\n(function() {\n /*\n WooCommerce Apple Pay Handler\n Version 4.7.0\n\n Copyright (c) 2016, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n */ jQuery(function($) {\n \"use strict\";\n // The WooCommerce Apple Pay handler base class.\n // @since 4.7.0\n window.SV_WC_Apple_Pay_Handler_v6_0_0 = class SV_WC_Apple_Pay_Handler_v6_0_0 {\n // Constructs the handler.\n // @since 4.7.0\n constructor(args){\n // Initializes the product page.\n // @since 5.6.0\n this.init_product_page = this.init_product_page.bind(this);\n // Initializes the cart page.\n // @since 5.6.0\n this.init_cart_page = this.init_cart_page.bind(this);\n // Initializes the checkout page.\n // @since 5.6.0\n this.init_checkout_page = this.init_checkout_page.bind(this);\n // The callback for after the merchant data is validated.\n // @since 4.7.0\n this.on_validate_merchant = this.on_validate_merchant.bind(this);\n // Validates the merchant data.\n // @since 4.7.0\n // @return object\n this.validate_merchant = this.validate_merchant.bind(this);\n // Fires after a payment method has been selected.\n // @since 4.7.0\n this.on_payment_method_selected = this.on_payment_method_selected.bind(this);\n // Fires after a shipping contact has been selected.\n // @since 4.7.0\n this.on_shipping_contact_selected = this.on_shipping_contact_selected.bind(this);\n // Fires after a shipping method has been selected.\n // @since 4.7.0\n this.on_shipping_method_selected = this.on_shipping_method_selected.bind(this);\n // The callback for after the payment data is authorized.\n // @since 4.7.0\n this.on_payment_authorized = this.on_payment_authorized.bind(this);\n // Processes the transaction data.\n // @since 4.7.0\n this.process_authorization = this.process_authorization.bind(this);\n // The callback for when the payment card is cancelled/dismissed.\n // @since 4.7.0\n this.on_cancel_payment = this.on_cancel_payment.bind(this);\n // Resets the payment request via AJAX.\n // Extending handlers can call this on change events to refresh the data.\n // @since 4.7.0\n this.reset_payment_request = this.reset_payment_request.bind(this);\n // Gets the payment request via AJAX.\n // @since 4.7.0\n this.get_payment_request = this.get_payment_request.bind(this);\n this.gateway_id = args.gateway_id;\n this.gateway_slug = args.gateway_slug;\n this.merchant_id = args.merchant_id;\n this.ajax_url = args.ajax_url;\n this.validate_nonce = args.validate_nonce;\n this.recalculate_totals_nonce = args.recalculate_totals_nonce;\n this.process_nonce = args.process_nonce;\n this.payment_request = args.payment_request;\n this.generic_error = args.generic_error;\n this.wrapper = '.sv-wc-external-checkout';\n this.container = '.buttons-container';\n this.button = '.sv-wc-apple-pay-button';\n }\n // Determines if Apple Pay is available.\n // @since 4.7.0\n // @return bool\n is_available() {\n if (!window.ApplePaySession) return false;\n return ApplePaySession.canMakePaymentsWithActiveCard(this.merchant_id).then((canMakePayments)=>{\n return canMakePayments;\n });\n }\n // Initializes the handler.\n // @since 4.7.0\n init() {\n // hide the wrapper if Apple Pay is the only button\n if ($(this.container).children().length === 1) $(this.wrapper).hide();\n if (!this.is_available()) return;\n // initialize for the various pages\n if ($('form.cart').length) this.init_product_page();\n else if ($('form.woocommerce-cart-form').length) this.init_cart_page();\n else if ($('form.woocommerce-checkout').length) this.init_checkout_page();\n // bail if no UI was initialized\n if (!this.ui_element) return;\n if (this.payment_request) {\n $(this.button).show();\n $(this.wrapper).show();\n }\n return $(document.body).on('click', '.sv-wc-apple-pay-button', (e)=>{\n var error;\n e.preventDefault();\n this.block_ui();\n try {\n this.session = this.get_new_session(this.payment_request);\n // set the payment card events\n this.session.onvalidatemerchant = (event)=>{\n return this.on_validate_merchant(event);\n };\n this.session.onpaymentmethodselected = (event)=>{\n return this.on_payment_method_selected(event);\n };\n this.session.onshippingcontactselected = (event)=>{\n return this.on_shipping_contact_selected(event);\n };\n this.session.onshippingmethodselected = (event)=>{\n return this.on_shipping_method_selected(event);\n };\n this.session.onpaymentauthorized = (event)=>{\n return this.on_payment_authorized(event);\n };\n this.session.oncancel = (event)=>{\n return this.on_cancel_payment(event);\n };\n return this.session.begin();\n } catch (error1) {\n error = error1;\n return this.fail_payment(error);\n }\n });\n }\n init_product_page() {\n return this.ui_element = $('form.cart');\n }\n init_cart_page() {\n this.ui_element = $('form.woocommerce-cart-form').parents('div.woocommerce');\n // re-init if the cart totals are updated\n return $(document.body).on('updated_cart_totals', ()=>{\n return this.reset_payment_request();\n });\n }\n init_checkout_page() {\n this.ui_element = $('form.woocommerce-checkout');\n return $(document.body).on('updated_checkout', ()=>{\n // re-init if the checkout is updated\n return this.reset_payment_request();\n });\n }\n // Gets a new Apple Pay session.\n // @since 5.6.0\n // @param [Object] payment_request payment request object\n // @return ApplePaySession\n get_new_session(payment_request) {\n return new ApplePaySession(this.get_sdk_version(), payment_request);\n }\n // Gets the Apple SDK version to use.\n // @since 5.6.0\n // @return int\n get_sdk_version() {\n return 2;\n }\n on_validate_merchant(event) {\n return this.validate_merchant(event.validationURL).then((merchant_session)=>{\n merchant_session = JSON.parse(merchant_session);\n return this.session.completeMerchantValidation(merchant_session);\n }, (response)=>{\n this.session.abort();\n return this.fail_payment('Merchant could no be validated. ' + response.message);\n });\n }\n validate_merchant(url) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n 'action': `wc_${this.gateway_id}_apple_pay_validate_merchant`,\n 'nonce': this.validate_nonce,\n 'merchant_id': this.merchant_id,\n 'url': url\n };\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) return resolve(response.data);\n else return reject(response.data);\n });\n });\n }\n on_payment_method_selected(event) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n 'action': `wc_${this.gateway_id}_apple_pay_recalculate_totals`,\n 'nonce': this.recalculate_totals_nonce\n };\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) {\n data = response.data;\n return resolve(this.session.completePaymentMethodSelection(data.total, data.line_items));\n } else {\n console.error('[Apple Pay] Error selecting a shipping contact. ' + response.data.message);\n return reject(this.session.completePaymentMethodSelection(this.payment_request.total, this.payment_request.lineItems));\n }\n });\n });\n }\n on_shipping_contact_selected(event) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n 'action': `wc_${this.gateway_id}_apple_pay_recalculate_totals`,\n 'nonce': this.recalculate_totals_nonce,\n 'contact': event.shippingContact\n };\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) {\n data = response.data;\n return resolve(this.session.completeShippingContactSelection(ApplePaySession.STATUS_SUCCESS, data.shipping_methods, data.total, data.line_items));\n } else {\n console.error('[Apple Pay] Error selecting a shipping contact. ' + response.data.message);\n return reject(this.session.completeShippingContactSelection(ApplePaySession.STATUS_FAILURE, [], this.payment_request.total, this.payment_request.lineItems));\n }\n });\n });\n }\n on_shipping_method_selected(event) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n 'action': `wc_${this.gateway_id}_apple_pay_recalculate_totals`,\n 'nonce': this.recalculate_totals_nonce,\n 'method': event.shippingMethod.identifier\n };\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) {\n data = response.data;\n return resolve(this.session.completeShippingMethodSelection(ApplePaySession.STATUS_SUCCESS, data.total, data.line_items));\n } else {\n console.error('[Apple Pay] Error selecting a shipping method. ' + response.data.message);\n return reject(this.session.completeShippingMethodSelection(ApplePaySession.STATUS_FAILURE, this.payment_request.total, this.payment_request.lineItems));\n }\n });\n });\n }\n on_payment_authorized(event) {\n return this.process_authorization(event.payment).then((response)=>{\n this.set_payment_status(true);\n return this.complete_purchase(response);\n }, (response)=>{\n this.set_payment_status(false);\n return this.fail_payment('Payment could no be processed. ' + response.message);\n });\n }\n process_authorization(payment) {\n return new Promise((resolve, reject)=>{\n var data;\n data = {\n action: `wc_${this.gateway_id}_apple_pay_process_payment`,\n nonce: this.process_nonce,\n payment: JSON.stringify(payment)\n };\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) return resolve(response.data);\n else return reject(response.data);\n });\n });\n }\n on_cancel_payment(event) {\n return this.unblock_ui();\n }\n // Completes the purchase based on the gateway result.\n // @since 4.7.0\n complete_purchase(response) {\n return window.location = response.redirect;\n }\n // Fails the purchase based on the gateway result.\n // @since 4.7.0\n fail_payment(error) {\n console.error('[Apple Pay] ' + error);\n this.unblock_ui();\n return this.render_errors([\n this.generic_error\n ]);\n }\n // Sets the Apple Pay payment status depending on the gateway result.\n // @since 4.7.0\n set_payment_status(success) {\n var status;\n if (success) status = ApplePaySession.STATUS_SUCCESS;\n else status = ApplePaySession.STATUS_FAILURE;\n return this.session.completePayment(status);\n }\n reset_payment_request(data = {}) {\n this.block_ui();\n return this.get_payment_request(data).then((response)=>{\n $(this.button).show();\n $(this.wrapper).show();\n this.payment_request = JSON.parse(response);\n return this.unblock_ui();\n }, (response)=>{\n console.error('[Apple Pay] Could not build payment request. ' + response.message);\n $(this.button).hide();\n // hide the wrapper if Apple Pay is the only button\n if ($(this.container).children().length === 1) $(this.wrapper).hide();\n return this.unblock_ui();\n });\n }\n get_payment_request(data) {\n return new Promise((resolve, reject)=>{\n var base_data;\n base_data = {\n 'action': `wc_${this.gateway_id}_apple_pay_get_payment_request`\n };\n $.extend(data, base_data);\n // retrieve a payment request object\n return $.post(this.ajax_url, data, (response)=>{\n if (response.success) return resolve(response.data);\n else return reject(response.data);\n });\n });\n }\n // Renders any new errors and bring them into the viewport.\n // @since 4.7.0\n render_errors(errors) {\n // hide and remove any previous errors\n $('.woocommerce-error, .woocommerce-message').remove();\n // add errors\n this.ui_element.prepend('');\n // unblock UI\n this.ui_element.removeClass('processing').unblock();\n // scroll to top\n return $('html, body').animate({\n scrollTop: this.ui_element.offset().top - 100\n }, 1000);\n }\n // Blocks the payment form UI.\n // @since 4.7.0\n block_ui() {\n return this.ui_element.block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n // Unblocks the payment form UI.\n // @since 4.7.0\n unblock_ui() {\n return this.ui_element.unblock();\n }\n };\n // dispatch loaded event\n return $(document.body).trigger('sv_wc_apple_pay_handler_v6_0_0_loaded');\n });\n}).call($83dab3ad15da905a$exports);\n\n})();\n//# sourceMappingURL=sv-wc-payment-gateway-apple-pay.js.map\n","###\n WooCommerce Apple Pay Handler\n Version 4.7.0\n\n Copyright (c) 2016, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n###\n\njQuery ( $ ) ->\n\n\t\"use strict\"\n\n\t# The WooCommerce Apple Pay handler base class.\n\t#\n\t# @since 4.7.0\n\tclass window.SV_WC_Apple_Pay_Handler_v6_0_0\n\n\n\t\t# Constructs the handler.\n\t\t#\n\t\t# @since 4.7.0\n\t\tconstructor: (args) ->\n\n\t\t\t@gateway_id = args.gateway_id\n\t\t\t@gateway_slug = args.gateway_slug\n\t\t\t@merchant_id = args.merchant_id\n\t\t\t@ajax_url = args.ajax_url\n\t\t\t@validate_nonce = args.validate_nonce\n\t\t\t@recalculate_totals_nonce = args.recalculate_totals_nonce\n\t\t\t@process_nonce = args.process_nonce\n\t\t\t@payment_request = args.payment_request\n\t\t\t@generic_error = args.generic_error\n\n\t\t\t@wrapper = '.sv-wc-external-checkout'\n\t\t\t@container = '.buttons-container'\n\t\t\t@button = '.sv-wc-apple-pay-button'\n\n\n\t\t# Determines if Apple Pay is available.\n\t\t#\n\t\t# @since 4.7.0\n\t\t# @return bool\n\t\tis_available: ->\n\n\t\t\treturn false unless window.ApplePaySession\n\n\t\t\tApplePaySession.canMakePaymentsWithActiveCard( @merchant_id ).then ( canMakePayments ) =>\n\n\t\t\t\treturn canMakePayments\n\n\n\t\t# Initializes the handler.\n\t\t#\n\t\t# @since 4.7.0\n\t\tinit: ->\n\n\t\t\t# hide the wrapper if Apple Pay is the only button\n\t\t\tif $( @container ).children().length is 1\n\t\t\t\t$( @wrapper ).hide()\n\n\t\t\treturn unless this.is_available()\n\n\t\t\t# initialize for the various pages\n\t\t\tif $( 'form.cart' ).length\n\t\t\t\tthis.init_product_page()\n\t\t\telse if $( 'form.woocommerce-cart-form' ).length\n\t\t\t\tthis.init_cart_page()\n\t\t\telse if $( 'form.woocommerce-checkout' ).length\n\t\t\t\tthis.init_checkout_page()\n\n\t\t\t# bail if no UI was initialized\n\t\t\treturn unless @ui_element\n\n\t\t\tif @payment_request\n\t\t\t\t$( @button ).show()\n\t\t\t\t$( @wrapper ).show()\n\n\t\t\t$( document.body ).on 'click', '.sv-wc-apple-pay-button', ( e ) =>\n\n\t\t\t\te.preventDefault()\n\n\t\t\t\tthis.block_ui()\n\n\t\t\t\ttry\n\n\t\t\t\t\t@session = this.get_new_session( @payment_request )\n\n\t\t\t\t\t# set the payment card events\n\t\t\t\t\t@session.onvalidatemerchant = ( event ) => this.on_validate_merchant( event )\n\t\t\t\t\t@session.onpaymentmethodselected = ( event ) => this.on_payment_method_selected( event )\n\t\t\t\t\t@session.onshippingcontactselected = ( event ) => this.on_shipping_contact_selected( event )\n\t\t\t\t\t@session.onshippingmethodselected = ( event ) => this.on_shipping_method_selected( event )\n\t\t\t\t\t@session.onpaymentauthorized = ( event ) => this.on_payment_authorized( event )\n\t\t\t\t\t@session.oncancel = ( event ) => this.on_cancel_payment( event )\n\n\t\t\t\t\t@session.begin()\n\n\t\t\t\tcatch error\n\n\t\t\t\t\tthis.fail_payment( error )\n\n\n\t\t# Initializes the product page.\n\t\t#\n\t\t# @since 5.6.0\n\t\tinit_product_page: =>\n\n\t\t\t@ui_element = $( 'form.cart' )\n\n\n\t\t# Initializes the cart page.\n\t\t#\n\t\t# @since 5.6.0\n\t\tinit_cart_page: =>\n\n\t\t\t@ui_element = $( 'form.woocommerce-cart-form' ).parents( 'div.woocommerce' )\n\n\t\t\t# re-init if the cart totals are updated\n\t\t\t$( document.body ).on 'updated_cart_totals', =>\n\n\t\t\t\tthis.reset_payment_request()\n\n\n\t\t# Initializes the checkout page.\n\t\t#\n\t\t# @since 5.6.0\n\t\tinit_checkout_page: =>\n\n\t\t\t@ui_element = $( 'form.woocommerce-checkout' )\n\n\t\t\t$( document.body ).on 'updated_checkout', =>\n\n\t\t\t\t# re-init if the checkout is updated\n\t\t\t\tthis.reset_payment_request()\n\n\n\t\t# Gets a new Apple Pay session.\n\t\t#\n\t\t# @since 5.6.0\n\t\t#\n\t\t# @param [Object] payment_request payment request object\n\t\t# @return ApplePaySession\n\t\tget_new_session: ( payment_request ) ->\n\n\t\t\treturn new ApplePaySession( this.get_sdk_version(), payment_request )\n\n\n\t\t# Gets the Apple SDK version to use.\n\t\t#\n\t\t# @since 5.6.0\n\t\t# @return int\n\t\tget_sdk_version: ->\n\n\t\t\treturn 2\n\n\n\t\t# The callback for after the merchant data is validated.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_validate_merchant: ( event ) =>\n\n\t\t\tthis.validate_merchant( event.validationURL ).then ( merchant_session ) =>\n\n\t\t\t\tmerchant_session = JSON.parse( merchant_session )\n\n\t\t\t\t@session.completeMerchantValidation( merchant_session )\n\n\t\t\t, ( response ) =>\n\n\t\t\t\t@session.abort()\n\n\t\t\t\tthis.fail_payment 'Merchant could no be validated. ' + response.message\n\n\n\t\t# Validates the merchant data.\n\t\t#\n\t\t# @since 4.7.0\n\t\t# @return object\n\t\tvalidate_merchant: ( url ) => new Promise ( resolve, reject ) =>\n\n\t\t\tdata = {\n\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_validate_merchant\",\n\t\t\t\t'nonce': @validate_nonce,\n\t\t\t\t'merchant_id': @merchant_id,\n\t\t\t\t'url': url\n\t\t\t}\n\n\t\t\t# retrieve a payment request object\n\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\tif response.success\n\t\t\t\t\tresolve response.data\n\t\t\t\telse\n\t\t\t\t\treject response.data\n\n\n\t\t# Fires after a payment method has been selected.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_payment_method_selected: ( event ) =>\n\n\t\t\tnew Promise ( resolve, reject ) =>\n\n\t\t\t\tdata = {\n\t\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_recalculate_totals\",\n\t\t\t\t\t'nonce': @recalculate_totals_nonce,\n\t\t\t\t}\n\n\t\t\t\t# retrieve a payment request object\n\t\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\t\tif response.success\n\n\t\t\t\t\t\tdata = response.data\n\n\t\t\t\t\t\tresolve @session.completePaymentMethodSelection( data.total, data.line_items )\n\n\t\t\t\t\telse\n\n\t\t\t\t\t\tconsole.error '[Apple Pay] Error selecting a shipping contact. ' + response.data.message\n\n\t\t\t\t\t\treject @session.completePaymentMethodSelection( @payment_request.total, @payment_request.lineItems )\n\n\n\t\t# Fires after a shipping contact has been selected.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_shipping_contact_selected: ( event ) =>\n\n\t\t\tnew Promise ( resolve, reject ) =>\n\n\t\t\t\tdata = {\n\t\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_recalculate_totals\",\n\t\t\t\t\t'nonce': @recalculate_totals_nonce,\n\t\t\t\t\t'contact': event.shippingContact\n\t\t\t\t}\n\n\t\t\t\t# retrieve a payment request object\n\t\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\t\tif response.success\n\n\t\t\t\t\t\tdata = response.data\n\n\t\t\t\t\t\tresolve @session.completeShippingContactSelection( ApplePaySession.STATUS_SUCCESS, data.shipping_methods, data.total, data.line_items )\n\n\t\t\t\t\telse\n\n\t\t\t\t\t\tconsole.error '[Apple Pay] Error selecting a shipping contact. ' + response.data.message\n\n\t\t\t\t\t\treject @session.completeShippingContactSelection( ApplePaySession.STATUS_FAILURE, [], @payment_request.total, @payment_request.lineItems )\n\n\n\t\t# Fires after a shipping method has been selected.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_shipping_method_selected: ( event ) =>\n\n\t\t\tnew Promise ( resolve, reject ) =>\n\n\t\t\t\tdata = {\n\t\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_recalculate_totals\",\n\t\t\t\t\t'nonce': @recalculate_totals_nonce,\n\t\t\t\t\t'method': event.shippingMethod.identifier\n\t\t\t\t}\n\n\t\t\t\t# retrieve a payment request object\n\t\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\t\tif response.success\n\n\t\t\t\t\t\tdata = response.data\n\n\t\t\t\t\t\tresolve @session.completeShippingMethodSelection( ApplePaySession.STATUS_SUCCESS, data.total, data.line_items )\n\n\t\t\t\t\telse\n\n\t\t\t\t\t\tconsole.error '[Apple Pay] Error selecting a shipping method. ' + response.data.message\n\n\t\t\t\t\t\treject @session.completeShippingMethodSelection( ApplePaySession.STATUS_FAILURE, @payment_request.total, @payment_request.lineItems )\n\n\n\t\t# The callback for after the payment data is authorized.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_payment_authorized: ( event ) =>\n\n\t\t\tthis.process_authorization( event.payment ).then ( response ) =>\n\n\t\t\t\tthis.set_payment_status( true )\n\n\t\t\t\tthis.complete_purchase( response )\n\n\t\t\t, ( response ) =>\n\n\t\t\t\tthis.set_payment_status( false )\n\n\t\t\t\tthis.fail_payment 'Payment could no be processed. ' + response.message\n\n\n\t\t# Processes the transaction data.\n\t\t#\n\t\t# @since 4.7.0\n\t\tprocess_authorization: ( payment ) => new Promise ( resolve, reject ) =>\n\n\t\t\tdata = {\n\t\t\t\taction: \"wc_#{ @gateway_id }_apple_pay_process_payment\",\n\t\t\t\tnonce: @process_nonce,\n\t\t\t\tpayment: JSON.stringify( payment )\n\t\t\t}\n\n\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\tif response.success\n\t\t\t\t\tresolve response.data\n\t\t\t\telse\n\t\t\t\t\treject response.data\n\n\n\t\t# The callback for when the payment card is cancelled/dismissed.\n\t\t#\n\t\t# @since 4.7.0\n\t\ton_cancel_payment: ( event ) =>\n\n\t\t\tthis.unblock_ui()\n\n\n\t\t# Completes the purchase based on the gateway result.\n\t\t#\n\t\t# @since 4.7.0\n\t\tcomplete_purchase: ( response ) ->\n\n\t\t\twindow.location = response.redirect\n\n\n\t\t# Fails the purchase based on the gateway result.\n\t\t#\n\t\t# @since 4.7.0\n\t\tfail_payment: ( error ) ->\n\n\t\t\tconsole.error '[Apple Pay] ' + error\n\n\t\t\tthis.unblock_ui()\n\n\t\t\tthis.render_errors( [ @generic_error ] )\n\n\n\t\t# Sets the Apple Pay payment status depending on the gateway result.\n\t\t#\n\t\t# @since 4.7.0\n\t\tset_payment_status: ( success ) ->\n\n\t\t\tif success\n\t\t\t\tstatus = ApplePaySession.STATUS_SUCCESS\n\t\t\telse\n\t\t\t\tstatus = ApplePaySession.STATUS_FAILURE\n\n\t\t\t@session.completePayment( status )\n\n\n\t\t# Resets the payment request via AJAX.\n\t\t#\n\t\t# Extending handlers can call this on change events to refresh the data.\n\t\t#\n\t\t# @since 4.7.0\n\t\treset_payment_request: ( data = {} ) =>\n\n\t\t\tthis.block_ui()\n\n\t\t\tthis.get_payment_request( data ).then ( response ) =>\n\n\t\t\t\t$( @button ).show()\n\t\t\t\t$( @wrapper ).show()\n\n\t\t\t\t@payment_request = JSON.parse( response )\n\n\t\t\t\tthis.unblock_ui()\n\n\t\t\t, ( response ) =>\n\n\t\t\t\tconsole.error '[Apple Pay] Could not build payment request. ' + response.message\n\n\t\t\t\t$( @button ).hide()\n\t\t\t\t# hide the wrapper if Apple Pay is the only button\n\t\t\t\tif $( @container ).children().length is 1\n\t\t\t\t\t$( @wrapper ).hide()\n\n\t\t\t\tthis.unblock_ui()\n\n\n\t\t# Gets the payment request via AJAX.\n\t\t#\n\t\t# @since 4.7.0\n\t\tget_payment_request: ( data ) => new Promise ( resolve, reject ) =>\n\n\t\t\tbase_data = {\n\t\t\t\t'action': \"wc_#{ @gateway_id }_apple_pay_get_payment_request\"\n\t\t\t}\n\n\t\t\t$.extend data, base_data\n\n\t\t\t# retrieve a payment request object\n\t\t\t$.post @ajax_url, data, ( response ) =>\n\n\t\t\t\tif response.success\n\t\t\t\t\tresolve response.data\n\t\t\t\telse\n\t\t\t\t\treject response.data\n\n\n\t\t# Renders any new errors and bring them into the viewport.\n\t\t#\n\t\t# @since 4.7.0\n\t\trender_errors: ( errors ) ->\n\n\t\t\t# hide and remove any previous errors\n\t\t\t$( '.woocommerce-error, .woocommerce-message' ).remove()\n\n\t\t\t# add errors\n\t\t\t@ui_element.prepend '- ' + errors.join( '
- ' ) + '
'\n\n\t\t\t# unblock UI\n\t\t\t@ui_element.removeClass( 'processing' ).unblock()\n\n\t\t\t# scroll to top\n\t\t\t$( 'html, body' ).animate( { scrollTop: @ui_element.offset().top - 100 }, 1000 )\n\n\n\t\t# Blocks the payment form UI.\n\t\t#\n\t\t# @since 4.7.0\n\t\tblock_ui: -> @ui_element.block( message: null, overlayCSS: background: '#fff', opacity: 0.6 )\n\n\n\t\t# Unblocks the payment form UI.\n\t\t#\n\t\t# @since 4.7.0\n\t\tunblock_ui: -> @ui_element.unblock()\n\n\n\t# dispatch loaded event\n\t$( document.body ).trigger( 'sv_wc_apple_pay_handler_v6_0_0_loaded' )\n"],"names":["jQuery","$","window","SV_WC_Apple_Pay_Handler_v6_0_0","constructor","args","init_product_page","bind","init_cart_page","init_checkout_page","on_validate_merchant","validate_merchant","on_payment_method_selected","on_shipping_contact_selected","on_shipping_method_selected","on_payment_authorized","process_authorization","on_cancel_payment","reset_payment_request","get_payment_request","gateway_id","gateway_slug","merchant_id","ajax_url","validate_nonce","recalculate_totals_nonce","process_nonce","payment_request","generic_error","wrapper","container","button","is_available","ApplePaySession","canMakePaymentsWithActiveCard","then","canMakePayments","init","children","length","hide","ui_element","show","document","body","on","e","preventDefault","block_ui","session","get_new_session","onvalidatemerchant","event","onpaymentmethodselected","onshippingcontactselected","onshippingmethodselected","onpaymentauthorized","oncancel","begin","error1","fail_payment","parents","get_sdk_version","validationURL","merchant_session","JSON","parse","completeMerchantValidation","response","abort","message","url","Promise","resolve","reject","data","post","success","completePaymentMethodSelection","total","line_items","console","error","lineItems","shippingContact","completeShippingContactSelection","STATUS_SUCCESS","shipping_methods","STATUS_FAILURE","shippingMethod","identifier","completeShippingMethodSelection","payment","set_payment_status","complete_purchase","action","nonce","stringify","unblock_ui","location","redirect","render_errors","status","completePayment","base_data","extend","errors","remove","prepend","join","removeClass","unblock","animate","scrollTop","offset","top","block","overlayCSS","background","opacity","trigger","call"],"version":3,"file":"sv-wc-payment-gateway-apple-pay.js.map"}
\ No newline at end of file
diff --git a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-google-pay.js b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-google-pay.js
index c4400a44a..884345bd2 100644
--- a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-google-pay.js
+++ b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-google-pay.js
@@ -1,2 +1,2 @@
-jQuery(function(e){window.SV_WC_Google_Pay_Handler_v5_15_12=class{constructor(e){let{plugin_id:t,merchant_id:a,merchant_name:o,gateway_id:n,gateway_id_dasherized:s,gateway_merchant_id:i,environment:r,ajax_url:l,recalculate_totals_nonce:c,process_nonce:h,button_style:d,card_types:m,available_countries:g,currency_code:u,needs_shipping:p,generic_error:y}=e;this.gatewayID=n,this.gatewayMerchantID=i,this.merchantID=a,this.merchantName=o,this.environment=r,this.ajaxURL=l,this.recalculateTotalsNonce=c,this.processNonce=h,this.buttonStyle=d,this.availableCountries=g,this.currencyCode=u,this.needsShipping=p,this.genericError=y,e.product_id&&(this.productID=e.product_id),this.baseRequest={apiVersion:2,apiVersionMinor:0};let P={type:"PAYMENT_GATEWAY",parameters:{gateway:t,gatewayMerchantId:this.gatewayMerchantID}};this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:m,billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}},this.cardPaymentMethod=Object.assign({},this.baseCardPaymentMethod,{tokenizationSpecification:P}),this.paymentsClient=null}getGoogleIsReadyToPayRequest(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})}getGooglePaymentDataRequest(e){return this.getGoogleTransactionInfo(t=>{let a=Object.assign({},this.baseRequest);a.allowedPaymentMethods=[this.cardPaymentMethod],a.transactionInfo=t,a.merchantInfo={merchantId:this.merchantID,merchantName:this.merchantName},a.emailRequired=!0,a.callbackIntents=["PAYMENT_AUTHORIZATION"],this.needsShipping&&(a.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"],a.shippingAddressRequired=!0,a.shippingAddressParameters=this.getGoogleShippingAddressParameters(),a.shippingOptionRequired=!0),e(a)})}getGooglePaymentsClient(){if(null===this.paymentsClient){let e={environment:this.environment,merchantInfo:{merchantName:this.merchantName,merchantId:this.merchantID},paymentDataCallbacks:{onPaymentAuthorized:e=>this.onPaymentAuthorized(e)}};this.needsShipping&&(e.paymentDataCallbacks.onPaymentDataChanged=e=>this.onPaymentDataChanged(e)),this.paymentsClient=new google.payments.api.PaymentsClient(e)}return this.paymentsClient}onPaymentAuthorized(e){return this.blockUI(),new Promise((t,a)=>{try{this.processPayment(e,t)}catch(e){a({transactionState:"ERROR",error:{intent:"PAYMENT_AUTHORIZATION",message:"Payment could not be processed",reason:"PAYMENT_DATA_INVALID"}})}this.unblockUI()})}onPaymentDataChanged(e){return this.blockUI(),new Promise((t,a)=>{try{let a=e.shippingAddress,o=e.shippingOptionData,n="";"SHIPPING_OPTION"==e.callbackTrigger&&(n=o.id),this.getUpdatedTotals(a,n,e=>{0==e.newShippingOptionParameters.shippingOptions.length&&(e={error:this.getGoogleUnserviceableAddressError()}),t(e)})}catch(e){this.failPayment("Could not load updated totals or process payment data request update. "+e)}this.unblockUI()})}getGoogleTransactionInfo(t){let a={action:`wc_${this.gatewayID}_google_pay_get_transaction_info`};this.productID&&(a.productID=this.productID),e.post(this.ajaxURL,a,e=>{e.success?t(JSON.parse(e.data)):this.failPayment("Could not build transaction info. "+e.data.message)})}getUpdatedTotals(t,a,o){let n={action:`wc_${this.gatewayID}_google_pay_recalculate_totals`,nonce:this.recalculateTotalsNonce,shippingAddress:t,shippingMethod:a};this.productID&&(n.productID=this.productID),e.post(this.ajaxURL,n,e=>{e.success?o(JSON.parse(e.data)):this.failPayment("Could not recalculate totals. "+e.data.message)})}getGoogleShippingAddressParameters(){return{allowedCountryCodes:this.availableCountries}}getGoogleUnserviceableAddressError(){return{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",message:"Cannot ship to the selected address",intent:"SHIPPING_ADDRESS"}}addGooglePayButton(){let e=this.getGooglePaymentsClient().createButton({onClick:e=>this.onGooglePaymentButtonClicked(e),buttonColor:this.buttonStyle,buttonSizeMode:"fill"});document.getElementById("sv-wc-google-pay-button-container").appendChild(e)}prefetchGooglePaymentData(){this.getGooglePaymentDataRequest(e=>{e.transactionInfo={totalPriceStatus:"NOT_CURRENTLY_KNOWN",currencyCode:this.currencyCode},this.getGooglePaymentsClient().prefetchPaymentData(e)})}processPayment(t,a){let o={action:`wc_${this.gatewayID}_google_pay_process_payment`,nonce:this.processNonce,paymentData:JSON.stringify(t)};return this.productID&&!this.needsShipping&&(o.productID=this.productID),e.post(this.ajaxURL,o,e=>{e.success?(a({transactionState:"SUCCESS"}),window.location=e.data.redirect):(a({transactionState:"ERROR",error:{intent:"SHIPPING_ADDRESS",message:"Invalid data",reason:"PAYMENT_DATA_INVALID"}}),this.failPayment("Payment could not be processed. "+e.data.message))})}onGooglePaymentButtonClicked(e){e.preventDefault(),this.blockUI(),this.getGooglePaymentDataRequest(e=>{let t=this.getGooglePaymentsClient();try{t.loadPaymentData(e)}catch(e){this.failPayment("Could not load payment data. "+e)}this.unblockUI()})}init(){if(e("form.cart").length)this.initProductPage();else if(e("form.woocommerce-cart-form").length)this.initCartPage();else{if(!e("form.woocommerce-checkout").length)return;this.initCheckoutPage()}this.initGooglePay()}initGooglePay(){this.getGooglePaymentsClient().isReadyToPay(this.getGoogleIsReadyToPayRequest()).then(e=>{e.result&&(this.addGooglePayButton(),this.prefetchGooglePaymentData())}).catch(e=>{this.failPayment("Google Pay is not ready. "+e)})}initProductPage(){this.uiElement=e("form.cart")}initCartPage(){this.uiElement=e("form.woocommerce-cart-form").parents("div.woocommerce"),e(document.body).on("updated_cart_totals",()=>{this.initGooglePay()})}initCheckoutPage(){this.uiElement=e("form.woocommerce-checkout")}failPayment(e){console.error("[Google Pay] "+e),this.unblockUI(),this.renderErrors([this.genericError])}renderErrors(t){e(".woocommerce-error, .woocommerce-message").remove(),this.uiElement.prepend('"),this.uiElement.removeClass("processing").unblock(),e("html, body").animate({scrollTop:this.uiElement.offset().top-100},1e3)}blockUI(){this.uiElement.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblockUI(){this.uiElement.unblock()}},e(document.body).trigger("sv_wc_google_pay_handler_v5_15_12_loaded")});
+jQuery(function(e){window.SV_WC_Google_Pay_Handler_v6_0_0=class{constructor(e){let{plugin_id:t,merchant_id:a,merchant_name:o,gateway_id:n,gateway_id_dasherized:s,gateway_merchant_id:i,environment:r,ajax_url:l,recalculate_totals_nonce:c,process_nonce:h,button_style:d,card_types:m,available_countries:g,currency_code:u,needs_shipping:p,generic_error:y}=e;this.gatewayID=n,this.gatewayMerchantID=i,this.merchantID=a,this.merchantName=o,this.environment=r,this.ajaxURL=l,this.recalculateTotalsNonce=c,this.processNonce=h,this.buttonStyle=d,this.availableCountries=g,this.currencyCode=u,this.needsShipping=p,this.genericError=y,e.product_id&&(this.productID=e.product_id),this.baseRequest={apiVersion:2,apiVersionMinor:0};let P={type:"PAYMENT_GATEWAY",parameters:{gateway:t,gatewayMerchantId:this.gatewayMerchantID}};this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:m,billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}},this.cardPaymentMethod=Object.assign({},this.baseCardPaymentMethod,{tokenizationSpecification:P}),this.paymentsClient=null}getGoogleIsReadyToPayRequest(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})}getGooglePaymentDataRequest(e){return this.getGoogleTransactionInfo(t=>{let a=Object.assign({},this.baseRequest);a.allowedPaymentMethods=[this.cardPaymentMethod],a.transactionInfo=t,a.merchantInfo={merchantId:this.merchantID,merchantName:this.merchantName},a.emailRequired=!0,a.callbackIntents=["PAYMENT_AUTHORIZATION"],this.needsShipping&&(a.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"],a.shippingAddressRequired=!0,a.shippingAddressParameters=this.getGoogleShippingAddressParameters(),a.shippingOptionRequired=!0),e(a)})}getGooglePaymentsClient(){if(null===this.paymentsClient){let e={environment:this.environment,merchantInfo:{merchantName:this.merchantName,merchantId:this.merchantID},paymentDataCallbacks:{onPaymentAuthorized:e=>this.onPaymentAuthorized(e)}};this.needsShipping&&(e.paymentDataCallbacks.onPaymentDataChanged=e=>this.onPaymentDataChanged(e)),this.paymentsClient=new google.payments.api.PaymentsClient(e)}return this.paymentsClient}onPaymentAuthorized(e){return this.blockUI(),new Promise((t,a)=>{try{this.processPayment(e,t)}catch(e){a({transactionState:"ERROR",error:{intent:"PAYMENT_AUTHORIZATION",message:"Payment could not be processed",reason:"PAYMENT_DATA_INVALID"}})}this.unblockUI()})}onPaymentDataChanged(e){return this.blockUI(),new Promise((t,a)=>{try{let a=e.shippingAddress,o=e.shippingOptionData,n="";"SHIPPING_OPTION"==e.callbackTrigger&&(n=o.id),this.getUpdatedTotals(a,n,e=>{0==e.newShippingOptionParameters.shippingOptions.length&&(e={error:this.getGoogleUnserviceableAddressError()}),t(e)})}catch(e){this.failPayment("Could not load updated totals or process payment data request update. "+e)}this.unblockUI()})}getGoogleTransactionInfo(t){let a={action:`wc_${this.gatewayID}_google_pay_get_transaction_info`};this.productID&&(a.productID=this.productID),e.post(this.ajaxURL,a,e=>{e.success?t(JSON.parse(e.data)):this.failPayment("Could not build transaction info. "+e.data.message)})}getUpdatedTotals(t,a,o){let n={action:`wc_${this.gatewayID}_google_pay_recalculate_totals`,nonce:this.recalculateTotalsNonce,shippingAddress:t,shippingMethod:a};this.productID&&(n.productID=this.productID),e.post(this.ajaxURL,n,e=>{e.success?o(JSON.parse(e.data)):this.failPayment("Could not recalculate totals. "+e.data.message)})}getGoogleShippingAddressParameters(){return{allowedCountryCodes:this.availableCountries}}getGoogleUnserviceableAddressError(){return{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",message:"Cannot ship to the selected address",intent:"SHIPPING_ADDRESS"}}addGooglePayButton(){let e=this.getGooglePaymentsClient().createButton({onClick:e=>this.onGooglePaymentButtonClicked(e),buttonColor:this.buttonStyle,buttonSizeMode:"fill"});document.getElementById("sv-wc-google-pay-button-container").appendChild(e)}prefetchGooglePaymentData(){this.getGooglePaymentDataRequest(e=>{e.transactionInfo={totalPriceStatus:"NOT_CURRENTLY_KNOWN",currencyCode:this.currencyCode},this.getGooglePaymentsClient().prefetchPaymentData(e)})}processPayment(t,a){let o={action:`wc_${this.gatewayID}_google_pay_process_payment`,nonce:this.processNonce,paymentData:JSON.stringify(t)};return this.productID&&!this.needsShipping&&(o.productID=this.productID),e.post(this.ajaxURL,o,e=>{e.success?(a({transactionState:"SUCCESS"}),window.location=e.data.redirect):(a({transactionState:"ERROR",error:{intent:"SHIPPING_ADDRESS",message:"Invalid data",reason:"PAYMENT_DATA_INVALID"}}),this.failPayment("Payment could not be processed. "+e.data.message))})}onGooglePaymentButtonClicked(e){e.preventDefault(),this.blockUI(),this.getGooglePaymentDataRequest(e=>{let t=this.getGooglePaymentsClient();try{t.loadPaymentData(e)}catch(e){this.failPayment("Could not load payment data. "+e)}this.unblockUI()})}init(){if(e("form.cart").length)this.initProductPage();else if(e("form.woocommerce-cart-form").length)this.initCartPage();else{if(!e("form.woocommerce-checkout").length)return;this.initCheckoutPage()}this.initGooglePay()}initGooglePay(){this.getGooglePaymentsClient().isReadyToPay(this.getGoogleIsReadyToPayRequest()).then(e=>{e.result&&(this.addGooglePayButton(),this.prefetchGooglePaymentData())}).catch(e=>{this.failPayment("Google Pay is not ready. "+e)})}initProductPage(){this.uiElement=e("form.cart")}initCartPage(){this.uiElement=e("form.woocommerce-cart-form").parents("div.woocommerce"),e(document.body).on("updated_cart_totals",()=>{this.initGooglePay()})}initCheckoutPage(){this.uiElement=e("form.woocommerce-checkout")}failPayment(e){console.error("[Google Pay] "+e),this.unblockUI(),this.renderErrors([this.genericError])}renderErrors(t){e(".woocommerce-error, .woocommerce-message").remove(),this.uiElement.prepend('"),this.uiElement.removeClass("processing").unblock(),e("html, body").animate({scrollTop:this.uiElement.offset().top-100},1e3)}blockUI(){this.uiElement.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblockUI(){this.uiElement.unblock()}},e(document.body).trigger("sv_wc_google_pay_handler_v6_0_0_loaded")});
//# sourceMappingURL=sv-wc-payment-gateway-google-pay.js.map
diff --git a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-google-pay.js.map b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-google-pay.js.map
index 22facffad..6e7754bb4 100644
--- a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-google-pay.js.map
+++ b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-google-pay.js.map
@@ -1 +1 @@
-{"mappings":"ACAA,OAAQ,SAAU,CAAC,EAWlB,OAAO,iCAAiC,CAAG,MA0B1C,YAAa,CAAM,CAAG,CAErB,GAAI,CAAA,UACH,CAAS,CAAA,YACT,CAAW,CAAA,cACX,CAAa,CAAA,WACb,CAAU,CAAA,sBACV,CAAqB,CAAA,oBACrB,CAAmB,CAAA,YACnB,CAAW,CAAA,SACX,CAAQ,CAAA,yBACR,CAAwB,CAAA,cACxB,CAAa,CAAA,aACb,CAAY,CAAA,WACZ,CAAU,CAAA,oBACV,CAAmB,CAAA,cACnB,CAAa,CAAA,eACb,CAAc,CAAA,cACd,CAAa,CACb,CAAG,CAEJ,CAAA,IAAI,CAAC,SAAS,CAAgB,EAC9B,IAAI,CAAC,iBAAiB,CAAQ,EAC9B,IAAI,CAAC,UAAU,CAAe,EAC9B,IAAI,CAAC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E,gBAAkB,GAEjC,IAAI,CAAC,SAAS,GAEd,IAAI,CAAC,YAAY,CAAE,CAAE,IAAI,CAAC,YAAY,CAAE,CACzC,CAKA,aAAc,CAAM,CAAG,CAGtB,EAAG,4CAA6C,MAAM,GAGtD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAE,qCAAuC,EAAO,IAAI,CAAE,aAAgB,cAG5F,IAAI,CAAC,SAAS,CAAC,WAAW,CAAE,cAAe,OAAO,GAGlD,EAAG,cAAe,OAAO,CAAE,CAAE,UAAW,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG,CAAG,GAAI,EAAG,IAC9E,CAKA,SAAU,CACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAE,CAAE,QAAS,KAAM,WAAY,CAAE,WAAY,OAAQ,QAAS,EAAI,CAAE,EACzF,CAKA,WAAY,CACX,IAAI,CAAC,SAAS,CAAC,OAAO,EACvB,CACD,EAEA,EAAG,SAAS,IAAI,EAAG,OAAO,CAAE,2CAE7B","sources":["","woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-google-pay.js"],"sourcesContent":["(() => {\njQuery(function($) {\n \"use strict\";\n /**\n\t * Google Pay handler.\n\t *\n\t * @since 5.10.0\n\t *\n\t * @type {SV_WC_Google_Pay_Handler_v5_15_12} object\n\t */ window.SV_WC_Google_Pay_Handler_v5_15_12 = class SV_WC_Google_Pay_Handler_v5_15_12 {\n /**\n\t\t * Handler constructor.\n\t\t *\n\t\t * @since 5.10.0\n\t\t *\n\t\t * @param {Object} params The plugin ID\n\t\t * @param {string} params.plugin_id The plugin ID\n\t\t * @param {string} params.merchant_id The merchant ID\n\t\t * @param {string} params.merchant_name The site name\n\t\t * @param {string} params.gateway_id The gateway ID\n\t\t * @param {string} params.gateway_id_dasherized The gateway ID dasherized\n\t\t * @param {string} params.gateway_merchant_id The gateway merchant ID\n\t\t * @param {string} params.environment The gateway environment (PRODUCTION or TEST)\n\t\t * @param {string} params.ajax_url The AJAX URL\n\t\t * @param {string} params.recalculate_totals_nonce Nonce for the recalculate_totals AJAX action\n\t\t * @param {string} params.process_nonce Nonce for the process AJAX action\n\t\t * @param {string} params.button_style The button style\n\t\t * @param {string[]} params.card_types The supported card types\n\t\t * @param {string[]} params.available_countries Array of two-letter country codes the gateway is available for\n\t\t * @param {string[]} params.currency_code WC configured currency\n\t\t * @param {boolean} params.needs_shipping Whether or not the cart or product needs shipping\n\t\t * @param {string} params.generic_error The generic error message\n\t\t * @param {string} params.product_id The product ID if we are on a Product page\n\t\t */ constructor(params){\n let { plugin_id: plugin_id, merchant_id: merchant_id, merchant_name: merchant_name, gateway_id: gateway_id, gateway_id_dasherized: gateway_id_dasherized, gateway_merchant_id: gateway_merchant_id, environment: environment, ajax_url: ajax_url, recalculate_totals_nonce: recalculate_totals_nonce, process_nonce: process_nonce, button_style: button_style, card_types: card_types, available_countries: available_countries, currency_code: currency_code, needs_shipping: needs_shipping, generic_error: generic_error } = params;\n this.gatewayID = gateway_id;\n this.gatewayMerchantID = gateway_merchant_id;\n this.merchantID = merchant_id;\n this.merchantName = merchant_name;\n this.environment = environment;\n this.ajaxURL = ajax_url;\n this.recalculateTotalsNonce = recalculate_totals_nonce;\n this.processNonce = process_nonce;\n this.buttonStyle = button_style;\n this.availableCountries = available_countries;\n this.currencyCode = currency_code;\n this.needsShipping = needs_shipping;\n this.genericError = generic_error;\n if (params.product_id) this.productID = params.product_id;\n /**\n\t\t\t * Card networks supported by your site and your gateway\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */ const allowedCardNetworks = card_types;\n /**\n\t\t\t * Define the version of the Google Pay API referenced when creating your configuration\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest|apiVersion in PaymentDataRequest}\n\t\t\t */ this.baseRequest = {\n apiVersion: 2,\n apiVersionMinor: 0\n };\n /**\n\t\t\t * Card authentication methods supported by your site and your gateway\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t *\n\t\t\t * @todo confirm your processor supports Android device tokens for your supported card networks\n\t\t\t */ const allowedCardAuthMethods = [\n 'PAN_ONLY',\n 'CRYPTOGRAM_3DS'\n ];\n /**\n\t\t\t * Identify your gateway and your site's gateway merchant identifier\n\t\t\t *\n\t\t\t * The Google Pay API response will return an encrypted payment method capable\n\t\t\t * of being charged by a supported gateway after payer authorization\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#gateway|PaymentMethodTokenizationSpecification}\n\t\t\t */ const tokenizationSpecification = {\n type: 'PAYMENT_GATEWAY',\n parameters: {\n 'gateway': plugin_id,\n 'gatewayMerchantId': this.gatewayMerchantID\n }\n };\n /**\n\t\t\t * Describe your site's support for the CARD payment method and its required fields\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */ this.baseCardPaymentMethod = {\n type: 'CARD',\n parameters: {\n allowedAuthMethods: allowedCardAuthMethods,\n allowedCardNetworks: allowedCardNetworks,\n billingAddressRequired: true,\n billingAddressParameters: {\n format: 'FULL',\n phoneNumberRequired: true\n }\n }\n };\n /**\n\t\t\t * Describe your site's support for the CARD payment method including optional fields\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */ this.cardPaymentMethod = Object.assign({}, this.baseCardPaymentMethod, {\n tokenizationSpecification: tokenizationSpecification\n });\n /**\n\t\t\t * An initialized google.payments.api.PaymentsClient object or null if not yet set\n\t\t\t *\n\t\t\t * @see {@link getGooglePaymentsClient}\n\t\t\t */ this.paymentsClient = null;\n }\n /**\n\t\t * Configure your site's support for payment methods supported by the Google Pay\n\t\t * API.\n\t\t *\n\t\t * Each member of allowedPaymentMethods should contain only the required fields,\n\t\t * allowing reuse of this base request when determining a viewer's ability\n\t\t * to pay and later requesting a supported payment method\n\t\t *\n\t\t * @returns {object} Google Pay API version, payment methods supported by the site\n\t\t */ getGoogleIsReadyToPayRequest() {\n return Object.assign({}, this.baseRequest, {\n allowedPaymentMethods: [\n this.baseCardPaymentMethod\n ]\n });\n }\n /**\n\t\t * Configure support for the Google Pay API\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest|PaymentDataRequest}\n\t\t *\n\t\t * @param {function} resolve callback\n\t\t * @returns {object} PaymentDataRequest fields\n\t\t */ getGooglePaymentDataRequest(resolve) {\n return this.getGoogleTransactionInfo((transactionInfo)=>{\n const paymentDataRequest = Object.assign({}, this.baseRequest);\n paymentDataRequest.allowedPaymentMethods = [\n this.cardPaymentMethod\n ];\n paymentDataRequest.transactionInfo = transactionInfo;\n paymentDataRequest.merchantInfo = {\n merchantId: this.merchantID,\n merchantName: this.merchantName\n };\n paymentDataRequest.emailRequired = true;\n paymentDataRequest.callbackIntents = [\n 'PAYMENT_AUTHORIZATION'\n ];\n if (this.needsShipping) {\n paymentDataRequest.callbackIntents = [\n 'SHIPPING_ADDRESS',\n 'SHIPPING_OPTION',\n 'PAYMENT_AUTHORIZATION'\n ];\n paymentDataRequest.shippingAddressRequired = true;\n paymentDataRequest.shippingAddressParameters = this.getGoogleShippingAddressParameters();\n paymentDataRequest.shippingOptionRequired = true;\n }\n resolve(paymentDataRequest);\n });\n }\n /**\n\t\t * Return an active PaymentsClient or initialize\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/client#PaymentsClient|PaymentsClient constructor}\n\t\t * @returns {google.payments.api.PaymentsClient} Google Pay API client\n\t\t */ getGooglePaymentsClient() {\n if (this.paymentsClient === null) {\n let args = {\n environment: this.environment,\n merchantInfo: {\n merchantName: this.merchantName,\n merchantId: this.merchantID\n },\n paymentDataCallbacks: {\n onPaymentAuthorized: (paymentData)=>this.onPaymentAuthorized(paymentData)\n }\n };\n if (this.needsShipping) args.paymentDataCallbacks.onPaymentDataChanged = (paymentData)=>this.onPaymentDataChanged(paymentData);\n this.paymentsClient = new google.payments.api.PaymentsClient(args);\n }\n return this.paymentsClient;\n }\n /**\n\t\t * Handles payment authorization callback intent.\n\t\t *\n\t\t * @param {object} paymentData response from Google Pay API after a payer approves payment.\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentData|PaymentData object reference}\n\t\t *\n\t\t * @returns Promise<{object}> Promise object to complete or fail the transaction.\n\t\t */ onPaymentAuthorized(paymentData) {\n this.blockUI();\n return new Promise((resolve, reject)=>{\n // handle the response\n try {\n this.processPayment(paymentData, resolve);\n } catch (err) {\n reject({\n transactionState: 'ERROR',\n error: {\n intent: 'PAYMENT_AUTHORIZATION',\n message: 'Payment could not be processed',\n reason: 'PAYMENT_DATA_INVALID'\n }\n });\n }\n this.unblockUI();\n });\n }\n /**\n\t\t * Handles dynamic buy flow shipping address and shipping options callback intents.\n\t\t *\n\t\t * @param {object} intermediatePaymentData response from Google Pay API a shipping address or shipping option is selected in the payment sheet.\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#IntermediatePaymentData|IntermediatePaymentData object reference}\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataRequestUpdate|PaymentDataRequestUpdate}\n\t\t * @returns Promise<{object}> Promise of PaymentDataRequestUpdate object to update the payment sheet.\n\t\t */ onPaymentDataChanged(intermediatePaymentData) {\n this.blockUI();\n return new Promise((resolve, reject)=>{\n try {\n let shippingAddress = intermediatePaymentData.shippingAddress;\n let shippingOptionData = intermediatePaymentData.shippingOptionData;\n let chosenShippingMethod = '';\n if (intermediatePaymentData.callbackTrigger == 'SHIPPING_OPTION') chosenShippingMethod = shippingOptionData.id;\n this.getUpdatedTotals(shippingAddress, chosenShippingMethod, (paymentDataRequestUpdate)=>{\n if (paymentDataRequestUpdate.newShippingOptionParameters.shippingOptions.length == 0) paymentDataRequestUpdate = {\n error: this.getGoogleUnserviceableAddressError()\n };\n resolve(paymentDataRequestUpdate);\n });\n } catch (err) {\n this.failPayment('Could not load updated totals or process payment data request update. ' + err);\n }\n this.unblockUI();\n });\n }\n /**\n\t\t * Provide Google Pay API with a payment amount, currency, and amount status\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#TransactionInfo|TransactionInfo}\n\t\t *\n\t\t * @param {function} resolve callback\n\t\t * @returns {object} transaction info, suitable for use as transactionInfo property of PaymentDataRequest\n\t\t */ getGoogleTransactionInfo(resolve) {\n // get transaction info from cart\n const data = {\n action: `wc_${this.gatewayID}_google_pay_get_transaction_info`\n };\n if (this.productID) data.productID = this.productID;\n $.post(this.ajaxURL, data, (response)=>{\n if (response.success) resolve(JSON.parse(response.data));\n else this.failPayment('Could not build transaction info. ' + response.data.message);\n });\n }\n /**\n\t\t * Get updated totals and shipping options via AJAX for use in the PaymentDataRequest\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataRequestUpdate|PaymentDataRequestUpdate}\n\t\t *\n\t\t * @param {object} shippingAddress shipping address\n\t\t * @param {object} shippingMethod chosen shipping method\n\t\t * @param {function} resolve callback\n\t\t */ getUpdatedTotals(shippingAddress, shippingMethod, resolve) {\n const data = {\n action: `wc_${this.gatewayID}_google_pay_recalculate_totals`,\n 'nonce': this.recalculateTotalsNonce,\n shippingAddress: shippingAddress,\n shippingMethod: shippingMethod\n };\n if (this.productID) data.productID = this.productID;\n $.post(this.ajaxURL, data, (response)=>{\n if (response.success) resolve(JSON.parse(response.data));\n else this.failPayment('Could not recalculate totals. ' + response.data.message);\n });\n }\n /**\n\t\t * Provide Google Pay API with shipping address parameters when using dynamic buy flow.\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#ShippingAddressParameters|ShippingAddressParameters}\n\t\t * @returns {object} shipping address details, suitable for use as shippingAddressParameters property of PaymentDataRequest\n\t\t */ getGoogleShippingAddressParameters() {\n return {\n allowedCountryCodes: this.availableCountries\n };\n }\n /**\n\t\t * Provide Google Pay API with a payment data error.\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataError|PaymentDataError}\n\t\t * @returns {object} payment data error, suitable for use as error property of PaymentDataRequestUpdate\n\t\t */ getGoogleUnserviceableAddressError() {\n return {\n reason: 'SHIPPING_ADDRESS_UNSERVICEABLE',\n message: 'Cannot ship to the selected address',\n intent: 'SHIPPING_ADDRESS'\n };\n }\n /**\n\t\t * Add a Google Pay purchase button alongside an existing checkout button\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions|Button options}\n\t\t * @see {@link https://developers.google.com/pay/api/web/guides/brand-guidelines|Google Pay brand guidelines}\n\t\t */ addGooglePayButton() {\n const paymentsClient = this.getGooglePaymentsClient();\n const button = paymentsClient.createButton({\n onClick: (event)=>this.onGooglePaymentButtonClicked(event),\n buttonColor: this.buttonStyle,\n buttonSizeMode: 'fill'\n });\n document.getElementById('sv-wc-google-pay-button-container').appendChild(button);\n }\n /**\n\t\t * Prefetch payment data to improve performance\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/client#prefetchPaymentData|prefetchPaymentData()}\n\t\t */ prefetchGooglePaymentData() {\n this.getGooglePaymentDataRequest((paymentDataRequest)=>{\n // transactionInfo must be set but does not affect cache\n paymentDataRequest.transactionInfo = {\n totalPriceStatus: 'NOT_CURRENTLY_KNOWN',\n currencyCode: this.currencyCode\n };\n const paymentsClient = this.getGooglePaymentsClient();\n paymentsClient.prefetchPaymentData(paymentDataRequest);\n });\n }\n /**\n\t\t * Process payment data returned by the Google Pay API\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentData|PaymentData object reference}\n\t\t *\n\t\t * @param {object} paymentData response from Google Pay API after user approves payment\n\t\t * @param {function} resolve callback\n\t\t */ processPayment(paymentData, resolve) {\n // pass payment token to your gateway to process payment\n const data = {\n action: `wc_${this.gatewayID}_google_pay_process_payment`,\n nonce: this.processNonce,\n paymentData: JSON.stringify(paymentData)\n };\n if (this.productID && !this.needsShipping) data.productID = this.productID;\n return $.post(this.ajaxURL, data, (response)=>{\n if (response.success) {\n resolve({\n transactionState: 'SUCCESS'\n });\n window.location = response.data.redirect;\n } else {\n resolve({\n transactionState: 'ERROR',\n error: {\n intent: 'SHIPPING_ADDRESS',\n message: 'Invalid data',\n reason: 'PAYMENT_DATA_INVALID'\n }\n });\n this.failPayment('Payment could not be processed. ' + response.data.message);\n }\n });\n }\n /**\n\t\t * Show Google Pay payment sheet when Google Pay payment button is clicked\n\t\t */ onGooglePaymentButtonClicked(event) {\n event.preventDefault();\n this.blockUI();\n this.getGooglePaymentDataRequest((paymentDataRequest)=>{\n const paymentsClient = this.getGooglePaymentsClient();\n try {\n paymentsClient.loadPaymentData(paymentDataRequest);\n } catch (err) {\n this.failPayment('Could not load payment data. ' + err);\n }\n this.unblockUI();\n });\n }\n /**\n\t\t * Initialize Google PaymentsClient after Google-hosted JavaScript has loaded\n\t\t *\n\t\t * Display a Google Pay payment button after confirmation of the viewer's\n\t\t * ability to pay.\n\t\t */ init() {\n // initialize for the various pages\n if ($('form.cart').length) this.initProductPage();\n else if ($('form.woocommerce-cart-form').length) this.initCartPage();\n else if ($('form.woocommerce-checkout').length) this.initCheckoutPage();\n else return;\n this.initGooglePay();\n }\n /**\n\t\t * Initializes Google Pay.\n\t\t */ initGooglePay() {\n const paymentsClient = this.getGooglePaymentsClient();\n paymentsClient.isReadyToPay(this.getGoogleIsReadyToPayRequest()).then((response)=>{\n if (response.result) {\n this.addGooglePayButton();\n // prefetch payment data to improve performance\n this.prefetchGooglePaymentData();\n }\n }).catch((err)=>{\n this.failPayment('Google Pay is not ready. ' + err);\n });\n }\n /**\n\t\t * Initializes the product page.\n\t\t */ initProductPage() {\n this.uiElement = $('form.cart');\n }\n /**\n\t\t * Initializes the cart page.\n\t\t */ initCartPage() {\n this.uiElement = $('form.woocommerce-cart-form').parents('div.woocommerce');\n // re-init if the cart totals are updated\n $(document.body).on('updated_cart_totals', ()=>{\n this.initGooglePay();\n });\n }\n /**\n\t\t * Initializes the checkout page.\n\t\t */ initCheckoutPage() {\n this.uiElement = $('form.woocommerce-checkout');\n }\n /**\n\t\t * Fails the purchase based on the gateway result.\n\t\t */ failPayment(error) {\n console.error('[Google Pay] ' + error);\n this.unblockUI();\n this.renderErrors([\n this.genericError\n ]);\n }\n /**\n\t\t * Renders any new errors and bring them into the viewport.\n \t\t */ renderErrors(errors) {\n // hide and remove any previous errors\n $('.woocommerce-error, .woocommerce-message').remove();\n // add errors\n this.uiElement.prepend('');\n // unblock UI\n this.uiElement.removeClass('processing').unblock();\n // scroll to top\n $('html, body').animate({\n scrollTop: this.uiElement.offset().top - 100\n }, 1000);\n }\n /**\n\t\t * Blocks the payment form UI.\n\t\t */ blockUI() {\n this.uiElement.block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n /**\n\t\t * Unblocks the payment form UI.\n\t\t */ unblockUI() {\n this.uiElement.unblock();\n }\n };\n $(document.body).trigger('sv_wc_google_pay_handler_v5_15_12_loaded');\n});\n\n})();\n//# sourceMappingURL=sv-wc-payment-gateway-google-pay.js.map\n","jQuery( function( $ ) {\n\n\t\"use strict\"\n\n\t/**\n\t * Google Pay handler.\n\t *\n\t * @since 5.10.0\n\t *\n\t * @type {SV_WC_Google_Pay_Handler_v5_15_12} object\n\t */\n\twindow.SV_WC_Google_Pay_Handler_v5_15_12 = class SV_WC_Google_Pay_Handler_v5_15_12 {\n\n\t\t/**\n\t\t * Handler constructor.\n\t\t *\n\t\t * @since 5.10.0\n\t\t *\n\t\t * @param {Object} params The plugin ID\n\t\t * @param {string} params.plugin_id The plugin ID\n\t\t * @param {string} params.merchant_id The merchant ID\n\t\t * @param {string} params.merchant_name The site name\n\t\t * @param {string} params.gateway_id The gateway ID\n\t\t * @param {string} params.gateway_id_dasherized The gateway ID dasherized\n\t\t * @param {string} params.gateway_merchant_id The gateway merchant ID\n\t\t * @param {string} params.environment The gateway environment (PRODUCTION or TEST)\n\t\t * @param {string} params.ajax_url The AJAX URL\n\t\t * @param {string} params.recalculate_totals_nonce Nonce for the recalculate_totals AJAX action\n\t\t * @param {string} params.process_nonce Nonce for the process AJAX action\n\t\t * @param {string} params.button_style The button style\n\t\t * @param {string[]} params.card_types The supported card types\n\t\t * @param {string[]} params.available_countries Array of two-letter country codes the gateway is available for\n\t\t * @param {string[]} params.currency_code WC configured currency\n\t\t * @param {boolean} params.needs_shipping Whether or not the cart or product needs shipping\n\t\t * @param {string} params.generic_error The generic error message\n\t\t * @param {string} params.product_id The product ID if we are on a Product page\n\t\t */\n\t\tconstructor( params ) {\n\n\t\t\tlet {\n\t\t\t\tplugin_id,\n\t\t\t\tmerchant_id,\n\t\t\t\tmerchant_name,\n\t\t\t\tgateway_id,\n\t\t\t\tgateway_id_dasherized,\n\t\t\t\tgateway_merchant_id,\n\t\t\t\tenvironment,\n\t\t\t\tajax_url,\n\t\t\t\trecalculate_totals_nonce,\n\t\t\t\tprocess_nonce,\n\t\t\t\tbutton_style,\n\t\t\t\tcard_types,\n\t\t\t\tavailable_countries,\n\t\t\t\tcurrency_code,\n\t\t\t\tneeds_shipping,\n\t\t\t\tgeneric_error\n\t\t\t} = params;\n\n\t\t\tthis.gatewayID = gateway_id;\n\t\t\tthis.gatewayMerchantID = gateway_merchant_id;\n\t\t\tthis.merchantID = merchant_id;\n\t\t\tthis.merchantName = merchant_name;\n\t\t\tthis.environment = environment;\n\t\t\tthis.ajaxURL = ajax_url;\n\t\t\tthis.recalculateTotalsNonce = recalculate_totals_nonce;\n\t\t\tthis.processNonce = process_nonce;\n\t\t\tthis.buttonStyle = button_style;\n\t\t\tthis.availableCountries = available_countries;\n\t\t\tthis.currencyCode = currency_code;\n\t\t\tthis.needsShipping = needs_shipping;\n\t\t\tthis.genericError = generic_error;\n\n\t\t\tif ( params.product_id ) {\n\t\t\t\tthis.productID = params.product_id;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Card networks supported by your site and your gateway\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */\n\t\t\tconst allowedCardNetworks = card_types;\n\n\t\t\t/**\n\t\t\t * Define the version of the Google Pay API referenced when creating your configuration\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest|apiVersion in PaymentDataRequest}\n\t\t\t */\n\t\t\tthis.baseRequest = {\n\t\t\t\tapiVersion: 2,\n\t\t\t\tapiVersionMinor: 0\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Card authentication methods supported by your site and your gateway\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t *\n\t\t\t * @todo confirm your processor supports Android device tokens for your supported card networks\n\t\t\t */\n\t\t\tconst allowedCardAuthMethods = [ 'PAN_ONLY', 'CRYPTOGRAM_3DS' ];\n\n\t\t\t/**\n\t\t\t * Identify your gateway and your site's gateway merchant identifier\n\t\t\t *\n\t\t\t * The Google Pay API response will return an encrypted payment method capable\n\t\t\t * of being charged by a supported gateway after payer authorization\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#gateway|PaymentMethodTokenizationSpecification}\n\t\t\t */\n\t\t\tconst tokenizationSpecification = {\n\t\t\t\ttype: 'PAYMENT_GATEWAY',\n\t\t\t\tparameters: {\n\t\t\t\t\t'gateway': plugin_id,\n\t\t\t\t\t'gatewayMerchantId': this.gatewayMerchantID\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Describe your site's support for the CARD payment method and its required fields\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */\n\t\t\tthis.baseCardPaymentMethod = {\n\t\t\t\ttype: 'CARD',\n\t\t\t\tparameters: {\n\t\t\t\t\tallowedAuthMethods: allowedCardAuthMethods,\n\t\t\t\t\tallowedCardNetworks: allowedCardNetworks,\n\t\t\t\t\tbillingAddressRequired: true,\n\t\t\t\t\tbillingAddressParameters: {\n\t\t\t\t\t\tformat: 'FULL',\n\t\t\t\t\t\tphoneNumberRequired: true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Describe your site's support for the CARD payment method including optional fields\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */\n\t\t\tthis.cardPaymentMethod = Object.assign(\n\t\t\t\t{},\n\t\t\t\tthis.baseCardPaymentMethod,\n\t\t\t\t{\n\t\t\t\t\ttokenizationSpecification: tokenizationSpecification\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * An initialized google.payments.api.PaymentsClient object or null if not yet set\n\t\t\t *\n\t\t\t * @see {@link getGooglePaymentsClient}\n\t\t\t */\n\t\t\tthis.paymentsClient = null;\n\t\t}\n\n\t\t/**\n\t\t * Configure your site's support for payment methods supported by the Google Pay\n\t\t * API.\n\t\t *\n\t\t * Each member of allowedPaymentMethods should contain only the required fields,\n\t\t * allowing reuse of this base request when determining a viewer's ability\n\t\t * to pay and later requesting a supported payment method\n\t\t *\n\t\t * @returns {object} Google Pay API version, payment methods supported by the site\n\t\t */\n\t\tgetGoogleIsReadyToPayRequest() {\n\n\t\t\treturn Object.assign(\n\t\t\t\t{},\n\t\t\t\tthis.baseRequest,\n\t\t\t\t{\n\t\t\t\t\tallowedPaymentMethods: [ this.baseCardPaymentMethod ]\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Configure support for the Google Pay API\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest|PaymentDataRequest}\n\t\t *\n\t\t * @param {function} resolve callback\n\t\t * @returns {object} PaymentDataRequest fields\n\t\t */\n\t\tgetGooglePaymentDataRequest( resolve ) {\n\n\t\t\treturn this.getGoogleTransactionInfo( ( transactionInfo ) => {\n\n\t\t\t\tconst paymentDataRequest = Object.assign( {}, this.baseRequest );\n\t\t\t\tpaymentDataRequest.allowedPaymentMethods = [ this.cardPaymentMethod ];\n\t\t\t\tpaymentDataRequest.transactionInfo = transactionInfo;\n\t\t\t\tpaymentDataRequest.merchantInfo = {\n\t\t\t\t\tmerchantId: this.merchantID,\n\t\t\t\t\tmerchantName: this.merchantName\n\t\t\t\t};\n\n\t\t\t\tpaymentDataRequest.emailRequired = true;\n\t\t\t\tpaymentDataRequest.callbackIntents = [ 'PAYMENT_AUTHORIZATION' ];\n\n\t\t\t\tif ( this.needsShipping ) {\n\t\t\t\t\tpaymentDataRequest.callbackIntents = [ 'SHIPPING_ADDRESS', 'SHIPPING_OPTION', 'PAYMENT_AUTHORIZATION' ];\n\t\t\t\t\tpaymentDataRequest.shippingAddressRequired = true;\n\t\t\t\t\tpaymentDataRequest.shippingAddressParameters = this.getGoogleShippingAddressParameters();\n\t\t\t\t\tpaymentDataRequest.shippingOptionRequired = true;\n\t\t\t\t}\n\n\t\t\t\tresolve( paymentDataRequest );\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Return an active PaymentsClient or initialize\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/client#PaymentsClient|PaymentsClient constructor}\n\t\t * @returns {google.payments.api.PaymentsClient} Google Pay API client\n\t\t */\n\t\tgetGooglePaymentsClient() {\n\t\t\tif ( this.paymentsClient === null ) {\n\t\t\t\tlet args = {\n\t\t\t\t\tenvironment: this.environment,\n\t\t\t\t\tmerchantInfo: {\n\t\t\t\t\t\tmerchantName: this.merchantName,\n\t\t\t\t\t\tmerchantId: this.merchantID\n\t\t\t\t\t},\n\t\t\t\t\tpaymentDataCallbacks: {\n\t\t\t\t\t\tonPaymentAuthorized: ( paymentData ) => this.onPaymentAuthorized( paymentData ),\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tif ( this.needsShipping ) {\n\t\t\t\t\targs.paymentDataCallbacks.onPaymentDataChanged = ( paymentData ) => this.onPaymentDataChanged( paymentData );\n\t\t\t\t}\n\n\t\t\t\tthis.paymentsClient = new google.payments.api.PaymentsClient( args );\n\t\t\t}\n\t\t\treturn this.paymentsClient;\n\t\t}\n\n\t\t/**\n\t\t * Handles payment authorization callback intent.\n\t\t *\n\t\t * @param {object} paymentData response from Google Pay API after a payer approves payment.\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentData|PaymentData object reference}\n\t\t *\n\t\t * @returns Promise<{object}> Promise object to complete or fail the transaction.\n\t\t */\n\t\tonPaymentAuthorized( paymentData ) {\n\n\t\t\tthis.blockUI();\n\n\t\t\treturn new Promise( (resolve, reject) => {\n\n\t\t\t\t// handle the response\n\t\t\t\ttry {\n\t\t\t\t\tthis.processPayment( paymentData, resolve );\n\t\t\t\t}\tcatch( err ) {\n\t\t\t\t\treject( {\n\t\t\t\t\t\ttransactionState: 'ERROR',\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tintent: 'PAYMENT_AUTHORIZATION',\n\t\t\t\t\t\t\tmessage: 'Payment could not be processed',\n\t\t\t\t\t\t\treason: 'PAYMENT_DATA_INVALID'\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tthis.unblockUI();\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Handles dynamic buy flow shipping address and shipping options callback intents.\n\t\t *\n\t\t * @param {object} intermediatePaymentData response from Google Pay API a shipping address or shipping option is selected in the payment sheet.\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#IntermediatePaymentData|IntermediatePaymentData object reference}\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataRequestUpdate|PaymentDataRequestUpdate}\n\t\t * @returns Promise<{object}> Promise of PaymentDataRequestUpdate object to update the payment sheet.\n\t\t */\n\t\tonPaymentDataChanged( intermediatePaymentData ) {\n\n\t\t\tthis.blockUI();\n\n\t\t\treturn new Promise(( resolve, reject ) => {\n\n\t\t\t\ttry {\n\t\t\t\t\tlet shippingAddress = intermediatePaymentData.shippingAddress;\n\t\t\t\t\tlet shippingOptionData = intermediatePaymentData.shippingOptionData;\n\t\t\t\t\tlet chosenShippingMethod = '';\n\n\t\t\t\t\tif ( intermediatePaymentData.callbackTrigger == 'SHIPPING_OPTION' ) {\n\t\t\t\t\t\tchosenShippingMethod = shippingOptionData.id;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.getUpdatedTotals( shippingAddress, chosenShippingMethod, ( paymentDataRequestUpdate ) => {\n\n\t\t\t\t\t\tif ( paymentDataRequestUpdate.newShippingOptionParameters.shippingOptions.length == 0 ) {\n\t\t\t\t\t\t\tpaymentDataRequestUpdate = {\n\t\t\t\t\t\t\t\terror: this.getGoogleUnserviceableAddressError()\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve( paymentDataRequestUpdate );\n\t\t\t\t\t} );\n\n\t\t\t\t}\tcatch( err ) {\n\t\t\t\t\tthis.failPayment( 'Could not load updated totals or process payment data request update. ' + err );\n\t\t\t\t}\n\n\t\t\t\tthis.unblockUI();\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Provide Google Pay API with a payment amount, currency, and amount status\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#TransactionInfo|TransactionInfo}\n\t\t *\n\t\t * @param {function} resolve callback\n\t\t * @returns {object} transaction info, suitable for use as transactionInfo property of PaymentDataRequest\n\t\t */\n\t\tgetGoogleTransactionInfo( resolve ) {\n\n\t\t\t// get transaction info from cart\n\t\t\tconst data = {\n\t\t\t\taction: `wc_${this.gatewayID}_google_pay_get_transaction_info`,\n\t\t\t}\n\n\t\t\tif ( this.productID ) {\n\t\t\t\tdata.productID = this.productID;\n\t\t\t}\n\n\t\t\t$.post( this.ajaxURL, data, ( response ) => {\n\n\t\t\t\tif ( response.success ) {\n\t\t\t\t\tresolve( JSON.parse( response.data ) )\n\t\t\t\t} else {\n\t\t\t\t\tthis.failPayment( 'Could not build transaction info. ' + response.data.message );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Get updated totals and shipping options via AJAX for use in the PaymentDataRequest\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataRequestUpdate|PaymentDataRequestUpdate}\n\t\t *\n\t\t * @param {object} shippingAddress shipping address\n\t\t * @param {object} shippingMethod chosen shipping method\n\t\t * @param {function} resolve callback\n\t\t */\n\t\tgetUpdatedTotals( shippingAddress, shippingMethod, resolve ) {\n\n\t\t\tconst data = {\n\t\t\t\taction: `wc_${this.gatewayID}_google_pay_recalculate_totals`,\n\t\t\t\t'nonce': this.recalculateTotalsNonce,\n\t\t\t\tshippingAddress,\n\t\t\t\tshippingMethod\n\t\t\t}\n\n\t\t\tif ( this.productID ) {\n\t\t\t\tdata.productID = this.productID;\n\t\t\t}\n\n\t\t\t$.post( this.ajaxURL, data, ( response ) => {\n\n\t\t\t\tif ( response.success ) {\n\t\t\t\t\tresolve( JSON.parse( response.data ) )\n\t\t\t\t} else {\n\t\t\t\t\tthis.failPayment( 'Could not recalculate totals. ' + response.data.message );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Provide Google Pay API with shipping address parameters when using dynamic buy flow.\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#ShippingAddressParameters|ShippingAddressParameters}\n\t\t * @returns {object} shipping address details, suitable for use as shippingAddressParameters property of PaymentDataRequest\n\t\t */\n\t\tgetGoogleShippingAddressParameters() {\n\n\t\t\treturn {\n\t\t\t\tallowedCountryCodes: this.availableCountries\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Provide Google Pay API with a payment data error.\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataError|PaymentDataError}\n\t\t * @returns {object} payment data error, suitable for use as error property of PaymentDataRequestUpdate\n\t\t */\n\t\tgetGoogleUnserviceableAddressError() {\n\t\t\treturn {\n\t\t\t\treason: 'SHIPPING_ADDRESS_UNSERVICEABLE',\n\t\t\t\tmessage: 'Cannot ship to the selected address',\n\t\t\t\tintent: 'SHIPPING_ADDRESS'\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Add a Google Pay purchase button alongside an existing checkout button\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions|Button options}\n\t\t * @see {@link https://developers.google.com/pay/api/web/guides/brand-guidelines|Google Pay brand guidelines}\n\t\t */\n\t\taddGooglePayButton() {\n\n\t\t\tconst paymentsClient = this.getGooglePaymentsClient();\n\t\t\tconst button = paymentsClient.createButton( {\n\t\t\t\tonClick: ( event ) => this.onGooglePaymentButtonClicked( event ),\n\t\t\t\tbuttonColor: this.buttonStyle,\n\t\t\t\tbuttonSizeMode: 'fill'\n\t\t\t} );\n\t\t\tdocument.getElementById( 'sv-wc-google-pay-button-container' ).appendChild( button );\n\t\t}\n\n\t\t/**\n\t\t * Prefetch payment data to improve performance\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/client#prefetchPaymentData|prefetchPaymentData()}\n\t\t */\n\t\tprefetchGooglePaymentData() {\n\n\t\t\tthis.getGooglePaymentDataRequest( ( paymentDataRequest ) => {\n\n\t\t\t\t// transactionInfo must be set but does not affect cache\n\t\t\t\tpaymentDataRequest.transactionInfo = {\n\t\t\t\t\ttotalPriceStatus: 'NOT_CURRENTLY_KNOWN',\n\t\t\t\t\tcurrencyCode: this.currencyCode\n\t\t\t\t};\n\t\t\t\tconst paymentsClient = this.getGooglePaymentsClient();\n\t\t\t\tpaymentsClient.prefetchPaymentData( paymentDataRequest );\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Process payment data returned by the Google Pay API\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentData|PaymentData object reference}\n\t\t *\n\t\t * @param {object} paymentData response from Google Pay API after user approves payment\n\t\t * @param {function} resolve callback\n\t\t */\n\t\tprocessPayment( paymentData, resolve ) {\n\n\t\t\t// pass payment token to your gateway to process payment\n\t\t\tconst data = {\n\t\t\t\taction: `wc_${this.gatewayID}_google_pay_process_payment`,\n\t\t\t\tnonce: this.processNonce,\n\t\t\t\tpaymentData: JSON.stringify( paymentData ),\n\t\t\t}\n\n\t\t\tif ( this.productID && ! this.needsShipping ) {\n\t\t\t\tdata.productID = this.productID;\n\t\t\t}\n\n\t\t\treturn $.post( this.ajaxURL, data, ( response ) => {\n\t\t\t\tif ( response.success ) {\n\t\t\t\t\tresolve( {\n\t\t\t\t\t\ttransactionState: 'SUCCESS'\n\t\t\t\t\t} );\n\t\t\t\t\twindow.location = response.data.redirect;\n\t\t\t\t} else {\n\t\t\t\t\tresolve( {\n\t\t\t\t\t\ttransactionState: 'ERROR',\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tintent: 'SHIPPING_ADDRESS',\n\t\t\t\t\t\t\tmessage: 'Invalid data',\n\t\t\t\t\t\t\treason: 'PAYMENT_DATA_INVALID'\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t\tthis.failPayment( 'Payment could not be processed. ' + response.data.message );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Show Google Pay payment sheet when Google Pay payment button is clicked\n\t\t */\n\t\tonGooglePaymentButtonClicked( event ) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tthis.blockUI();\n\n\t\t\tthis.getGooglePaymentDataRequest( ( paymentDataRequest ) => {\n\n\t\t\t\tconst paymentsClient = this.getGooglePaymentsClient();\n\t\t\t\ttry {\n\t\t\t\t\tpaymentsClient.loadPaymentData( paymentDataRequest );\n\t\t\t\t} catch ( err ) {\n\t\t\t\t\tthis.failPayment( 'Could not load payment data. ' + err );\n\t\t\t\t}\n\n\t\t\t\tthis.unblockUI();\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Initialize Google PaymentsClient after Google-hosted JavaScript has loaded\n\t\t *\n\t\t * Display a Google Pay payment button after confirmation of the viewer's\n\t\t * ability to pay.\n\t\t */\n\t\tinit() {\n\n\t\t\t// initialize for the various pages\n\t\t\tif ( $( 'form.cart' ).length ) {\n\t\t\t\tthis.initProductPage();\n\t\t\t} else if ( $( 'form.woocommerce-cart-form' ).length ) {\n\t\t\t\tthis.initCartPage();\n\t\t\t} else if ( $( 'form.woocommerce-checkout' ).length) {\n\t\t\t\tthis.initCheckoutPage()\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.initGooglePay();\n\t\t}\n\n\t\t/**\n\t\t * Initializes Google Pay.\n\t\t */\n\t\tinitGooglePay() {\n\n\t\t\tconst paymentsClient = this.getGooglePaymentsClient();\n\t\t\tpaymentsClient.isReadyToPay( this.getGoogleIsReadyToPayRequest() )\n\t\t\t\t.then( ( response ) => {\n\t\t\t\t\tif ( response.result ) {\n\t\t\t\t\t\tthis.addGooglePayButton();\n\t\t\t\t\t\t// prefetch payment data to improve performance\n\t\t\t\t\t\tthis.prefetchGooglePaymentData();\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t\t.catch( ( err ) => {\n\t\t\t\t\tthis.failPayment( 'Google Pay is not ready. ' + err );\n\t\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Initializes the product page.\n\t\t */\n\t\tinitProductPage() {\n\t\t\tthis.uiElement = $( 'form.cart' );\n\t\t}\n\n\t\t/**\n\t\t * Initializes the cart page.\n\t\t */\n\t\tinitCartPage() {\n\t\t\tthis.uiElement = $( 'form.woocommerce-cart-form' ).parents( 'div.woocommerce' );\n\n\t\t\t// re-init if the cart totals are updated\n\t\t\t$( document.body ).on( 'updated_cart_totals', () => {\n\t\t\t\tthis.initGooglePay();\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Initializes the checkout page.\n\t\t */\n\t\tinitCheckoutPage() {\n\t\t\tthis.uiElement = $( 'form.woocommerce-checkout' );\n\t\t}\n\n\t\t/**\n\t\t * Fails the purchase based on the gateway result.\n\t\t */\n\t\tfailPayment( error ) {\n\n\t\t\tconsole.error( '[Google Pay] ' + error );\n\n\t\t\tthis.unblockUI();\n\n\t\t\tthis.renderErrors( [ this.genericError ] );\n\t\t}\n\n\t\t/**\n\t\t * Renders any new errors and bring them into the viewport.\n \t\t */\n\t\trenderErrors( errors ) {\n\n\t\t\t// hide and remove any previous errors\n\t\t\t$( '.woocommerce-error, .woocommerce-message' ).remove();\n\n\t\t\t// add errors\n\t\t\tthis.uiElement.prepend( '- ' + errors.join( '
- ' ) + '
' );\n\n\t\t\t// unblock UI\n\t\t\tthis.uiElement.removeClass( 'processing' ).unblock();\n\n\t\t\t// scroll to top\n\t\t\t$( 'html, body' ).animate( { scrollTop: this.uiElement.offset().top - 100 }, 1000 );\n\t\t}\n\n\t\t/**\n\t\t * Blocks the payment form UI.\n\t\t */\n\t\tblockUI() {\n\t\t\tthis.uiElement.block( { message: null, overlayCSS: { background: '#fff', opacity: 0.6 } } );\n\t\t}\n\n\t\t/**\n\t\t * Unblocks the payment form UI.\n\t\t */\n\t\tunblockUI() {\n\t\t\tthis.uiElement.unblock();\n\t\t}\n\t}\n\n\t$( document.body ).trigger( 'sv_wc_google_pay_handler_v5_15_12_loaded' );\n\n} );\n"],"names":["jQuery","$","window","SV_WC_Google_Pay_Handler_v5_15_12","constructor","params","plugin_id","merchant_id","merchant_name","gateway_id","gateway_id_dasherized","gateway_merchant_id","environment","ajax_url","recalculate_totals_nonce","process_nonce","button_style","card_types","available_countries","currency_code","needs_shipping","generic_error","gatewayID","gatewayMerchantID","merchantID","merchantName","ajaxURL","recalculateTotalsNonce","processNonce","buttonStyle","availableCountries","currencyCode","needsShipping","genericError","product_id","productID","baseRequest","apiVersion","apiVersionMinor","tokenizationSpecification","type","parameters","baseCardPaymentMethod","allowedAuthMethods","allowedCardNetworks","billingAddressRequired","billingAddressParameters","format","phoneNumberRequired","cardPaymentMethod","Object","assign","paymentsClient","getGoogleIsReadyToPayRequest","allowedPaymentMethods","getGooglePaymentDataRequest","resolve","getGoogleTransactionInfo","transactionInfo","paymentDataRequest","merchantInfo","merchantId","emailRequired","callbackIntents","shippingAddressRequired","shippingAddressParameters","getGoogleShippingAddressParameters","shippingOptionRequired","getGooglePaymentsClient","args","paymentDataCallbacks","onPaymentAuthorized","paymentData","onPaymentDataChanged","google","payments","api","PaymentsClient","blockUI","Promise","reject","processPayment","err","transactionState","error","intent","message","reason","unblockUI","intermediatePaymentData","shippingAddress","shippingOptionData","chosenShippingMethod","callbackTrigger","id","getUpdatedTotals","paymentDataRequestUpdate","newShippingOptionParameters","shippingOptions","length","getGoogleUnserviceableAddressError","failPayment","data","action","post","response","success","JSON","parse","shippingMethod","allowedCountryCodes","addGooglePayButton","button","createButton","onClick","event","onGooglePaymentButtonClicked","buttonColor","buttonSizeMode","document","getElementById","appendChild","prefetchGooglePaymentData","totalPriceStatus","prefetchPaymentData","nonce","stringify","location","redirect","preventDefault","loadPaymentData","init","initProductPage","initCartPage","initCheckoutPage","initGooglePay","isReadyToPay","then","result","catch","uiElement","parents","body","on","console","renderErrors","errors","remove","prepend","join","removeClass","unblock","animate","scrollTop","offset","top","block","overlayCSS","background","opacity","trigger"],"version":3,"file":"sv-wc-payment-gateway-google-pay.js.map"}
\ No newline at end of file
+{"mappings":"ACAA,OAAQ,SAAU,CAAC,EAWlB,OAAO,+BAA+B,CAAG,MA0BxC,YAAa,CAAM,CAAG,CAErB,GAAI,CAAA,UACH,CAAS,CAAA,YACT,CAAW,CAAA,cACX,CAAa,CAAA,WACb,CAAU,CAAA,sBACV,CAAqB,CAAA,oBACrB,CAAmB,CAAA,YACnB,CAAW,CAAA,SACX,CAAQ,CAAA,yBACR,CAAwB,CAAA,cACxB,CAAa,CAAA,aACb,CAAY,CAAA,WACZ,CAAU,CAAA,oBACV,CA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5D,EAAG,SAAS,IAAI,EAAG,EAAE,CAAE,sBAAuB,KAC7C,IAAI,CAAC,aAAa,EACnB,EACD,CAKA,kBAAmB,CAClB,IAAI,CAAC,SAAS,CAAG,EAAG,4BACrB,CAKA,YAAa,CAAK,CAAG,CAEpB,QAAQ,KAAK,CAAE,gBAAkB,GAEjC,IAAI,CAAC,SAAS,GAEd,IAAI,CAAC,YAAY,CAAE,CAAE,IAAI,CAAC,YAAY,CAAE,CACzC,CAKA,aAAc,CAAM,CAAG,CAGtB,EAAG,4CAA6C,MAAM,GAGtD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAE,qCAAuC,EAAO,IAAI,CAAE,aAAgB,cAG5F,IAAI,CAAC,SAAS,CAAC,WAAW,CAAE,cAAe,OAAO,GAGlD,EAAG,cAAe,OAAO,CAAE,CAAE,UAAW,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG,CAAG,GAAI,EAAG,IAC9E,CAKA,SAAU,CACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAE,CAAE,QAAS,KAAM,WAAY,CAAE,WAAY,OAAQ,QAAS,EAAI,CAAE,EACzF,CAKA,WAAY,CACX,IAAI,CAAC,SAAS,CAAC,OAAO,EACvB,CACD,EAEA,EAAG,SAAS,IAAI,EAAG,OAAO,CAAE,yCAE7B","sources":["","woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-google-pay.js"],"sourcesContent":["(() => {\njQuery(function($) {\n \"use strict\";\n /**\n\t * Google Pay handler.\n\t *\n\t * @since 5.10.0\n\t *\n\t * @type {SV_WC_Google_Pay_Handler_v6_0_0} object\n\t */ window.SV_WC_Google_Pay_Handler_v6_0_0 = class SV_WC_Google_Pay_Handler_v6_0_0 {\n /**\n\t\t * Handler constructor.\n\t\t *\n\t\t * @since 5.10.0\n\t\t *\n\t\t * @param {Object} params The plugin ID\n\t\t * @param {string} params.plugin_id The plugin ID\n\t\t * @param {string} params.merchant_id The merchant ID\n\t\t * @param {string} params.merchant_name The site name\n\t\t * @param {string} params.gateway_id The gateway ID\n\t\t * @param {string} params.gateway_id_dasherized The gateway ID dasherized\n\t\t * @param {string} params.gateway_merchant_id The gateway merchant ID\n\t\t * @param {string} params.environment The gateway environment (PRODUCTION or TEST)\n\t\t * @param {string} params.ajax_url The AJAX URL\n\t\t * @param {string} params.recalculate_totals_nonce Nonce for the recalculate_totals AJAX action\n\t\t * @param {string} params.process_nonce Nonce for the process AJAX action\n\t\t * @param {string} params.button_style The button style\n\t\t * @param {string[]} params.card_types The supported card types\n\t\t * @param {string[]} params.available_countries Array of two-letter country codes the gateway is available for\n\t\t * @param {string[]} params.currency_code WC configured currency\n\t\t * @param {boolean} params.needs_shipping Whether or not the cart or product needs shipping\n\t\t * @param {string} params.generic_error The generic error message\n\t\t * @param {string} params.product_id The product ID if we are on a Product page\n\t\t */ constructor(params){\n let { plugin_id: plugin_id, merchant_id: merchant_id, merchant_name: merchant_name, gateway_id: gateway_id, gateway_id_dasherized: gateway_id_dasherized, gateway_merchant_id: gateway_merchant_id, environment: environment, ajax_url: ajax_url, recalculate_totals_nonce: recalculate_totals_nonce, process_nonce: process_nonce, button_style: button_style, card_types: card_types, available_countries: available_countries, currency_code: currency_code, needs_shipping: needs_shipping, generic_error: generic_error } = params;\n this.gatewayID = gateway_id;\n this.gatewayMerchantID = gateway_merchant_id;\n this.merchantID = merchant_id;\n this.merchantName = merchant_name;\n this.environment = environment;\n this.ajaxURL = ajax_url;\n this.recalculateTotalsNonce = recalculate_totals_nonce;\n this.processNonce = process_nonce;\n this.buttonStyle = button_style;\n this.availableCountries = available_countries;\n this.currencyCode = currency_code;\n this.needsShipping = needs_shipping;\n this.genericError = generic_error;\n if (params.product_id) this.productID = params.product_id;\n /**\n\t\t\t * Card networks supported by your site and your gateway\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */ const allowedCardNetworks = card_types;\n /**\n\t\t\t * Define the version of the Google Pay API referenced when creating your configuration\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest|apiVersion in PaymentDataRequest}\n\t\t\t */ this.baseRequest = {\n apiVersion: 2,\n apiVersionMinor: 0\n };\n /**\n\t\t\t * Card authentication methods supported by your site and your gateway\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t *\n\t\t\t * @todo confirm your processor supports Android device tokens for your supported card networks\n\t\t\t */ const allowedCardAuthMethods = [\n 'PAN_ONLY',\n 'CRYPTOGRAM_3DS'\n ];\n /**\n\t\t\t * Identify your gateway and your site's gateway merchant identifier\n\t\t\t *\n\t\t\t * The Google Pay API response will return an encrypted payment method capable\n\t\t\t * of being charged by a supported gateway after payer authorization\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#gateway|PaymentMethodTokenizationSpecification}\n\t\t\t */ const tokenizationSpecification = {\n type: 'PAYMENT_GATEWAY',\n parameters: {\n 'gateway': plugin_id,\n 'gatewayMerchantId': this.gatewayMerchantID\n }\n };\n /**\n\t\t\t * Describe your site's support for the CARD payment method and its required fields\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */ this.baseCardPaymentMethod = {\n type: 'CARD',\n parameters: {\n allowedAuthMethods: allowedCardAuthMethods,\n allowedCardNetworks: allowedCardNetworks,\n billingAddressRequired: true,\n billingAddressParameters: {\n format: 'FULL',\n phoneNumberRequired: true\n }\n }\n };\n /**\n\t\t\t * Describe your site's support for the CARD payment method including optional fields\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */ this.cardPaymentMethod = Object.assign({}, this.baseCardPaymentMethod, {\n tokenizationSpecification: tokenizationSpecification\n });\n /**\n\t\t\t * An initialized google.payments.api.PaymentsClient object or null if not yet set\n\t\t\t *\n\t\t\t * @see {@link getGooglePaymentsClient}\n\t\t\t */ this.paymentsClient = null;\n }\n /**\n\t\t * Configure your site's support for payment methods supported by the Google Pay\n\t\t * API.\n\t\t *\n\t\t * Each member of allowedPaymentMethods should contain only the required fields,\n\t\t * allowing reuse of this base request when determining a viewer's ability\n\t\t * to pay and later requesting a supported payment method\n\t\t *\n\t\t * @returns {object} Google Pay API version, payment methods supported by the site\n\t\t */ getGoogleIsReadyToPayRequest() {\n return Object.assign({}, this.baseRequest, {\n allowedPaymentMethods: [\n this.baseCardPaymentMethod\n ]\n });\n }\n /**\n\t\t * Configure support for the Google Pay API\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest|PaymentDataRequest}\n\t\t *\n\t\t * @param {function} resolve callback\n\t\t * @returns {object} PaymentDataRequest fields\n\t\t */ getGooglePaymentDataRequest(resolve) {\n return this.getGoogleTransactionInfo((transactionInfo)=>{\n const paymentDataRequest = Object.assign({}, this.baseRequest);\n paymentDataRequest.allowedPaymentMethods = [\n this.cardPaymentMethod\n ];\n paymentDataRequest.transactionInfo = transactionInfo;\n paymentDataRequest.merchantInfo = {\n merchantId: this.merchantID,\n merchantName: this.merchantName\n };\n paymentDataRequest.emailRequired = true;\n paymentDataRequest.callbackIntents = [\n 'PAYMENT_AUTHORIZATION'\n ];\n if (this.needsShipping) {\n paymentDataRequest.callbackIntents = [\n 'SHIPPING_ADDRESS',\n 'SHIPPING_OPTION',\n 'PAYMENT_AUTHORIZATION'\n ];\n paymentDataRequest.shippingAddressRequired = true;\n paymentDataRequest.shippingAddressParameters = this.getGoogleShippingAddressParameters();\n paymentDataRequest.shippingOptionRequired = true;\n }\n resolve(paymentDataRequest);\n });\n }\n /**\n\t\t * Return an active PaymentsClient or initialize\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/client#PaymentsClient|PaymentsClient constructor}\n\t\t * @returns {google.payments.api.PaymentsClient} Google Pay API client\n\t\t */ getGooglePaymentsClient() {\n if (this.paymentsClient === null) {\n let args = {\n environment: this.environment,\n merchantInfo: {\n merchantName: this.merchantName,\n merchantId: this.merchantID\n },\n paymentDataCallbacks: {\n onPaymentAuthorized: (paymentData)=>this.onPaymentAuthorized(paymentData)\n }\n };\n if (this.needsShipping) args.paymentDataCallbacks.onPaymentDataChanged = (paymentData)=>this.onPaymentDataChanged(paymentData);\n this.paymentsClient = new google.payments.api.PaymentsClient(args);\n }\n return this.paymentsClient;\n }\n /**\n\t\t * Handles payment authorization callback intent.\n\t\t *\n\t\t * @param {object} paymentData response from Google Pay API after a payer approves payment.\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentData|PaymentData object reference}\n\t\t *\n\t\t * @returns Promise<{object}> Promise object to complete or fail the transaction.\n\t\t */ onPaymentAuthorized(paymentData) {\n this.blockUI();\n return new Promise((resolve, reject)=>{\n // handle the response\n try {\n this.processPayment(paymentData, resolve);\n } catch (err) {\n reject({\n transactionState: 'ERROR',\n error: {\n intent: 'PAYMENT_AUTHORIZATION',\n message: 'Payment could not be processed',\n reason: 'PAYMENT_DATA_INVALID'\n }\n });\n }\n this.unblockUI();\n });\n }\n /**\n\t\t * Handles dynamic buy flow shipping address and shipping options callback intents.\n\t\t *\n\t\t * @param {object} intermediatePaymentData response from Google Pay API a shipping address or shipping option is selected in the payment sheet.\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#IntermediatePaymentData|IntermediatePaymentData object reference}\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataRequestUpdate|PaymentDataRequestUpdate}\n\t\t * @returns Promise<{object}> Promise of PaymentDataRequestUpdate object to update the payment sheet.\n\t\t */ onPaymentDataChanged(intermediatePaymentData) {\n this.blockUI();\n return new Promise((resolve, reject)=>{\n try {\n let shippingAddress = intermediatePaymentData.shippingAddress;\n let shippingOptionData = intermediatePaymentData.shippingOptionData;\n let chosenShippingMethod = '';\n if (intermediatePaymentData.callbackTrigger == 'SHIPPING_OPTION') chosenShippingMethod = shippingOptionData.id;\n this.getUpdatedTotals(shippingAddress, chosenShippingMethod, (paymentDataRequestUpdate)=>{\n if (paymentDataRequestUpdate.newShippingOptionParameters.shippingOptions.length == 0) paymentDataRequestUpdate = {\n error: this.getGoogleUnserviceableAddressError()\n };\n resolve(paymentDataRequestUpdate);\n });\n } catch (err) {\n this.failPayment('Could not load updated totals or process payment data request update. ' + err);\n }\n this.unblockUI();\n });\n }\n /**\n\t\t * Provide Google Pay API with a payment amount, currency, and amount status\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#TransactionInfo|TransactionInfo}\n\t\t *\n\t\t * @param {function} resolve callback\n\t\t * @returns {object} transaction info, suitable for use as transactionInfo property of PaymentDataRequest\n\t\t */ getGoogleTransactionInfo(resolve) {\n // get transaction info from cart\n const data = {\n action: `wc_${this.gatewayID}_google_pay_get_transaction_info`\n };\n if (this.productID) data.productID = this.productID;\n $.post(this.ajaxURL, data, (response)=>{\n if (response.success) resolve(JSON.parse(response.data));\n else this.failPayment('Could not build transaction info. ' + response.data.message);\n });\n }\n /**\n\t\t * Get updated totals and shipping options via AJAX for use in the PaymentDataRequest\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataRequestUpdate|PaymentDataRequestUpdate}\n\t\t *\n\t\t * @param {object} shippingAddress shipping address\n\t\t * @param {object} shippingMethod chosen shipping method\n\t\t * @param {function} resolve callback\n\t\t */ getUpdatedTotals(shippingAddress, shippingMethod, resolve) {\n const data = {\n action: `wc_${this.gatewayID}_google_pay_recalculate_totals`,\n 'nonce': this.recalculateTotalsNonce,\n shippingAddress: shippingAddress,\n shippingMethod: shippingMethod\n };\n if (this.productID) data.productID = this.productID;\n $.post(this.ajaxURL, data, (response)=>{\n if (response.success) resolve(JSON.parse(response.data));\n else this.failPayment('Could not recalculate totals. ' + response.data.message);\n });\n }\n /**\n\t\t * Provide Google Pay API with shipping address parameters when using dynamic buy flow.\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#ShippingAddressParameters|ShippingAddressParameters}\n\t\t * @returns {object} shipping address details, suitable for use as shippingAddressParameters property of PaymentDataRequest\n\t\t */ getGoogleShippingAddressParameters() {\n return {\n allowedCountryCodes: this.availableCountries\n };\n }\n /**\n\t\t * Provide Google Pay API with a payment data error.\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataError|PaymentDataError}\n\t\t * @returns {object} payment data error, suitable for use as error property of PaymentDataRequestUpdate\n\t\t */ getGoogleUnserviceableAddressError() {\n return {\n reason: 'SHIPPING_ADDRESS_UNSERVICEABLE',\n message: 'Cannot ship to the selected address',\n intent: 'SHIPPING_ADDRESS'\n };\n }\n /**\n\t\t * Add a Google Pay purchase button alongside an existing checkout button\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions|Button options}\n\t\t * @see {@link https://developers.google.com/pay/api/web/guides/brand-guidelines|Google Pay brand guidelines}\n\t\t */ addGooglePayButton() {\n const paymentsClient = this.getGooglePaymentsClient();\n const button = paymentsClient.createButton({\n onClick: (event)=>this.onGooglePaymentButtonClicked(event),\n buttonColor: this.buttonStyle,\n buttonSizeMode: 'fill'\n });\n document.getElementById('sv-wc-google-pay-button-container').appendChild(button);\n }\n /**\n\t\t * Prefetch payment data to improve performance\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/client#prefetchPaymentData|prefetchPaymentData()}\n\t\t */ prefetchGooglePaymentData() {\n this.getGooglePaymentDataRequest((paymentDataRequest)=>{\n // transactionInfo must be set but does not affect cache\n paymentDataRequest.transactionInfo = {\n totalPriceStatus: 'NOT_CURRENTLY_KNOWN',\n currencyCode: this.currencyCode\n };\n const paymentsClient = this.getGooglePaymentsClient();\n paymentsClient.prefetchPaymentData(paymentDataRequest);\n });\n }\n /**\n\t\t * Process payment data returned by the Google Pay API\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentData|PaymentData object reference}\n\t\t *\n\t\t * @param {object} paymentData response from Google Pay API after user approves payment\n\t\t * @param {function} resolve callback\n\t\t */ processPayment(paymentData, resolve) {\n // pass payment token to your gateway to process payment\n const data = {\n action: `wc_${this.gatewayID}_google_pay_process_payment`,\n nonce: this.processNonce,\n paymentData: JSON.stringify(paymentData)\n };\n if (this.productID && !this.needsShipping) data.productID = this.productID;\n return $.post(this.ajaxURL, data, (response)=>{\n if (response.success) {\n resolve({\n transactionState: 'SUCCESS'\n });\n window.location = response.data.redirect;\n } else {\n resolve({\n transactionState: 'ERROR',\n error: {\n intent: 'SHIPPING_ADDRESS',\n message: 'Invalid data',\n reason: 'PAYMENT_DATA_INVALID'\n }\n });\n this.failPayment('Payment could not be processed. ' + response.data.message);\n }\n });\n }\n /**\n\t\t * Show Google Pay payment sheet when Google Pay payment button is clicked\n\t\t */ onGooglePaymentButtonClicked(event) {\n event.preventDefault();\n this.blockUI();\n this.getGooglePaymentDataRequest((paymentDataRequest)=>{\n const paymentsClient = this.getGooglePaymentsClient();\n try {\n paymentsClient.loadPaymentData(paymentDataRequest);\n } catch (err) {\n this.failPayment('Could not load payment data. ' + err);\n }\n this.unblockUI();\n });\n }\n /**\n\t\t * Initialize Google PaymentsClient after Google-hosted JavaScript has loaded\n\t\t *\n\t\t * Display a Google Pay payment button after confirmation of the viewer's\n\t\t * ability to pay.\n\t\t */ init() {\n // initialize for the various pages\n if ($('form.cart').length) this.initProductPage();\n else if ($('form.woocommerce-cart-form').length) this.initCartPage();\n else if ($('form.woocommerce-checkout').length) this.initCheckoutPage();\n else return;\n this.initGooglePay();\n }\n /**\n\t\t * Initializes Google Pay.\n\t\t */ initGooglePay() {\n const paymentsClient = this.getGooglePaymentsClient();\n paymentsClient.isReadyToPay(this.getGoogleIsReadyToPayRequest()).then((response)=>{\n if (response.result) {\n this.addGooglePayButton();\n // prefetch payment data to improve performance\n this.prefetchGooglePaymentData();\n }\n }).catch((err)=>{\n this.failPayment('Google Pay is not ready. ' + err);\n });\n }\n /**\n\t\t * Initializes the product page.\n\t\t */ initProductPage() {\n this.uiElement = $('form.cart');\n }\n /**\n\t\t * Initializes the cart page.\n\t\t */ initCartPage() {\n this.uiElement = $('form.woocommerce-cart-form').parents('div.woocommerce');\n // re-init if the cart totals are updated\n $(document.body).on('updated_cart_totals', ()=>{\n this.initGooglePay();\n });\n }\n /**\n\t\t * Initializes the checkout page.\n\t\t */ initCheckoutPage() {\n this.uiElement = $('form.woocommerce-checkout');\n }\n /**\n\t\t * Fails the purchase based on the gateway result.\n\t\t */ failPayment(error) {\n console.error('[Google Pay] ' + error);\n this.unblockUI();\n this.renderErrors([\n this.genericError\n ]);\n }\n /**\n\t\t * Renders any new errors and bring them into the viewport.\n \t\t */ renderErrors(errors) {\n // hide and remove any previous errors\n $('.woocommerce-error, .woocommerce-message').remove();\n // add errors\n this.uiElement.prepend('');\n // unblock UI\n this.uiElement.removeClass('processing').unblock();\n // scroll to top\n $('html, body').animate({\n scrollTop: this.uiElement.offset().top - 100\n }, 1000);\n }\n /**\n\t\t * Blocks the payment form UI.\n\t\t */ blockUI() {\n this.uiElement.block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n /**\n\t\t * Unblocks the payment form UI.\n\t\t */ unblockUI() {\n this.uiElement.unblock();\n }\n };\n $(document.body).trigger('sv_wc_google_pay_handler_v6_0_0_loaded');\n});\n\n})();\n//# sourceMappingURL=sv-wc-payment-gateway-google-pay.js.map\n","jQuery( function( $ ) {\n\n\t\"use strict\"\n\n\t/**\n\t * Google Pay handler.\n\t *\n\t * @since 5.10.0\n\t *\n\t * @type {SV_WC_Google_Pay_Handler_v6_0_0} object\n\t */\n\twindow.SV_WC_Google_Pay_Handler_v6_0_0 = class SV_WC_Google_Pay_Handler_v6_0_0 {\n\n\t\t/**\n\t\t * Handler constructor.\n\t\t *\n\t\t * @since 5.10.0\n\t\t *\n\t\t * @param {Object} params The plugin ID\n\t\t * @param {string} params.plugin_id The plugin ID\n\t\t * @param {string} params.merchant_id The merchant ID\n\t\t * @param {string} params.merchant_name The site name\n\t\t * @param {string} params.gateway_id The gateway ID\n\t\t * @param {string} params.gateway_id_dasherized The gateway ID dasherized\n\t\t * @param {string} params.gateway_merchant_id The gateway merchant ID\n\t\t * @param {string} params.environment The gateway environment (PRODUCTION or TEST)\n\t\t * @param {string} params.ajax_url The AJAX URL\n\t\t * @param {string} params.recalculate_totals_nonce Nonce for the recalculate_totals AJAX action\n\t\t * @param {string} params.process_nonce Nonce for the process AJAX action\n\t\t * @param {string} params.button_style The button style\n\t\t * @param {string[]} params.card_types The supported card types\n\t\t * @param {string[]} params.available_countries Array of two-letter country codes the gateway is available for\n\t\t * @param {string[]} params.currency_code WC configured currency\n\t\t * @param {boolean} params.needs_shipping Whether or not the cart or product needs shipping\n\t\t * @param {string} params.generic_error The generic error message\n\t\t * @param {string} params.product_id The product ID if we are on a Product page\n\t\t */\n\t\tconstructor( params ) {\n\n\t\t\tlet {\n\t\t\t\tplugin_id,\n\t\t\t\tmerchant_id,\n\t\t\t\tmerchant_name,\n\t\t\t\tgateway_id,\n\t\t\t\tgateway_id_dasherized,\n\t\t\t\tgateway_merchant_id,\n\t\t\t\tenvironment,\n\t\t\t\tajax_url,\n\t\t\t\trecalculate_totals_nonce,\n\t\t\t\tprocess_nonce,\n\t\t\t\tbutton_style,\n\t\t\t\tcard_types,\n\t\t\t\tavailable_countries,\n\t\t\t\tcurrency_code,\n\t\t\t\tneeds_shipping,\n\t\t\t\tgeneric_error\n\t\t\t} = params;\n\n\t\t\tthis.gatewayID = gateway_id;\n\t\t\tthis.gatewayMerchantID = gateway_merchant_id;\n\t\t\tthis.merchantID = merchant_id;\n\t\t\tthis.merchantName = merchant_name;\n\t\t\tthis.environment = environment;\n\t\t\tthis.ajaxURL = ajax_url;\n\t\t\tthis.recalculateTotalsNonce = recalculate_totals_nonce;\n\t\t\tthis.processNonce = process_nonce;\n\t\t\tthis.buttonStyle = button_style;\n\t\t\tthis.availableCountries = available_countries;\n\t\t\tthis.currencyCode = currency_code;\n\t\t\tthis.needsShipping = needs_shipping;\n\t\t\tthis.genericError = generic_error;\n\n\t\t\tif ( params.product_id ) {\n\t\t\t\tthis.productID = params.product_id;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Card networks supported by your site and your gateway\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */\n\t\t\tconst allowedCardNetworks = card_types;\n\n\t\t\t/**\n\t\t\t * Define the version of the Google Pay API referenced when creating your configuration\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest|apiVersion in PaymentDataRequest}\n\t\t\t */\n\t\t\tthis.baseRequest = {\n\t\t\t\tapiVersion: 2,\n\t\t\t\tapiVersionMinor: 0\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Card authentication methods supported by your site and your gateway\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t *\n\t\t\t * @todo confirm your processor supports Android device tokens for your supported card networks\n\t\t\t */\n\t\t\tconst allowedCardAuthMethods = [ 'PAN_ONLY', 'CRYPTOGRAM_3DS' ];\n\n\t\t\t/**\n\t\t\t * Identify your gateway and your site's gateway merchant identifier\n\t\t\t *\n\t\t\t * The Google Pay API response will return an encrypted payment method capable\n\t\t\t * of being charged by a supported gateway after payer authorization\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#gateway|PaymentMethodTokenizationSpecification}\n\t\t\t */\n\t\t\tconst tokenizationSpecification = {\n\t\t\t\ttype: 'PAYMENT_GATEWAY',\n\t\t\t\tparameters: {\n\t\t\t\t\t'gateway': plugin_id,\n\t\t\t\t\t'gatewayMerchantId': this.gatewayMerchantID\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Describe your site's support for the CARD payment method and its required fields\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */\n\t\t\tthis.baseCardPaymentMethod = {\n\t\t\t\ttype: 'CARD',\n\t\t\t\tparameters: {\n\t\t\t\t\tallowedAuthMethods: allowedCardAuthMethods,\n\t\t\t\t\tallowedCardNetworks: allowedCardNetworks,\n\t\t\t\t\tbillingAddressRequired: true,\n\t\t\t\t\tbillingAddressParameters: {\n\t\t\t\t\t\tformat: 'FULL',\n\t\t\t\t\t\tphoneNumberRequired: true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Describe your site's support for the CARD payment method including optional fields\n\t\t\t *\n\t\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#CardParameters|CardParameters}\n\t\t\t */\n\t\t\tthis.cardPaymentMethod = Object.assign(\n\t\t\t\t{},\n\t\t\t\tthis.baseCardPaymentMethod,\n\t\t\t\t{\n\t\t\t\t\ttokenizationSpecification: tokenizationSpecification\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * An initialized google.payments.api.PaymentsClient object or null if not yet set\n\t\t\t *\n\t\t\t * @see {@link getGooglePaymentsClient}\n\t\t\t */\n\t\t\tthis.paymentsClient = null;\n\t\t}\n\n\t\t/**\n\t\t * Configure your site's support for payment methods supported by the Google Pay\n\t\t * API.\n\t\t *\n\t\t * Each member of allowedPaymentMethods should contain only the required fields,\n\t\t * allowing reuse of this base request when determining a viewer's ability\n\t\t * to pay and later requesting a supported payment method\n\t\t *\n\t\t * @returns {object} Google Pay API version, payment methods supported by the site\n\t\t */\n\t\tgetGoogleIsReadyToPayRequest() {\n\n\t\t\treturn Object.assign(\n\t\t\t\t{},\n\t\t\t\tthis.baseRequest,\n\t\t\t\t{\n\t\t\t\t\tallowedPaymentMethods: [ this.baseCardPaymentMethod ]\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Configure support for the Google Pay API\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest|PaymentDataRequest}\n\t\t *\n\t\t * @param {function} resolve callback\n\t\t * @returns {object} PaymentDataRequest fields\n\t\t */\n\t\tgetGooglePaymentDataRequest( resolve ) {\n\n\t\t\treturn this.getGoogleTransactionInfo( ( transactionInfo ) => {\n\n\t\t\t\tconst paymentDataRequest = Object.assign( {}, this.baseRequest );\n\t\t\t\tpaymentDataRequest.allowedPaymentMethods = [ this.cardPaymentMethod ];\n\t\t\t\tpaymentDataRequest.transactionInfo = transactionInfo;\n\t\t\t\tpaymentDataRequest.merchantInfo = {\n\t\t\t\t\tmerchantId: this.merchantID,\n\t\t\t\t\tmerchantName: this.merchantName\n\t\t\t\t};\n\n\t\t\t\tpaymentDataRequest.emailRequired = true;\n\t\t\t\tpaymentDataRequest.callbackIntents = [ 'PAYMENT_AUTHORIZATION' ];\n\n\t\t\t\tif ( this.needsShipping ) {\n\t\t\t\t\tpaymentDataRequest.callbackIntents = [ 'SHIPPING_ADDRESS', 'SHIPPING_OPTION', 'PAYMENT_AUTHORIZATION' ];\n\t\t\t\t\tpaymentDataRequest.shippingAddressRequired = true;\n\t\t\t\t\tpaymentDataRequest.shippingAddressParameters = this.getGoogleShippingAddressParameters();\n\t\t\t\t\tpaymentDataRequest.shippingOptionRequired = true;\n\t\t\t\t}\n\n\t\t\t\tresolve( paymentDataRequest );\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Return an active PaymentsClient or initialize\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/client#PaymentsClient|PaymentsClient constructor}\n\t\t * @returns {google.payments.api.PaymentsClient} Google Pay API client\n\t\t */\n\t\tgetGooglePaymentsClient() {\n\t\t\tif ( this.paymentsClient === null ) {\n\t\t\t\tlet args = {\n\t\t\t\t\tenvironment: this.environment,\n\t\t\t\t\tmerchantInfo: {\n\t\t\t\t\t\tmerchantName: this.merchantName,\n\t\t\t\t\t\tmerchantId: this.merchantID\n\t\t\t\t\t},\n\t\t\t\t\tpaymentDataCallbacks: {\n\t\t\t\t\t\tonPaymentAuthorized: ( paymentData ) => this.onPaymentAuthorized( paymentData ),\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tif ( this.needsShipping ) {\n\t\t\t\t\targs.paymentDataCallbacks.onPaymentDataChanged = ( paymentData ) => this.onPaymentDataChanged( paymentData );\n\t\t\t\t}\n\n\t\t\t\tthis.paymentsClient = new google.payments.api.PaymentsClient( args );\n\t\t\t}\n\t\t\treturn this.paymentsClient;\n\t\t}\n\n\t\t/**\n\t\t * Handles payment authorization callback intent.\n\t\t *\n\t\t * @param {object} paymentData response from Google Pay API after a payer approves payment.\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentData|PaymentData object reference}\n\t\t *\n\t\t * @returns Promise<{object}> Promise object to complete or fail the transaction.\n\t\t */\n\t\tonPaymentAuthorized( paymentData ) {\n\n\t\t\tthis.blockUI();\n\n\t\t\treturn new Promise( (resolve, reject) => {\n\n\t\t\t\t// handle the response\n\t\t\t\ttry {\n\t\t\t\t\tthis.processPayment( paymentData, resolve );\n\t\t\t\t}\tcatch( err ) {\n\t\t\t\t\treject( {\n\t\t\t\t\t\ttransactionState: 'ERROR',\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tintent: 'PAYMENT_AUTHORIZATION',\n\t\t\t\t\t\t\tmessage: 'Payment could not be processed',\n\t\t\t\t\t\t\treason: 'PAYMENT_DATA_INVALID'\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tthis.unblockUI();\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Handles dynamic buy flow shipping address and shipping options callback intents.\n\t\t *\n\t\t * @param {object} intermediatePaymentData response from Google Pay API a shipping address or shipping option is selected in the payment sheet.\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#IntermediatePaymentData|IntermediatePaymentData object reference}\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataRequestUpdate|PaymentDataRequestUpdate}\n\t\t * @returns Promise<{object}> Promise of PaymentDataRequestUpdate object to update the payment sheet.\n\t\t */\n\t\tonPaymentDataChanged( intermediatePaymentData ) {\n\n\t\t\tthis.blockUI();\n\n\t\t\treturn new Promise(( resolve, reject ) => {\n\n\t\t\t\ttry {\n\t\t\t\t\tlet shippingAddress = intermediatePaymentData.shippingAddress;\n\t\t\t\t\tlet shippingOptionData = intermediatePaymentData.shippingOptionData;\n\t\t\t\t\tlet chosenShippingMethod = '';\n\n\t\t\t\t\tif ( intermediatePaymentData.callbackTrigger == 'SHIPPING_OPTION' ) {\n\t\t\t\t\t\tchosenShippingMethod = shippingOptionData.id;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.getUpdatedTotals( shippingAddress, chosenShippingMethod, ( paymentDataRequestUpdate ) => {\n\n\t\t\t\t\t\tif ( paymentDataRequestUpdate.newShippingOptionParameters.shippingOptions.length == 0 ) {\n\t\t\t\t\t\t\tpaymentDataRequestUpdate = {\n\t\t\t\t\t\t\t\terror: this.getGoogleUnserviceableAddressError()\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve( paymentDataRequestUpdate );\n\t\t\t\t\t} );\n\n\t\t\t\t}\tcatch( err ) {\n\t\t\t\t\tthis.failPayment( 'Could not load updated totals or process payment data request update. ' + err );\n\t\t\t\t}\n\n\t\t\t\tthis.unblockUI();\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Provide Google Pay API with a payment amount, currency, and amount status\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#TransactionInfo|TransactionInfo}\n\t\t *\n\t\t * @param {function} resolve callback\n\t\t * @returns {object} transaction info, suitable for use as transactionInfo property of PaymentDataRequest\n\t\t */\n\t\tgetGoogleTransactionInfo( resolve ) {\n\n\t\t\t// get transaction info from cart\n\t\t\tconst data = {\n\t\t\t\taction: `wc_${this.gatewayID}_google_pay_get_transaction_info`,\n\t\t\t}\n\n\t\t\tif ( this.productID ) {\n\t\t\t\tdata.productID = this.productID;\n\t\t\t}\n\n\t\t\t$.post( this.ajaxURL, data, ( response ) => {\n\n\t\t\t\tif ( response.success ) {\n\t\t\t\t\tresolve( JSON.parse( response.data ) )\n\t\t\t\t} else {\n\t\t\t\t\tthis.failPayment( 'Could not build transaction info. ' + response.data.message );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Get updated totals and shipping options via AJAX for use in the PaymentDataRequest\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataRequestUpdate|PaymentDataRequestUpdate}\n\t\t *\n\t\t * @param {object} shippingAddress shipping address\n\t\t * @param {object} shippingMethod chosen shipping method\n\t\t * @param {function} resolve callback\n\t\t */\n\t\tgetUpdatedTotals( shippingAddress, shippingMethod, resolve ) {\n\n\t\t\tconst data = {\n\t\t\t\taction: `wc_${this.gatewayID}_google_pay_recalculate_totals`,\n\t\t\t\t'nonce': this.recalculateTotalsNonce,\n\t\t\t\tshippingAddress,\n\t\t\t\tshippingMethod\n\t\t\t}\n\n\t\t\tif ( this.productID ) {\n\t\t\t\tdata.productID = this.productID;\n\t\t\t}\n\n\t\t\t$.post( this.ajaxURL, data, ( response ) => {\n\n\t\t\t\tif ( response.success ) {\n\t\t\t\t\tresolve( JSON.parse( response.data ) )\n\t\t\t\t} else {\n\t\t\t\t\tthis.failPayment( 'Could not recalculate totals. ' + response.data.message );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Provide Google Pay API with shipping address parameters when using dynamic buy flow.\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#ShippingAddressParameters|ShippingAddressParameters}\n\t\t * @returns {object} shipping address details, suitable for use as shippingAddressParameters property of PaymentDataRequest\n\t\t */\n\t\tgetGoogleShippingAddressParameters() {\n\n\t\t\treturn {\n\t\t\t\tallowedCountryCodes: this.availableCountries\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Provide Google Pay API with a payment data error.\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentDataError|PaymentDataError}\n\t\t * @returns {object} payment data error, suitable for use as error property of PaymentDataRequestUpdate\n\t\t */\n\t\tgetGoogleUnserviceableAddressError() {\n\t\t\treturn {\n\t\t\t\treason: 'SHIPPING_ADDRESS_UNSERVICEABLE',\n\t\t\t\tmessage: 'Cannot ship to the selected address',\n\t\t\t\tintent: 'SHIPPING_ADDRESS'\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Add a Google Pay purchase button alongside an existing checkout button\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions|Button options}\n\t\t * @see {@link https://developers.google.com/pay/api/web/guides/brand-guidelines|Google Pay brand guidelines}\n\t\t */\n\t\taddGooglePayButton() {\n\n\t\t\tconst paymentsClient = this.getGooglePaymentsClient();\n\t\t\tconst button = paymentsClient.createButton( {\n\t\t\t\tonClick: ( event ) => this.onGooglePaymentButtonClicked( event ),\n\t\t\t\tbuttonColor: this.buttonStyle,\n\t\t\t\tbuttonSizeMode: 'fill'\n\t\t\t} );\n\t\t\tdocument.getElementById( 'sv-wc-google-pay-button-container' ).appendChild( button );\n\t\t}\n\n\t\t/**\n\t\t * Prefetch payment data to improve performance\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/client#prefetchPaymentData|prefetchPaymentData()}\n\t\t */\n\t\tprefetchGooglePaymentData() {\n\n\t\t\tthis.getGooglePaymentDataRequest( ( paymentDataRequest ) => {\n\n\t\t\t\t// transactionInfo must be set but does not affect cache\n\t\t\t\tpaymentDataRequest.transactionInfo = {\n\t\t\t\t\ttotalPriceStatus: 'NOT_CURRENTLY_KNOWN',\n\t\t\t\t\tcurrencyCode: this.currencyCode\n\t\t\t\t};\n\t\t\t\tconst paymentsClient = this.getGooglePaymentsClient();\n\t\t\t\tpaymentsClient.prefetchPaymentData( paymentDataRequest );\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Process payment data returned by the Google Pay API\n\t\t *\n\t\t * @see {@link https://developers.google.com/pay/api/web/reference/response-objects#PaymentData|PaymentData object reference}\n\t\t *\n\t\t * @param {object} paymentData response from Google Pay API after user approves payment\n\t\t * @param {function} resolve callback\n\t\t */\n\t\tprocessPayment( paymentData, resolve ) {\n\n\t\t\t// pass payment token to your gateway to process payment\n\t\t\tconst data = {\n\t\t\t\taction: `wc_${this.gatewayID}_google_pay_process_payment`,\n\t\t\t\tnonce: this.processNonce,\n\t\t\t\tpaymentData: JSON.stringify( paymentData ),\n\t\t\t}\n\n\t\t\tif ( this.productID && ! this.needsShipping ) {\n\t\t\t\tdata.productID = this.productID;\n\t\t\t}\n\n\t\t\treturn $.post( this.ajaxURL, data, ( response ) => {\n\t\t\t\tif ( response.success ) {\n\t\t\t\t\tresolve( {\n\t\t\t\t\t\ttransactionState: 'SUCCESS'\n\t\t\t\t\t} );\n\t\t\t\t\twindow.location = response.data.redirect;\n\t\t\t\t} else {\n\t\t\t\t\tresolve( {\n\t\t\t\t\t\ttransactionState: 'ERROR',\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tintent: 'SHIPPING_ADDRESS',\n\t\t\t\t\t\t\tmessage: 'Invalid data',\n\t\t\t\t\t\t\treason: 'PAYMENT_DATA_INVALID'\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t\tthis.failPayment( 'Payment could not be processed. ' + response.data.message );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Show Google Pay payment sheet when Google Pay payment button is clicked\n\t\t */\n\t\tonGooglePaymentButtonClicked( event ) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tthis.blockUI();\n\n\t\t\tthis.getGooglePaymentDataRequest( ( paymentDataRequest ) => {\n\n\t\t\t\tconst paymentsClient = this.getGooglePaymentsClient();\n\t\t\t\ttry {\n\t\t\t\t\tpaymentsClient.loadPaymentData( paymentDataRequest );\n\t\t\t\t} catch ( err ) {\n\t\t\t\t\tthis.failPayment( 'Could not load payment data. ' + err );\n\t\t\t\t}\n\n\t\t\t\tthis.unblockUI();\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Initialize Google PaymentsClient after Google-hosted JavaScript has loaded\n\t\t *\n\t\t * Display a Google Pay payment button after confirmation of the viewer's\n\t\t * ability to pay.\n\t\t */\n\t\tinit() {\n\n\t\t\t// initialize for the various pages\n\t\t\tif ( $( 'form.cart' ).length ) {\n\t\t\t\tthis.initProductPage();\n\t\t\t} else if ( $( 'form.woocommerce-cart-form' ).length ) {\n\t\t\t\tthis.initCartPage();\n\t\t\t} else if ( $( 'form.woocommerce-checkout' ).length) {\n\t\t\t\tthis.initCheckoutPage()\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.initGooglePay();\n\t\t}\n\n\t\t/**\n\t\t * Initializes Google Pay.\n\t\t */\n\t\tinitGooglePay() {\n\n\t\t\tconst paymentsClient = this.getGooglePaymentsClient();\n\t\t\tpaymentsClient.isReadyToPay( this.getGoogleIsReadyToPayRequest() )\n\t\t\t\t.then( ( response ) => {\n\t\t\t\t\tif ( response.result ) {\n\t\t\t\t\t\tthis.addGooglePayButton();\n\t\t\t\t\t\t// prefetch payment data to improve performance\n\t\t\t\t\t\tthis.prefetchGooglePaymentData();\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t\t.catch( ( err ) => {\n\t\t\t\t\tthis.failPayment( 'Google Pay is not ready. ' + err );\n\t\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Initializes the product page.\n\t\t */\n\t\tinitProductPage() {\n\t\t\tthis.uiElement = $( 'form.cart' );\n\t\t}\n\n\t\t/**\n\t\t * Initializes the cart page.\n\t\t */\n\t\tinitCartPage() {\n\t\t\tthis.uiElement = $( 'form.woocommerce-cart-form' ).parents( 'div.woocommerce' );\n\n\t\t\t// re-init if the cart totals are updated\n\t\t\t$( document.body ).on( 'updated_cart_totals', () => {\n\t\t\t\tthis.initGooglePay();\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Initializes the checkout page.\n\t\t */\n\t\tinitCheckoutPage() {\n\t\t\tthis.uiElement = $( 'form.woocommerce-checkout' );\n\t\t}\n\n\t\t/**\n\t\t * Fails the purchase based on the gateway result.\n\t\t */\n\t\tfailPayment( error ) {\n\n\t\t\tconsole.error( '[Google Pay] ' + error );\n\n\t\t\tthis.unblockUI();\n\n\t\t\tthis.renderErrors( [ this.genericError ] );\n\t\t}\n\n\t\t/**\n\t\t * Renders any new errors and bring them into the viewport.\n \t\t */\n\t\trenderErrors( errors ) {\n\n\t\t\t// hide and remove any previous errors\n\t\t\t$( '.woocommerce-error, .woocommerce-message' ).remove();\n\n\t\t\t// add errors\n\t\t\tthis.uiElement.prepend( '- ' + errors.join( '
- ' ) + '
' );\n\n\t\t\t// unblock UI\n\t\t\tthis.uiElement.removeClass( 'processing' ).unblock();\n\n\t\t\t// scroll to top\n\t\t\t$( 'html, body' ).animate( { scrollTop: this.uiElement.offset().top - 100 }, 1000 );\n\t\t}\n\n\t\t/**\n\t\t * Blocks the payment form UI.\n\t\t */\n\t\tblockUI() {\n\t\t\tthis.uiElement.block( { message: null, overlayCSS: { background: '#fff', opacity: 0.6 } } );\n\t\t}\n\n\t\t/**\n\t\t * Unblocks the payment form UI.\n\t\t */\n\t\tunblockUI() {\n\t\t\tthis.uiElement.unblock();\n\t\t}\n\t}\n\n\t$( document.body ).trigger( 'sv_wc_google_pay_handler_v6_0_0_loaded' );\n\n} );\n"],"names":["jQuery","$","window","SV_WC_Google_Pay_Handler_v6_0_0","constructor","params","plugin_id","merchant_id","merchant_name","gateway_id","gateway_id_dasherized","gateway_merchant_id","environment","ajax_url","recalculate_totals_nonce","process_nonce","button_style","card_types","available_countries","currency_code","needs_shipping","generic_error","gatewayID","gatewayMerchantID","merchantID","merchantName","ajaxURL","recalculateTotalsNonce","processNonce","buttonStyle","availableCountries","currencyCode","needsShipping","genericError","product_id","productID","baseRequest","apiVersion","apiVersionMinor","tokenizationSpecification","type","parameters","baseCardPaymentMethod","allowedAuthMethods","allowedCardNetworks","billingAddressRequired","billingAddressParameters","format","phoneNumberRequired","cardPaymentMethod","Object","assign","paymentsClient","getGoogleIsReadyToPayRequest","allowedPaymentMethods","getGooglePaymentDataRequest","resolve","getGoogleTransactionInfo","transactionInfo","paymentDataRequest","merchantInfo","merchantId","emailRequired","callbackIntents","shippingAddressRequired","shippingAddressParameters","getGoogleShippingAddressParameters","shippingOptionRequired","getGooglePaymentsClient","args","paymentDataCallbacks","onPaymentAuthorized","paymentData","onPaymentDataChanged","google","payments","api","PaymentsClient","blockUI","Promise","reject","processPayment","err","transactionState","error","intent","message","reason","unblockUI","intermediatePaymentData","shippingAddress","shippingOptionData","chosenShippingMethod","callbackTrigger","id","getUpdatedTotals","paymentDataRequestUpdate","newShippingOptionParameters","shippingOptions","length","getGoogleUnserviceableAddressError","failPayment","data","action","post","response","success","JSON","parse","shippingMethod","allowedCountryCodes","addGooglePayButton","button","createButton","onClick","event","onGooglePaymentButtonClicked","buttonColor","buttonSizeMode","document","getElementById","appendChild","prefetchGooglePaymentData","totalPriceStatus","prefetchPaymentData","nonce","stringify","location","redirect","preventDefault","loadPaymentData","init","initProductPage","initCartPage","initCheckoutPage","initGooglePay","isReadyToPay","then","result","catch","uiElement","parents","body","on","console","renderErrors","errors","remove","prepend","join","removeClass","unblock","animate","scrollTop","offset","top","block","overlayCSS","background","opacity","trigger"],"version":3,"file":"sv-wc-payment-gateway-google-pay.js.map"}
\ No newline at end of file
diff --git a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-my-payment-methods.js b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-my-payment-methods.js
index 21257bbb5..3a1e4f6fb 100644
--- a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-my-payment-methods.js
+++ b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-my-payment-methods.js
@@ -1,2 +1,2 @@
-(function(){jQuery(function(e){return window.SV_WC_Payment_Methods_Handler_v5_15_12=class{constructor(t){this.replace_method_column=this.replace_method_column.bind(this),this.remove_duplicate_default_marks=this.remove_duplicate_default_marks.bind(this),this.edit_method=this.edit_method.bind(this),this.save_method=this.save_method.bind(this),this.cancel_edit=this.cancel_edit.bind(this),this.id=t.id,this.slug=t.slug,this.i18n=t.i18n,this.ajax_url=t.ajax_url,this.ajax_nonce=t.ajax_nonce,this.replace_method_column(),this.remove_duplicate_default_marks(),e(".woocommerce-MyAccount-paymentMethods").on("click",".woocommerce-PaymentMethod--actions .button.edit",e=>this.edit_method(e)),e(".woocommerce-MyAccount-paymentMethods").on("click",".woocommerce-PaymentMethod--actions .button.save",e=>this.save_method(e)),e(".woocommerce-MyAccount-paymentMethods").on("click",".woocommerce-PaymentMethod--actions .cancel-edit",e=>this.cancel_edit(e)),e(".woocommerce-MyAccount-paymentMethods").on("click",".woocommerce-PaymentMethod--actions .button.delete",t=>{var n;if(0!==(n=e(t.currentTarget)).parents("tr").find(`input[name=plugin-id][value=${this.slug}]`).length&&!confirm(this.i18n.delete_ays))return n.prop("disabled",!1).removeClass("disabled"),t.preventDefault()}),e('.button[href*="add-payment-method"]').on("click",event(function(){if(e(this).hasClass("disabled"))return event.preventDefault()}))}replace_method_column(){return e(".woocommerce-MyAccount-paymentMethods").find("tr").each((t,n)=>{var i;if(0!==e(n).find(`input[name=plugin-id][value=${this.slug}]`).length)return e(n).find("th.woocommerce-PaymentMethod--title").remove(),(i=e(n).find("td.woocommerce-PaymentMethod--title")).children().length>0&&e(n).find("td.woocommerce-PaymentMethod--method").html(i.html()),e(n).find("td.woocommerce-PaymentMethod--title").remove()})}remove_duplicate_default_marks(){return e(".woocommerce-MyAccount-paymentMethods").find("tr").each((t,n)=>e(n).find("td.woocommerce-PaymentMethod--default").find("mark.default:not(:first-child)").remove())}edit_method(t){var n,i;if(t.preventDefault(),0!==(i=(n=e(t.currentTarget)).parents("tr")).find(`input[name=plugin-id][value=${this.slug}]`).length)return i.find("div.view").hide(),i.find("div.edit").show(),i.addClass("editing"),n.text(this.i18n.cancel_button).removeClass("edit").addClass("cancel-edit").removeClass("button"),this.enable_editing_ui()}save_method(t){var n,i,o;if(t.preventDefault(),0!==(o=(n=e(t.currentTarget)).parents("tr")).find(`input[name=plugin-id][value=${this.slug}]`).length)return this.block_ui(),o.next(".error").remove(),i={action:`wc_${this.id}_save_payment_method`,nonce:this.ajax_nonce,token_id:o.find("input[name=token-id]").val(),data:o.find("input[name]").serialize()},e.post(this.ajax_url,i).done(e=>e.success?(null!=e.data.title&&o.find(".woocommerce-PaymentMethod--method").html(e.data.title),null!=e.data.nonce&&(this.ajax_nonce=e.data.nonce),n.siblings(".cancel-edit").removeClass("cancel-edit").addClass("edit").text(this.i18n.edit_button).addClass("button"),o.removeClass("editing"),this.disable_editing_ui()):this.display_error(o,e.data)).fail((e,t,n)=>this.display_error(o,n)).always(()=>this.unblock_ui())}cancel_edit(t){var n,i;if(t.preventDefault(),0!==(i=(n=e(t.currentTarget)).parents("tr")).find(`input[name=plugin-id][value=${this.slug}]`).length)return i.find("div.view").show(),i.find("div.edit").hide(),i.removeClass("editing"),n.removeClass("cancel-edit").addClass("edit").text(this.i18n.edit_button).addClass("button"),this.disable_editing_ui()}enable_editing_ui(){return e(".woocommerce-MyAccount-paymentMethods").addClass("editing"),e('.button[href*="add-payment-method"]').addClass("disabled")}disable_editing_ui(){return e(".woocommerce-MyAccount-paymentMethods").removeClass("editing"),e('.button[href*="add-payment-method"]').removeClass("disabled")}block_ui(){return e(".woocommerce-MyAccount-paymentMethods").parent("div").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblock_ui(){return e(".woocommerce-MyAccount-paymentMethods").parent("div").unblock()}display_error(t,n,i=""){var o;return console.error(n),i||(i=this.i18n.save_error),o=e(".woocommerce-MyAccount-paymentMethods thead tr th").length,e('| '+i+" |
").insertAfter(t).find("td").delay(8e3).slideUp(200)}},e(document.body).trigger("sv_wc_payment_methods_handler_v5_15_12_loaded")})}).call({});
+(function(){jQuery(function(e){return window.SV_WC_Payment_Methods_Handler_v6_0_0=class{constructor(t){this.replace_method_column=this.replace_method_column.bind(this),this.remove_duplicate_default_marks=this.remove_duplicate_default_marks.bind(this),this.edit_method=this.edit_method.bind(this),this.save_method=this.save_method.bind(this),this.cancel_edit=this.cancel_edit.bind(this),this.id=t.id,this.slug=t.slug,this.i18n=t.i18n,this.ajax_url=t.ajax_url,this.ajax_nonce=t.ajax_nonce,this.replace_method_column(),this.remove_duplicate_default_marks(),e(".woocommerce-MyAccount-paymentMethods").on("click",".woocommerce-PaymentMethod--actions .button.edit",e=>this.edit_method(e)),e(".woocommerce-MyAccount-paymentMethods").on("click",".woocommerce-PaymentMethod--actions .button.save",e=>this.save_method(e)),e(".woocommerce-MyAccount-paymentMethods").on("click",".woocommerce-PaymentMethod--actions .cancel-edit",e=>this.cancel_edit(e)),e(".woocommerce-MyAccount-paymentMethods").on("click",".woocommerce-PaymentMethod--actions .button.delete",t=>{var n;if(0!==(n=e(t.currentTarget)).parents("tr").find(`input[name=plugin-id][value=${this.slug}]`).length&&!confirm(this.i18n.delete_ays))return n.prop("disabled",!1).removeClass("disabled"),t.preventDefault()}),e('.button[href*="add-payment-method"]').on("click",event(function(){if(e(this).hasClass("disabled"))return event.preventDefault()}))}replace_method_column(){return e(".woocommerce-MyAccount-paymentMethods").find("tr").each((t,n)=>{var i;if(0!==e(n).find(`input[name=plugin-id][value=${this.slug}]`).length)return e(n).find("th.woocommerce-PaymentMethod--title").remove(),(i=e(n).find("td.woocommerce-PaymentMethod--title")).children().length>0&&e(n).find("td.woocommerce-PaymentMethod--method").html(i.html()),e(n).find("td.woocommerce-PaymentMethod--title").remove()})}remove_duplicate_default_marks(){return e(".woocommerce-MyAccount-paymentMethods").find("tr").each((t,n)=>e(n).find("td.woocommerce-PaymentMethod--default").find("mark.default:not(:first-child)").remove())}edit_method(t){var n,i;if(t.preventDefault(),0!==(i=(n=e(t.currentTarget)).parents("tr")).find(`input[name=plugin-id][value=${this.slug}]`).length)return i.find("div.view").hide(),i.find("div.edit").show(),i.addClass("editing"),n.text(this.i18n.cancel_button).removeClass("edit").addClass("cancel-edit").removeClass("button"),this.enable_editing_ui()}save_method(t){var n,i,o;if(t.preventDefault(),0!==(o=(n=e(t.currentTarget)).parents("tr")).find(`input[name=plugin-id][value=${this.slug}]`).length)return this.block_ui(),o.next(".error").remove(),i={action:`wc_${this.id}_save_payment_method`,nonce:this.ajax_nonce,token_id:o.find("input[name=token-id]").val(),data:o.find("input[name]").serialize()},e.post(this.ajax_url,i).done(e=>e.success?(null!=e.data.title&&o.find(".woocommerce-PaymentMethod--method").html(e.data.title),null!=e.data.nonce&&(this.ajax_nonce=e.data.nonce),n.siblings(".cancel-edit").removeClass("cancel-edit").addClass("edit").text(this.i18n.edit_button).addClass("button"),o.removeClass("editing"),this.disable_editing_ui()):this.display_error(o,e.data)).fail((e,t,n)=>this.display_error(o,n)).always(()=>this.unblock_ui())}cancel_edit(t){var n,i;if(t.preventDefault(),0!==(i=(n=e(t.currentTarget)).parents("tr")).find(`input[name=plugin-id][value=${this.slug}]`).length)return i.find("div.view").show(),i.find("div.edit").hide(),i.removeClass("editing"),n.removeClass("cancel-edit").addClass("edit").text(this.i18n.edit_button).addClass("button"),this.disable_editing_ui()}enable_editing_ui(){return e(".woocommerce-MyAccount-paymentMethods").addClass("editing"),e('.button[href*="add-payment-method"]').addClass("disabled")}disable_editing_ui(){return e(".woocommerce-MyAccount-paymentMethods").removeClass("editing"),e('.button[href*="add-payment-method"]').removeClass("disabled")}block_ui(){return e(".woocommerce-MyAccount-paymentMethods").parent("div").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblock_ui(){return e(".woocommerce-MyAccount-paymentMethods").parent("div").unblock()}display_error(t,n,i=""){var o;return console.error(n),i||(i=this.i18n.save_error),o=e(".woocommerce-MyAccount-paymentMethods thead tr th").length,e('| '+i+" |
").insertAfter(t).find("td").delay(8e3).slideUp(200)}},e(document.body).trigger("sv_wc_payment_methods_handler_v6_0_0_loaded")})}).call({});
//# sourceMappingURL=sv-wc-payment-gateway-my-payment-methods.js.map
diff --git a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-my-payment-methods.js.map b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-my-payment-methods.js.map
index 12bdf4f74..fcf330175 100644
--- a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-my-payment-methods.js.map
+++ b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-my-payment-methods.js.map
@@ -1 +1 @@
-{"mappings":"ACOG,CAAA,WACH,OAAO,SAAE,CAAF,EA0QN,OApQM,OAAO,sCAAA,CAAb,MAaC,YAAe,CAAF,CAAA,CAgDb,IAAA,CAAA,qBAAA,CAAA,IAAA,CAAA,qBAAA,CAAA,IAAA,CAAA,IAAA,EA4BA,IAAA,CAAA,8BAAA,CAAA,IAAA,CAAA,8BAAA,CAAA,IAAA,CAAA,IAAA,EAYA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,IAAA,EA0BA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,IAAA,EAuDA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,IAAA,EAvKC,IAAC,CAAA,EAAD,CAAc,EAAK,EAAnB,CACA,IAAC,CAAA,IAAD,CAAc,EAAK,IAAnB,CACA,IAAC,CAAA,IAAD,CAAc,EAAK,IAAnB,CACA,IAAC,CAAA,QAAD,CAAc,EAAK,QAAnB,CACA,IAAC,CAAA,UAAD,CAAc,EAAK,UAAA,CAGnB,IAAI,C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AI,CAAC,WAAnE,EAAiF,QAAjF,CAA2F,UAE3F,IAAI,CAAC,kBAAL,EAlBY,CA2Bb,mBAAmB,CAMlB,OAHA,EAAG,yCAA0C,QAA7C,CAAuD,WAGvD,EAAG,uCAAwC,QAA3C,CAAqD,WANnC,CAYnB,oBAAoB,CAMnB,OAHA,EAAG,yCAA0C,WAA7C,CAA0D,WAG1D,EAAG,uCAAwC,WAA3C,CAAwD,WANrC,CAYpB,UAAA,CAAa,OAAA,EAAG,yCAA0C,MAA7C,CAAqD,OAAQ,KAA7D,CAAoE,CAAA,QAAS,KAAM,WAAY,CAAA,WAAY,OAAQ,QAAS,EAA7B,CAA3B,EAAvE,CAMV,YAAA,CAAe,OAAA,EAAG,yCAA0C,MAA7C,CAAqD,OAAQ,OAA7D,EAAH,CAUZ,cAAiB,CAAF,CAAO,CAAP,CAAc,EAAU,EAAxB,CAAf,CAEF,IAAA,EAKG,OALA,QAAQ,KAAR,CAAe,GAEmB,GAAlC,CAAA,EAAU,IAAC,CAAA,IAAI,CAAC,UAAA,AAAA,EAChB,EAAU,EAAG,qDAAsD,MAAnE,CAEA,EAAG,kCAAoC,EAAU,KAAO,EAAU,cAAe,WAAjF,CAA8F,GAAM,IAApG,CAA0G,MAAO,KAAjH,CAAwH,KAAO,OAA/H,CAAwI,IAP1H,CAzPhB,EAoQA,EAAG,SAAS,IAAZ,EAAmB,OAAnB,CAA4B,gDA1QtB,E,C,E,I,C,C","sources":["","woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.coffee"],"sourcesContent":["(() => {\nvar $f921149b16c1f5f9$exports = {};\n(function() {\n /*\n WooCommerce SkyVerge Payment Gateway My Payment Methods CoffeeScript\n Version 5.1.0\n\n Copyright (c) 2014-2024, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n */ jQuery(function($) {\n \"use strict\";\n // The My Payment Methods handler.\n // @since 5.1.0\n window.SV_WC_Payment_Methods_Handler_v5_15_12 = class SV_WC_Payment_Methods_Handler_v5_15_12 {\n // Constructs the class.\n // @since 5.1.0\n // @param [Object] args, with the properties:\n // id: [String] plugin ID\n // slug: [String] plugin slug or dasherized ID\n // i18n: [Object] localized text strings\n // ajax_url: [String] URL for AJAX requests\n // ajax_nonce: [String] nonce for AJAX requests\n constructor(args){\n // Replace Method column content with Title column content, for FW tokens.\n // @since 5.8.0\n this.replace_method_column = this.replace_method_column.bind(this);\n // Removes duplicate \"Default\" marks.\n // They are already hidden using CSS, but should also be removed for accessibility.\n // @since 5.8.0\n this.remove_duplicate_default_marks = this.remove_duplicate_default_marks.bind(this);\n // Edits a payment method.\n // @since 5.1.0\n // @param [Object] event jQuery event object\n this.edit_method = this.edit_method.bind(this);\n // Saves a payment method.\n // @since 5.1.0\n // @param [Object] event jQuery event object\n this.save_method = this.save_method.bind(this);\n // Cancels/stop editing a payment method.\n // @since 5.1.0\n // @param [Object] event jQuery event object\n this.cancel_edit = this.cancel_edit.bind(this);\n this.id = args.id;\n this.slug = args.slug;\n this.i18n = args.i18n;\n this.ajax_url = args.ajax_url;\n this.ajax_nonce = args.ajax_nonce;\n // replace the \"Method\" column content for FW tokens\n this.replace_method_column();\n // remove duplicate \"Default\" marks\n this.remove_duplicate_default_marks();\n // handle the edit action\n $(\".woocommerce-MyAccount-paymentMethods\").on('click', \".woocommerce-PaymentMethod--actions .button.edit\", (event1)=>{\n return this.edit_method(event1);\n });\n // handle the save action\n $(\".woocommerce-MyAccount-paymentMethods\").on('click', \".woocommerce-PaymentMethod--actions .button.save\", (event1)=>{\n return this.save_method(event1);\n });\n // handle the cancel action\n $(\".woocommerce-MyAccount-paymentMethods\").on('click', \".woocommerce-PaymentMethod--actions .cancel-edit\", (event1)=>{\n return this.cancel_edit(event1);\n });\n // handle the delete action\n $(\".woocommerce-MyAccount-paymentMethods\").on('click', \".woocommerce-PaymentMethod--actions .button.delete\", (event1)=>{\n var button, row;\n button = $(event1.currentTarget);\n row = button.parents('tr');\n // check if the method belongs to this plugin\n if (row.find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n if (!confirm(this.i18n.delete_ays)) {\n // re-enable the button if user cancels (side note: WooCommerce core is the one that added the disabled state in the first place)\n button.prop('disabled', false).removeClass('disabled');\n return event1.preventDefault();\n }\n });\n // don't follow the Add Payment Method button URL if it's disabled\n $('.button[href*=\"add-payment-method\"]').on('click', event(function() {\n if ($(this).hasClass('disabled')) return event.preventDefault();\n }));\n }\n replace_method_column() {\n return $('.woocommerce-MyAccount-paymentMethods').find('tr').each((index, element)=>{\n var titleColumn;\n // check if the method belongs to this plugin\n if ($(element).find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n // delete the Title header\n $(element).find('th.woocommerce-PaymentMethod--title').remove();\n titleColumn = $(element).find('td.woocommerce-PaymentMethod--title');\n // Title column is not empty, this is a FW token\n if (titleColumn.children().length > 0) // replace Method column\n $(element).find('td.woocommerce-PaymentMethod--method').html(titleColumn.html());\n // delete Title column\n return $(element).find('td.woocommerce-PaymentMethod--title').remove();\n });\n }\n remove_duplicate_default_marks() {\n return $('.woocommerce-MyAccount-paymentMethods').find('tr').each((index, element)=>{\n return $(element).find('td.woocommerce-PaymentMethod--default').find('mark.default:not(:first-child)').remove();\n });\n }\n edit_method(event1) {\n var button, row;\n event1.preventDefault();\n button = $(event1.currentTarget);\n row = button.parents('tr');\n // check if the method belongs to this plugin\n if (row.find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n row.find('div.view').hide();\n row.find('div.edit').show();\n row.addClass('editing');\n // change the Edit button to \"Cancel\"\n button.text(this.i18n.cancel_button).removeClass('edit').addClass('cancel-edit').removeClass('button');\n return this.enable_editing_ui();\n }\n save_method(event1) {\n var button, data, row;\n event1.preventDefault();\n button = $(event1.currentTarget);\n row = button.parents('tr');\n // check if the method belongs to this plugin\n if (row.find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n this.block_ui();\n // remove any previous errors\n row.next('.error').remove();\n data = {\n action: `wc_${this.id}_save_payment_method`,\n nonce: this.ajax_nonce,\n token_id: row.find('input[name=token-id]').val(),\n data: row.find('input[name]').serialize()\n };\n return $.post(this.ajax_url, data).done((response)=>{\n if (!response.success) return this.display_error(row, response.data);\n if (response.data.title != null) row.find('.woocommerce-PaymentMethod--method').html(response.data.title);\n if (response.data.nonce != null) this.ajax_nonce = response.data.nonce;\n // change the \"Cancel\" button back to \"Edit\"\n button.siblings('.cancel-edit').removeClass('cancel-edit').addClass('edit').text(this.i18n.edit_button).addClass('button');\n row.removeClass('editing');\n return this.disable_editing_ui();\n }).fail((jqXHR, textStatus, error)=>{\n return this.display_error(row, error);\n }).always(()=>{\n return this.unblock_ui();\n });\n }\n cancel_edit(event1) {\n var button, row;\n event1.preventDefault();\n button = $(event1.currentTarget);\n row = button.parents('tr');\n // check if the method belongs to this plugin\n if (row.find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n row.find('div.view').show();\n row.find('div.edit').hide();\n row.removeClass('editing');\n // change the \"Cancel\" button back to \"Edit\"\n button.removeClass('cancel-edit').addClass('edit').text(this.i18n.edit_button).addClass('button');\n return this.disable_editing_ui();\n }\n // Sets the page UI to the \"editing\" state.\n // This brings proper focus to the method being edited and prevents\n // other available buttons/actions until the editing is finished or cancelled.\n // @since 5.1.1\n enable_editing_ui() {\n // set the methods table as 'editing'\n $(\".woocommerce-MyAccount-paymentMethods\").addClass('editing');\n // disable the Add Payment Method button\n return $('.button[href*=\"add-payment-method\"]').addClass('disabled');\n }\n // Sets the page UI back to the default state.\n // @since 5.1.1\n disable_editing_ui() {\n // removes the methods table's \"editing\" status\n $(\".woocommerce-MyAccount-paymentMethods\").removeClass('editing');\n // re-enable the Add Payment Method button\n return $('.button[href*=\"add-payment-method\"]').removeClass('disabled');\n }\n // Blocks the payment methods table UI.\n // @since 5.1.0\n block_ui() {\n return $(\".woocommerce-MyAccount-paymentMethods\").parent('div').block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n // Unblocks the payment methods table UI.\n // @since 5.1.0\n unblock_ui() {\n return $(\".woocommerce-MyAccount-paymentMethods\").parent('div').unblock();\n }\n // Displays an error message to the user.\n // @since 5.1.0\n // @param [Object] row payment method table row\n // @param [String] error raw error message\n // @param [String] message user error message\n display_error(row, error, message = '') {\n var columns;\n console.error(error);\n if (!message) message = this.i18n.save_error;\n columns = $(\".woocommerce-MyAccount-paymentMethods thead tr th\").length;\n return $('| ' + message + ' |
').insertAfter(row).find('td').delay(8000).slideUp(200);\n }\n };\n // dispatch loaded event\n return $(document.body).trigger('sv_wc_payment_methods_handler_v5_15_12_loaded');\n });\n}).call($f921149b16c1f5f9$exports);\n\n})();\n//# sourceMappingURL=sv-wc-payment-gateway-my-payment-methods.js.map\n","###\n WooCommerce SkyVerge Payment Gateway My Payment Methods CoffeeScript\n Version 5.1.0\n\n Copyright (c) 2014-2024, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n###\njQuery ( $ ) ->\n\t\"use strict\"\n\n\t# The My Payment Methods handler.\n\t#\n\t# @since 5.1.0\n\tclass window.SV_WC_Payment_Methods_Handler_v5_15_12\n\n\n\t\t# Constructs the class.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] args, with the properties:\n\t\t# id: [String] plugin ID\n\t\t# slug: [String] plugin slug or dasherized ID\n\t\t# i18n: [Object] localized text strings\n\t\t# ajax_url: [String] URL for AJAX requests\n\t\t# ajax_nonce: [String] nonce for AJAX requests\n\t\tconstructor: ( args ) ->\n\n\t\t\t@id = args.id\n\t\t\t@slug = args.slug\n\t\t\t@i18n = args.i18n\n\t\t\t@ajax_url = args.ajax_url\n\t\t\t@ajax_nonce = args.ajax_nonce\n\n\t\t\t# replace the \"Method\" column content for FW tokens\n\t\t\tthis.replace_method_column()\n\n\t\t\t# remove duplicate \"Default\" marks\n\t\t\tthis.remove_duplicate_default_marks()\n\n\t\t\t# handle the edit action\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).on( 'click', \".woocommerce-PaymentMethod--actions .button.edit\", ( event ) => this.edit_method( event ) )\n\n\t\t\t# handle the save action\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).on( 'click', \".woocommerce-PaymentMethod--actions .button.save\", ( event ) => this.save_method( event ) )\n\n\t\t\t# handle the cancel action\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).on( 'click', \".woocommerce-PaymentMethod--actions .cancel-edit\", ( event ) => this.cancel_edit( event ) )\n\n\t\t\t# handle the delete action\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).on( 'click', \".woocommerce-PaymentMethod--actions .button.delete\", ( event ) =>\n\n\t\t\t\tbutton = $( event.currentTarget )\n\t\t\t\trow = button.parents( 'tr' )\n\n\t\t\t\t# check if the method belongs to this plugin\n\t\t\t\tif row.find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\t\treturn\n\n\t\t\t\tif not confirm( @i18n.delete_ays )\n\t\t\t\t\t# re-enable the button if user cancels (side note: WooCommerce core is the one that added the disabled state in the first place)\n\t\t\t\t\tbutton.prop( 'disabled', false ).removeClass( 'disabled' )\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t)\n\n\t\t\t# don't follow the Add Payment Method button URL if it's disabled\n\t\t\t$( '.button[href*=\"add-payment-method\"]' ).on 'click', event ->\n\t\t\t\tevent.preventDefault() if $( this ).hasClass( 'disabled' )\n\n\n\t\t# Replace Method column content with Title column content, for FW tokens.\n\t\t#\n\t\t# @since 5.8.0\n\t\treplace_method_column: =>\n\n\t\t\t$( '.woocommerce-MyAccount-paymentMethods' ).find( 'tr' ).each ( index, element ) =>\n\n\t\t\t\t# check if the method belongs to this plugin\n\t\t\t\tif $( element ).find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\t\treturn\n\n\t\t\t\t# delete the Title header\n\t\t\t\t$( element ).find( 'th.woocommerce-PaymentMethod--title' ).remove()\n\n\t\t\t\ttitleColumn = $( element ).find( 'td.woocommerce-PaymentMethod--title' )\n\n\t\t\t\t# Title column is not empty, this is a FW token\n\t\t\t\tif ( titleColumn.children().length > 0 )\n\n\t\t\t\t\t# replace Method column\n\t\t\t\t\t$( element ).find( 'td.woocommerce-PaymentMethod--method' ).html( titleColumn.html() )\n\n\t\t\t\t# delete Title column\n\t\t\t\t$( element ).find( 'td.woocommerce-PaymentMethod--title' ).remove()\n\n\n\t\t# Removes duplicate \"Default\" marks.\n\t\t#\n\t\t# They are already hidden using CSS, but should also be removed for accessibility.\n\t\t#\n\t\t# @since 5.8.0\n\t\tremove_duplicate_default_marks: =>\n\n\t\t\t$( '.woocommerce-MyAccount-paymentMethods' ).find( 'tr' ).each ( index, element ) =>\n\n\t\t\t\t$( element ).find( 'td.woocommerce-PaymentMethod--default' ).find( 'mark.default:not(:first-child)' ).remove()\n\n\n\t\t# Edits a payment method.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] event jQuery event object\n\t\tedit_method: ( event ) =>\n\n\t\t\tevent.preventDefault()\n\n\t\t\tbutton = $( event.currentTarget )\n\t\t\trow = button.parents( 'tr' )\n\n\t\t\t# check if the method belongs to this plugin\n\t\t\tif row.find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\treturn\n\n\t\t\trow.find( 'div.view' ).hide()\n\t\t\trow.find( 'div.edit' ).show()\n\t\t\trow.addClass( 'editing' )\n\n\t\t\t# change the Edit button to \"Cancel\"\n\t\t\tbutton.text( @i18n.cancel_button ).removeClass( 'edit' ).addClass( 'cancel-edit' ).removeClass( 'button' )\n\n\t\t\tthis.enable_editing_ui()\n\n\n\t\t# Saves a payment method.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] event jQuery event object\n\t\tsave_method: ( event ) =>\n\n\t\t\tevent.preventDefault()\n\n\t\t\tbutton = $( event.currentTarget )\n\t\t\trow = button.parents( 'tr' )\n\n\t\t\t# check if the method belongs to this plugin\n\t\t\tif row.find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\treturn\n\n\t\t\tthis.block_ui()\n\n\t\t\t# remove any previous errors\n\t\t\trow.next( '.error' ).remove()\n\n\t\t\tdata =\n\t\t\t\taction: \"wc_#{@id}_save_payment_method\"\n\t\t\t\tnonce: @ajax_nonce\n\t\t\t\ttoken_id: row.find( 'input[name=token-id]' ).val()\n\t\t\t\tdata: row.find( 'input[name]' ).serialize()\n\n\t\t\t$.post( @ajax_url, data )\n\n\t\t\t\t.done ( response ) =>\n\n\t\t\t\t\treturn this.display_error( row, response.data ) unless response.success\n\n\t\t\t\t\tif response.data.title?\n\t\t\t\t\t\trow.find('.woocommerce-PaymentMethod--method').html( response.data.title )\n\n\t\t\t\t\tif response.data.nonce?\n\t\t\t\t\t\t@ajax_nonce = response.data.nonce\n\n\t\t\t\t\t# change the \"Cancel\" button back to \"Edit\"\n\t\t\t\t\tbutton.siblings( '.cancel-edit' ).removeClass( 'cancel-edit' ).addClass( 'edit' ).text( @i18n.edit_button ).addClass( 'button' )\n\n\t\t\t\t\trow.removeClass( 'editing' )\n\n\t\t\t\t\tthis.disable_editing_ui()\n\n\t\t\t\t.fail ( jqXHR, textStatus, error ) =>\n\n\t\t\t\t\tthis.display_error( row, error )\n\n\t\t\t\t.always =>\n\n\t\t\t\t\tthis.unblock_ui()\n\n\n\t\t# Cancels/stop editing a payment method.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] event jQuery event object\n\t\tcancel_edit: ( event ) =>\n\n\t\t\tevent.preventDefault()\n\n\t\t\tbutton = $( event.currentTarget )\n\t\t\trow = button.parents( 'tr' )\n\n\t\t\t# check if the method belongs to this plugin\n\t\t\tif row.find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\treturn\n\n\t\t\trow.find( 'div.view' ).show()\n\t\t\trow.find( 'div.edit' ).hide()\n\t\t\trow.removeClass( 'editing' )\n\n\t\t\t# change the \"Cancel\" button back to \"Edit\"\n\t\t\tbutton.removeClass( 'cancel-edit' ).addClass( 'edit' ).text( @i18n.edit_button ).addClass( 'button' )\n\n\t\t\tthis.disable_editing_ui()\n\n\n\t\t# Sets the page UI to the \"editing\" state.\n\t\t#\n\t\t# This brings proper focus to the method being edited and prevents\n\t\t# other available buttons/actions until the editing is finished or cancelled.\n\t\t#\n\t\t# @since 5.1.1\n\t\tenable_editing_ui: ->\n\n\t\t\t# set the methods table as 'editing'\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).addClass( 'editing' )\n\n\t\t\t# disable the Add Payment Method button\n\t\t\t$( '.button[href*=\"add-payment-method\"]' ).addClass( 'disabled' )\n\n\n\t\t# Sets the page UI back to the default state.\n\t\t#\n\t\t# @since 5.1.1\n\t\tdisable_editing_ui: ->\n\n\t\t\t# removes the methods table's \"editing\" status\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).removeClass( 'editing' )\n\n\t\t\t# re-enable the Add Payment Method button\n\t\t\t$( '.button[href*=\"add-payment-method\"]' ).removeClass( 'disabled' )\n\n\n\t\t# Blocks the payment methods table UI.\n\t\t#\n\t\t# @since 5.1.0\n\t\tblock_ui: -> $( \".woocommerce-MyAccount-paymentMethods\" ).parent( 'div' ).block( message: null, overlayCSS: background: '#fff', opacity: 0.6 )\n\n\n\t\t# Unblocks the payment methods table UI.\n\t\t#\n\t\t# @since 5.1.0\n\t\tunblock_ui: -> $( \".woocommerce-MyAccount-paymentMethods\" ).parent( 'div' ).unblock()\n\n\n\t\t# Displays an error message to the user.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] row payment method table row\n\t\t# @param [String] error raw error message\n\t\t# @param [String] message user error message\n\t\tdisplay_error: ( row, error, message = '' ) ->\n\n\t\t\tconsole.error( error )\n\n\t\t\tmessage = @i18n.save_error unless message\n\t\t\tcolumns = $( \".woocommerce-MyAccount-paymentMethods thead tr th\" ).length\n\n\t\t\t$( '| ' + message + ' |
' ).insertAfter( row ).find( 'td' ).delay( 8000 ).slideUp( 200 )\n\n\n\t# dispatch loaded event\n\t$( document.body ).trigger( 'sv_wc_payment_methods_handler_v5_15_12_loaded' )\n"],"names":["jQuery","$","window","SV_WC_Payment_Methods_Handler_v5_15_12","constructor","args","replace_method_column","bind","remove_duplicate_default_marks","edit_method","save_method","cancel_edit","id","slug","i18n","ajax_url","ajax_nonce","on","event1","button","row","currentTarget","parents","find","length","confirm","delete_ays","prop","removeClass","preventDefault","event","hasClass","each","index","element","titleColumn","remove","children","html","hide","show","addClass","text","cancel_button","enable_editing_ui","data","block_ui","next","action","nonce","token_id","val","serialize","post","done","response","success","title","siblings","edit_button","disable_editing_ui","display_error","fail","jqXHR","textStatus","error","always","unblock_ui","parent","block","message","overlayCSS","background","opacity","unblock","columns","console","save_error","insertAfter","delay","slideUp","document","body","trigger","call"],"version":3,"file":"sv-wc-payment-gateway-my-payment-methods.js.map"}
\ No newline at end of file
+{"mappings":"ACOG,CAAA,WACH,OAAO,SAAE,CAAF,EA0QN,OApQM,OAAO,oCAAA,CAAb,MAaC,YAAe,CAAF,CAAA,CAgDb,IAAA,CAAA,qBAAA,CAAA,IAAA,CAAA,qBAAA,CAAA,IAAA,CAAA,IAAA,EA4BA,IAAA,CAAA,8BAAA,CAAA,IAAA,CAAA,8BAAA,CAAA,IAAA,CAAA,IAAA,EAYA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,IAAA,EA0BA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,IAAA,EAuDA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,WAAA,CAAA,IAAA,CAAA,IAAA,EAvKC,IAAC,CAAA,EAAD,CAAc,EAAK,EAAnB,CACA,IAAC,CAAA,IAAD,CAAc,EAAK,IAAnB,CACA,IAAC,CAAA,IAAD,CAAc,EAAK,IAAnB,CACA,IAAC,CAAA,QAA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B,EAAO,WAAP,CAAoB,eAAgB,QAApC,CAA8C,QAAS,IAAvD,CAA6D,IAAC,CAAA,IAAI,CAAC,WAAnE,EAAiF,QAAjF,CAA2F,UAE3F,IAAI,CAAC,kBAAL,EAlBY,CA2Bb,mBAAmB,CAMlB,OAHA,EAAG,yCAA0C,QAA7C,CAAuD,WAGvD,EAAG,uCAAwC,QAA3C,CAAqD,WANnC,CAYnB,oBAAoB,CAMnB,OAHA,EAAG,yCAA0C,WAA7C,CAA0D,WAG1D,EAAG,uCAAwC,WAA3C,CAAwD,WANrC,CAYpB,UAAA,CAAa,OAAA,EAAG,yCAA0C,MAA7C,CAAqD,OAAQ,KAA7D,CAAoE,CAAA,QAAS,KAAM,WAAY,CAAA,WAAY,OAAQ,QAAS,EAA7B,CAA3B,EAAvE,CAMV,YAAA,CAAe,OAAA,EAAG,yCAA0C,MAA7C,CAAqD,OAAQ,OAA7D,EAAH,CAUZ,cAAiB,CAAF,CAAO,CAAP,CAAc,EAAU,EAAxB,CAAf,CAEF,IAAA,EAKG,OALA,QAAQ,KAAR,CAAe,GAEmB,GAAlC,CAAA,EAAU,IAAC,CAAA,IAAI,CAAC,UAAA,AAAA,EAChB,EAAU,EAAG,qDAAsD,MAAnE,CAEA,EAAG,kCAAoC,EAAU,KAAO,EAAU,cAAe,WAAjF,CAA8F,GAAM,IAApG,CAA0G,MAAO,KAAjH,CAAwH,KAAO,OAA/H,CAAwI,IAP1H,CAzPhB,EAoQA,EAAG,SAAS,IAAZ,EAAmB,OAAnB,CAA4B,8CA1QtB,E,C,E,I,C,C","sources":["","woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.coffee"],"sourcesContent":["(() => {\nvar $f921149b16c1f5f9$exports = {};\n(function() {\n /*\n WooCommerce SkyVerge Payment Gateway My Payment Methods CoffeeScript\n Version 5.1.0\n\n Copyright (c) 2014-2024, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n */ jQuery(function($) {\n \"use strict\";\n // The My Payment Methods handler.\n // @since 5.1.0\n window.SV_WC_Payment_Methods_Handler_v6_0_0 = class SV_WC_Payment_Methods_Handler_v6_0_0 {\n // Constructs the class.\n // @since 5.1.0\n // @param [Object] args, with the properties:\n // id: [String] plugin ID\n // slug: [String] plugin slug or dasherized ID\n // i18n: [Object] localized text strings\n // ajax_url: [String] URL for AJAX requests\n // ajax_nonce: [String] nonce for AJAX requests\n constructor(args){\n // Replace Method column content with Title column content, for FW tokens.\n // @since 5.8.0\n this.replace_method_column = this.replace_method_column.bind(this);\n // Removes duplicate \"Default\" marks.\n // They are already hidden using CSS, but should also be removed for accessibility.\n // @since 5.8.0\n this.remove_duplicate_default_marks = this.remove_duplicate_default_marks.bind(this);\n // Edits a payment method.\n // @since 5.1.0\n // @param [Object] event jQuery event object\n this.edit_method = this.edit_method.bind(this);\n // Saves a payment method.\n // @since 5.1.0\n // @param [Object] event jQuery event object\n this.save_method = this.save_method.bind(this);\n // Cancels/stop editing a payment method.\n // @since 5.1.0\n // @param [Object] event jQuery event object\n this.cancel_edit = this.cancel_edit.bind(this);\n this.id = args.id;\n this.slug = args.slug;\n this.i18n = args.i18n;\n this.ajax_url = args.ajax_url;\n this.ajax_nonce = args.ajax_nonce;\n // replace the \"Method\" column content for FW tokens\n this.replace_method_column();\n // remove duplicate \"Default\" marks\n this.remove_duplicate_default_marks();\n // handle the edit action\n $(\".woocommerce-MyAccount-paymentMethods\").on('click', \".woocommerce-PaymentMethod--actions .button.edit\", (event1)=>{\n return this.edit_method(event1);\n });\n // handle the save action\n $(\".woocommerce-MyAccount-paymentMethods\").on('click', \".woocommerce-PaymentMethod--actions .button.save\", (event1)=>{\n return this.save_method(event1);\n });\n // handle the cancel action\n $(\".woocommerce-MyAccount-paymentMethods\").on('click', \".woocommerce-PaymentMethod--actions .cancel-edit\", (event1)=>{\n return this.cancel_edit(event1);\n });\n // handle the delete action\n $(\".woocommerce-MyAccount-paymentMethods\").on('click', \".woocommerce-PaymentMethod--actions .button.delete\", (event1)=>{\n var button, row;\n button = $(event1.currentTarget);\n row = button.parents('tr');\n // check if the method belongs to this plugin\n if (row.find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n if (!confirm(this.i18n.delete_ays)) {\n // re-enable the button if user cancels (side note: WooCommerce core is the one that added the disabled state in the first place)\n button.prop('disabled', false).removeClass('disabled');\n return event1.preventDefault();\n }\n });\n // don't follow the Add Payment Method button URL if it's disabled\n $('.button[href*=\"add-payment-method\"]').on('click', event(function() {\n if ($(this).hasClass('disabled')) return event.preventDefault();\n }));\n }\n replace_method_column() {\n return $('.woocommerce-MyAccount-paymentMethods').find('tr').each((index, element)=>{\n var titleColumn;\n // check if the method belongs to this plugin\n if ($(element).find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n // delete the Title header\n $(element).find('th.woocommerce-PaymentMethod--title').remove();\n titleColumn = $(element).find('td.woocommerce-PaymentMethod--title');\n // Title column is not empty, this is a FW token\n if (titleColumn.children().length > 0) // replace Method column\n $(element).find('td.woocommerce-PaymentMethod--method').html(titleColumn.html());\n // delete Title column\n return $(element).find('td.woocommerce-PaymentMethod--title').remove();\n });\n }\n remove_duplicate_default_marks() {\n return $('.woocommerce-MyAccount-paymentMethods').find('tr').each((index, element)=>{\n return $(element).find('td.woocommerce-PaymentMethod--default').find('mark.default:not(:first-child)').remove();\n });\n }\n edit_method(event1) {\n var button, row;\n event1.preventDefault();\n button = $(event1.currentTarget);\n row = button.parents('tr');\n // check if the method belongs to this plugin\n if (row.find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n row.find('div.view').hide();\n row.find('div.edit').show();\n row.addClass('editing');\n // change the Edit button to \"Cancel\"\n button.text(this.i18n.cancel_button).removeClass('edit').addClass('cancel-edit').removeClass('button');\n return this.enable_editing_ui();\n }\n save_method(event1) {\n var button, data, row;\n event1.preventDefault();\n button = $(event1.currentTarget);\n row = button.parents('tr');\n // check if the method belongs to this plugin\n if (row.find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n this.block_ui();\n // remove any previous errors\n row.next('.error').remove();\n data = {\n action: `wc_${this.id}_save_payment_method`,\n nonce: this.ajax_nonce,\n token_id: row.find('input[name=token-id]').val(),\n data: row.find('input[name]').serialize()\n };\n return $.post(this.ajax_url, data).done((response)=>{\n if (!response.success) return this.display_error(row, response.data);\n if (response.data.title != null) row.find('.woocommerce-PaymentMethod--method').html(response.data.title);\n if (response.data.nonce != null) this.ajax_nonce = response.data.nonce;\n // change the \"Cancel\" button back to \"Edit\"\n button.siblings('.cancel-edit').removeClass('cancel-edit').addClass('edit').text(this.i18n.edit_button).addClass('button');\n row.removeClass('editing');\n return this.disable_editing_ui();\n }).fail((jqXHR, textStatus, error)=>{\n return this.display_error(row, error);\n }).always(()=>{\n return this.unblock_ui();\n });\n }\n cancel_edit(event1) {\n var button, row;\n event1.preventDefault();\n button = $(event1.currentTarget);\n row = button.parents('tr');\n // check if the method belongs to this plugin\n if (row.find(`input[name=plugin-id][value=${this.slug}]`).length === 0) return;\n row.find('div.view').show();\n row.find('div.edit').hide();\n row.removeClass('editing');\n // change the \"Cancel\" button back to \"Edit\"\n button.removeClass('cancel-edit').addClass('edit').text(this.i18n.edit_button).addClass('button');\n return this.disable_editing_ui();\n }\n // Sets the page UI to the \"editing\" state.\n // This brings proper focus to the method being edited and prevents\n // other available buttons/actions until the editing is finished or cancelled.\n // @since 5.1.1\n enable_editing_ui() {\n // set the methods table as 'editing'\n $(\".woocommerce-MyAccount-paymentMethods\").addClass('editing');\n // disable the Add Payment Method button\n return $('.button[href*=\"add-payment-method\"]').addClass('disabled');\n }\n // Sets the page UI back to the default state.\n // @since 5.1.1\n disable_editing_ui() {\n // removes the methods table's \"editing\" status\n $(\".woocommerce-MyAccount-paymentMethods\").removeClass('editing');\n // re-enable the Add Payment Method button\n return $('.button[href*=\"add-payment-method\"]').removeClass('disabled');\n }\n // Blocks the payment methods table UI.\n // @since 5.1.0\n block_ui() {\n return $(\".woocommerce-MyAccount-paymentMethods\").parent('div').block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n // Unblocks the payment methods table UI.\n // @since 5.1.0\n unblock_ui() {\n return $(\".woocommerce-MyAccount-paymentMethods\").parent('div').unblock();\n }\n // Displays an error message to the user.\n // @since 5.1.0\n // @param [Object] row payment method table row\n // @param [String] error raw error message\n // @param [String] message user error message\n display_error(row, error, message = '') {\n var columns;\n console.error(error);\n if (!message) message = this.i18n.save_error;\n columns = $(\".woocommerce-MyAccount-paymentMethods thead tr th\").length;\n return $('| ' + message + ' |
').insertAfter(row).find('td').delay(8000).slideUp(200);\n }\n };\n // dispatch loaded event\n return $(document.body).trigger('sv_wc_payment_methods_handler_v6_0_0_loaded');\n });\n}).call($f921149b16c1f5f9$exports);\n\n})();\n//# sourceMappingURL=sv-wc-payment-gateway-my-payment-methods.js.map\n","###\n WooCommerce SkyVerge Payment Gateway My Payment Methods CoffeeScript\n Version 5.1.0\n\n Copyright (c) 2014-2024, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n###\njQuery ( $ ) ->\n\t\"use strict\"\n\n\t# The My Payment Methods handler.\n\t#\n\t# @since 5.1.0\n\tclass window.SV_WC_Payment_Methods_Handler_v6_0_0\n\n\n\t\t# Constructs the class.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] args, with the properties:\n\t\t# id: [String] plugin ID\n\t\t# slug: [String] plugin slug or dasherized ID\n\t\t# i18n: [Object] localized text strings\n\t\t# ajax_url: [String] URL for AJAX requests\n\t\t# ajax_nonce: [String] nonce for AJAX requests\n\t\tconstructor: ( args ) ->\n\n\t\t\t@id = args.id\n\t\t\t@slug = args.slug\n\t\t\t@i18n = args.i18n\n\t\t\t@ajax_url = args.ajax_url\n\t\t\t@ajax_nonce = args.ajax_nonce\n\n\t\t\t# replace the \"Method\" column content for FW tokens\n\t\t\tthis.replace_method_column()\n\n\t\t\t# remove duplicate \"Default\" marks\n\t\t\tthis.remove_duplicate_default_marks()\n\n\t\t\t# handle the edit action\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).on( 'click', \".woocommerce-PaymentMethod--actions .button.edit\", ( event ) => this.edit_method( event ) )\n\n\t\t\t# handle the save action\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).on( 'click', \".woocommerce-PaymentMethod--actions .button.save\", ( event ) => this.save_method( event ) )\n\n\t\t\t# handle the cancel action\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).on( 'click', \".woocommerce-PaymentMethod--actions .cancel-edit\", ( event ) => this.cancel_edit( event ) )\n\n\t\t\t# handle the delete action\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).on( 'click', \".woocommerce-PaymentMethod--actions .button.delete\", ( event ) =>\n\n\t\t\t\tbutton = $( event.currentTarget )\n\t\t\t\trow = button.parents( 'tr' )\n\n\t\t\t\t# check if the method belongs to this plugin\n\t\t\t\tif row.find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\t\treturn\n\n\t\t\t\tif not confirm( @i18n.delete_ays )\n\t\t\t\t\t# re-enable the button if user cancels (side note: WooCommerce core is the one that added the disabled state in the first place)\n\t\t\t\t\tbutton.prop( 'disabled', false ).removeClass( 'disabled' )\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t)\n\n\t\t\t# don't follow the Add Payment Method button URL if it's disabled\n\t\t\t$( '.button[href*=\"add-payment-method\"]' ).on 'click', event ->\n\t\t\t\tevent.preventDefault() if $( this ).hasClass( 'disabled' )\n\n\n\t\t# Replace Method column content with Title column content, for FW tokens.\n\t\t#\n\t\t# @since 5.8.0\n\t\treplace_method_column: =>\n\n\t\t\t$( '.woocommerce-MyAccount-paymentMethods' ).find( 'tr' ).each ( index, element ) =>\n\n\t\t\t\t# check if the method belongs to this plugin\n\t\t\t\tif $( element ).find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\t\treturn\n\n\t\t\t\t# delete the Title header\n\t\t\t\t$( element ).find( 'th.woocommerce-PaymentMethod--title' ).remove()\n\n\t\t\t\ttitleColumn = $( element ).find( 'td.woocommerce-PaymentMethod--title' )\n\n\t\t\t\t# Title column is not empty, this is a FW token\n\t\t\t\tif ( titleColumn.children().length > 0 )\n\n\t\t\t\t\t# replace Method column\n\t\t\t\t\t$( element ).find( 'td.woocommerce-PaymentMethod--method' ).html( titleColumn.html() )\n\n\t\t\t\t# delete Title column\n\t\t\t\t$( element ).find( 'td.woocommerce-PaymentMethod--title' ).remove()\n\n\n\t\t# Removes duplicate \"Default\" marks.\n\t\t#\n\t\t# They are already hidden using CSS, but should also be removed for accessibility.\n\t\t#\n\t\t# @since 5.8.0\n\t\tremove_duplicate_default_marks: =>\n\n\t\t\t$( '.woocommerce-MyAccount-paymentMethods' ).find( 'tr' ).each ( index, element ) =>\n\n\t\t\t\t$( element ).find( 'td.woocommerce-PaymentMethod--default' ).find( 'mark.default:not(:first-child)' ).remove()\n\n\n\t\t# Edits a payment method.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] event jQuery event object\n\t\tedit_method: ( event ) =>\n\n\t\t\tevent.preventDefault()\n\n\t\t\tbutton = $( event.currentTarget )\n\t\t\trow = button.parents( 'tr' )\n\n\t\t\t# check if the method belongs to this plugin\n\t\t\tif row.find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\treturn\n\n\t\t\trow.find( 'div.view' ).hide()\n\t\t\trow.find( 'div.edit' ).show()\n\t\t\trow.addClass( 'editing' )\n\n\t\t\t# change the Edit button to \"Cancel\"\n\t\t\tbutton.text( @i18n.cancel_button ).removeClass( 'edit' ).addClass( 'cancel-edit' ).removeClass( 'button' )\n\n\t\t\tthis.enable_editing_ui()\n\n\n\t\t# Saves a payment method.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] event jQuery event object\n\t\tsave_method: ( event ) =>\n\n\t\t\tevent.preventDefault()\n\n\t\t\tbutton = $( event.currentTarget )\n\t\t\trow = button.parents( 'tr' )\n\n\t\t\t# check if the method belongs to this plugin\n\t\t\tif row.find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\treturn\n\n\t\t\tthis.block_ui()\n\n\t\t\t# remove any previous errors\n\t\t\trow.next( '.error' ).remove()\n\n\t\t\tdata =\n\t\t\t\taction: \"wc_#{@id}_save_payment_method\"\n\t\t\t\tnonce: @ajax_nonce\n\t\t\t\ttoken_id: row.find( 'input[name=token-id]' ).val()\n\t\t\t\tdata: row.find( 'input[name]' ).serialize()\n\n\t\t\t$.post( @ajax_url, data )\n\n\t\t\t\t.done ( response ) =>\n\n\t\t\t\t\treturn this.display_error( row, response.data ) unless response.success\n\n\t\t\t\t\tif response.data.title?\n\t\t\t\t\t\trow.find('.woocommerce-PaymentMethod--method').html( response.data.title )\n\n\t\t\t\t\tif response.data.nonce?\n\t\t\t\t\t\t@ajax_nonce = response.data.nonce\n\n\t\t\t\t\t# change the \"Cancel\" button back to \"Edit\"\n\t\t\t\t\tbutton.siblings( '.cancel-edit' ).removeClass( 'cancel-edit' ).addClass( 'edit' ).text( @i18n.edit_button ).addClass( 'button' )\n\n\t\t\t\t\trow.removeClass( 'editing' )\n\n\t\t\t\t\tthis.disable_editing_ui()\n\n\t\t\t\t.fail ( jqXHR, textStatus, error ) =>\n\n\t\t\t\t\tthis.display_error( row, error )\n\n\t\t\t\t.always =>\n\n\t\t\t\t\tthis.unblock_ui()\n\n\n\t\t# Cancels/stop editing a payment method.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] event jQuery event object\n\t\tcancel_edit: ( event ) =>\n\n\t\t\tevent.preventDefault()\n\n\t\t\tbutton = $( event.currentTarget )\n\t\t\trow = button.parents( 'tr' )\n\n\t\t\t# check if the method belongs to this plugin\n\t\t\tif row.find( \"input[name=plugin-id][value=#{@slug}]\" ).length is 0\n\t\t\t\treturn\n\n\t\t\trow.find( 'div.view' ).show()\n\t\t\trow.find( 'div.edit' ).hide()\n\t\t\trow.removeClass( 'editing' )\n\n\t\t\t# change the \"Cancel\" button back to \"Edit\"\n\t\t\tbutton.removeClass( 'cancel-edit' ).addClass( 'edit' ).text( @i18n.edit_button ).addClass( 'button' )\n\n\t\t\tthis.disable_editing_ui()\n\n\n\t\t# Sets the page UI to the \"editing\" state.\n\t\t#\n\t\t# This brings proper focus to the method being edited and prevents\n\t\t# other available buttons/actions until the editing is finished or cancelled.\n\t\t#\n\t\t# @since 5.1.1\n\t\tenable_editing_ui: ->\n\n\t\t\t# set the methods table as 'editing'\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).addClass( 'editing' )\n\n\t\t\t# disable the Add Payment Method button\n\t\t\t$( '.button[href*=\"add-payment-method\"]' ).addClass( 'disabled' )\n\n\n\t\t# Sets the page UI back to the default state.\n\t\t#\n\t\t# @since 5.1.1\n\t\tdisable_editing_ui: ->\n\n\t\t\t# removes the methods table's \"editing\" status\n\t\t\t$( \".woocommerce-MyAccount-paymentMethods\" ).removeClass( 'editing' )\n\n\t\t\t# re-enable the Add Payment Method button\n\t\t\t$( '.button[href*=\"add-payment-method\"]' ).removeClass( 'disabled' )\n\n\n\t\t# Blocks the payment methods table UI.\n\t\t#\n\t\t# @since 5.1.0\n\t\tblock_ui: -> $( \".woocommerce-MyAccount-paymentMethods\" ).parent( 'div' ).block( message: null, overlayCSS: background: '#fff', opacity: 0.6 )\n\n\n\t\t# Unblocks the payment methods table UI.\n\t\t#\n\t\t# @since 5.1.0\n\t\tunblock_ui: -> $( \".woocommerce-MyAccount-paymentMethods\" ).parent( 'div' ).unblock()\n\n\n\t\t# Displays an error message to the user.\n\t\t#\n\t\t# @since 5.1.0\n\t\t#\n\t\t# @param [Object] row payment method table row\n\t\t# @param [String] error raw error message\n\t\t# @param [String] message user error message\n\t\tdisplay_error: ( row, error, message = '' ) ->\n\n\t\t\tconsole.error( error )\n\n\t\t\tmessage = @i18n.save_error unless message\n\t\t\tcolumns = $( \".woocommerce-MyAccount-paymentMethods thead tr th\" ).length\n\n\t\t\t$( '| ' + message + ' |
' ).insertAfter( row ).find( 'td' ).delay( 8000 ).slideUp( 200 )\n\n\n\t# dispatch loaded event\n\t$( document.body ).trigger( 'sv_wc_payment_methods_handler_v6_0_0_loaded' )\n"],"names":["jQuery","$","window","SV_WC_Payment_Methods_Handler_v6_0_0","constructor","args","replace_method_column","bind","remove_duplicate_default_marks","edit_method","save_method","cancel_edit","id","slug","i18n","ajax_url","ajax_nonce","on","event1","button","row","currentTarget","parents","find","length","confirm","delete_ays","prop","removeClass","preventDefault","event","hasClass","each","index","element","titleColumn","remove","children","html","hide","show","addClass","text","cancel_button","enable_editing_ui","data","block_ui","next","action","nonce","token_id","val","serialize","post","done","response","success","title","siblings","edit_button","disable_editing_ui","display_error","fail","jqXHR","textStatus","error","always","unblock_ui","parent","block","message","overlayCSS","background","opacity","unblock","columns","console","save_error","insertAfter","delay","slideUp","document","body","trigger","call"],"version":3,"file":"sv-wc-payment-gateway-my-payment-methods.js.map"}
\ No newline at end of file
diff --git a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-payment-form.js b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-payment-form.js
index 843e50a2d..d96ad6c32 100644
--- a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-payment-form.js
+++ b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-payment-form.js
@@ -1,2 +1,2 @@
-(function(){var e=[].indexOf;jQuery(function(t){return window.SV_WC_Payment_Form_Handler_v5_15_12=class{constructor(e){if(this.id=e.id,this.id_dasherized=e.id_dasherized,this.plugin_id=e.plugin_id,this.type=e.type,this.csc_required=e.csc_required,this.csc_required_for_tokens=e.csc_required_for_tokens,this.enabled_card_types=e.enabled_card_types,t("form.checkout").length)this.form=t("form.checkout"),this.handle_checkout_page();else if(t("form#order_review").length)this.form=t("form#order_review"),this.handle_pay_page();else if(t("form#add_payment_method").length)this.form=t("form#add_payment_method"),this.handle_add_payment_method_page();else{console.log("No payment form found!");return}this.params=window.sv_wc_payment_gateway_payment_form_params,"echeck"===this.type&&this.form.on("click",".js-sv-wc-payment-gateway-echeck-form-check-hint, .js-sv-wc-payment-gateway-echeck-form-sample-check",()=>this.handle_sample_check_hint()),t(document).trigger("sv_wc_payment_form_handler_init",{id:this.id,instance:this})}handle_checkout_page(){return"credit-card"===this.type&&t(document.body).on("updated_checkout",()=>this.format_credit_card_inputs()),t(document.body).on("updated_checkout",()=>this.set_payment_fields()),t(document.body).on("updated_checkout",()=>this.handle_saved_payment_methods()),this.form.on(`checkout_place_order_${this.id}`,()=>this.validate_payment_data())}handle_pay_page(){return this.set_payment_fields(),"credit-card"===this.type&&this.format_credit_card_inputs(),this.handle_saved_payment_methods(),this.form.submit(()=>{if(t("#order_review input[name=payment_method]:checked").val()===this.id)return this.validate_payment_data()})}handle_add_payment_method_page(){return this.set_payment_fields(),"credit-card"===this.type&&this.format_credit_card_inputs(),this.form.submit(()=>{if(t("#add_payment_method input[name=payment_method]:checked").val()===this.id)return this.validate_payment_data()})}set_payment_fields(){return this.payment_fields=t(`.payment_method_${this.id}`),this.payment_fields.find(".validate-required .input-text").each((e,a)=>!t(a).val()&&t(a).trigger("input"))}validate_payment_data(){var e,a;return!this.form.is(".processing")&&(this.saved_payment_method_selected=this.payment_fields.find(".js-sv-wc-payment-gateway-payment-token:checked").val(),a="credit-card"===this.type?this.validate_card_data():this.validate_account_data(),e=!1!==t(document.body).triggerHandler("sv_wc_payment_form_valid_payment_data",{payment_form:this,passed_validation:a}),a&&e)}format_credit_card_inputs(){var e,a,r;return e=t(".js-sv-wc-payment-gateway-credit-card-form-account-number").payment("formatCardNumber"),r=t(".js-sv-wc-payment-gateway-credit-card-form-expiry").payment("formatCardExpiry"),a=t(".js-sv-wc-payment-gateway-credit-card-form-csc").payment("formatCardCVC"),e.val()&&e.val().length>0&&e.trigger("change"),r.val()&&r.val().length>0&&r.trigger("change"),a.val()&&a.val().length>0&&a.trigger("change"),t(".js-sv-wc-payment-gateway-credit-card-form-input").on("change paste keyup",()=>this.do_inline_credit_card_validation())}do_inline_credit_card_validation(){var a,r,i,s;return(a=t(".js-sv-wc-payment-gateway-credit-card-form-account-number"),s=t(".js-sv-wc-payment-gateway-credit-card-form-expiry"),i=t(".js-sv-wc-payment-gateway-credit-card-form-csc"),r=t.payment.cardType(a.val()),0>e.call(this.enabled_card_types,r)?a.addClass("invalid-card-type"):a.removeClass("invalid-card-type"),t.payment.validateCardExpiry(s.payment("cardExpiryVal"))?s.addClass("identified"):s.removeClass("identified"),t.payment.validateCardCVC(i.val()))?i.addClass("identified"):i.removeClass("identified")}validate_card_data(){var e,a,r,i;return(r=[],null!=(a=this.payment_fields.find(".js-sv-wc-payment-gateway-credit-card-form-csc").val())&&(a?(/\D/.test(a)&&r.push(this.params.cvv_digits_invalid),(a.length<3||a.length>4)&&r.push(this.params.cvv_length_invalid)):this.csc_required&&(!this.saved_payment_method_selected||this.csc_required_for_tokens)&&r.push(this.params.cvv_missing)),this.saved_payment_method_selected||(e=this.payment_fields.find(".js-sv-wc-payment-gateway-credit-card-form-account-number").val(),i=t.payment.cardExpiryVal(this.payment_fields.find(".js-sv-wc-payment-gateway-credit-card-form-expiry").val()),(e=e.replace(/-|\s/g,""))?((e.length<12||e.length>19)&&r.push(this.params.card_number_length_invalid),/\D/.test(e)&&r.push(this.params.card_number_digits_invalid),t.payment.validateCardNumber(e)||r.push(this.params.card_number_invalid)):r.push(this.params.card_number_missing),t.payment.validateCardExpiry(i)||r.push(this.params.card_exp_date_invalid)),r.length>0)?(this.render_errors(r),!1):(this.payment_fields.find(".js-sv-wc-payment-gateway-credit-card-form-account-number").val(e),!0)}validate_account_data(){var e,t,a;return!!this.saved_payment_method_selected||((t=[],a=this.payment_fields.find(".js-sv-wc-payment-gateway-echeck-form-routing-number").val(),e=this.payment_fields.find(".js-sv-wc-payment-gateway-echeck-form-account-number").val(),a?(9!==a.length&&t.push(this.params.routing_number_length_invalid),/\D/.test(a)&&t.push(this.params.routing_number_digits_invalid)):t.push(this.params.routing_number_missing),e?((e.length<3||e.length>17)&&t.push(this.params.account_number_length_invalid),/\D/.test(e)&&t.push(this.params.account_number_invalid)):t.push(this.params.account_number_missing),t.length>0)?(this.render_errors(t),!1):(this.payment_fields.find(".js-sv-wc-payment-gateway-echeck-form-account-number").val(e),!0))}render_errors(e){return t(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('"),this.form.removeClass("processing").unblock(),this.form.find(".input-text, select").blur(),t("html, body").animate({scrollTop:this.form.offset().top-100},1e3)}handle_saved_payment_methods(){var e,a,r,i;if(i=this.id_dasherized,this.csc_required,r=this.csc_required_for_tokens,e=(a=t(`div.js-wc-${i}-new-payment-method-form`)).find(".js-sv-wc-payment-gateway-credit-card-form-csc").closest(".form-row"),t(`input.js-wc-${this.id_dasherized}-payment-token`).on("change",function(){if(t(`input.js-wc-${i}-payment-token:checked`).val()){if(a.slideUp(200),r)return e.removeClass("form-row-last").addClass("form-row-first"),a.after(e)}else if(a.slideDown(200),r)return e.removeClass("form-row-first").addClass("form-row-last"),a.find(".js-sv-wc-payment-gateway-credit-card-form-expiry").closest(".form-row").after(e)}).change(),t("input#createaccount").on("change",function(){var e;return(e=t(`input.js-wc-${i}-tokenize-payment-method`).closest("p.form-row"),t(this).is(":checked"))?(e.slideDown(),e.next().show()):(e.hide(),e.next().hide())}),!t("input#createaccount").is(":checked"))return t("input#createaccount").change()}handle_sample_check_hint(){var e;return(e=this.payment_fields.find(".js-sv-wc-payment-gateway-echeck-form-sample-check")).is(":visible")?e.slideUp():e.slideDown()}block_ui(){return this.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblock_ui(){return this.form.unblock()}},t(document.body).trigger("sv_wc_payment_form_handler_v5_15_12_loaded")})}).call({});
+(function(){var e=[].indexOf;jQuery(function(t){return window.SV_WC_Payment_Form_Handler_v6_0_0=class{constructor(e){if(this.id=e.id,this.id_dasherized=e.id_dasherized,this.plugin_id=e.plugin_id,this.type=e.type,this.csc_required=e.csc_required,this.csc_required_for_tokens=e.csc_required_for_tokens,this.enabled_card_types=e.enabled_card_types,t("form.checkout").length)this.form=t("form.checkout"),this.handle_checkout_page();else if(t("form#order_review").length)this.form=t("form#order_review"),this.handle_pay_page();else if(t("form#add_payment_method").length)this.form=t("form#add_payment_method"),this.handle_add_payment_method_page();else{console.log("No payment form found!");return}this.params=window.sv_wc_payment_gateway_payment_form_params,"echeck"===this.type&&this.form.on("click",".js-sv-wc-payment-gateway-echeck-form-check-hint, .js-sv-wc-payment-gateway-echeck-form-sample-check",()=>this.handle_sample_check_hint()),t(document).trigger("sv_wc_payment_form_handler_init",{id:this.id,instance:this})}handle_checkout_page(){return"credit-card"===this.type&&t(document.body).on("updated_checkout",()=>this.format_credit_card_inputs()),t(document.body).on("updated_checkout",()=>this.set_payment_fields()),t(document.body).on("updated_checkout",()=>this.handle_saved_payment_methods()),this.form.on(`checkout_place_order_${this.id}`,()=>this.validate_payment_data())}handle_pay_page(){return this.set_payment_fields(),"credit-card"===this.type&&this.format_credit_card_inputs(),this.handle_saved_payment_methods(),this.form.submit(()=>{if(t("#order_review input[name=payment_method]:checked").val()===this.id)return this.validate_payment_data()})}handle_add_payment_method_page(){return this.set_payment_fields(),"credit-card"===this.type&&this.format_credit_card_inputs(),this.form.submit(()=>{if(t("#add_payment_method input[name=payment_method]:checked").val()===this.id)return this.validate_payment_data()})}set_payment_fields(){return this.payment_fields=t(`.payment_method_${this.id}`),this.payment_fields.find(".validate-required .input-text").each((e,a)=>!t(a).val()&&t(a).trigger("input"))}validate_payment_data(){var e,a;return!this.form.is(".processing")&&(this.saved_payment_method_selected=this.payment_fields.find(".js-sv-wc-payment-gateway-payment-token:checked").val(),a="credit-card"===this.type?this.validate_card_data():this.validate_account_data(),e=!1!==t(document.body).triggerHandler("sv_wc_payment_form_valid_payment_data",{payment_form:this,passed_validation:a}),a&&e)}format_credit_card_inputs(){var e,a,r;return e=t(".js-sv-wc-payment-gateway-credit-card-form-account-number").payment("formatCardNumber"),r=t(".js-sv-wc-payment-gateway-credit-card-form-expiry").payment("formatCardExpiry"),a=t(".js-sv-wc-payment-gateway-credit-card-form-csc").payment("formatCardCVC"),e.val()&&e.val().length>0&&e.trigger("change"),r.val()&&r.val().length>0&&r.trigger("change"),a.val()&&a.val().length>0&&a.trigger("change"),t(".js-sv-wc-payment-gateway-credit-card-form-input").on("change paste keyup",()=>this.do_inline_credit_card_validation())}do_inline_credit_card_validation(){var a,r,i,s;return(a=t(".js-sv-wc-payment-gateway-credit-card-form-account-number"),s=t(".js-sv-wc-payment-gateway-credit-card-form-expiry"),i=t(".js-sv-wc-payment-gateway-credit-card-form-csc"),r=t.payment.cardType(a.val()),0>e.call(this.enabled_card_types,r)?a.addClass("invalid-card-type"):a.removeClass("invalid-card-type"),t.payment.validateCardExpiry(s.payment("cardExpiryVal"))?s.addClass("identified"):s.removeClass("identified"),t.payment.validateCardCVC(i.val()))?i.addClass("identified"):i.removeClass("identified")}validate_card_data(){var e,a,r,i;return(r=[],null!=(a=this.payment_fields.find(".js-sv-wc-payment-gateway-credit-card-form-csc").val())&&(a?(/\D/.test(a)&&r.push(this.params.cvv_digits_invalid),(a.length<3||a.length>4)&&r.push(this.params.cvv_length_invalid)):this.csc_required&&(!this.saved_payment_method_selected||this.csc_required_for_tokens)&&r.push(this.params.cvv_missing)),this.saved_payment_method_selected||(e=this.payment_fields.find(".js-sv-wc-payment-gateway-credit-card-form-account-number").val(),i=t.payment.cardExpiryVal(this.payment_fields.find(".js-sv-wc-payment-gateway-credit-card-form-expiry").val()),(e=e.replace(/-|\s/g,""))?((e.length<12||e.length>19)&&r.push(this.params.card_number_length_invalid),/\D/.test(e)&&r.push(this.params.card_number_digits_invalid),t.payment.validateCardNumber(e)||r.push(this.params.card_number_invalid)):r.push(this.params.card_number_missing),t.payment.validateCardExpiry(i)||r.push(this.params.card_exp_date_invalid)),r.length>0)?(this.render_errors(r),!1):(this.payment_fields.find(".js-sv-wc-payment-gateway-credit-card-form-account-number").val(e),!0)}validate_account_data(){var e,t,a;return!!this.saved_payment_method_selected||((t=[],a=this.payment_fields.find(".js-sv-wc-payment-gateway-echeck-form-routing-number").val(),e=this.payment_fields.find(".js-sv-wc-payment-gateway-echeck-form-account-number").val(),a?(9!==a.length&&t.push(this.params.routing_number_length_invalid),/\D/.test(a)&&t.push(this.params.routing_number_digits_invalid)):t.push(this.params.routing_number_missing),e?((e.length<3||e.length>17)&&t.push(this.params.account_number_length_invalid),/\D/.test(e)&&t.push(this.params.account_number_invalid)):t.push(this.params.account_number_missing),t.length>0)?(this.render_errors(t),!1):(this.payment_fields.find(".js-sv-wc-payment-gateway-echeck-form-account-number").val(e),!0))}render_errors(e){return t(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('"),this.form.removeClass("processing").unblock(),this.form.find(".input-text, select").blur(),t("html, body").animate({scrollTop:this.form.offset().top-100},1e3)}handle_saved_payment_methods(){var e,a,r,i;if(i=this.id_dasherized,this.csc_required,r=this.csc_required_for_tokens,e=(a=t(`div.js-wc-${i}-new-payment-method-form`)).find(".js-sv-wc-payment-gateway-credit-card-form-csc").closest(".form-row"),t(`input.js-wc-${this.id_dasherized}-payment-token`).on("change",function(){if(t(`input.js-wc-${i}-payment-token:checked`).val()){if(a.slideUp(200),r)return e.removeClass("form-row-last").addClass("form-row-first"),a.after(e)}else if(a.slideDown(200),r)return e.removeClass("form-row-first").addClass("form-row-last"),a.find(".js-sv-wc-payment-gateway-credit-card-form-expiry").closest(".form-row").after(e)}).change(),t("input#createaccount").on("change",function(){var e;return(e=t(`input.js-wc-${i}-tokenize-payment-method`).closest("p.form-row"),t(this).is(":checked"))?(e.slideDown(),e.next().show()):(e.hide(),e.next().hide())}),!t("input#createaccount").is(":checked"))return t("input#createaccount").change()}handle_sample_check_hint(){var e;return(e=this.payment_fields.find(".js-sv-wc-payment-gateway-echeck-form-sample-check")).is(":visible")?e.slideUp():e.slideDown()}block_ui(){return this.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}unblock_ui(){return this.form.unblock()}},t(document.body).trigger("sv_wc_payment_form_handler_v6_0_0_loaded")})}).call({});
//# sourceMappingURL=sv-wc-payment-gateway-payment-form.js.map
diff --git a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-payment-form.js.map b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-payment-form.js.map
index 0d1a3de58..481cd93bf 100644
--- a/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-payment-form.js.map
+++ b/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-payment-form.js.map
@@ -1 +1 @@
-{"mappings":"ACOG,CAAA,WAAA,IAAA,EAAA,EAAA,CAAA,OAAA,CACH,OAAO,SAAE,CAAF,EA2XN,OAvXM,OAAO,mCAAA,CAAb,MAaC,YAAc,CAAD,CAAb,CAWC,GATA,IAAC,CAAA,EAAD,CAA2B,EAAK,EAAhC,CACA,IAAC,CAAA,aAAD,CAA2B,EAAK,aAAhC,CACA,IAAC,CAAA,SAAD,CAA2B,EAAK,SAAhC,CACA,IAAC,CAAA,IAAD,CAA2B,EAAK,IAAhC,CACA,IAAC,CAAA,YAAD,CAA2B,EAAK,YAAhC,CACA,IAAC,CAAA,uBAAD,CAA2B,EAAK,uBAAhC,CACA,IAAC,CAAA,kBAAD,CAA2B,EAAK,kBAAA,CAG7B,EAAG,iBAAkB,MAAxB,CACC,IAAC,CAAA,IAAD,CAAQ,EAAG,iBACX,IAAI,CAAC,oBAAL,QAEI,GAAG,EAAG,qBAAsB,MAA5B,CACJ,IAAC,CAAA,IAAD,CAAQ,EAAG,qBACX,IAAI,CAAC,eAAL,QAEI,GAAG,EAAG,2BAA4B,MAAlC,CACJ,IAAC,CAAA,IAAD,CAAQ,EAAG,2BACX,IAAI,CAAC,8BAAL,OAFI,CAKJ,QAAQ,GAAR,CAAa,0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A3C,CAAqD,iBACrD,EAA8B,IAA9B,CAAoC,qDAAsD,OAA1F,CAAmG,aAAc,KAAjH,CAAwH,EArBzD,GAsBjE,MAtBD,GA0BA,EAAG,uBAAwB,EAA3B,CAA8B,SAAU,WAC3C,IAAA,QAEI,CAFA,EAAc,EAAG,CAAA,YAAA,EAAgB,EAAhB,wBAAA,CAAH,EAA8D,OAA9D,CAAuE,cAElF,EAAG,IAAH,EAAU,EAAV,CAAc,cAChB,EAAY,SAAZ,GACA,EAAY,IAAZ,GAAmB,IAAnB,KAEA,EAAY,IAAZ,GACA,EAAY,IAAZ,GAAmB,IAAnB,GARsC,GAUxC,CAA2C,EAAG,uBAAwB,EAA3B,CAA+B,YAA1E,OAAA,EAAG,uBAAwB,MAA3B,EAhD6B,CAsD9B,0BAAA,CAEF,IAAA,QAEG,AAAG,AAFH,CAAA,EAAgB,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAsB,qDAAtC,EAEiB,EAAd,CAAkB,YAAkB,EAAc,OAAd,GAA6B,EAAc,SAAd,EAJ3C,CAW1B,UAAA,CAAa,OAAA,IAAC,CAAA,IAAI,CAAC,KAAN,CAAa,CAAA,QAAS,KAAM,WAAY,CAAA,WAAY,OAAO,QAAS,EAA5B,CAA3B,EAAhB,CAMV,YAAA,CAAe,OAAA,IAAC,CAAA,IAAI,CAAC,OAAN,EAAH,CAnXb,EAuXA,EAAG,SAAS,IAAZ,EAAmB,OAAnB,CAA4B,6CA3XtB,E,C,E,I,C,C","sources":["","woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.coffee"],"sourcesContent":["(() => {\nvar $a2c1c221aac1d794$exports = {};\n(function() {\n /*\n WooCommerce SkyVerge Payment Gateway Framework Payment Form CoffeeScript\n Version 4.3.0\n\n Copyright (c) 2014-2024, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n */ var indexOf = [].indexOf;\n jQuery(function($) {\n \"use strict\";\n window.SV_WC_Payment_Form_Handler_v5_15_12 = class SV_WC_Payment_Form_Handler_v5_15_12 {\n // Public: Instantiate Payment Form Handler\n // args - object with properties:\n // id - gateway ID\n // id_dasherized - gateway ID dasherized\n // plugin_id - plugin ID\n // type - gateway type, either `credit-card` or `echeck`\n // csc_required - true if the gateway requires the CSC field to be displayed\n // Returns SV_WC_Payment_Form_Handler_v5_15_12 instance\n constructor(args){\n this.id = args.id;\n this.id_dasherized = args.id_dasherized;\n this.plugin_id = args.plugin_id;\n this.type = args.type;\n this.csc_required = args.csc_required;\n this.csc_required_for_tokens = args.csc_required_for_tokens;\n this.enabled_card_types = args.enabled_card_types;\n // which payment form?\n if ($('form.checkout').length) {\n this.form = $('form.checkout');\n this.handle_checkout_page();\n } else if ($('form#order_review').length) {\n this.form = $('form#order_review');\n this.handle_pay_page();\n } else if ($('form#add_payment_method').length) {\n this.form = $('form#add_payment_method');\n this.handle_add_payment_method_page();\n } else {\n console.log('No payment form found!');\n return;\n }\n // localized error messages\n this.params = window[\"sv_wc_payment_gateway_payment_form_params\"];\n if (this.type === 'echeck') // handle sample check image hint\n this.form.on('click', '.js-sv-wc-payment-gateway-echeck-form-check-hint, .js-sv-wc-payment-gateway-echeck-form-sample-check', ()=>{\n return this.handle_sample_check_hint();\n });\n $(document).trigger('sv_wc_payment_form_handler_init', {\n id: this.id,\n instance: this\n });\n }\n // Public: Handle required actions on the checkout page\n // Returns nothing.\n handle_checkout_page() {\n if (this.type === 'credit-card') // format/validate credit card inputs using jQuery.payment\n $(document.body).on('updated_checkout', ()=>{\n return this.format_credit_card_inputs();\n });\n // updated payment fields jQuery object on each checkout update (prevents stale data)\n $(document.body).on('updated_checkout', ()=>{\n return this.set_payment_fields();\n });\n // handle saved payment methods\n // note on the checkout page, this is bound to `updated_checkout` so it\n // fires even when other parts of the checkout are changed\n $(document.body).on('updated_checkout', ()=>{\n return this.handle_saved_payment_methods();\n });\n // validate payment data before order is submitted\n return this.form.on(`checkout_place_order_${this.id}`, ()=>{\n return this.validate_payment_data();\n });\n }\n // Public: Handle required actions on the Order > Pay page\n // Returns nothing.\n handle_pay_page() {\n this.set_payment_fields();\n // format/validate credit card inputs using jQuery.payment\n if (this.type === 'credit-card') this.format_credit_card_inputs();\n // handle saved payment methods\n this.handle_saved_payment_methods();\n // validate payment data before order is submitted\n return this.form.submit(()=>{\n if ($('#order_review input[name=payment_method]:checked').val() === this.id) // but only when one of our payment gateways is selected\n return this.validate_payment_data();\n });\n }\n // Public: Handle required actions on the Add Payment Method page\n // Returns nothing.\n handle_add_payment_method_page() {\n this.set_payment_fields();\n // format/validate credit card inputs using jQuery.payment\n if (this.type === 'credit-card') this.format_credit_card_inputs();\n // validate payment data before order is submitted\n return this.form.submit(()=>{\n if ($('#add_payment_method input[name=payment_method]:checked').val() === this.id) // but only when one of our payment gateways is selected\n return this.validate_payment_data();\n });\n }\n // Public: Set payment fields class variable, this is done\n // during the updated_checkout event as otherwise the reference to\n // the checkout fields becomes stale (somehow ¯\\_(ツ)_/¯)\n // This ensures payment fields are not marked as \"invalid\" before the customer has interacted with them.\n // Returns nothing.\n set_payment_fields() {\n var $required_fields;\n this.payment_fields = $(`.payment_method_${this.id}`);\n $required_fields = this.payment_fields.find('.validate-required .input-text');\n return $required_fields.each((i, input)=>{\n // if any of the required fields have a value, bail this loop and proceed with WooCommerce validation\n if ($(input).val()) return false;\n // otherwise remove all validation result classes from the inputs, since the form is freshly loaded\n return $(input).trigger('input');\n });\n }\n // Public: Validate Payment data when order is placed\n // Returns boolean, true if payment data is valid, false otherwise\n validate_payment_data() {\n var handler, valid;\n if (this.form.is('.processing')) // bail when already processing\n return false;\n this.saved_payment_method_selected = this.payment_fields.find('.js-sv-wc-payment-gateway-payment-token:checked').val();\n // perform internal validations (all fields present & valid, etc)\n valid = this.type === 'credit-card' ? this.validate_card_data() : this.validate_account_data();\n // let gateways perform their own validation prior to form submission\n handler = $(document.body).triggerHandler('sv_wc_payment_form_valid_payment_data', {\n payment_form: this,\n passed_validation: valid\n }) !== false;\n return valid && handler;\n }\n // Public: format card data using jQuery.Payment\n // Returns nothing.\n format_credit_card_inputs() {\n var $card_number, $csc, $expiry;\n $card_number = $('.js-sv-wc-payment-gateway-credit-card-form-account-number').payment('formatCardNumber');\n $expiry = $('.js-sv-wc-payment-gateway-credit-card-form-expiry').payment('formatCardExpiry');\n $csc = $('.js-sv-wc-payment-gateway-credit-card-form-csc').payment('formatCardCVC');\n if ($card_number.val() && $card_number.val().length > 0) $card_number.trigger('change');\n if ($expiry.val() && $expiry.val().length > 0) $expiry.trigger('change');\n if ($csc.val() && $csc.val().length > 0) $csc.trigger('change');\n // perform inline validation on credit card inputs\n return $('.js-sv-wc-payment-gateway-credit-card-form-input').on('change paste keyup', ()=>{\n return this.do_inline_credit_card_validation();\n });\n }\n // Public: perform inline validation on credit card fields\n // Returns nothing.\n do_inline_credit_card_validation() {\n var $card_number, $card_type, $csc, $expiry;\n $card_number = $('.js-sv-wc-payment-gateway-credit-card-form-account-number');\n $expiry = $('.js-sv-wc-payment-gateway-credit-card-form-expiry');\n $csc = $('.js-sv-wc-payment-gateway-credit-card-form-csc');\n $card_type = $.payment.cardType($card_number.val());\n if (indexOf.call(this.enabled_card_types, $card_type) < 0) $card_number.addClass('invalid-card-type');\n else $card_number.removeClass('invalid-card-type');\n if ($.payment.validateCardExpiry($expiry.payment('cardExpiryVal'))) $expiry.addClass('identified');\n else $expiry.removeClass('identified');\n if ($.payment.validateCardCVC($csc.val())) return $csc.addClass('identified');\n else return $csc.removeClass('identified');\n }\n // Public: Perform validation on the credit card info entered\n // Return boolean, true if credit card info is valid, false otherwise\n validate_card_data() {\n var account_number, csc, errors, expiry;\n errors = [];\n csc = this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-csc').val();\n // always validate the CSC if present\n if (csc != null) {\n if (csc) {\n if (/\\D/.test(csc)) errors.push(this.params.cvv_digits_invalid);\n if (csc.length < 3 || csc.length > 4) errors.push(this.params.cvv_length_invalid);\n } else if (this.csc_required) {\n if (!this.saved_payment_method_selected || this.csc_required_for_tokens) errors.push(this.params.cvv_missing);\n }\n }\n // Only validate the other CC fields if necessary\n if (!this.saved_payment_method_selected) {\n account_number = this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-account-number').val();\n expiry = $.payment.cardExpiryVal(this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-expiry').val());\n // replace any dashes or spaces in the card number\n account_number = account_number.replace(/-|\\s/g, '');\n // validate card number\n if (!account_number) errors.push(this.params.card_number_missing);\n else {\n if (account_number.length < 12 || account_number.length > 19) errors.push(this.params.card_number_length_invalid);\n if (/\\D/.test(account_number)) errors.push(this.params.card_number_digits_invalid);\n if (!$.payment.validateCardNumber(account_number)) errors.push(this.params.card_number_invalid);\n }\n if (!$.payment.validateCardExpiry(expiry)) // validate expiration date\n errors.push(this.params.card_exp_date_invalid);\n }\n if (errors.length > 0) {\n this.render_errors(errors);\n return false;\n } else {\n // get rid of any space/dash characters\n this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-account-number').val(account_number);\n return true;\n }\n }\n // Public: Perform validation on the eCheck info entered\n // Return boolean, true if eCheck info is valid, false otherwise\n validate_account_data() {\n var account_number, errors, routing_number;\n if (this.saved_payment_method_selected) return true;\n errors = [];\n routing_number = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-routing-number').val();\n account_number = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val();\n // validate routing number\n if (!routing_number) errors.push(this.params.routing_number_missing);\n else {\n if (9 !== routing_number.length) errors.push(this.params.routing_number_length_invalid);\n if (/\\D/.test(routing_number)) errors.push(this.params.routing_number_digits_invalid);\n }\n // validate account number\n if (!account_number) errors.push(this.params.account_number_missing);\n else {\n if (account_number.length < 3 || account_number.length > 17) errors.push(this.params.account_number_length_invalid);\n if (/\\D/.test(account_number)) errors.push(this.params.account_number_invalid);\n }\n if (errors.length > 0) {\n this.render_errors(errors);\n return false;\n } else {\n // get rid of any space/dash characters\n this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val(account_number);\n return true;\n }\n }\n // Public: Render any new errors and bring them into the viewport\n // Returns nothing.\n render_errors(errors) {\n // hide and remove any previous errors\n $('.woocommerce-error, .woocommerce-message').remove();\n // add errors\n this.form.prepend('');\n // unblock UI\n this.form.removeClass('processing').unblock();\n this.form.find('.input-text, select').blur();\n // scroll to top\n return $('html, body').animate({\n scrollTop: this.form.offset().top - 100\n }, 1000);\n }\n // Public: Handle associated actions for saved payment methods\n // Returns nothing.\n handle_saved_payment_methods() {\n var $csc_field, $new_payment_method_selection, csc_required, csc_required_for_tokens, id_dasherized;\n // make available inside change events\n id_dasherized = this.id_dasherized;\n csc_required = this.csc_required;\n csc_required_for_tokens = this.csc_required_for_tokens;\n $new_payment_method_selection = $(`div.js-wc-${id_dasherized}-new-payment-method-form`);\n $csc_field = $new_payment_method_selection.find('.js-sv-wc-payment-gateway-credit-card-form-csc').closest('.form-row');\n // show/hide the saved payment methods when a saved payment method is de-selected/selected\n $(`input.js-wc-${this.id_dasherized}-payment-token`).on('change', function() {\n var tokenized_payment_method_selected;\n tokenized_payment_method_selected = $(`input.js-wc-${id_dasherized}-payment-token:checked`).val();\n if (tokenized_payment_method_selected) {\n // using an existing tokenized payment method, hide the 'new method' fields\n $new_payment_method_selection.slideUp(200);\n // move the CSC field out of the 'new method' fields so it can be used with the tokenized transaction\n if (csc_required_for_tokens) {\n $csc_field.removeClass('form-row-last').addClass('form-row-first');\n return $new_payment_method_selection.after($csc_field);\n }\n } else {\n // use new payment method, display the 'new method' fields\n $new_payment_method_selection.slideDown(200);\n // move the CSC field back into its regular spot\n if (csc_required_for_tokens) {\n $csc_field.removeClass('form-row-first').addClass('form-row-last');\n return $new_payment_method_selection.find('.js-sv-wc-payment-gateway-credit-card-form-expiry').closest('.form-row').after($csc_field);\n }\n }\n }).change();\n // display the 'save payment method' option for guest checkouts if the 'create account' option is checked\n // but only hide the input if there is a 'create account' checkbox (some themes just display the password)\n $('input#createaccount').on('change', function() {\n var $parent_row;\n $parent_row = $(`input.js-wc-${id_dasherized}-tokenize-payment-method`).closest('p.form-row');\n if ($(this).is(':checked')) {\n $parent_row.slideDown();\n return $parent_row.next().show();\n } else {\n $parent_row.hide();\n return $parent_row.next().hide();\n }\n });\n if (!$('input#createaccount').is(':checked')) return $('input#createaccount').change();\n }\n // Public: Handle showing/hiding the sample check image\n // Returns nothing.\n handle_sample_check_hint() {\n var $sample_check;\n $sample_check = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-sample-check');\n if ($sample_check.is(\":visible\")) return $sample_check.slideUp();\n else return $sample_check.slideDown();\n }\n // Blocks the payment form UI\n // @since 3.0.0\n block_ui() {\n return this.form.block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n // Unblocks the payment form UI\n // @since 3.0.0\n unblock_ui() {\n return this.form.unblock();\n }\n };\n // dispatch loaded event\n return $(document.body).trigger(\"sv_wc_payment_form_handler_v5_15_12_loaded\");\n });\n}).call($a2c1c221aac1d794$exports);\n\n})();\n//# sourceMappingURL=sv-wc-payment-gateway-payment-form.js.map\n","###\n WooCommerce SkyVerge Payment Gateway Framework Payment Form CoffeeScript\n Version 4.3.0\n\n Copyright (c) 2014-2024, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n###\njQuery ( $ ) ->\n\t\"use strict\"\n\n\n\tclass window.SV_WC_Payment_Form_Handler_v5_15_12\n\n\n\t\t# Public: Instantiate Payment Form Handler\n\t\t#\n\t\t# args - object with properties:\n\t\t# id - gateway ID\n\t\t# id_dasherized - gateway ID dasherized\n\t\t# plugin_id - plugin ID\n\t\t# type - gateway type, either `credit-card` or `echeck`\n\t\t# csc_required - true if the gateway requires the CSC field to be displayed\n\t\t#\n\t\t# Returns SV_WC_Payment_Form_Handler_v5_15_12 instance\n\t\tconstructor: (args) ->\n\n\t\t\t@id = args.id\n\t\t\t@id_dasherized = args.id_dasherized\n\t\t\t@plugin_id = args.plugin_id\n\t\t\t@type = args.type\n\t\t\t@csc_required = args.csc_required\n\t\t\t@csc_required_for_tokens = args.csc_required_for_tokens\n\t\t\t@enabled_card_types = args.enabled_card_types\n\n\t\t\t# which payment form?\n\t\t\tif $( 'form.checkout' ).length\n\t\t\t\t@form = $( 'form.checkout' )\n\t\t\t\tthis.handle_checkout_page()\n\n\t\t\telse if $( 'form#order_review' ).length\n\t\t\t\t@form = $( 'form#order_review' )\n\t\t\t\tthis.handle_pay_page()\n\n\t\t\telse if $( 'form#add_payment_method' ).length\n\t\t\t\t@form = $( 'form#add_payment_method' )\n\t\t\t\tthis.handle_add_payment_method_page()\n\n\t\t\telse\n\t\t\t\tconsole.log( 'No payment form found!' )\n\t\t\t\treturn\n\n\t\t\t# localized error messages\n\t\t\t@params = window[ \"sv_wc_payment_gateway_payment_form_params\" ]\n\n\t\t\t# handle sample check image hint\n\t\t\t@form.on( 'click', '.js-sv-wc-payment-gateway-echeck-form-check-hint, .js-sv-wc-payment-gateway-echeck-form-sample-check', => this.handle_sample_check_hint() ) if @type is 'echeck'\n\n\t\t\t$( document ).trigger( 'sv_wc_payment_form_handler_init', { id: @id, instance: @ } )\n\n\n\t\t# Public: Handle required actions on the checkout page\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_checkout_page: ->\n\n\t\t\t# format/validate credit card inputs using jQuery.payment\n\t\t\t$( document.body ).on( 'updated_checkout', => this.format_credit_card_inputs() ) if @type is 'credit-card'\n\n\t\t\t# updated payment fields jQuery object on each checkout update (prevents stale data)\n\t\t\t$( document.body ).on( 'updated_checkout', => this.set_payment_fields() )\n\n\t\t\t# handle saved payment methods\n\t\t\t# note on the checkout page, this is bound to `updated_checkout` so it\n\t\t\t# fires even when other parts of the checkout are changed\n\t\t\t$( document.body ).on( 'updated_checkout', => this.handle_saved_payment_methods() )\n\n\t\t\t# validate payment data before order is submitted\n\t\t\t@form.on( \"checkout_place_order_#{ @id }\", => this.validate_payment_data() )\n\n\n\t\t# Public: Handle required actions on the Order > Pay page\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_pay_page: ->\n\n\t\t\tthis.set_payment_fields()\n\n\t\t\t# format/validate credit card inputs using jQuery.payment\n\t\t\tif @type is 'credit-card'\n\t\t\t\tthis.format_credit_card_inputs()\n\n\t\t\t# handle saved payment methods\n\t\t\tthis.handle_saved_payment_methods()\n\n\t\t\t# validate payment data before order is submitted\n\t\t\t@form.submit =>\n\n\t\t\t\t# but only when one of our payment gateways is selected\n\t\t\t\treturn this.validate_payment_data() if $( '#order_review input[name=payment_method]:checked' ).val() is @id\n\n\n\t\t# Public: Handle required actions on the Add Payment Method page\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_add_payment_method_page: ->\n\n\t\t\tthis.set_payment_fields()\n\n\t\t\t# format/validate credit card inputs using jQuery.payment\n\t\t\tif @type is 'credit-card'\n\t\t\t\tthis.format_credit_card_inputs()\n\n\t\t\t# validate payment data before order is submitted\n\t\t\t@form.submit =>\n\n\t\t\t\t# but only when one of our payment gateways is selected\n\t\t\t\treturn this.validate_payment_data() if $( '#add_payment_method input[name=payment_method]:checked' ).val() is @id\n\n\n\t\t# Public: Set payment fields class variable, this is done\n\t\t# during the updated_checkout event as otherwise the reference to\n\t\t# the checkout fields becomes stale (somehow ¯\\_(ツ)_/¯)\n\t\t#\n\t\t# This ensures payment fields are not marked as \"invalid\" before the customer has interacted with them.\n\t\t#\n\t\t# Returns nothing.\n\t\tset_payment_fields: ->\n\n\t\t\t@payment_fields = $( \".payment_method_#{ @id }\" )\n\n\t\t\t$required_fields = @payment_fields.find( '.validate-required .input-text' )\n\n\t\t\t$required_fields.each( ( i, input ) =>\n\n\t\t\t\t# if any of the required fields have a value, bail this loop and proceed with WooCommerce validation\n\t\t\t\tif $( input ).val()\n\t\t\t\t\treturn false\n\n\t\t\t\t# otherwise remove all validation result classes from the inputs, since the form is freshly loaded\n\t\t\t\t$( input ).trigger( 'input' )\n\t\t\t)\n\n\n\t\t# Public: Validate Payment data when order is placed\n\t\t#\n\t\t# Returns boolean, true if payment data is valid, false otherwise\n\t\tvalidate_payment_data: ->\n\n\t\t\t# bail when already processing\n\t\t\treturn false if @form.is( '.processing' )\n\n\t\t\t@saved_payment_method_selected = @payment_fields.find( '.js-sv-wc-payment-gateway-payment-token:checked' ).val()\n\n\t\t\t# perform internal validations (all fields present & valid, etc)\n\t\t\tvalid = if @type is 'credit-card' then this.validate_card_data() else this.validate_account_data()\n\n\t\t\t# let gateways perform their own validation prior to form submission\n\t\t\thandler = $( document.body ).triggerHandler( 'sv_wc_payment_form_valid_payment_data', { payment_form: this, passed_validation: valid } ) isnt false\n\n\t\t\treturn valid && handler\n\n\n\t\t# Public: format card data using jQuery.Payment\n\t\t#\n\t\t# Returns nothing.\n\t\tformat_credit_card_inputs: ->\n\t\t\t$card_number = $('.js-sv-wc-payment-gateway-credit-card-form-account-number').payment('formatCardNumber');\n\t\t\t$expiry = $('.js-sv-wc-payment-gateway-credit-card-form-expiry').payment('formatCardExpiry');\n\t\t\t$csc = $('.js-sv-wc-payment-gateway-credit-card-form-csc').payment('formatCardCVC');\n\n\t\t\t# trigger a 'change' event for non empty fields only\n\t\t\t$card_number.trigger( 'change') if $card_number.val() && $card_number.val().length > 0\n\t\t\t$expiry.trigger( 'change') if $expiry.val() && $expiry.val().length > 0\n\t\t\t$csc.trigger( 'change') if $csc.val() && $csc.val().length > 0\n\n\t\t\t# perform inline validation on credit card inputs\n\t\t\t$( '.js-sv-wc-payment-gateway-credit-card-form-input' ).on( 'change paste keyup', => this.do_inline_credit_card_validation() )\n\n\n\t\t# Public: perform inline validation on credit card fields\n\t\t#\n\t\t# Returns nothing.\n\t\tdo_inline_credit_card_validation: ->\n\n\t\t\t$card_number = $( '.js-sv-wc-payment-gateway-credit-card-form-account-number' )\n\t\t\t$expiry = $( '.js-sv-wc-payment-gateway-credit-card-form-expiry' )\n\t\t\t$csc = $( '.js-sv-wc-payment-gateway-credit-card-form-csc' )\n\n\t\t\t$card_type = $.payment.cardType( $card_number.val() )\n\n\t\t\tif $card_type not in @enabled_card_types\n\t\t\t\t$card_number.addClass( 'invalid-card-type' )\n\t\t\telse\n\t\t\t\t$card_number.removeClass( 'invalid-card-type' )\n\n\t\t\tif $.payment.validateCardExpiry( $expiry.payment( 'cardExpiryVal' ) )\n\t\t\t\t$expiry.addClass( 'identified' )\n\t\t\telse\n\t\t\t\t$expiry.removeClass( 'identified' )\n\n\t\t\tif $.payment.validateCardCVC( $csc.val() )\n\t\t\t\t$csc.addClass( 'identified' )\n\t\t\telse\n\t\t\t\t$csc.removeClass( 'identified' )\n\n\n\t\t# Public: Perform validation on the credit card info entered\n\t\t#\n\t\t# Return boolean, true if credit card info is valid, false otherwise\n\t\tvalidate_card_data: ->\n\n\t\t\terrors = []\n\n\t\t\tcsc = @payment_fields.find( '.js-sv-wc-payment-gateway-credit-card-form-csc' ).val()\n\n\t\t\t# always validate the CSC if present\n\t\t\tif csc?\n\n\t\t\t\tif csc\n\t\t\t\t\terrors.push( @params.cvv_digits_invalid ) if /\\D/.test( csc )\n\t\t\t\t\terrors.push( @params.cvv_length_invalid ) if csc.length < 3 || csc.length > 4\n\t\t\t\telse if @csc_required\n\t\t\t\t\tif not @saved_payment_method_selected or @csc_required_for_tokens\n\t\t\t\t\t\terrors.push( @params.cvv_missing )\n\n\t\t\t# Only validate the other CC fields if necessary\n\t\t\tif not @saved_payment_method_selected\n\n\t\t\t\taccount_number = @payment_fields.find( '.js-sv-wc-payment-gateway-credit-card-form-account-number' ).val()\n\t\t\t\texpiry = $.payment.cardExpiryVal( @payment_fields.find( '.js-sv-wc-payment-gateway-credit-card-form-expiry' ).val() )\n\n\t\t\t\t# replace any dashes or spaces in the card number\n\t\t\t\taccount_number = account_number.replace( /-|\\s/g, '' )\n\n\t\t\t\t# validate card number\n\t\t\t\tif not account_number\n\t\t\t\t\terrors.push( @params.card_number_missing )\n\t\t\t\telse\n\t\t\t\t\terrors.push( @params.card_number_length_invalid ) if account_number.length < 12 || account_number.length > 19\n\t\t\t\t\terrors.push( @params.card_number_digits_invalid ) if /\\D/.test( account_number )\n\t\t\t\t\terrors.push( @params.card_number_invalid ) unless $.payment.validateCardNumber( account_number ) # performs luhn check\n\n\t\t\t\t# validate expiration date\n\t\t\t\terrors.push( @params.card_exp_date_invalid ) unless $.payment.validateCardExpiry( expiry ) # validates future date\n\n\t\t\tif errors.length > 0\n\t\t\t\tthis.render_errors( errors )\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\t# get rid of any space/dash characters\n\t\t\t\t@payment_fields.find( '.js-sv-wc-payment-gateway-credit-card-form-account-number' ).val( account_number )\n\t\t\t\treturn true\n\n\n\t\t# Public: Perform validation on the eCheck info entered\n\t\t#\n\t\t# Return boolean, true if eCheck info is valid, false otherwise\n\t\tvalidate_account_data: ->\n\n\t\t\treturn true if @saved_payment_method_selected\n\n\t\t\terrors = []\n\n\t\t\trouting_number = @payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-routing-number').val()\n\t\t\taccount_number = @payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val()\n\n\t\t\t# validate routing number\n\t\t\tif not routing_number\n\t\t\t\terrors.push( @params.routing_number_missing )\n\t\t\telse\n\t\t\t\terrors.push( @params.routing_number_length_invalid ) if 9 != routing_number.length\n\t\t\t\terrors.push( @params.routing_number_digits_invalid ) if /\\D/.test( routing_number )\n\n\t\t\t# validate account number\n\t\t\tif not account_number\n\t\t\t\terrors.push( @params.account_number_missing )\n\t\t\telse\n\t\t\t\terrors.push( @params.account_number_length_invalid ) if account_number.length < 3 || account_number.length > 17\n\t\t\t\terrors.push( @params.account_number_invalid ) if /\\D/.test( account_number )\n\n\t\t\tif errors.length > 0\n\t\t\t\tthis.render_errors( errors )\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\t# get rid of any space/dash characters\n\t\t\t\t@payment_fields.find( '.js-sv-wc-payment-gateway-echeck-form-account-number' ).val( account_number )\n\t\t\t\treturn true\n\n\n\t\t# Public: Render any new errors and bring them into the viewport\n\t\t#\n\t\t# Returns nothing.\n\t\trender_errors: (errors) ->\n\n\t\t\t# hide and remove any previous errors\n\t\t\t$( '.woocommerce-error, .woocommerce-message' ).remove()\n\n\t\t\t# add errors\n\t\t\t@form.prepend '- ' + errors.join( '
- ' ) + '
'\n\n\t\t\t# unblock UI\n\t\t\t@form.removeClass( 'processing' ).unblock()\n\t\t\t@form.find( '.input-text, select' ).blur()\n\n\t\t\t# scroll to top\n\t\t\t$( 'html, body' ).animate( { scrollTop: @form.offset().top - 100 }, 1000 )\n\n\n\t\t# Public: Handle associated actions for saved payment methods\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_saved_payment_methods: ->\n\n\t\t\t# make available inside change events\n\t\t\tid_dasherized = @id_dasherized\n\n\t\t\tcsc_required = @csc_required\n\t\t\tcsc_required_for_tokens = @csc_required_for_tokens\n\n\t\t\t$new_payment_method_selection = $( \"div.js-wc-#{ id_dasherized }-new-payment-method-form\" )\n\t\t\t$csc_field = $new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-csc' ).closest( '.form-row' )\n\n\t\t\t# show/hide the saved payment methods when a saved payment method is de-selected/selected\n\t\t\t$( \"input.js-wc-#{ @id_dasherized }-payment-token\" ).on 'change', ->\n\n\t\t\t\ttokenized_payment_method_selected = $( \"input.js-wc-#{ id_dasherized }-payment-token:checked\" ).val()\n\n\t\t\t\tif tokenized_payment_method_selected\n\n\t\t\t\t\t# using an existing tokenized payment method, hide the 'new method' fields\n\t\t\t\t\t$new_payment_method_selection.slideUp( 200 )\n\n\t\t\t\t\t# move the CSC field out of the 'new method' fields so it can be used with the tokenized transaction\n\t\t\t\t\tif csc_required_for_tokens\n\t\t\t\t\t\t$csc_field.removeClass( 'form-row-last' ).addClass( 'form-row-first' )\n\t\t\t\t\t\t$new_payment_method_selection.after( $csc_field )\n\n\t\t\t\telse\n\t\t\t\t\t# use new payment method, display the 'new method' fields\n\t\t\t\t\t$new_payment_method_selection.slideDown( 200 )\n\n\t\t\t\t\t# move the CSC field back into its regular spot\n\t\t\t\t\tif csc_required_for_tokens\n\t\t\t\t\t\t$csc_field.removeClass( 'form-row-first' ).addClass( 'form-row-last' )\n\t\t\t\t\t\t$new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-expiry' ).closest( '.form-row' ).after( $csc_field )\n\t\t\t.change()\n\n\t\t\t# display the 'save payment method' option for guest checkouts if the 'create account' option is checked\n\t\t\t# but only hide the input if there is a 'create account' checkbox (some themes just display the password)\n\t\t\t$( 'input#createaccount' ).on 'change', ->\n\t\t\t\t$parent_row = $( \"input.js-wc-#{ id_dasherized }-tokenize-payment-method\" ).closest( 'p.form-row' )\n\n\t\t\t\tif $( this ).is( ':checked' )\n\t\t\t\t\t$parent_row.slideDown()\n\t\t\t\t\t$parent_row.next().show()\n\t\t\t\telse\n\t\t\t\t\t$parent_row.hide()\n\t\t\t\t\t$parent_row.next().hide()\n\n\t\t\t$( 'input#createaccount' ).change() unless $( 'input#createaccount' ).is( ':checked' )\n\n\n\t\t# Public: Handle showing/hiding the sample check image\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_sample_check_hint: ->\n\n\t\t\t$sample_check = @payment_fields.find( '.js-sv-wc-payment-gateway-echeck-form-sample-check' )\n\n\t\t\tif $sample_check.is( \":visible\" ) then $sample_check.slideUp() else $sample_check.slideDown()\n\n\n\n\t\t# Blocks the payment form UI\n\t\t#\n\t\t# @since 3.0.0\n\t\tblock_ui: -> @form.block( message: null, overlayCSS: background: '#fff',opacity: 0.6 )\n\n\n\t\t# Unblocks the payment form UI\n\t\t#\n\t\t# @since 3.0.0\n\t\tunblock_ui: -> @form.unblock()\n\n\n\t# dispatch loaded event\n\t$( document.body ).trigger( \"sv_wc_payment_form_handler_v5_15_12_loaded\" )\n"],"names":["indexOf","jQuery","$","window","SV_WC_Payment_Form_Handler_v5_15_12","constructor","args","id","id_dasherized","plugin_id","type","csc_required","csc_required_for_tokens","enabled_card_types","length","form","handle_checkout_page","handle_pay_page","handle_add_payment_method_page","console","log","params","on","handle_sample_check_hint","document","trigger","instance","body","format_credit_card_inputs","set_payment_fields","handle_saved_payment_methods","validate_payment_data","submit","val","payment_fields","$required_fields","find","each","i","input","handler","valid","is","saved_payment_method_selected","validate_card_data","validate_account_data","triggerHandler","payment_form","passed_validation","$card_number","$csc","$expiry","payment","do_inline_credit_card_validation","$card_type","cardType","call","addClass","removeClass","validateCardExpiry","validateCardCVC","account_number","csc","errors","expiry","test","push","cvv_digits_invalid","cvv_length_invalid","cvv_missing","cardExpiryVal","replace","card_number_length_invalid","card_number_digits_invalid","validateCardNumber","card_number_invalid","card_number_missing","card_exp_date_invalid","render_errors","routing_number","routing_number_length_invalid","routing_number_digits_invalid","routing_number_missing","account_number_length_invalid","account_number_invalid","account_number_missing","remove","prepend","join","unblock","blur","animate","scrollTop","offset","top","$csc_field","$new_payment_method_selection","closest","slideUp","after","slideDown","change","$parent_row","next","show","hide","$sample_check","block_ui","block","message","overlayCSS","background","opacity","unblock_ui"],"version":3,"file":"sv-wc-payment-gateway-payment-form.js.map"}
\ No newline at end of file
+{"mappings":"ACOG,CAAA,WAAA,IAAA,EAAA,EAAA,CAAA,OAAA,CACH,OAAO,SAAE,CAAF,EA2XN,OAvXM,OAAO,iCAAA,CAAb,MAaC,YAAc,CAAD,CAAb,CAWC,GATA,IAAC,CAAA,EAAD,CAA2B,EAAK,EAAhC,CACA,IAAC,CAAA,aAAD,CAA2B,EAAK,aAAhC,CACA,IAAC,CAAA,SAAD,CAA2B,EAAK,SAAhC,CACA,IAAC,CAAA,IAAD,CAA2B,EAAK,IAAhC,CACA,IAAC,CAAA,YAAD,CAA2B,EAAK,YAAhC,CACA,IAAC,CAAA,uBAAD,CAA2B,EAAK,uBAAhC,CACA,IAAC,CAAA,kBAAD,CAA2B,EAAK,kBAAA,CAG7B,EAAG,iBAAkB,MAAxB,CACC,IAAC,CAAA,IAAD,CAAQ,EAAG,iBACX,IAAI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":["(() => {\nvar $a2c1c221aac1d794$exports = {};\n(function() {\n /*\n WooCommerce SkyVerge Payment Gateway Framework Payment Form CoffeeScript\n Version 4.3.0\n\n Copyright (c) 2014-2024, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n */ var indexOf = [].indexOf;\n jQuery(function($) {\n \"use strict\";\n window.SV_WC_Payment_Form_Handler_v6_0_0 = class SV_WC_Payment_Form_Handler_v6_0_0 {\n // Public: Instantiate Payment Form Handler\n // args - object with properties:\n // id - gateway ID\n // id_dasherized - gateway ID dasherized\n // plugin_id - plugin ID\n // type - gateway type, either `credit-card` or `echeck`\n // csc_required - true if the gateway requires the CSC field to be displayed\n // Returns SV_WC_Payment_Form_Handler_v6_0_0 instance\n constructor(args){\n this.id = args.id;\n this.id_dasherized = args.id_dasherized;\n this.plugin_id = args.plugin_id;\n this.type = args.type;\n this.csc_required = args.csc_required;\n this.csc_required_for_tokens = args.csc_required_for_tokens;\n this.enabled_card_types = args.enabled_card_types;\n // which payment form?\n if ($('form.checkout').length) {\n this.form = $('form.checkout');\n this.handle_checkout_page();\n } else if ($('form#order_review').length) {\n this.form = $('form#order_review');\n this.handle_pay_page();\n } else if ($('form#add_payment_method').length) {\n this.form = $('form#add_payment_method');\n this.handle_add_payment_method_page();\n } else {\n console.log('No payment form found!');\n return;\n }\n // localized error messages\n this.params = window[\"sv_wc_payment_gateway_payment_form_params\"];\n if (this.type === 'echeck') // handle sample check image hint\n this.form.on('click', '.js-sv-wc-payment-gateway-echeck-form-check-hint, .js-sv-wc-payment-gateway-echeck-form-sample-check', ()=>{\n return this.handle_sample_check_hint();\n });\n $(document).trigger('sv_wc_payment_form_handler_init', {\n id: this.id,\n instance: this\n });\n }\n // Public: Handle required actions on the checkout page\n // Returns nothing.\n handle_checkout_page() {\n if (this.type === 'credit-card') // format/validate credit card inputs using jQuery.payment\n $(document.body).on('updated_checkout', ()=>{\n return this.format_credit_card_inputs();\n });\n // updated payment fields jQuery object on each checkout update (prevents stale data)\n $(document.body).on('updated_checkout', ()=>{\n return this.set_payment_fields();\n });\n // handle saved payment methods\n // note on the checkout page, this is bound to `updated_checkout` so it\n // fires even when other parts of the checkout are changed\n $(document.body).on('updated_checkout', ()=>{\n return this.handle_saved_payment_methods();\n });\n // validate payment data before order is submitted\n return this.form.on(`checkout_place_order_${this.id}`, ()=>{\n return this.validate_payment_data();\n });\n }\n // Public: Handle required actions on the Order > Pay page\n // Returns nothing.\n handle_pay_page() {\n this.set_payment_fields();\n // format/validate credit card inputs using jQuery.payment\n if (this.type === 'credit-card') this.format_credit_card_inputs();\n // handle saved payment methods\n this.handle_saved_payment_methods();\n // validate payment data before order is submitted\n return this.form.submit(()=>{\n if ($('#order_review input[name=payment_method]:checked').val() === this.id) // but only when one of our payment gateways is selected\n return this.validate_payment_data();\n });\n }\n // Public: Handle required actions on the Add Payment Method page\n // Returns nothing.\n handle_add_payment_method_page() {\n this.set_payment_fields();\n // format/validate credit card inputs using jQuery.payment\n if (this.type === 'credit-card') this.format_credit_card_inputs();\n // validate payment data before order is submitted\n return this.form.submit(()=>{\n if ($('#add_payment_method input[name=payment_method]:checked').val() === this.id) // but only when one of our payment gateways is selected\n return this.validate_payment_data();\n });\n }\n // Public: Set payment fields class variable, this is done\n // during the updated_checkout event as otherwise the reference to\n // the checkout fields becomes stale (somehow ¯\\_(ツ)_/¯)\n // This ensures payment fields are not marked as \"invalid\" before the customer has interacted with them.\n // Returns nothing.\n set_payment_fields() {\n var $required_fields;\n this.payment_fields = $(`.payment_method_${this.id}`);\n $required_fields = this.payment_fields.find('.validate-required .input-text');\n return $required_fields.each((i, input)=>{\n // if any of the required fields have a value, bail this loop and proceed with WooCommerce validation\n if ($(input).val()) return false;\n // otherwise remove all validation result classes from the inputs, since the form is freshly loaded\n return $(input).trigger('input');\n });\n }\n // Public: Validate Payment data when order is placed\n // Returns boolean, true if payment data is valid, false otherwise\n validate_payment_data() {\n var handler, valid;\n if (this.form.is('.processing')) // bail when already processing\n return false;\n this.saved_payment_method_selected = this.payment_fields.find('.js-sv-wc-payment-gateway-payment-token:checked').val();\n // perform internal validations (all fields present & valid, etc)\n valid = this.type === 'credit-card' ? this.validate_card_data() : this.validate_account_data();\n // let gateways perform their own validation prior to form submission\n handler = $(document.body).triggerHandler('sv_wc_payment_form_valid_payment_data', {\n payment_form: this,\n passed_validation: valid\n }) !== false;\n return valid && handler;\n }\n // Public: format card data using jQuery.Payment\n // Returns nothing.\n format_credit_card_inputs() {\n var $card_number, $csc, $expiry;\n $card_number = $('.js-sv-wc-payment-gateway-credit-card-form-account-number').payment('formatCardNumber');\n $expiry = $('.js-sv-wc-payment-gateway-credit-card-form-expiry').payment('formatCardExpiry');\n $csc = $('.js-sv-wc-payment-gateway-credit-card-form-csc').payment('formatCardCVC');\n if ($card_number.val() && $card_number.val().length > 0) $card_number.trigger('change');\n if ($expiry.val() && $expiry.val().length > 0) $expiry.trigger('change');\n if ($csc.val() && $csc.val().length > 0) $csc.trigger('change');\n // perform inline validation on credit card inputs\n return $('.js-sv-wc-payment-gateway-credit-card-form-input').on('change paste keyup', ()=>{\n return this.do_inline_credit_card_validation();\n });\n }\n // Public: perform inline validation on credit card fields\n // Returns nothing.\n do_inline_credit_card_validation() {\n var $card_number, $card_type, $csc, $expiry;\n $card_number = $('.js-sv-wc-payment-gateway-credit-card-form-account-number');\n $expiry = $('.js-sv-wc-payment-gateway-credit-card-form-expiry');\n $csc = $('.js-sv-wc-payment-gateway-credit-card-form-csc');\n $card_type = $.payment.cardType($card_number.val());\n if (indexOf.call(this.enabled_card_types, $card_type) < 0) $card_number.addClass('invalid-card-type');\n else $card_number.removeClass('invalid-card-type');\n if ($.payment.validateCardExpiry($expiry.payment('cardExpiryVal'))) $expiry.addClass('identified');\n else $expiry.removeClass('identified');\n if ($.payment.validateCardCVC($csc.val())) return $csc.addClass('identified');\n else return $csc.removeClass('identified');\n }\n // Public: Perform validation on the credit card info entered\n // Return boolean, true if credit card info is valid, false otherwise\n validate_card_data() {\n var account_number, csc, errors, expiry;\n errors = [];\n csc = this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-csc').val();\n // always validate the CSC if present\n if (csc != null) {\n if (csc) {\n if (/\\D/.test(csc)) errors.push(this.params.cvv_digits_invalid);\n if (csc.length < 3 || csc.length > 4) errors.push(this.params.cvv_length_invalid);\n } else if (this.csc_required) {\n if (!this.saved_payment_method_selected || this.csc_required_for_tokens) errors.push(this.params.cvv_missing);\n }\n }\n // Only validate the other CC fields if necessary\n if (!this.saved_payment_method_selected) {\n account_number = this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-account-number').val();\n expiry = $.payment.cardExpiryVal(this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-expiry').val());\n // replace any dashes or spaces in the card number\n account_number = account_number.replace(/-|\\s/g, '');\n // validate card number\n if (!account_number) errors.push(this.params.card_number_missing);\n else {\n if (account_number.length < 12 || account_number.length > 19) errors.push(this.params.card_number_length_invalid);\n if (/\\D/.test(account_number)) errors.push(this.params.card_number_digits_invalid);\n if (!$.payment.validateCardNumber(account_number)) errors.push(this.params.card_number_invalid);\n }\n if (!$.payment.validateCardExpiry(expiry)) // validate expiration date\n errors.push(this.params.card_exp_date_invalid);\n }\n if (errors.length > 0) {\n this.render_errors(errors);\n return false;\n } else {\n // get rid of any space/dash characters\n this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-account-number').val(account_number);\n return true;\n }\n }\n // Public: Perform validation on the eCheck info entered\n // Return boolean, true if eCheck info is valid, false otherwise\n validate_account_data() {\n var account_number, errors, routing_number;\n if (this.saved_payment_method_selected) return true;\n errors = [];\n routing_number = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-routing-number').val();\n account_number = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val();\n // validate routing number\n if (!routing_number) errors.push(this.params.routing_number_missing);\n else {\n if (9 !== routing_number.length) errors.push(this.params.routing_number_length_invalid);\n if (/\\D/.test(routing_number)) errors.push(this.params.routing_number_digits_invalid);\n }\n // validate account number\n if (!account_number) errors.push(this.params.account_number_missing);\n else {\n if (account_number.length < 3 || account_number.length > 17) errors.push(this.params.account_number_length_invalid);\n if (/\\D/.test(account_number)) errors.push(this.params.account_number_invalid);\n }\n if (errors.length > 0) {\n this.render_errors(errors);\n return false;\n } else {\n // get rid of any space/dash characters\n this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val(account_number);\n return true;\n }\n }\n // Public: Render any new errors and bring them into the viewport\n // Returns nothing.\n render_errors(errors) {\n // hide and remove any previous errors\n $('.woocommerce-error, .woocommerce-message').remove();\n // add errors\n this.form.prepend('');\n // unblock UI\n this.form.removeClass('processing').unblock();\n this.form.find('.input-text, select').blur();\n // scroll to top\n return $('html, body').animate({\n scrollTop: this.form.offset().top - 100\n }, 1000);\n }\n // Public: Handle associated actions for saved payment methods\n // Returns nothing.\n handle_saved_payment_methods() {\n var $csc_field, $new_payment_method_selection, csc_required, csc_required_for_tokens, id_dasherized;\n // make available inside change events\n id_dasherized = this.id_dasherized;\n csc_required = this.csc_required;\n csc_required_for_tokens = this.csc_required_for_tokens;\n $new_payment_method_selection = $(`div.js-wc-${id_dasherized}-new-payment-method-form`);\n $csc_field = $new_payment_method_selection.find('.js-sv-wc-payment-gateway-credit-card-form-csc').closest('.form-row');\n // show/hide the saved payment methods when a saved payment method is de-selected/selected\n $(`input.js-wc-${this.id_dasherized}-payment-token`).on('change', function() {\n var tokenized_payment_method_selected;\n tokenized_payment_method_selected = $(`input.js-wc-${id_dasherized}-payment-token:checked`).val();\n if (tokenized_payment_method_selected) {\n // using an existing tokenized payment method, hide the 'new method' fields\n $new_payment_method_selection.slideUp(200);\n // move the CSC field out of the 'new method' fields so it can be used with the tokenized transaction\n if (csc_required_for_tokens) {\n $csc_field.removeClass('form-row-last').addClass('form-row-first');\n return $new_payment_method_selection.after($csc_field);\n }\n } else {\n // use new payment method, display the 'new method' fields\n $new_payment_method_selection.slideDown(200);\n // move the CSC field back into its regular spot\n if (csc_required_for_tokens) {\n $csc_field.removeClass('form-row-first').addClass('form-row-last');\n return $new_payment_method_selection.find('.js-sv-wc-payment-gateway-credit-card-form-expiry').closest('.form-row').after($csc_field);\n }\n }\n }).change();\n // display the 'save payment method' option for guest checkouts if the 'create account' option is checked\n // but only hide the input if there is a 'create account' checkbox (some themes just display the password)\n $('input#createaccount').on('change', function() {\n var $parent_row;\n $parent_row = $(`input.js-wc-${id_dasherized}-tokenize-payment-method`).closest('p.form-row');\n if ($(this).is(':checked')) {\n $parent_row.slideDown();\n return $parent_row.next().show();\n } else {\n $parent_row.hide();\n return $parent_row.next().hide();\n }\n });\n if (!$('input#createaccount').is(':checked')) return $('input#createaccount').change();\n }\n // Public: Handle showing/hiding the sample check image\n // Returns nothing.\n handle_sample_check_hint() {\n var $sample_check;\n $sample_check = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-sample-check');\n if ($sample_check.is(\":visible\")) return $sample_check.slideUp();\n else return $sample_check.slideDown();\n }\n // Blocks the payment form UI\n // @since 3.0.0\n block_ui() {\n return this.form.block({\n message: null,\n overlayCSS: {\n background: '#fff',\n opacity: 0.6\n }\n });\n }\n // Unblocks the payment form UI\n // @since 3.0.0\n unblock_ui() {\n return this.form.unblock();\n }\n };\n // dispatch loaded event\n return $(document.body).trigger(\"sv_wc_payment_form_handler_v6_0_0_loaded\");\n });\n}).call($a2c1c221aac1d794$exports);\n\n})();\n//# sourceMappingURL=sv-wc-payment-gateway-payment-form.js.map\n","###\n WooCommerce SkyVerge Payment Gateway Framework Payment Form CoffeeScript\n Version 4.3.0\n\n Copyright (c) 2014-2024, SkyVerge, Inc.\n Licensed under the GNU General Public License v3.0\n http://www.gnu.org/licenses/gpl-3.0.html\n###\njQuery ( $ ) ->\n\t\"use strict\"\n\n\n\tclass window.SV_WC_Payment_Form_Handler_v6_0_0\n\n\n\t\t# Public: Instantiate Payment Form Handler\n\t\t#\n\t\t# args - object with properties:\n\t\t# id - gateway ID\n\t\t# id_dasherized - gateway ID dasherized\n\t\t# plugin_id - plugin ID\n\t\t# type - gateway type, either `credit-card` or `echeck`\n\t\t# csc_required - true if the gateway requires the CSC field to be displayed\n\t\t#\n\t\t# Returns SV_WC_Payment_Form_Handler_v6_0_0 instance\n\t\tconstructor: (args) ->\n\n\t\t\t@id = args.id\n\t\t\t@id_dasherized = args.id_dasherized\n\t\t\t@plugin_id = args.plugin_id\n\t\t\t@type = args.type\n\t\t\t@csc_required = args.csc_required\n\t\t\t@csc_required_for_tokens = args.csc_required_for_tokens\n\t\t\t@enabled_card_types = args.enabled_card_types\n\n\t\t\t# which payment form?\n\t\t\tif $( 'form.checkout' ).length\n\t\t\t\t@form = $( 'form.checkout' )\n\t\t\t\tthis.handle_checkout_page()\n\n\t\t\telse if $( 'form#order_review' ).length\n\t\t\t\t@form = $( 'form#order_review' )\n\t\t\t\tthis.handle_pay_page()\n\n\t\t\telse if $( 'form#add_payment_method' ).length\n\t\t\t\t@form = $( 'form#add_payment_method' )\n\t\t\t\tthis.handle_add_payment_method_page()\n\n\t\t\telse\n\t\t\t\tconsole.log( 'No payment form found!' )\n\t\t\t\treturn\n\n\t\t\t# localized error messages\n\t\t\t@params = window[ \"sv_wc_payment_gateway_payment_form_params\" ]\n\n\t\t\t# handle sample check image hint\n\t\t\t@form.on( 'click', '.js-sv-wc-payment-gateway-echeck-form-check-hint, .js-sv-wc-payment-gateway-echeck-form-sample-check', => this.handle_sample_check_hint() ) if @type is 'echeck'\n\n\t\t\t$( document ).trigger( 'sv_wc_payment_form_handler_init', { id: @id, instance: @ } )\n\n\n\t\t# Public: Handle required actions on the checkout page\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_checkout_page: ->\n\n\t\t\t# format/validate credit card inputs using jQuery.payment\n\t\t\t$( document.body ).on( 'updated_checkout', => this.format_credit_card_inputs() ) if @type is 'credit-card'\n\n\t\t\t# updated payment fields jQuery object on each checkout update (prevents stale data)\n\t\t\t$( document.body ).on( 'updated_checkout', => this.set_payment_fields() )\n\n\t\t\t# handle saved payment methods\n\t\t\t# note on the checkout page, this is bound to `updated_checkout` so it\n\t\t\t# fires even when other parts of the checkout are changed\n\t\t\t$( document.body ).on( 'updated_checkout', => this.handle_saved_payment_methods() )\n\n\t\t\t# validate payment data before order is submitted\n\t\t\t@form.on( \"checkout_place_order_#{ @id }\", => this.validate_payment_data() )\n\n\n\t\t# Public: Handle required actions on the Order > Pay page\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_pay_page: ->\n\n\t\t\tthis.set_payment_fields()\n\n\t\t\t# format/validate credit card inputs using jQuery.payment\n\t\t\tif @type is 'credit-card'\n\t\t\t\tthis.format_credit_card_inputs()\n\n\t\t\t# handle saved payment methods\n\t\t\tthis.handle_saved_payment_methods()\n\n\t\t\t# validate payment data before order is submitted\n\t\t\t@form.submit =>\n\n\t\t\t\t# but only when one of our payment gateways is selected\n\t\t\t\treturn this.validate_payment_data() if $( '#order_review input[name=payment_method]:checked' ).val() is @id\n\n\n\t\t# Public: Handle required actions on the Add Payment Method page\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_add_payment_method_page: ->\n\n\t\t\tthis.set_payment_fields()\n\n\t\t\t# format/validate credit card inputs using jQuery.payment\n\t\t\tif @type is 'credit-card'\n\t\t\t\tthis.format_credit_card_inputs()\n\n\t\t\t# validate payment data before order is submitted\n\t\t\t@form.submit =>\n\n\t\t\t\t# but only when one of our payment gateways is selected\n\t\t\t\treturn this.validate_payment_data() if $( '#add_payment_method input[name=payment_method]:checked' ).val() is @id\n\n\n\t\t# Public: Set payment fields class variable, this is done\n\t\t# during the updated_checkout event as otherwise the reference to\n\t\t# the checkout fields becomes stale (somehow ¯\\_(ツ)_/¯)\n\t\t#\n\t\t# This ensures payment fields are not marked as \"invalid\" before the customer has interacted with them.\n\t\t#\n\t\t# Returns nothing.\n\t\tset_payment_fields: ->\n\n\t\t\t@payment_fields = $( \".payment_method_#{ @id }\" )\n\n\t\t\t$required_fields = @payment_fields.find( '.validate-required .input-text' )\n\n\t\t\t$required_fields.each( ( i, input ) =>\n\n\t\t\t\t# if any of the required fields have a value, bail this loop and proceed with WooCommerce validation\n\t\t\t\tif $( input ).val()\n\t\t\t\t\treturn false\n\n\t\t\t\t# otherwise remove all validation result classes from the inputs, since the form is freshly loaded\n\t\t\t\t$( input ).trigger( 'input' )\n\t\t\t)\n\n\n\t\t# Public: Validate Payment data when order is placed\n\t\t#\n\t\t# Returns boolean, true if payment data is valid, false otherwise\n\t\tvalidate_payment_data: ->\n\n\t\t\t# bail when already processing\n\t\t\treturn false if @form.is( '.processing' )\n\n\t\t\t@saved_payment_method_selected = @payment_fields.find( '.js-sv-wc-payment-gateway-payment-token:checked' ).val()\n\n\t\t\t# perform internal validations (all fields present & valid, etc)\n\t\t\tvalid = if @type is 'credit-card' then this.validate_card_data() else this.validate_account_data()\n\n\t\t\t# let gateways perform their own validation prior to form submission\n\t\t\thandler = $( document.body ).triggerHandler( 'sv_wc_payment_form_valid_payment_data', { payment_form: this, passed_validation: valid } ) isnt false\n\n\t\t\treturn valid && handler\n\n\n\t\t# Public: format card data using jQuery.Payment\n\t\t#\n\t\t# Returns nothing.\n\t\tformat_credit_card_inputs: ->\n\t\t\t$card_number = $('.js-sv-wc-payment-gateway-credit-card-form-account-number').payment('formatCardNumber');\n\t\t\t$expiry = $('.js-sv-wc-payment-gateway-credit-card-form-expiry').payment('formatCardExpiry');\n\t\t\t$csc = $('.js-sv-wc-payment-gateway-credit-card-form-csc').payment('formatCardCVC');\n\n\t\t\t# trigger a 'change' event for non empty fields only\n\t\t\t$card_number.trigger( 'change') if $card_number.val() && $card_number.val().length > 0\n\t\t\t$expiry.trigger( 'change') if $expiry.val() && $expiry.val().length > 0\n\t\t\t$csc.trigger( 'change') if $csc.val() && $csc.val().length > 0\n\n\t\t\t# perform inline validation on credit card inputs\n\t\t\t$( '.js-sv-wc-payment-gateway-credit-card-form-input' ).on( 'change paste keyup', => this.do_inline_credit_card_validation() )\n\n\n\t\t# Public: perform inline validation on credit card fields\n\t\t#\n\t\t# Returns nothing.\n\t\tdo_inline_credit_card_validation: ->\n\n\t\t\t$card_number = $( '.js-sv-wc-payment-gateway-credit-card-form-account-number' )\n\t\t\t$expiry = $( '.js-sv-wc-payment-gateway-credit-card-form-expiry' )\n\t\t\t$csc = $( '.js-sv-wc-payment-gateway-credit-card-form-csc' )\n\n\t\t\t$card_type = $.payment.cardType( $card_number.val() )\n\n\t\t\tif $card_type not in @enabled_card_types\n\t\t\t\t$card_number.addClass( 'invalid-card-type' )\n\t\t\telse\n\t\t\t\t$card_number.removeClass( 'invalid-card-type' )\n\n\t\t\tif $.payment.validateCardExpiry( $expiry.payment( 'cardExpiryVal' ) )\n\t\t\t\t$expiry.addClass( 'identified' )\n\t\t\telse\n\t\t\t\t$expiry.removeClass( 'identified' )\n\n\t\t\tif $.payment.validateCardCVC( $csc.val() )\n\t\t\t\t$csc.addClass( 'identified' )\n\t\t\telse\n\t\t\t\t$csc.removeClass( 'identified' )\n\n\n\t\t# Public: Perform validation on the credit card info entered\n\t\t#\n\t\t# Return boolean, true if credit card info is valid, false otherwise\n\t\tvalidate_card_data: ->\n\n\t\t\terrors = []\n\n\t\t\tcsc = @payment_fields.find( '.js-sv-wc-payment-gateway-credit-card-form-csc' ).val()\n\n\t\t\t# always validate the CSC if present\n\t\t\tif csc?\n\n\t\t\t\tif csc\n\t\t\t\t\terrors.push( @params.cvv_digits_invalid ) if /\\D/.test( csc )\n\t\t\t\t\terrors.push( @params.cvv_length_invalid ) if csc.length < 3 || csc.length > 4\n\t\t\t\telse if @csc_required\n\t\t\t\t\tif not @saved_payment_method_selected or @csc_required_for_tokens\n\t\t\t\t\t\terrors.push( @params.cvv_missing )\n\n\t\t\t# Only validate the other CC fields if necessary\n\t\t\tif not @saved_payment_method_selected\n\n\t\t\t\taccount_number = @payment_fields.find( '.js-sv-wc-payment-gateway-credit-card-form-account-number' ).val()\n\t\t\t\texpiry = $.payment.cardExpiryVal( @payment_fields.find( '.js-sv-wc-payment-gateway-credit-card-form-expiry' ).val() )\n\n\t\t\t\t# replace any dashes or spaces in the card number\n\t\t\t\taccount_number = account_number.replace( /-|\\s/g, '' )\n\n\t\t\t\t# validate card number\n\t\t\t\tif not account_number\n\t\t\t\t\terrors.push( @params.card_number_missing )\n\t\t\t\telse\n\t\t\t\t\terrors.push( @params.card_number_length_invalid ) if account_number.length < 12 || account_number.length > 19\n\t\t\t\t\terrors.push( @params.card_number_digits_invalid ) if /\\D/.test( account_number )\n\t\t\t\t\terrors.push( @params.card_number_invalid ) unless $.payment.validateCardNumber( account_number ) # performs luhn check\n\n\t\t\t\t# validate expiration date\n\t\t\t\terrors.push( @params.card_exp_date_invalid ) unless $.payment.validateCardExpiry( expiry ) # validates future date\n\n\t\t\tif errors.length > 0\n\t\t\t\tthis.render_errors( errors )\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\t# get rid of any space/dash characters\n\t\t\t\t@payment_fields.find( '.js-sv-wc-payment-gateway-credit-card-form-account-number' ).val( account_number )\n\t\t\t\treturn true\n\n\n\t\t# Public: Perform validation on the eCheck info entered\n\t\t#\n\t\t# Return boolean, true if eCheck info is valid, false otherwise\n\t\tvalidate_account_data: ->\n\n\t\t\treturn true if @saved_payment_method_selected\n\n\t\t\terrors = []\n\n\t\t\trouting_number = @payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-routing-number').val()\n\t\t\taccount_number = @payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val()\n\n\t\t\t# validate routing number\n\t\t\tif not routing_number\n\t\t\t\terrors.push( @params.routing_number_missing )\n\t\t\telse\n\t\t\t\terrors.push( @params.routing_number_length_invalid ) if 9 != routing_number.length\n\t\t\t\terrors.push( @params.routing_number_digits_invalid ) if /\\D/.test( routing_number )\n\n\t\t\t# validate account number\n\t\t\tif not account_number\n\t\t\t\terrors.push( @params.account_number_missing )\n\t\t\telse\n\t\t\t\terrors.push( @params.account_number_length_invalid ) if account_number.length < 3 || account_number.length > 17\n\t\t\t\terrors.push( @params.account_number_invalid ) if /\\D/.test( account_number )\n\n\t\t\tif errors.length > 0\n\t\t\t\tthis.render_errors( errors )\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\t# get rid of any space/dash characters\n\t\t\t\t@payment_fields.find( '.js-sv-wc-payment-gateway-echeck-form-account-number' ).val( account_number )\n\t\t\t\treturn true\n\n\n\t\t# Public: Render any new errors and bring them into the viewport\n\t\t#\n\t\t# Returns nothing.\n\t\trender_errors: (errors) ->\n\n\t\t\t# hide and remove any previous errors\n\t\t\t$( '.woocommerce-error, .woocommerce-message' ).remove()\n\n\t\t\t# add errors\n\t\t\t@form.prepend '- ' + errors.join( '
- ' ) + '
'\n\n\t\t\t# unblock UI\n\t\t\t@form.removeClass( 'processing' ).unblock()\n\t\t\t@form.find( '.input-text, select' ).blur()\n\n\t\t\t# scroll to top\n\t\t\t$( 'html, body' ).animate( { scrollTop: @form.offset().top - 100 }, 1000 )\n\n\n\t\t# Public: Handle associated actions for saved payment methods\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_saved_payment_methods: ->\n\n\t\t\t# make available inside change events\n\t\t\tid_dasherized = @id_dasherized\n\n\t\t\tcsc_required = @csc_required\n\t\t\tcsc_required_for_tokens = @csc_required_for_tokens\n\n\t\t\t$new_payment_method_selection = $( \"div.js-wc-#{ id_dasherized }-new-payment-method-form\" )\n\t\t\t$csc_field = $new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-csc' ).closest( '.form-row' )\n\n\t\t\t# show/hide the saved payment methods when a saved payment method is de-selected/selected\n\t\t\t$( \"input.js-wc-#{ @id_dasherized }-payment-token\" ).on 'change', ->\n\n\t\t\t\ttokenized_payment_method_selected = $( \"input.js-wc-#{ id_dasherized }-payment-token:checked\" ).val()\n\n\t\t\t\tif tokenized_payment_method_selected\n\n\t\t\t\t\t# using an existing tokenized payment method, hide the 'new method' fields\n\t\t\t\t\t$new_payment_method_selection.slideUp( 200 )\n\n\t\t\t\t\t# move the CSC field out of the 'new method' fields so it can be used with the tokenized transaction\n\t\t\t\t\tif csc_required_for_tokens\n\t\t\t\t\t\t$csc_field.removeClass( 'form-row-last' ).addClass( 'form-row-first' )\n\t\t\t\t\t\t$new_payment_method_selection.after( $csc_field )\n\n\t\t\t\telse\n\t\t\t\t\t# use new payment method, display the 'new method' fields\n\t\t\t\t\t$new_payment_method_selection.slideDown( 200 )\n\n\t\t\t\t\t# move the CSC field back into its regular spot\n\t\t\t\t\tif csc_required_for_tokens\n\t\t\t\t\t\t$csc_field.removeClass( 'form-row-first' ).addClass( 'form-row-last' )\n\t\t\t\t\t\t$new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-expiry' ).closest( '.form-row' ).after( $csc_field )\n\t\t\t.change()\n\n\t\t\t# display the 'save payment method' option for guest checkouts if the 'create account' option is checked\n\t\t\t# but only hide the input if there is a 'create account' checkbox (some themes just display the password)\n\t\t\t$( 'input#createaccount' ).on 'change', ->\n\t\t\t\t$parent_row = $( \"input.js-wc-#{ id_dasherized }-tokenize-payment-method\" ).closest( 'p.form-row' )\n\n\t\t\t\tif $( this ).is( ':checked' )\n\t\t\t\t\t$parent_row.slideDown()\n\t\t\t\t\t$parent_row.next().show()\n\t\t\t\telse\n\t\t\t\t\t$parent_row.hide()\n\t\t\t\t\t$parent_row.next().hide()\n\n\t\t\t$( 'input#createaccount' ).change() unless $( 'input#createaccount' ).is( ':checked' )\n\n\n\t\t# Public: Handle showing/hiding the sample check image\n\t\t#\n\t\t# Returns nothing.\n\t\thandle_sample_check_hint: ->\n\n\t\t\t$sample_check = @payment_fields.find( '.js-sv-wc-payment-gateway-echeck-form-sample-check' )\n\n\t\t\tif $sample_check.is( \":visible\" ) then $sample_check.slideUp() else $sample_check.slideDown()\n\n\n\n\t\t# Blocks the payment form UI\n\t\t#\n\t\t# @since 3.0.0\n\t\tblock_ui: -> @form.block( message: null, overlayCSS: background: '#fff',opacity: 0.6 )\n\n\n\t\t# Unblocks the payment form UI\n\t\t#\n\t\t# @since 3.0.0\n\t\tunblock_ui: -> @form.unblock()\n\n\n\t# dispatch loaded event\n\t$( document.body ).trigger( \"sv_wc_payment_form_handler_v6_0_0_loaded\" )\n"],"names":["indexOf","jQuery","$","window","SV_WC_Payment_Form_Handler_v6_0_0","constructor","args","id","id_dasherized","plugin_id","type","csc_required","csc_required_for_tokens","enabled_card_types","length","form","handle_checkout_page","handle_pay_page","handle_add_payment_method_page","console","log","params","on","handle_sample_check_hint","document","trigger","instance","body","format_credit_card_inputs","set_payment_fields","handle_saved_payment_methods","validate_payment_data","submit","val","payment_fields","$required_fields","find","each","i","input","handler","valid","is","saved_payment_method_selected","validate_card_data","validate_account_data","triggerHandler","payment_form","passed_validation","$card_number","$csc","$expiry","payment","do_inline_credit_card_validation","$card_type","cardType","call","addClass","removeClass","validateCardExpiry","validateCardCVC","account_number","csc","errors","expiry","test","push","cvv_digits_invalid","cvv_length_invalid","cvv_missing","cardExpiryVal","replace","card_number_length_invalid","card_number_digits_invalid","validateCardNumber","card_number_invalid","card_number_missing","card_exp_date_invalid","render_errors","routing_number","routing_number_length_invalid","routing_number_digits_invalid","routing_number_missing","account_number_length_invalid","account_number_invalid","account_number_missing","remove","prepend","join","unblock","blur","animate","scrollTop","offset","top","$csc_field","$new_payment_method_selection","closest","slideUp","after","slideDown","change","$parent_row","next","show","hide","$sample_check","block_ui","block","message","overlayCSS","background","opacity","unblock_ui"],"version":3,"file":"sv-wc-payment-gateway-payment-form.js.map"}
\ No newline at end of file
diff --git a/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-apple-pay.coffee b/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-apple-pay.coffee
index 55868c9c8..e9387e261 100644
--- a/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-apple-pay.coffee
+++ b/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-apple-pay.coffee
@@ -14,7 +14,7 @@ jQuery ( $ ) ->
# The WooCommerce Apple Pay handler base class.
#
# @since 4.7.0
- class window.SV_WC_Apple_Pay_Handler_v5_15_12
+ class window.SV_WC_Apple_Pay_Handler_v6_0_0
# Constructs the handler.
@@ -440,4 +440,4 @@ jQuery ( $ ) ->
# dispatch loaded event
- $( document.body ).trigger( 'sv_wc_apple_pay_handler_v5_15_12_loaded' )
+ $( document.body ).trigger( 'sv_wc_apple_pay_handler_v6_0_0_loaded' )
diff --git a/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-google-pay.js b/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-google-pay.js
index 6256a8633..d01750be3 100644
--- a/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-google-pay.js
+++ b/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-google-pay.js
@@ -7,9 +7,9 @@ jQuery( function( $ ) {
*
* @since 5.10.0
*
- * @type {SV_WC_Google_Pay_Handler_v5_15_12} object
+ * @type {SV_WC_Google_Pay_Handler_v6_0_0} object
*/
- window.SV_WC_Google_Pay_Handler_v5_15_12 = class SV_WC_Google_Pay_Handler_v5_15_12 {
+ window.SV_WC_Google_Pay_Handler_v6_0_0 = class SV_WC_Google_Pay_Handler_v6_0_0 {
/**
* Handler constructor.
@@ -612,6 +612,6 @@ jQuery( function( $ ) {
}
}
- $( document.body ).trigger( 'sv_wc_google_pay_handler_v5_15_12_loaded' );
+ $( document.body ).trigger( 'sv_wc_google_pay_handler_v6_0_0_loaded' );
} );
diff --git a/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.coffee b/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.coffee
index baf48c53a..a4618f46f 100644
--- a/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.coffee
+++ b/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.coffee
@@ -12,7 +12,7 @@ jQuery ( $ ) ->
# The My Payment Methods handler.
#
# @since 5.1.0
- class window.SV_WC_Payment_Methods_Handler_v5_15_12
+ class window.SV_WC_Payment_Methods_Handler_v6_0_0
# Constructs the class.
@@ -272,4 +272,4 @@ jQuery ( $ ) ->
# dispatch loaded event
- $( document.body ).trigger( 'sv_wc_payment_methods_handler_v5_15_12_loaded' )
+ $( document.body ).trigger( 'sv_wc_payment_methods_handler_v6_0_0_loaded' )
diff --git a/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.coffee b/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.coffee
index 9658759f9..c6bc57f28 100644
--- a/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.coffee
+++ b/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.coffee
@@ -10,7 +10,7 @@ jQuery ( $ ) ->
"use strict"
- class window.SV_WC_Payment_Form_Handler_v5_15_12
+ class window.SV_WC_Payment_Form_Handler_v6_0_0
# Public: Instantiate Payment Form Handler
@@ -22,7 +22,7 @@ jQuery ( $ ) ->
# type - gateway type, either `credit-card` or `echeck`
# csc_required - true if the gateway requires the CSC field to be displayed
#
- # Returns SV_WC_Payment_Form_Handler_v5_15_12 instance
+ # Returns SV_WC_Payment_Form_Handler_v6_0_0 instance
constructor: (args) ->
@id = args.id
@@ -385,4 +385,4 @@ jQuery ( $ ) ->
# dispatch loaded event
- $( document.body ).trigger( "sv_wc_payment_form_handler_v5_15_12_loaded" )
+ $( document.body ).trigger( "sv_wc_payment_form_handler_v6_0_0_loaded" )
diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php
index 8c63d045e..50b5fe054 100644
--- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php
+++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php
@@ -22,13 +22,15 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Blocks\Blocks_Handler;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Blocks\Blocks_Handler;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Helpers\OrderHelper;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Dynamic_Props;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Direct' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Direct' ) ) :
/**
@@ -372,7 +374,7 @@ public function process_payment( $order_id ) {
if ( $this->supports_tokenization() && 0 !== (int) $order->get_user_id() ) {
// if already paying with an existing method, try and updated it locally and remotely
- if ( ! empty( $order->payment->token ) ) {
+ if ( ! empty( Dynamic_Props::get( $order, 'payment', 'token' ) ) ) {
$this->update_transaction_payment_method( $order );
@@ -388,7 +390,7 @@ public function process_payment( $order_id ) {
if ( $this->should_skip_transaction( $order ) || $this->do_transaction( $order ) ) {
// add transaction data for zero-dollar "orders"
- if ( '0.00' === $order->payment_total ) {
+ if ( '0.00' === OrderHelper::get_payment_total( $order ) ) {
$this->add_transaction_data( $order );
}
@@ -482,7 +484,7 @@ protected function get_notices_as_user_messages( ?string $type = null ) : array
$message = $notice['notice'] ?? $notice;
// this will handle some log data eventually
- $messages[] = htmlspecialchars( is_array( $message ) ? print_r( $message, true ) : $message );
+ $messages[] = htmlspecialchars( is_array( $message ) ? print_r( $message, true ) : $message, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 );
}
}
@@ -502,7 +504,7 @@ protected function get_notices_as_user_messages( ?string $type = null ) : array
*/
protected function update_transaction_payment_method( \WC_Order $order ) {
- $token = $this->get_payment_tokens_handler()->get_token( $order->get_user_id(), $order->payment->token );
+ $token = $this->get_payment_tokens_handler()->get_token( $order->get_user_id(), Dynamic_Props::get( $order, 'payment', 'token' ) );
$address = new Addresses\Customer_Address();
$address->set_from_order( $order );
@@ -566,8 +568,11 @@ protected function update_transaction_payment_method( \WC_Order $order ) {
/**
- * Add payment and transaction information as class members of WC_Order
- * instance. The standard information that can be added includes:
+ * Add payment and transaction information to $order object.
+ *
+ * The standard information that can be added includes:
+ *
+ * It is set and get using Dynamic_Props class and not directly on $order object, but documented here for reference.
*
* $order->payment_total - the payment total
* $order->customer_id - optional payment gateway customer id (useful for tokenized payments for certain gateways, etc)
@@ -599,43 +604,46 @@ public function get_order( $order_id ) {
$order = parent::get_order( $order_id );
+ // Get payment info from the order object.
+ $payment = OrderHelper::get_payment( $order );
+
// payment info
if ( SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-account-number' ) && ! SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-payment-token' ) ) {
// common attributes
- $order->payment->account_number = str_replace( array( ' ', '-' ), '', SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-account-number' ) );
- $order->payment->last_four = substr( $order->payment->account_number, -4 );
+ $payment->account_number = str_replace( array( ' ', '-' ), '', SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-account-number' ) );
+ $payment->last_four = substr( $payment->account_number, -4 );
if ( $this->is_credit_card_gateway() ) {
// credit card specific attributes
- $order->payment->card_type = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-card-type' );
- $order->payment->exp_month = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-exp-month' );
- $order->payment->exp_year = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-exp-year' );
+ $payment->card_type = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-card-type' );
+ $payment->exp_month = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-exp-month' );
+ $payment->exp_year = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-exp-year' );
// add card type for gateways that don't require it displayed at checkout
- if ( empty( $order->payment->card_type ) ) {
- $order->payment->card_type = SV_WC_Payment_Gateway_Helper::card_type_from_account_number( $order->payment->account_number );
+ if ( empty( $payment->card_type ) ) {
+ $payment->card_type = SV_WC_Payment_Gateway_Helper::card_type_from_account_number( $payment->account_number );
}
// handle single expiry field formatted like "MM / YY" or "MM / YYYY"
if ( SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-expiry' ) ) {
- [ $order->payment->exp_month, $order->payment->exp_year ] = array_map( 'trim', explode( '/', SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-expiry' ) ) );
+ [ $payment->exp_month, $payment->exp_year ] = array_map( 'trim', explode( '/', SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-expiry' ) ) );
}
// add CSC if enabled
if ( $this->csc_enabled() ) {
- $order->payment->csc = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-csc' );
+ $payment->csc = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-csc' );
}
} elseif ( $this->is_echeck_gateway() ) {
// echeck specific attributes
- $order->payment->routing_number = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-routing-number' );
- $order->payment->account_type = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-account-type' );
- $order->payment->check_number = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-check-number' );
- $order->payment->drivers_license_number = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-drivers-license-number' );
- $order->payment->drivers_license_state = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-drivers-license-state' );
+ $payment->routing_number = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-routing-number' );
+ $payment->account_type = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-account-type' );
+ $payment->check_number = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-check-number' );
+ $payment->drivers_license_number = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-drivers-license-number' );
+ $payment->drivers_license_state = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-drivers-license-state' );
}
@@ -644,25 +652,25 @@ public function get_order( $order_id ) {
// paying with tokenized payment method (we've already verified that this token exists in the validate_fields method)
$token = $this->get_payment_tokens_handler()->get_token( $order->get_user_id(), $token_value );
- $order->payment->token = $token->get_id();
- $order->payment->account_number = $token->get_last_four();
- $order->payment->last_four = $token->get_last_four();
+ $payment->token = $token->get_id();
+ $payment->account_number = $token->get_last_four();
+ $payment->last_four = $token->get_last_four();
if ( $this->is_credit_card_gateway() ) {
// credit card specific attributes
- $order->payment->card_type = $token->get_card_type();
- $order->payment->exp_month = $token->get_exp_month();
- $order->payment->exp_year = $token->get_exp_year();
+ $payment->card_type = $token->get_card_type();
+ $payment->exp_month = $token->get_exp_month();
+ $payment->exp_year = $token->get_exp_year();
if ( $this->csc_enabled_for_tokens() ) {
- $order->payment->csc = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-csc' );
+ $payment->csc = SV_WC_Helper::get_posted_value( 'wc-' . $this->get_id_dasherized() . '-csc' );
}
} elseif ( $this->is_echeck_gateway() ) {
// echeck specific attributes
- $order->payment->account_type = $token->get_account_type();
+ $payment->account_type = $token->get_account_type();
}
// make this the new default payment token
@@ -670,10 +678,13 @@ public function get_order( $order_id ) {
}
// standardize expiration date year to 2 digits
- if ( ! empty( $order->payment->exp_year ) && 4 === strlen( $order->payment->exp_year ) ) {
- $order->payment->exp_year = substr( $order->payment->exp_year, 2 );
+ if ( ! empty( $payment->exp_year ) && 4 === strlen( $payment->exp_year ) ) {
+ $payment->exp_year = substr( $payment->exp_year, 2 );
}
+ // Set payment info on the order object.
+ OrderHelper::set_payment( $order, $payment );
+
/**
* Direct Gateway Get Order Filter.
*
@@ -706,16 +717,16 @@ protected function do_check_transaction( $order, $response = null ) {
// success! update order record
if ( $response->transaction_approved() ) {
- $last_four = substr( $order->payment->account_number, -4 );
+ $last_four = substr( Dynamic_Props::get( $order, 'payment', 'account_number', '' ), -4 );
// check order note. there may not be an account_type available, but that's fine
/* translators: Placeholders: %1$s - Payment method title, %2$s - Payment account type (savings/checking) (may or may not be available), %3$s - Last four digits of the account */
- $message = sprintf( esc_html__( '%1$s Check Transaction Approved: %2$s account ending in %3$s', 'woocommerce-plugin-framework' ), $this->get_method_title(), $order->payment->account_type, $last_four );
+ $message = sprintf( esc_html__( '%1$s Check Transaction Approved: %2$s account ending in %3$s', 'woocommerce-plugin-framework' ), $this->get_method_title(), Dynamic_Props::get( $order, 'payment', 'account_type' ), $last_four );
// optional check number
- if ( ! empty( $order->payment->check_number ) ) {
+ if ( ! empty( Dynamic_Props::get( $order, 'payment', 'check_number' ) ) ) {
/* translators: Placeholder: %s - Bank check number */
- $message .= '. ' . sprintf( esc_html__( 'Check number %s', 'woocommerce-plugin-framework' ), $order->payment->check_number );
+ $message .= '. ' . sprintf( esc_html__( 'Check number %s', 'woocommerce-plugin-framework' ), Dynamic_Props::get( $order, 'payment', 'check_number' ) );
}
// adds the transaction id (if any) to the order note
@@ -771,12 +782,12 @@ protected function do_credit_card_transaction( $order, $response = null ) {
// success! update order record
if ( $response->transaction_approved() ) {
- $account_number = ! empty( $order->payment->account_number ) ? $order->payment->account_number : null;
+ $account_number = ! empty( Dynamic_Props::get( $order, 'payment', 'account_number' ) ) ? Dynamic_Props::get( $order, 'payment', 'account_number' ) : null;
$last_four = $account_number ? substr( $account_number, -4 ) : '';
// use direct card type if set, or try to guess it from card number
- if ( ! empty( $order->payment->card_type ) ) {
- $card_type = $order->payment->card_type;
+ if ( ! empty( Dynamic_Props::get( $order, 'payment', 'card_type' ) ) ) {
+ $card_type = Dynamic_Props::get( $order, 'payment', 'card_type' );
} elseif ( $first_four = $account_number ? substr( $account_number, 0, 4 ) : '' ) {
$card_type = SV_WC_Payment_Gateway_Helper::card_type_from_account_number( $first_four );
} else {
@@ -806,12 +817,12 @@ protected function do_credit_card_transaction( $order, $response = null ) {
}
// add the expiry date if it is available
- if ( ! empty( $order->payment->exp_month ) && ! empty( $order->payment->exp_year ) ) {
+ if ( ! empty( Dynamic_Props::get( $order, 'payment', 'exp_month' ) ) && ! empty( Dynamic_Props::get( $order, 'payment', 'exp_year' ) ) ) {
$message .= ' ' . sprintf(
/* translators: Placeholder: %s - Credit card expiry date */
__( '(expires %s)', 'woocommerce-plugin-framework' ),
- $order->payment->exp_month . '/' . substr( $order->payment->exp_year, -2 )
+ Dynamic_Props::get( $order, 'payment', 'exp_month', '' ) . '/' . substr( Dynamic_Props::get( $order, 'payment', 'exp_year', '' ), -2 )
);
}
@@ -977,7 +988,7 @@ public function add_payment_method() {
* @return array result with success/error message and request status (success/failure)
* @throws SV_WC_Plugin_Exception
*/
- protected function do_add_payment_method_transaction( \WC_Order $order, SV_WC_Payment_Gateway_API_Create_Payment_Token_Response $response = null ) {
+ protected function do_add_payment_method_transaction( \WC_Order $order, ?SV_WC_Payment_Gateway_API_Create_Payment_Token_Response $response = null ) {
if ( is_null( $response ) ) {
$response = $this->get_api()->tokenize_payment_method( $order );
@@ -1131,13 +1142,14 @@ protected function get_order_for_add_payment_method() {
$order->set_props( $properties );
// other default info
- $order->customer_id = $this->get_customer_id( $order->get_user_id() );
+ OrderHelper::set_customer_id( $order, $this->get_customer_id( $order->get_user_id() ) );
/* translators: Placeholders: %1$s - site title, %2$s - customer email. Payment method as in a specific credit card, e-check or bank account */
- $order->description = sprintf( esc_html__( '%1$s - Add Payment Method for %2$s', 'woocommerce-plugin-framework' ), sanitize_text_field( SV_WC_Helper::get_site_name() ), $properties['billing_email'] );
+ $description = sprintf( esc_html__( '%1$s - Add Payment Method for %2$s', 'woocommerce-plugin-framework' ), sanitize_text_field( SV_WC_Helper::get_site_name() ), $properties['billing_email'] );
+ Dynamic_Props::set( $order, 'description', $description );
// force zero amount
- $order->payment_total = '0.00';
+ OrderHelper::set_payment_total( $order, '0.00' );
/**
* Direct Gateway Get Order for Add Payment Method Filter.
@@ -1168,12 +1180,12 @@ protected function add_add_payment_method_customer_data( $order, $response ) {
// set customer ID from response if available
if ( $this->supports_customer_id() && method_exists( $response, 'get_customer_id' ) && $response->get_customer_id() ) {
- $order->customer_id = $customer_id = $response->get_customer_id();
+ OrderHelper::set_customer_id( $order, $customer_id = $response->get_customer_id() );
} else {
// default to the customer ID on "order"
- $customer_id = $order->customer_id;
+ $customer_id = OrderHelper::get_customer_id( $order );
}
// update the user
@@ -1283,7 +1295,7 @@ public function transaction_forced() {
*/
protected function should_tokenize_before_sale( \WC_Order $order ): bool {
- $result = $this->get_payment_tokens_handler()->should_tokenize() && ( '0.00' === $order->payment_total || $this->tokenize_before_sale() );
+ $result = $this->get_payment_tokens_handler()->should_tokenize() && ( '0.00' === OrderHelper::get_payment_total( $order ) || $this->tokenize_before_sale() );
/**
* Filters whether tokenization should be performed before the sale, for a given order.
@@ -1374,7 +1386,7 @@ protected function can_tokenize_with_or_after_sale( \WC_Order $order ): bool {
*/
return apply_filters(
"wc_payment_gateway_{$this->get_id()}_can_tokenize_with_or_after_sale",
- $order->payment_total > 0,
+ OrderHelper::get_payment_total( $order ) > 0,
$order,
$this
);
@@ -1411,7 +1423,7 @@ protected function should_skip_transaction( \WC_Order $order ): bool {
return apply_filters(
"wc_payment_gateway_{$this->get_id()}_should_skip_transaction",
// the order amount will be $0 if a WooCommerce Subscriptions free trial product is being processed
- ( '0.00' === $order->payment_total && ! $this->transaction_forced() ),
+ ( '0.00' === OrderHelper::get_payment_total( $order ) && ! $this->transaction_forced() ),
$order,
$this
);
diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-helper.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-helper.php
index aa4dde4b8..5cf5a4402 100755
--- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-helper.php
+++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-helper.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Helper' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Helper' ) ) :
/**
diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php
index 2d499d0ea..e37a2496b 100644
--- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php
+++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php
@@ -22,11 +22,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
+
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Helpers\OrderHelper;
+
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Hosted' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Hosted' ) ) :
/**
@@ -465,20 +468,25 @@ protected function get_order_from_response( $response ) {
$order = $this->get_order( $order );
- $order->payment->account_number = $response->get_account_number();
+ $payment = OrderHelper::get_payment( $order );
+
+ $payment->account_number = $response->get_account_number();
if ( self::PAYMENT_TYPE_CREDIT_CARD == $response->get_payment_type() ) {
- $order->payment->exp_month = $response->get_exp_month();
- $order->payment->exp_year = $response->get_exp_year();
- $order->payment->card_type = $response->get_card_type();
+ $payment->exp_month = $response->get_exp_month();
+ $payment->exp_year = $response->get_exp_year();
+ $payment->card_type = $response->get_card_type();
} elseif ( self::PAYMENT_TYPE_ECHECK == $response->get_payment_type() ) {
- $order->payment->account_type = $response->get_account_type();
- $order->payment->check_number = $response->get_check_number();
+ $payment->account_type = $response->get_account_type();
+ $payment->check_number = $response->get_check_number();
}
+ // Set payment info on the order object.
+ OrderHelper::set_payment( $order, $payment );
+
return $order;
}
@@ -596,7 +604,7 @@ protected function process_transaction_response( $order, $response ) {
protected function process_tokenization_response( \WC_Order $order, $response ) {
if ( is_callable( array( $response, 'get_customer_id' ) ) && $response->get_customer_id() ) {
- $order->customer_id = $response->get_customer_id();
+ OrderHelper::set_customer_id( $order, $response->get_customer_id() );
}
$token = $response->get_payment_token();
@@ -655,21 +663,26 @@ protected function process_tokenization_response( \WC_Order $order, $response )
// add the payment method order data
if ( $token ) {
- $order->payment->token = $token->get_id();
- $order->payment->account_number = $token->get_last_four();
- $order->payment->last_four = $token->get_last_four();
+ $payment = OrderHelper::get_payment( $order );
+
+ $payment->token = $token->get_id();
+ $payment->account_number = $token->get_last_four();
+ $payment->last_four = $token->get_last_four();
if ( $token->is_credit_card() ) {
- $order->payment->exp_month = $token->get_exp_month();
- $order->payment->exp_year = $token->get_exp_year();
- $order->payment->card_type = $token->get_card_type();
+ $payment->exp_month = $token->get_exp_month();
+ $payment->exp_year = $token->get_exp_year();
+ $payment->card_type = $token->get_card_type();
} elseif ( $token->is_echeck() ) {
- $order->payment->account_type = $token->get_account_type();
- $order->payment->check_number = $token->get_check_number();
+ $payment->account_type = $token->get_account_type();
+ $payment->check_number = $token->get_check_number();
}
+
+ // Set payment info on the order object
+ OrderHelper::set_payment( $order, $payment );
}
// remove any tokens that were deleted on the hosted pay page
diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php
index 5206e615a..52642c4a4 100644
--- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php
+++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_My_Payment_Methods' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_My_Payment_Methods' ) ) :
/**
@@ -174,9 +174,9 @@ public function maybe_enqueue_styles_scripts() {
wp_register_script( 'jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', [ 'jquery' ], $wc_version );
- wp_enqueue_style( "$handle-v5_15_12", $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/' . $handle . '.min.css', [ 'dashicons' ], $fw_version );
+ wp_enqueue_style( "$handle-v6_0_0", $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/' . $handle . '.min.css', [ 'dashicons' ], $fw_version );
- wp_enqueue_script( "$handle-v5_15_12", $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/dist/frontend/' . $handle . '.js', [ 'jquery-tiptip', 'jquery' ], $fw_version );
+ wp_enqueue_script( "$handle-v6_0_0", $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/dist/frontend/' . $handle . '.js', [ 'jquery-tiptip', 'jquery' ], $fw_version );
}
@@ -900,7 +900,7 @@ protected function get_payment_method_title_html( SV_WC_Payment_Gateway_Payment_
* @param SV_WC_Payment_Gateway_Payment_Token|null $token FW token object, only set if the token is a FW token
* @return string
*/
- protected function get_payment_method_default_html( $is_default = false, SV_WC_Payment_Gateway_Payment_Token $token = null ) {
+ protected function get_payment_method_default_html( $is_default = false, ?SV_WC_Payment_Gateway_Payment_Token $token = null ) {
$html = $is_default ? '' . esc_html__( 'Default', 'woocommerce-plugin-framework' ) . '' : '';
diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-payment-form.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-payment-form.php
index 6a0db9258..0a4a77881 100644
--- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-payment-form.php
+++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-payment-form.php
@@ -22,15 +22,15 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Blocks\Blocks_Handler;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Enums\PaymentFormContext;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\Blocks\Gateway_Checkout_Block_Integration;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Blocks\Blocks_Handler;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Enums\PaymentFormContext;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Blocks\Gateway_Checkout_Block_Integration;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Payment_Form' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Payment_Form' ) ) :
/**
@@ -1180,7 +1180,7 @@ protected function get_js_handler_args() {
if ( is_array( $card_types ) && ! empty( $card_types ) ) {
- $args['enabled_card_types'] = array_map( [ 'SkyVerge\WooCommerce\PluginFramework\v5_15_12\SV_WC_Payment_Gateway_Helper', 'normalize_card_type' ], $card_types );
+ $args['enabled_card_types'] = array_map( [ 'SkyVerge\WooCommerce\PluginFramework\v6_0_0\SV_WC_Payment_Gateway_Helper', 'normalize_card_type' ], $card_types );
}
}
diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php
index d7b371178..7d545b7e6 100644
--- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php
+++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php
@@ -22,16 +22,16 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Note;
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\Blocks\Gateway_Blocks_Handler;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\External_Checkout\Google_Pay\Google_Pay;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Blocks\Gateway_Blocks_Handler;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\External_Checkout\Google_Pay\Google_Pay;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Plugin' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Plugin' ) ) :
/**
diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-privacy.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-privacy.php
index a31117b1b..e72b88012 100644
--- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-privacy.php
+++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-privacy.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Privacy' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Privacy' ) ) :
/**
diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php
index 9b943158c..c821269fe 100755
--- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php
+++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php
@@ -22,16 +22,18 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
use Automattic\WooCommerce\Blocks\Integrations\IntegrationInterface;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Blocks\Blocks_Handler;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway\Blocks\Gateway_Checkout_Block_Integration;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Blocks\Blocks_Handler;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Helpers\OrderHelper;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Blocks\Gateway_Checkout_Block_Integration;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Dynamic_Props;
use stdClass;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway' ) ) :
/**
@@ -473,7 +475,7 @@ protected function enqueue_payment_form_assets() {
}
$handle = 'sv-wc-payment-gateway-payment-form';
- $versioned_handle = $handle . '-v5_15_12';
+ $versioned_handle = $handle . '-v6_0_0';
// Frontend JS
wp_enqueue_script( $versioned_handle, $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/dist/frontend/' . $handle . '.js', array( 'jquery-payment' ), SV_WC_Plugin::VERSION, true );
@@ -1281,9 +1283,13 @@ public function get_apple_pay_currencies() {
*/
public function get_order_for_apple_pay( \WC_Order $order, SV_WC_Payment_Gateway_Apple_Pay_Payment_Response $response ) {
- $order->payment->account_number = $response->get_last_four();
- $order->payment->last_four = $response->get_last_four();
- $order->payment->card_type = $response->get_card_type();
+ $payment = OrderHelper::get_payment( $order );
+
+ $payment->account_number = $response->get_last_four();
+ $payment->last_four = $response->get_last_four();
+ $payment->card_type = $response->get_card_type();
+
+ OrderHelper::set_payment( $order, $payment );
return $order;
}
@@ -1336,11 +1342,16 @@ public function get_order_for_google_pay( \WC_Order $order, $response_data ) {
$payment_method_data = $response_data['paymentMethodData'];
- $order->payment->google_pay = base64_encode( $payment_method_data['tokenizationData']['token'] );
+ $payment = OrderHelper::get_payment( $order );
+
+ $payment->google_pay = base64_encode( $payment_method_data['tokenizationData']['token'] );
// account last four
- $order->payment->account_number = $payment_method_data['info']['cardDetails'];
- $order->payment->card_type = SV_WC_Payment_Gateway_Helper::normalize_card_type( $payment_method_data['info']['cardNetwork'] );
+ $payment->account_number = $payment_method_data['info']['cardDetails'];
+ $payment->card_type = SV_WC_Payment_Gateway_Helper::normalize_card_type( $payment_method_data['info']['cardNetwork'] );
+
+ // Set payment info on the order object.
+ OrderHelper::set_payment( $order, $payment );
return $order;
}
@@ -1906,10 +1917,12 @@ public function get_payment_method_image_url( $type ) {
/**
- * Adds payment and transaction information as class members of {@see WC_Order} instance.
+ * Adds payment and transaction information on $order object.
*
* The standard information that can be added includes:
*
+ * It is set and get using Dynamic_Props class and not directly on $order object, but documented here for reference.
+ *
* $order->payment_total - the payment total
* $order->customer_id - optional payment gateway customer id (useful for tokenized payments, etc)
* $order->payment->type - one of 'credit_card' or 'check'
@@ -1933,23 +1946,30 @@ public function get_order( $order ) {
}
// set payment total here, so it can be modified for later by add-ons like subscriptions which may need to charge an amount different than the get_total()
- $order->payment_total = number_format( $order->get_total(), 2, '.', '' );
+ $payment_total = number_format( $order->get_total(), 2, '.', '' );
+
+ OrderHelper::set_payment_total( $order, $payment_total );
- $order->customer_id = '';
+ OrderHelper::set_customer_id( $order, '' );
// logged in customer?
if ( 0 != $order->get_user_id() && false !== ( $customer_id = $this->get_customer_id( $order->get_user_id(), array( 'order' => $order ) ) ) ) {
- $order->customer_id = $customer_id;
+ OrderHelper::set_customer_id( $order, $customer_id );
}
// add payment info
- $order->payment = new \stdClass();
+ $payment = new \stdClass();
// payment type (credit_card/check/etc)
- $order->payment->type = str_replace( '-', '_', $this->get_payment_type() );
+ $payment->type = str_replace( '-', '_', $this->get_payment_type() );
+
+ // Set payment info on the order object
+ OrderHelper::set_payment( $order, $payment );
/* translators: Placeholders: %1$s - site title, %2$s - order number */
- $order->description = sprintf( esc_html__( '%1$s - Order %2$s', 'woocommerce-plugin-framework' ), wp_specialchars_decode( SV_WC_Helper::get_site_name(), ENT_QUOTES ), $order->get_order_number() );
+ $description = sprintf( esc_html__( '%1$s - Order %2$s', 'woocommerce-plugin-framework' ), wp_specialchars_decode( SV_WC_Helper::get_site_name(), ENT_QUOTES ), $order->get_order_number() );
+
+ Dynamic_Props::set( $order, 'description', $description );
// the get_order_with_unique_transaction_ref() call results in saving the order object, which we don't want to do if the order hasn't already been saved (such as when adding a payment method)
if ( $order->get_id() ) {
@@ -2069,7 +2089,7 @@ public function get_order_for_capture( $order, $amount = null ) {
}
// add capture info
- $order->capture = new \stdClass();
+ $capture = new \stdClass();
$total_captured = $this->get_order_meta( $order, 'capture_total' );
@@ -2078,11 +2098,14 @@ public function get_order_for_capture( $order, $amount = null ) {
$amount = (float) $order->get_total() - (float) $total_captured;
}
- $order->capture->amount = SV_WC_Helper::number_format( $amount );
+ $capture->amount = SV_WC_Helper::number_format( $amount );
/* translators: Placeholders: %1$s - site title, %2$s - order number. Definitions: Capture as in capture funds from a credit card. */
- $order->capture->description = sprintf( esc_html__( '%1$s - Capture for Order %2$s', 'woocommerce-plugin-framework' ), wp_specialchars_decode( SV_WC_Helper::get_site_name() ), $order->get_order_number() );
- $order->capture->trans_id = $this->get_order_meta( $order, 'trans_id' );
+ $capture->description = sprintf( esc_html__( '%1$s - Capture for Order %2$s', 'woocommerce-plugin-framework' ), wp_specialchars_decode( SV_WC_Helper::get_site_name() ), $order->get_order_number() );
+ $capture->trans_id = $this->get_order_meta( $order, 'trans_id' );
+
+ // Set capture info on the order object.
+ Dynamic_Props::set( $order, 'capture', $capture );
/**
* Direct Gateway Capture Get Order Filter.
@@ -2196,8 +2219,11 @@ public function process_refund( $order_id, $amount = null, $reason = '' ) {
/**
- * Add refund information as class members of WC_Order
- * instance for use in refund transactions. Standard information includes:
+ * Add refund information to $order object.
+ *
+ * It is set and get using Dynamic_Props class and not directly on $order object, but documented here for reference.
+ *
+ * Standard information includes:
*
* $order->refund->amount = refund amount
* $order->refund->reason = user-entered reason text for the refund
@@ -2220,14 +2246,17 @@ protected function get_order_for_refund( $order, $amount, $reason ) {
}
// add refund info
- $order->refund = new \stdClass();
- $order->refund->amount = number_format( $amount, 2, '.', '' );
+ $refund = new \stdClass();
+ $refund->amount = number_format( $amount, 2, '.', '' );
/* translators: Placeholders: %1$s - site title, %2$s - order number */
- $order->refund->reason = $reason ? $reason : sprintf( esc_html__( '%1$s - Refund for Order %2$s', 'woocommerce-plugin-framework' ), esc_html( SV_WC_Helper::get_site_name() ), $order->get_order_number() );
+ $refund->reason = $reason ? $reason : sprintf( esc_html__( '%1$s - Refund for Order %2$s', 'woocommerce-plugin-framework' ), esc_html( SV_WC_Helper::get_site_name() ), $order->get_order_number() );
// almost all gateways require the original transaction ID, so include it by default
- $order->refund->trans_id = $this->get_order_meta( $order, 'trans_id' );
+ $refund->trans_id = $this->get_order_meta( $order, 'trans_id' );
+
+ // Set refund info on the order object.
+ Dynamic_Props::set( $order, 'refund', $refund );
/**
* Payment Gateway Get Order For Refund Filter.
@@ -2257,7 +2286,7 @@ protected function get_order_for_refund( $order, $amount, $reason ) {
protected function add_refund_data( \WC_Order $order, $response ) {
// indicate the order was refunded along with the refund amount
- $this->add_order_meta( $order, 'refund_amount', $order->refund->amount );
+ $this->add_order_meta( $order, 'refund_amount', Dynamic_Props::get( $order, 'refund', 'amount' ) );
// add refund transaction ID
if ( $response && $response->get_transaction_id() ) {
@@ -2293,7 +2322,7 @@ protected function add_refund_order_note( \WC_Order $order, $response ) {
/* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - a monetary amount */
esc_html__( '%1$s Refund in the amount of %2$s approved.', 'woocommerce-plugin-framework' ),
$this->get_method_title(),
- wc_price( $order->refund->amount, [
+ wc_price( Dynamic_Props::get( $order, 'refund', 'amount' ), [
'currency' => $order->get_currency()
] )
);
@@ -2404,7 +2433,7 @@ protected function maybe_void_instead_of_refund( $order, $response ) {
protected function process_void( \WC_Order $order ) {
// partial voids are not supported
- if ( $order->refund->amount != $order->get_total() ) {
+ if ( Dynamic_Props::get( $order, 'refund', 'amount' ) != $order->get_total() ) {
return new \WP_Error( 'wc_' . $this->get_id() . '_void_error', esc_html__( 'Oops, you cannot partially void this order. Please use the full order amount.', 'woocommerce-plugin-framework' ), 500 );
}
@@ -2456,7 +2485,7 @@ protected function process_void( \WC_Order $order ) {
protected function add_void_data( \WC_Order $order, $response ) {
// indicate the order was voided along with the amount
- $this->update_order_meta( $order, 'void_amount', $order->refund->amount );
+ $this->update_order_meta( $order, 'void_amount', Dynamic_Props::get( $order, 'refund', 'amount' ) );
// add refund transaction ID
if ( $response && $response->get_transaction_id() ) {
@@ -2526,7 +2555,7 @@ public function mark_order_as_voided( $order, $response ) {
/* translators: Placeholders: %1$s - payment gateway title, %2$s - a monetary amount. Void as in to void an order. */
esc_html__( '%1$s Void in the amount of %2$s approved.', 'woocommerce-plugin-framework' ),
$this->get_method_title(),
- wc_price( $order->refund->amount, [
+ wc_price( Dynamic_Props::get( $order, 'refund', 'amount' ), [
'currency' => $order->get_currency()
] )
);
@@ -2599,7 +2628,9 @@ protected function get_order_with_unique_transaction_ref( $order ) {
$this->update_order_meta( $order, 'retry_count', $retry_count );
// generate a unique transaction ref based on the order number and retry count, for gateways that require a unique identifier for every transaction request
- $order->unique_transaction_ref = ltrim( $order->get_order_number(), esc_html_x( '#', 'hash before order number', 'woocommerce-plugin-framework' ) ) . ( $retry_count > 0 ? '-' . $retry_count : '' );
+ $unique_transaction_ref = ltrim( $order->get_order_number(), esc_html_x( '#', 'hash before order number', 'woocommerce-plugin-framework' ) ) . ( $retry_count > 0 ? '-' . $retry_count : '' );
+
+ Dynamic_Props::set( $order, 'unique_transaction_ref', $unique_transaction_ref );
return $order;
}
@@ -2676,13 +2707,15 @@ public function add_transaction_data( $order, $response = null ) {
$this->add_customer_data( $order, $response );
}
- if ( isset( $order->payment->token ) && $order->payment->token ) {
- $this->update_order_meta( $order, 'payment_token', $order->payment->token );
+ $payment = OrderHelper::get_payment( $order );
+
+ if ( isset( $payment->token ) && $payment->token ) {
+ $this->update_order_meta( $order, 'payment_token', $payment->token );
}
// account number
- if ( isset( $order->payment->account_number ) && $order->payment->account_number ) {
- $this->update_order_meta( $order, 'account_four', substr( $order->payment->account_number, -4 ) );
+ if ( isset( $payment->account_number ) && $payment->account_number ) {
+ $this->update_order_meta( $order, 'account_four', substr( $payment->account_number, -4 ) );
}
if ( $this->is_credit_card_gateway() ) {
@@ -2690,13 +2723,13 @@ public function add_transaction_data( $order, $response = null ) {
// credit card gateway data
if ( $response instanceof SV_WC_Payment_Gateway_API_Authorization_Response ) {
- $this->update_order_meta( $order, 'authorization_amount', $order->payment_total );
+ $this->update_order_meta( $order, 'authorization_amount', OrderHelper::get_payment_total( $order ) );
if ( $response->get_authorization_code() ) {
$this->update_order_meta( $order, 'authorization_code', $response->get_authorization_code() );
}
- if ( $order->payment_total > 0 ) {
+ if ( OrderHelper::get_payment_total( $order ) > 0 ) {
// mark as captured
if ( $this->perform_credit_card_charge( $order ) ) {
@@ -2709,12 +2742,12 @@ public function add_transaction_data( $order, $response = null ) {
}
}
- if ( isset( $order->payment->exp_year ) && $order->payment->exp_year && isset( $order->payment->exp_month ) && $order->payment->exp_month ) {
- $this->update_order_meta( $order, 'card_expiry_date', $order->payment->exp_year . '-' . $order->payment->exp_month );
+ if ( isset( $payment->exp_year ) && $payment->exp_year && isset( $payment->exp_month ) && $payment->exp_month ) {
+ $this->update_order_meta( $order, 'card_expiry_date', $payment->exp_year . '-' . $payment->exp_month );
}
- if ( isset( $order->payment->card_type ) && $order->payment->card_type ) {
- $this->update_order_meta( $order, 'card_type', $order->payment->card_type );
+ if ( isset( $payment->card_type ) && $payment->card_type ) {
+ $this->update_order_meta( $order, 'card_type', $payment->card_type );
}
} elseif ( $this->is_echeck_gateway() ) {
@@ -2722,13 +2755,13 @@ public function add_transaction_data( $order, $response = null ) {
// checking gateway data
// optional account type (checking/savings)
- if ( isset( $order->payment->account_type ) && $order->payment->account_type ) {
- $this->update_order_meta( $order, 'account_type', $order->payment->account_type );
+ if ( isset( $payment->account_type ) && $payment->account_type ) {
+ $this->update_order_meta( $order, 'account_type', $payment->account_type );
}
// optional check number
- if ( isset( $order->payment->check_number ) && $order->payment->check_number ) {
- $this->update_order_meta( $order, 'check_number', $order->payment->check_number );
+ if ( isset( $payment->check_number ) && $payment->check_number ) {
+ $this->update_order_meta( $order, 'check_number', $payment->check_number );
}
}
@@ -2779,12 +2812,13 @@ protected function add_customer_data( $order, $response = null ) {
if ( $response && method_exists( $response, 'get_customer_id' ) && $response->get_customer_id() ) {
- $order->customer_id = $customer_id = $response->get_customer_id();
+ $customer_id = $response->get_customer_id();
+ OrderHelper::set_customer_id( $order, $customer_id );
} else {
// default to the customer ID set on the order
- $customer_id = $order->customer_id;
+ $customer_id = OrderHelper::get_customer_id( $order );
}
// update the order with the customer ID, note environment is not appended here because it's already available
@@ -2810,12 +2844,14 @@ protected function add_customer_data( $order, $response = null ) {
*/
public function get_credit_card_transaction_approved_message( \WC_Order $order, $response ) {
- $last_four = ! empty( $order->payment->last_four ) ? $order->payment->last_four : substr( $order->payment->account_number, -4 );
+ $payment = OrderHelper::get_payment( $order );
+
+ $last_four = ! empty( $payment->last_four ) ? $payment->last_four : substr( $payment->account_number, -4 );
// use direct card type if set, or try to guess it from card number
- if ( ! empty( $order->payment->card_type ) ) {
- $card_type = $order->payment->card_type;
- } elseif ( $first_four = substr( $order->payment->account_number, 0, 4 ) ) {
+ if ( ! empty( $payment->card_type ) ) {
+ $card_type = $payment->card_type;
+ } elseif ( $first_four = substr( $payment->account_number, 0, 4 ) ) {
$card_type = SV_WC_Payment_Gateway_Helper::card_type_from_account_number( $first_four );
} else {
$card_type = 'card';
@@ -2840,12 +2876,12 @@ public function get_credit_card_transaction_approved_message( \WC_Order $order,
}
// add the expiry date if it is available
- if ( ! empty( $order->payment->exp_month ) && ! empty( $order->payment->exp_year ) ) {
+ if ( ! empty( $payment->exp_month ) && ! empty( $payment->exp_year ) ) {
$message .= ' ' . sprintf(
/* translators: Placeholder: %s - Credit card expiry date */
__( '(expires %s)', 'woocommerce-plugin-framework' ),
- $order->payment->exp_month . '/' . substr( $order->payment->exp_year, -2 )
+ $payment->exp_month . '/' . substr( $payment->exp_year, -2 )
);
}
@@ -2883,16 +2919,18 @@ public function get_credit_card_transaction_approved_message( \WC_Order $order,
*/
public function get_echeck_transaction_approved_message( \WC_Order $order, SV_WC_Payment_Gateway_API_Response $response ) {
- $last_four = ! empty( $order->payment->last_four ) ? $order->payment->last_four : substr( $order->payment->account_number, -4 );
+ $payment = OrderHelper::get_payment( $order );
+
+ $last_four = ! empty( $payment->last_four ) ? $payment->last_four : substr( $payment->account_number, -4 );
// check order note. there may not be an account_type available, but that's fine
/* translators: Context: "Check" as in "bank check" (noun, not verb). Placeholders: %1$s - payment method title, %2$s - payment account type (savings/checking) (may or may not be available), %3$s - last four digits of the account */
- $message = sprintf( __( '%1$s Check Transaction Approved: %2$s account ending in %3$s', 'woocommerce-plugin-framework' ), $this->get_method_title(), $order->payment->account_type, $last_four );
+ $message = sprintf( __( '%1$s Check Transaction Approved: %2$s account ending in %3$s', 'woocommerce-plugin-framework' ), $this->get_method_title(), $payment->account_type, $last_four );
// optional check number
- if ( ! empty( $order->payment->check_number ) ) {
+ if ( ! empty( $payment->check_number ) ) {
/* translators: Context: "Check" as in "bank check" (noun, not verb). Placeholder: %s - check number */
- $message .= '. ' . sprintf( esc_html__( 'Check number %s', 'woocommerce-plugin-framework' ), $order->payment->check_number );
+ $message .= '. ' . sprintf( esc_html__( 'Check number %s', 'woocommerce-plugin-framework' ), $payment->check_number );
}
// adds the transaction id (if any) to the order note
@@ -3376,10 +3414,10 @@ public function get_authorization_time_window() {
*
* @since 1.0.0
*
- * @param \WC_Order $order Optional. The order being charged
+ * @param \WC_Order|null $order Optional. The order being charged
* @return bool
*/
- public function perform_credit_card_charge( \WC_Order $order = null ) {
+ public function perform_credit_card_charge( ?\WC_Order $order = null ) {
$this->get_plugin()->assert( $this->supports_credit_card_charge() );
@@ -3407,10 +3445,10 @@ public function perform_credit_card_charge( \WC_Order $order = null ) {
*
* @since 1.0.0
*
- * @param \WC_Order $order Optional. The order being authorized
+ * @param \WC_Order|null $order Optional. The order being authorized
* @return bool
*/
- public function perform_credit_card_authorization( \WC_Order $order = null ) {
+ public function perform_credit_card_authorization( ?\WC_Order $order = null ) {
$this->get_plugin()->assert( $this->supports_credit_card_authorization() );
@@ -3715,12 +3753,12 @@ public function add_debug_message( $message, ?string $type = 'message' ) : void
if ( 'message' === $type ) {
- SV_WC_Helper::wc_add_notice( str_replace( "\n", "
", htmlspecialchars( $message ) ), 'notice' );
+ SV_WC_Helper::wc_add_notice( str_replace( "\n", "
", htmlspecialchars( $message, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ), 'notice' );
} else {
// defaults to error message
- SV_WC_Helper::wc_add_notice( str_replace( "\n", "
", htmlspecialchars( $message ) ), 'error' );
+ SV_WC_Helper::wc_add_notice( str_replace( "\n", "
", htmlspecialchars( $message, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ), 'error' );
}
}
}
diff --git a/woocommerce/payment-gateway/exceptions/class-sv-wc-payment-gateway-exception.php b/woocommerce/payment-gateway/exceptions/class-sv-wc-payment-gateway-exception.php
index 46a652944..363d101c8 100644
--- a/woocommerce/payment-gateway/exceptions/class-sv-wc-payment-gateway-exception.php
+++ b/woocommerce/payment-gateway/exceptions/class-sv-wc-payment-gateway-exception.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Exception' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Exception' ) ) :
/**
diff --git a/woocommerce/payment-gateway/integrations/abstract-sv-wc-payment-gateway-integration.php b/woocommerce/payment-gateway/integrations/abstract-sv-wc-payment-gateway-integration.php
index b55c95569..9c527a152 100644
--- a/woocommerce/payment-gateway/integrations/abstract-sv-wc-payment-gateway-integration.php
+++ b/woocommerce/payment-gateway/integrations/abstract-sv-wc-payment-gateway-integration.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Integration' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Integration' ) ) :
/**
diff --git a/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php b/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php
index 1d76560bd..bdfb9afe8 100644
--- a/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php
+++ b/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php
@@ -22,11 +22,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
+
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Helpers\OrderHelper;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Dynamic_Props;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Integration_Pre_Orders' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Integration_Pre_Orders' ) ) :
/**
@@ -139,44 +142,46 @@ public function get_order( $order ) {
// normally a guest user wouldn't be assigned a customer id, but for a pre-order requiring tokenization, it might be
if ( 0 == $order->get_user_id() && false !== ( $customer_id = $this->get_gateway()->get_guest_customer_id( $order ) ) ) {
- $order->customer_id = $customer_id;
+ OrderHelper::set_customer_id( $order, $customer_id );
+
}
// zero out the payment total since we're just tokenizing the payment method
- $order->payment_total = '0.00';
+ OrderHelper::set_payment_total( $order, '0.00' );
} elseif ( \WC_Pre_Orders_Order::order_has_payment_token( $order ) && ! is_checkout_pay_page() ) {
// if this is a pre-order release payment with a tokenized payment method, get the payment token to complete the order
+ $payment = OrderHelper::get_payment( $order );
// retrieve the payment token
- $order->payment->token = $this->get_gateway()->get_order_meta( $order, 'payment_token' );
+ $payment->token = $this->get_gateway()->get_order_meta( $order, 'payment_token' );
// retrieve the optional customer id
- $order->customer_id = $this->get_gateway()->get_order_meta( $order, 'customer_id' );
+ OrderHelper::set_customer_id( $order, $this->get_gateway()->get_order_meta( $order, 'customer_id' ) );
// set token data on order
- if ( $this->get_gateway()->get_payment_tokens_handler()->user_has_token( $order->get_user_id(), $order->payment->token ) ) {
+ if ( $this->get_gateway()->get_payment_tokens_handler()->user_has_token( $order->get_user_id(), $payment->token ) ) {
// an existing registered user with a saved payment token
- $token = $this->get_gateway()->get_payment_tokens_handler()->get_token( $order->get_user_id(), $order->payment->token );
+ $token = $this->get_gateway()->get_payment_tokens_handler()->get_token( $order->get_user_id(), $payment->token );
// account last four
- $order->payment->account_number = $token->get_last_four();
+ $payment->account_number = $token->get_last_four();
if ( $this->get_gateway()->is_credit_card_gateway() ) {
// card type
- $order->payment->card_type = $token->get_card_type();
+ $payment->card_type = $token->get_card_type();
// exp month/year
- $order->payment->exp_month = $token->get_exp_month();
- $order->payment->exp_year = SV_WC_Payment_Gateway_Helper::format_exp_year( $token->get_exp_year() );
+ $payment->exp_month = $token->get_exp_month();
+ $payment->exp_year = SV_WC_Payment_Gateway_Helper::format_exp_year( $token->get_exp_year() );
} elseif ( $this->get_gateway()->is_echeck_gateway() ) {
// account type (checking/savings)
- $order->payment->account_type = $token->get_account_type();
+ $payment->account_type = $token->get_account_type();
}
} else {
@@ -184,28 +189,31 @@ public function get_order( $order ) {
// a guest user means that token data must be set from the original order
// account number
- $order->payment->account_number = $this->get_gateway()->get_order_meta( $order, 'account_four' );
+ $payment->account_number = $this->get_gateway()->get_order_meta( $order, 'account_four' );
if ( $this->get_gateway()->is_credit_card_gateway() ) {
// card type
- $order->payment->card_type = $this->get_gateway()->get_order_meta( $order, 'card_type' );
+ $payment->card_type = $this->get_gateway()->get_order_meta( $order, 'card_type' );
// expiry date
if ( $expiry_date = $this->get_gateway()->get_order_meta( $order, 'card_expiry_date' ) ) {
list( $exp_year, $exp_month ) = explode( '-', $expiry_date );
- $order->payment->exp_month = $exp_month;
- $order->payment->exp_year = SV_WC_Payment_Gateway_Helper::format_exp_year( $exp_year );
+ $payment->exp_month = $exp_month;
+ $payment->exp_year = SV_WC_Payment_Gateway_Helper::format_exp_year( $exp_year );
}
} elseif ( $this->get_gateway()->is_echeck_gateway() ) {
// account type
- $order->payment->account_type = $this->get_gateway()->get_order_meta( $order, 'account_type' );
+ $payment->account_type = $this->get_gateway()->get_order_meta( $order, 'account_type' );
}
}
+
+ // Set payment info on the order object
+ OrderHelper::set_payment( $order, $payment );
}
return $order;
@@ -233,8 +241,10 @@ public function process_payment( $result, $order_id ) {
try {
+ $payment = OrderHelper::get_payment( $order );
+
// using an existing tokenized payment method
- if ( isset( $order->payment->token ) && $order->payment->token ) {
+ if ( isset( $payment->token ) && $payment->token ) {
// save the tokenized card info for completing the pre-order in the future
$this->get_gateway()->add_transaction_data( $order );
@@ -302,18 +312,21 @@ public function process_release_payment( $order ) {
try {
// set order defaults
- $order = $this->get_gateway()->get_order( $order );
+ $order = $this->get_gateway()->get_order( $order );
+ $payment = OrderHelper::get_payment( $order );
// order description
- $order->description = sprintf(
+ $description = sprintf(
/* translators: Context: A payment is released for a pre-order. Placeholders: %1$s - Site name, %2$s - Order number */
__( '%1$s - Pre-Order Release Payment for Order %2$s', 'woocommerce-plugin-framework' ),
esc_html( SV_WC_Helper::get_site_name() ),
$order->get_order_number()
);
+ Dynamic_Props::set( $order, 'description', $description );
+
// token is required
- if ( ! $order->payment->token ) {
+ if ( ! $payment->token ) {
throw new SV_WC_Payment_Gateway_Exception( __( 'Payment token missing/invalid.', 'woocommerce-plugin-framework' ) );
}
@@ -333,7 +346,7 @@ public function process_release_payment( $order ) {
// success! update order record
if ( $response->transaction_approved() ) {
- $last_four = substr( $order->payment->account_number, -4 );
+ $last_four = substr( $payment->account_number, -4 );
// order note based on gateway type
if ( $this->get_gateway()->is_credit_card_gateway() ) {
@@ -343,9 +356,9 @@ public function process_release_payment( $order ) {
__( '%1$s %2$s Pre-Order Release Payment Approved: %3$s ending in %4$s (expires %5$s)', 'woocommerce-plugin-framework' ),
$this->get_gateway()->get_method_title(),
$this->get_gateway()->perform_credit_card_authorization( $order ) ? 'Authorization' : 'Charge',
- SV_WC_Payment_Gateway_Helper::payment_type_to_name( ! empty( $order->payment->card_type ) ? $order->payment->card_type : 'card' ),
+ SV_WC_Payment_Gateway_Helper::payment_type_to_name( ! empty( $payment->card_type ) ? $payment->card_type : 'card' ),
$last_four,
- ( ! empty( $order->payment->exp_month) && ! empty( $order->payment->exp_year ) ? $order->payment->exp_month . '/' . substr( $order->payment->exp_year, -2 ) : 'n/a' )
+ ( ! empty( $payment->exp_month) && ! empty( $payment->exp_year ) ? $payment->exp_month . '/' . substr( $payment->exp_year, -2 ) : 'n/a' )
);
} elseif ( $this->get_gateway()->is_echeck_gateway() ) {
@@ -355,7 +368,7 @@ public function process_release_payment( $order ) {
/* translators: Context: A payment is released for a pre-order. Placeholders: %1$s - Payment gateway name, %2$s - Payment method type (e.g. 'Bank Account'), %3$s - Last four digits of the account */
__( '%1$s eCheck Pre-Order Release Payment Approved: %2$s ending in %3$s', 'woocommerce-plugin-framework' ),
$this->get_gateway()->get_method_title(),
- SV_WC_Payment_Gateway_Helper::payment_type_to_name( ! empty( $order->payment->account_type ) ? $order->payment->account_type : 'bank'),
+ SV_WC_Payment_Gateway_Helper::payment_type_to_name( ! empty( $payment->account_type ) ? $payment->account_type : 'bank'),
$last_four
);
diff --git a/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php b/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php
index ba62a0e8b..b832f78ed 100644
--- a/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php
+++ b/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php
@@ -22,11 +22,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
+
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Helpers\OrderHelper;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway\Dynamic_Props;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Integration_Subscriptions' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Integration_Subscriptions' ) ) :
/**
@@ -216,14 +219,14 @@ public function save_payment_meta( $order ) {
$updated = false;
// payment token
- if ( ! empty( $order->payment->token ) ) {
- $subscription->update_meta_data( $this->get_gateway()->get_order_meta_prefix() . 'payment_token', $order->payment->token );
+ if ( ! empty( Dynamic_Props::get( $order, 'payment', 'token' ) ) ) {
+ $subscription->update_meta_data( $this->get_gateway()->get_order_meta_prefix() . 'payment_token', Dynamic_Props::get( $order, 'payment', 'token' ) );
$updated = true;
}
// customer ID
- if ( ! empty( $order->customer_id ) ) {
- $subscription->update_meta_data( $this->get_gateway()->get_order_meta_prefix() . 'customer_id', $order->customer_id );
+ if ( ! empty( OrderHelper::get_customer_id( $order ) ) ) {
+ $subscription->update_meta_data( $this->get_gateway()->get_order_meta_prefix() . 'customer_id', OrderHelper::get_customer_id( $order ) );
$updated = true;
}
@@ -249,16 +252,18 @@ public function save_payment_meta( $order ) {
*/
public function add_subscriptions_details_to_order( $order, $gateway ) {
- if ( isset( $order->payment ) ) {
+ $payment = OrderHelper::get_payment( $order );
+
+ if ( $payment ) {
// defaults
- $order->payment->subscriptions = [];
- $order->payment->recurring = ! empty( $order->payment->recurring ) ?: false;
+ $payment->subscriptions = [];
+ $payment->recurring = ! empty( $payment->recurring ) ?: false;
// if the order contains a subscription (but is not a renewal)
if ( wcs_order_contains_subscription( $order ) ) {
- $order->payment->recurring = true;
+ $payment->recurring = true;
// an order ID might be 0 if it's a mock order we use when adding a payment method
// passing in an order with an ID of 0 to `wcs_get_subscriptions_for_order()` can cause very unexpected results
@@ -270,7 +275,7 @@ public function add_subscriptions_details_to_order( $order, $gateway ) {
if ( $subscription instanceof \WC_Subscription ) {
- $order->payment->subscriptions[] = $this->add_subscription_details_to_order( $subscription, false );
+ $payment->subscriptions[] = $this->add_subscription_details_to_order( $subscription, false );
}
}
}
@@ -278,7 +283,7 @@ public function add_subscriptions_details_to_order( $order, $gateway ) {
// order is for a subscription renewal
} elseif ( wcs_order_contains_renewal( $order ) ) {
- $order->payment->recurring = true;
+ $payment->recurring = true;
// an order ID might be 0 if it's a mock order we use when adding a payment method
// passing in an order with an ID of 0 to `wcs_get_subscriptions_for_order()` can cause very unexpected results
@@ -290,11 +295,13 @@ public function add_subscriptions_details_to_order( $order, $gateway ) {
if ( $subscription instanceof \WC_Subscription ) {
- $order->payment->subscriptions[] = $this->add_subscription_details_to_order( $subscription, true );
+ $payment->subscriptions[] = $this->add_subscription_details_to_order( $subscription, true );
}
}
}
}
+
+ OrderHelper::set_payment( $order, $payment );
}
return $order;
@@ -390,45 +397,52 @@ public function process_renewal_payment( $amount_to_charge, $order ) {
*/
public function get_order( $order ) {
- $order->description = sprintf(
+ $description = sprintf(
/* translators: Placeholders: %1$s - Site name, %2$s - Order number */
esc_html__( '%1$s - Subscription Renewal Order %2$s', 'woocommerce-plugin-framework' ),
wp_specialchars_decode( SV_WC_Helper::get_site_name(), ENT_QUOTES ),
$order->get_order_number()
);
+ Dynamic_Props::set( $order, 'description', $description );
+
// override the payment total with the amount to charge given by Subscriptions
- $order->payment_total = $this->renewal_payment_total;
+ OrderHelper::set_payment_total( $order, $this->renewal_payment_total );
+
+ $payment = OrderHelper::get_payment( $order );
// set payment token
- $order->payment->token = $this->get_gateway()->get_order_meta( $order, 'payment_token' );
+ $payment->token = $this->get_gateway()->get_order_meta( $order, 'payment_token' );
// use customer ID from renewal order, not user meta so the admin can update the customer ID for a subscription if needed
$customer_id = $this->get_gateway()->get_order_meta( $order, 'customer_id' );
// only if a customer ID exists in order meta, otherwise this will default to the previously set value from user meta
if ( ! empty( $customer_id ) ) {
- $order->customer_id = $customer_id;
+ OrderHelper::set_customer_id( $order, $customer_id );
}
// get the token object
- $token = $this->get_gateway()->get_payment_tokens_handler()->get_token( $order->get_user_id(), $order->payment->token );
+ $token = $this->get_gateway()->get_payment_tokens_handler()->get_token( $order->get_user_id(), $payment->token );
// set token data on the order
- $order->payment->account_number = $token->get_last_four();
- $order->payment->last_four = $token->get_last_four();
+ $payment->account_number = $token->get_last_four();
+ $payment->last_four = $token->get_last_four();
if ( $token->is_credit_card() ) {
- $order->payment->card_type = $token->get_card_type();
- $order->payment->exp_month = $token->get_exp_month();
- $order->payment->exp_year = SV_WC_Payment_Gateway_Helper::format_exp_year( $token->get_exp_year() );
+ $payment->card_type = $token->get_card_type();
+ $payment->exp_month = $token->get_exp_month();
+ $payment->exp_year = SV_WC_Payment_Gateway_Helper::format_exp_year( $token->get_exp_year() );
} elseif ( $token->is_echeck() ) {
- $order->payment->account_type = $token->get_account_type();
+ $payment->account_type = $token->get_account_type();
}
+ // Set payment info on the order object
+ OrderHelper::set_payment( $order, $payment );
+
return $order;
}
@@ -508,10 +522,12 @@ public function process_change_payment( $result, $order_id, $gateway ) {
$subscription = $gateway->get_order( $order_id );
+ $payment = OrderHelper::get_payment( $subscription );
+
try {
// if using a saved method, just add the data
- if ( isset( $subscription->payment->token ) && $subscription->payment->token ) {
+ if ( isset( $payment->token ) && $payment->token ) {
$gateway->add_transaction_data( $subscription );
diff --git a/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-token.php b/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-token.php
index fdb76b7fe..f309455b8 100644
--- a/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-token.php
+++ b/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-token.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Payment_Token' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Payment_Token' ) ) :
/**
diff --git a/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php b/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php
index 5a7048f7a..a923af614 100644
--- a/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php
+++ b/woocommerce/payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php
@@ -22,11 +22,13 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
+
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Helpers\OrderHelper;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WC_Payment_Gateway_Payment_Tokens_Handler' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WC_Payment_Gateway_Payment_Tokens_Handler' ) ) :
/**
@@ -144,17 +146,19 @@ public function create_token( \WC_Order $order, $response = null, $environment_i
// store the billing hash on the token for later use in case it needs to be updated
$token->set_billing_hash( $address->get_hash() );
+ $payment = OrderHelper::get_payment( $order );
+
// set the resulting token on the order
- $order->payment->token = $token->get_id();
+ $payment->token = $token->get_id();
// for credit card transactions add the card type, if known (some gateways return the credit card type as part of the response, others may require it as part of the request, and still others it may never be known)
if ( $gateway->is_credit_card_gateway() && $token->get_card_type() ) {
- $order->payment->card_type = $token->get_card_type();
+ $payment->card_type = $token->get_card_type();
}
// checking/savings, if known
if ( $gateway->is_echeck_gateway() && $token->get_account_type() ) {
- $order->payment->account_type = $token->get_account_type();
+ $payment->account_type = $token->get_account_type();
}
// set the token to the user account
@@ -162,6 +166,9 @@ public function create_token( \WC_Order $order, $response = null, $environment_i
$this->add_token( $order->get_user_id(), $token, $environment_id );
}
+ // Set payment info on the order object.
+ OrderHelper::set_payment( $order, $payment );
+
$order->add_order_note( $this->get_order_note( $token ) );
// add the standard transaction data
@@ -295,7 +302,7 @@ public function get_token( $user_id, $token, $environment_id = null ) {
* @param string|null $environment_id optional environment id, defaults to plugin current environment
* @return SV_WC_Payment_Gateway_Payment_Token payment token object or null
*/
- public function get_token_by_core_id( int $user_id, int $core_token_id, string $environment_id = null ): ?SV_WC_Payment_Gateway_Payment_Token
+ public function get_token_by_core_id( int $user_id, int $core_token_id, ?string $environment_id = null ): ?SV_WC_Payment_Gateway_Payment_Token
{
// default to current environment
if ( is_null( $environment_id ) ) {
diff --git a/woocommerce/payment-gateway/rest-api/class-sv-wc-payment-gateway-plugin-rest-api.php b/woocommerce/payment-gateway/rest-api/class-sv-wc-payment-gateway-plugin-rest-api.php
index e0406593b..610ebe205 100644
--- a/woocommerce/payment-gateway/rest-api/class-sv-wc-payment-gateway-plugin-rest-api.php
+++ b/woocommerce/payment-gateway/rest-api/class-sv-wc-payment-gateway-plugin-rest-api.php
@@ -22,19 +22,19 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\Payment_Gateway;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\Payment_Gateway;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\REST_API as Plugin_REST_API;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\REST_API as Plugin_REST_API;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\Payment_Gateway\\REST_API' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\Payment_Gateway\\REST_API' ) ) :
/**
* The payment gateway plugin REST API handler class.
*
- * @see \SkyVerge\WooCommerce\PluginFramework\v5_15_12\REST_API
+ * @see \SkyVerge\WooCommerce\PluginFramework\v6_0_0\REST_API
*
* @since 5.2.0
*/
@@ -47,7 +47,7 @@ class REST_API extends Plugin_REST_API {
*
* Plugins can override this to add their own data.
*
- * @see \SkyVerge\WooCommerce\PluginFramework\v5_15_12\REST_API::get_system_status_data()
+ * @see \SkyVerge\WooCommerce\PluginFramework\v6_0_0\REST_API::get_system_status_data()
*
* @since 5.2.0
*
diff --git a/woocommerce/rest-api/Controllers/Settings.php b/woocommerce/rest-api/Controllers/Settings.php
index f4bc27af9..3bba41167 100644
--- a/woocommerce/rest-api/Controllers/Settings.php
+++ b/woocommerce/rest-api/Controllers/Settings.php
@@ -22,14 +22,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12\REST_API\Controllers;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0\REST_API\Controllers;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Settings_API\Abstract_Settings;
-use SkyVerge\WooCommerce\PluginFramework\v5_15_12\Settings_API\Setting;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Settings_API\Abstract_Settings;
+use SkyVerge\WooCommerce\PluginFramework\v6_0_0\Settings_API\Setting;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\REST_API\\Controllers\\Settings' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\REST_API\\Controllers\\Settings' ) ) :
/**
diff --git a/woocommerce/rest-api/class-sv-wc-plugin-rest-api.php b/woocommerce/rest-api/class-sv-wc-plugin-rest-api.php
index 52c2884fc..e2253f40b 100644
--- a/woocommerce/rest-api/class-sv-wc-plugin-rest-api.php
+++ b/woocommerce/rest-api/class-sv-wc-plugin-rest-api.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\REST_API' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\REST_API' ) ) :
/**
diff --git a/woocommerce/utilities/class-sv-wp-async-request.php b/woocommerce/utilities/class-sv-wp-async-request.php
index 25ed265fa..019a33db5 100644
--- a/woocommerce/utilities/class-sv-wp-async-request.php
+++ b/woocommerce/utilities/class-sv-wp-async-request.php
@@ -23,11 +23,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WP_Async_Request' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WP_Async_Request' ) ) :
/**
diff --git a/woocommerce/utilities/class-sv-wp-background-job-handler.php b/woocommerce/utilities/class-sv-wp-background-job-handler.php
index 435149f92..b27a15ed0 100644
--- a/woocommerce/utilities/class-sv-wp-background-job-handler.php
+++ b/woocommerce/utilities/class-sv-wp-background-job-handler.php
@@ -23,11 +23,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
-namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
-if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WP_Background_Job_Handler' ) ) :
+if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WP_Background_Job_Handler' ) ) :
/**
diff --git a/woocommerce/utilities/class-sv-wp-job-batch-handler.php b/woocommerce/utilities/class-sv-wp-job-batch-handler.php
index deec81693..b54dd5cfb 100644
--- a/woocommerce/utilities/class-sv-wp-job-batch-handler.php
+++ b/woocommerce/utilities/class-sv-wp-job-batch-handler.php
@@ -22,11 +22,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
- namespace SkyVerge\WooCommerce\PluginFramework\v5_15_12;
+ namespace SkyVerge\WooCommerce\PluginFramework\v6_0_0;
defined( 'ABSPATH' ) or exit;
- if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_15_12\\SV_WP_Job_Batch_Handler' ) ) :
+ if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v6_0_0\\SV_WP_Job_Batch_Handler' ) ) :
/**