From f861b10197399c806bed836b10edae62c1ff120c Mon Sep 17 00:00:00 2001 From: Scott Kennedy Date: Wed, 27 Mar 2024 22:48:40 +0000 Subject: [PATCH] Change to setup_intents. --- plugin.json | 6 ++-- woonuxt.php | 100 +++++++++++++++++++++++++--------------------------- 2 files changed, 52 insertions(+), 54 deletions(-) diff --git a/plugin.json b/plugin.json index 5e3ddd7..0fff960 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "name": "woonuxt Settings", - "version": "1.0.53", - "download_url": "https://github.com/scottyzen/woonuxt-settings/releases/download/1.0.53/woonuxt-settings.zip", + "version": "1.0.54", + "download_url": "https://github.com/scottyzen/woonuxt-settings/releases/download/1.0.54/woonuxt-settings.zip", "homepage": "https://woonuxt.com/", "tested": "6.4.3", @@ -13,7 +13,7 @@ "sections": { "description": "WooNuxt is unmatched when it comes to performance and scalability. Reap the benefits of having a online store that out performs all of your competitors.", "installation": "(Recommended) Installation instructions.", - "changelog": "

1.0.53

Add stripePaymentIntent for 3d secure.

1.0.52

Bump version.

1.0.51

Inhance Social media fileds and schema.

<

1.0.50

Add SEO settings

1.0.49

Add functionality to increase max query amount if there are more than 100 products

1.0.45

Fix error when WooCommerce is disabled or not installed

" + "changelog": "

1.0.54

Change to setup_intents.

1.0.53

Add stripePaymentIntent for 3d secure.

1.0.52

Bump version.

1.0.51

Inhance Social media fileds and schema.

<

1.0.50

Add SEO settings

1.0.49

Add functionality to increase max query amount if there are more than 100 products

1.0.45

Fix error when WooCommerce is disabled or not installed

" }, "icons": { diff --git a/woonuxt.php b/woonuxt.php index a656668..46abc8d 100644 --- a/woonuxt.php +++ b/woonuxt.php @@ -5,7 +5,7 @@ Author: Scott Kennedy Author URI: http://scottyzen.com Plugin URI: https://github.com/scottyzen/woonuxt-settings -Version: 1.0.53 +Version: 1.0.54 Text Domain: woonuxt GitHub Plugin URI: scottyzen/woonuxt-settings GitHub Plugin URI: https://github.com/scottyzen/woonuxt-settings @@ -16,7 +16,7 @@ exit(); } -define('WOONUXT_SETTINGS_VERSION', '1.0.53'); +define('WOONUXT_SETTINGS_VERSION', '1.0.54'); define('MY_WOOCOMMERCE_VERSION', '8.5.2'); define('WP_GRAPHQL_VERSION', '1.20.0'); define('WOO_GRAPHQL_VERSION', '0.19.0'); @@ -478,16 +478,16 @@ function global_setting_callback() $value): ?> - - - - - - - - Delete - - + + + + + + + + Delete + + @@ -584,40 +584,40 @@ function global_setting_callback() $value): ?> - - - - - - + + + - - - /> - - - /> - - - /> - - -
- Delete | - | - -
- - - + + + + /> + + + /> + + + /> + + +
+ Delete | + | + +
+ + + @@ -754,6 +754,7 @@ function global_setting_callback() 'resolve' => function () { $amount = floatval(WC()->cart->get_total(false)) * 100; $currency = get_woocommerce_currency(); + $currency = strtoupper($currency); $payment_intent = create_payment_intent($amount, $currency); return [ @@ -809,23 +810,20 @@ function create_payment_intent($amount, $currency) return new WP_Error('stripe_not_installed', 'Stripe is not installed'); } - $payment_intent = WC_Stripe_API::request( + $setup_intent = WC_Stripe_API::request( [ - 'amount' => $amount, - 'currency' => $currency, 'payment_method_types' => ['card'], - 'capture_method' => 'automatic', ], - 'payment_intents' - ); + 'setup_intents'); - if (!empty($payment_intent->error)) { + if (!empty($setup_intent->error)) { throw new Exception($payment_intent->error->message); } return [ 'id' => $payment_intent->id, - 'client_secret' => $payment_intent->client_secret, + // 'client_secret' => $payment_intent->client_secret, + 'client_secret' => $setup_intent->client_secret, 'error' => $payment_intent->error, ]; } \ No newline at end of file