From 8a29622fe801ed033477d97c6df34693136df12a Mon Sep 17 00:00:00 2001 From: babak alizadeh Date: Fri, 12 Jan 2024 21:54:21 +0000 Subject: [PATCH] add hook controller --- admin/partials/ssbhesabix-admin-setting.php | 19 ++++--------------- includes/class-ssbhesabix-activator.php | 4 ++-- includes/class-ssbhesabix-api.php | 4 ++-- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/admin/partials/ssbhesabix-admin-setting.php b/admin/partials/ssbhesabix-admin-setting.php index d2562ae..dd70cbe 100644 --- a/admin/partials/ssbhesabix-admin-setting.php +++ b/admin/partials/ssbhesabix-admin-setting.php @@ -1667,7 +1667,7 @@ class Ssbhesabix_Setting { $default_currency = $ssbhesabix_api->settingGetCurrency(); if ( $default_currency->Success ) { $woocommerce_currency = get_woocommerce_currency(); - $hesabix_currency = $default_currency->Result->Currency; + $hesabix_currency = $default_currency->Result->moneyName; if ( $hesabix_currency == $woocommerce_currency || ( $hesabix_currency == 'IRR' && $woocommerce_currency == 'IRT' ) || ( $hesabix_currency == 'IRT' && $woocommerce_currency == 'IRR' ) ) { update_option( 'ssbhesabix_hesabix_default_currency', $hesabix_currency ); } else { @@ -1693,24 +1693,13 @@ class Ssbhesabix_Setting { } } else { update_option( 'ssbhesabix_live_mode', 0 ); - - if ( $response->ErrorCode === 108 ) { - echo '
'; - echo '

' . __( 'Cannot connect to Hesabix. Business expired.', 'ssbhesabix' ) . $response->ErrorMessage . '

'; - echo '
'; - update_option( 'ssbhesabix_business_expired', 1 ); - } else { - echo '
'; - echo '

' . __( 'Cannot set Hesabix webHook. Error Message:', 'ssbhesabix' ) . $response->ErrorMessage . '

'; - echo '
'; - update_option( 'ssbhesabix_business_expired', 0 ); - } - + echo '
'; + echo '

' . __( 'Cannot set Hesabix webHook. Error Message:', 'ssbhesabix' ) . $response->ErrorMessage . '

'; + echo '
'; HesabixLogService::log( array("Cannot set Hesabix webHook. Error Message: $response->ErrorMessage. Error Code: $response->ErrorCode") ); } } else { update_option( 'ssbhesabix_live_mode', 0 ); - echo '
'; echo '

' . __( 'Cannot connect to Hesabix servers. Please check your Internet connection', 'ssbhesabix' ) . '

'; echo '
'; diff --git a/includes/class-ssbhesabix-activator.php b/includes/class-ssbhesabix-activator.php index 75273e7..73231a6 100644 --- a/includes/class-ssbhesabix-activator.php +++ b/includes/class-ssbhesabix-activator.php @@ -40,8 +40,8 @@ class Ssbhesabix_Activator { add_option('ssbhesabix_do_not_submit_product_automatically', "no"); add_option('ssbhesabix_do_not_update_product_price_in_hesabix', "no"); add_option('ssbhesabix_contact_add_additional_checkout_fields_hesabix', 1); - add_option('ssbhesabix_account_bid', 1); - add_option('ssbhesabix_account_year', 1); + add_option('ssbhesabix_account_bid', 0); + add_option('ssbhesabix_account_year', 0); self::ssbhesabix_create_database_table(); } diff --git a/includes/class-ssbhesabix-api.php b/includes/class-ssbhesabix-api.php index 4e0efcc..c5232b9 100644 --- a/includes/class-ssbhesabix-api.php +++ b/includes/class-ssbhesabix-api.php @@ -374,7 +374,7 @@ class Ssbhesabix_Api //================================================================================================ public function settingGetChanges($start = 0) { - $method = 'setting/GetChanges'; + $method = 'hooks/setting/GetChanges'; $data = array( 'start' => $start, ); @@ -413,7 +413,7 @@ class Ssbhesabix_Api //================================================================================================ public function settingGetCurrency() { - $method = 'setting/getCurrency'; + $method = 'hooks/setting/getCurrency'; return $this->apiRequest($method); }