From 578502838ec62b78c4c02b164e47a49dadcb7a2f Mon Sep 17 00:00:00 2001 From: asus Date: Wed, 20 Mar 2024 15:29:34 +0100 Subject: [PATCH] rollback to not calculating price --- plugins/cipf_plugin/cipf_plugin.php | 2 +- .../cipf_plugin/php/paypal/route_api_orders.php | 5 +++-- plugins/cipf_plugin/php/paypal/user_can_pay.php | 3 ++- plugins/cipf_plugin/utils/plgntls_class.php | 14 +++++++------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/plugins/cipf_plugin/cipf_plugin.php b/plugins/cipf_plugin/cipf_plugin.php index 4295b8b..049a073 100644 --- a/plugins/cipf_plugin/cipf_plugin.php +++ b/plugins/cipf_plugin/cipf_plugin.php @@ -4,7 +4,7 @@ Plugin Name: cipf_plugin Plugin URI: Description: Author: hugogogo -Version: 0.3.10.1 +Version: 0.3.10.2 Author URI: */ diff --git a/plugins/cipf_plugin/php/paypal/route_api_orders.php b/plugins/cipf_plugin/php/paypal/route_api_orders.php index 095d429..e363bb8 100644 --- a/plugins/cipf_plugin/php/paypal/route_api_orders.php +++ b/plugins/cipf_plugin/php/paypal/route_api_orders.php @@ -92,13 +92,14 @@ function handle_orders_request_CIPF($request_data) { function create_order_CIPF() { PLGNTLS_class::debug_infos(); $paypal_api_base_url = PLGNTLS_class::get_paypal_api_base_url(); + $acf_card_price_total = PLGNTLS_class::ACF_CARD_PRICE_TOTAL; $access_token = generate_access_token_CIPF(); $user_id = get_current_user_id(); $acf_id = 'user_' . $user_id; -// $price = get_field('somme_a_regler', $acf_id); - $price = 0.01; + $price = get_field($acf_card_price_total['_name'], $acf_id); +// $price = 0.01; $url = $paypal_api_base_url . '/v2/checkout/orders'; $payload = array( diff --git a/plugins/cipf_plugin/php/paypal/user_can_pay.php b/plugins/cipf_plugin/php/paypal/user_can_pay.php index b8263ca..bfd7e1f 100644 --- a/plugins/cipf_plugin/php/paypal/user_can_pay.php +++ b/plugins/cipf_plugin/php/paypal/user_can_pay.php @@ -65,11 +65,11 @@ function check_can_pay_CIPF() { /* + * ABANDONNED : bug with formbuilder * calculate price * update the price even if form builder already did it * in case it was changed from admin pannel * - */ $tarif = get_acf_value_CIPF($acf_card_price_choice, $acf_id); $livraison = get_acf_value_CIPF($acf_card_price_delivery, $acf_id); if ($tarif !== null && $livraison !== null) { @@ -79,6 +79,7 @@ function check_can_pay_CIPF() { $price = 0; } update_field($acf_card_price_total['_name'], $price, $acf_id); + */ /* diff --git a/plugins/cipf_plugin/utils/plgntls_class.php b/plugins/cipf_plugin/utils/plgntls_class.php index a6fe265..e6bf0cc 100644 --- a/plugins/cipf_plugin/utils/plgntls_class.php +++ b/plugins/cipf_plugin/utils/plgntls_class.php @@ -63,7 +63,7 @@ class PLGNTLS_class { const ACF_CARD_STATE = ['_name'=>'etat_carte', 'new'=>'Commande', 'renew'=>'Renouvellement']; // radio button const ACF_CARD_PAYMENT_METHOD = ['_name'=>'paiement', 'paypal'=>'Paypal', 'transfert'=>'Virement']; // radio button const ACF_CARD_PRICE_CHOICE = ['_name'=>'tarif', 'low'=>'10', 'high'=>'15']; // radio button - const ACF_CARD_PRICE_DELIVERY = ['_name'=>'livraison', 'pdf'=>'PDF', 'post'=>'Fabrication']; // radio button + const ACF_CARD_PRICE_DELIVERY = ['_name'=>'livraison', 'pdf'=>'0', 'post'=>'5']; // radio button const ACF_PROF_IS_ACTIV = ['_name'=>'compte-actif', 'activ'=>'Actif', 'inactiv'=>'Inactif']; // radio button const ACF_PROF_CGV = ['_name'=>'cgv', 'cgv'=>'cgv']; // checkbox const ACF_CARD_PRICE_TOTAL = ['_name'=>'somme_a_regler']; // number @@ -96,8 +96,8 @@ class PLGNTLS_class { // PAYPAL const PAYPAL_SBOX_API_BASE_URL = "https://api-m.sandbox.paypal.com"; const PAYPAL_LIVE_API_BASE_URL = "https://api-m.paypal.com"; - const PAYPAL_HUGO_SANDBOX_CLIENT_ID = "AfcmwxIXlG2ZxaMdjazX57I70BXz__aEqNWaTnqfSCI34a0V7nMbytswx7EViUjlpHs7opyrRwaH9YLl"; - const PAYPAL_HUGO_SANDBOX_CLIENT_SECRET = "EGunIhGRjPvn0Z8wXO0JsdhET30OStTAH_IyRsmhimEN23_qiRSFD-ql4tvnulKJw6TitZ-vU-ytc4A-"; + const PAYPAL_HUGO_SBOX_CLIENT_ID = "AfcmwxIXlG2ZxaMdjazX57I70BXz__aEqNWaTnqfSCI34a0V7nMbytswx7EViUjlpHs7opyrRwaH9YLl"; + const PAYPAL_HUGO_SBOX_CLIENT_SECRET = "EGunIhGRjPvn0Z8wXO0JsdhET30OStTAH_IyRsmhimEN23_qiRSFD-ql4tvnulKJw6TitZ-vU-ytc4A-"; const PAYPAL_HUGO_LIVE_CLIENT_ID = "Aedn5e8z__hPBvKirqw5bwlhI9ChG8_N6c1xbgybYyBr4B4oP8uVzmVdH1QVKdPQKf6bWg7orPV4PDrO"; const PAYPAL_HUGO_LIVE_CLIENT_SECRET = "EGeGwfHGxHxsjnC-tH8W0IL4nN3_xlc3sXFRPCQOw5uUoWae3eOgghuDKMnZc5DVGTbP6yIjVJ1BaAra"; //const PAYPAL_CLIENT_ID = self::PAYPAL_HUGO_LIVE_CLIENT_ID; @@ -225,16 +225,16 @@ class PLGNTLS_class { public static function set_paypal_api_base_url($api_url) { } public static function get_paypal_client_id() { - return self::PAYPAL_HUGO_LIVE_CLIENT_ID; + return self::PAYPAL_HUGO_SBOX_CLIENT_ID; } public static function get_paypal_client_secret() { - return self::PAYPAL_HUGO_LIVE_CLIENT_SECRET; + return self::PAYPAL_HUGO_SBOX_CLIENT_SECRET; } public static function get_paypal_api_base_url() { /* - return self::PAYPAL_SBOX_API_BASE_URL; - */ return self::PAYPAL_LIVE_API_BASE_URL; + */ + return self::PAYPAL_SBOX_API_BASE_URL; }