add hook controller

This commit is contained in:
Hesabix 2024-01-12 21:54:21 +00:00
parent 2690989f86
commit 8a29622fe8
3 changed files with 8 additions and 19 deletions

View file

@ -1667,7 +1667,7 @@ class Ssbhesabix_Setting {
$default_currency = $ssbhesabix_api->settingGetCurrency(); $default_currency = $ssbhesabix_api->settingGetCurrency();
if ( $default_currency->Success ) { if ( $default_currency->Success ) {
$woocommerce_currency = get_woocommerce_currency(); $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' ) ) { 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 ); update_option( 'ssbhesabix_hesabix_default_currency', $hesabix_currency );
} else { } else {
@ -1693,24 +1693,13 @@ class Ssbhesabix_Setting {
} }
} else { } else {
update_option( 'ssbhesabix_live_mode', 0 ); update_option( 'ssbhesabix_live_mode', 0 );
echo '<div class="error">';
if ( $response->ErrorCode === 108 ) { echo '<p class="hesabix-p">' . __( 'Cannot set Hesabix webHook. Error Message:', 'ssbhesabix' ) . $response->ErrorMessage . '</p>';
echo '<div class="error">'; echo '</div>';
echo '<p class="hesabix-p">' . __( 'Cannot connect to Hesabix. Business expired.', 'ssbhesabix' ) . $response->ErrorMessage . '</p>';
echo '</div>';
update_option( 'ssbhesabix_business_expired', 1 );
} else {
echo '<div class="error">';
echo '<p class="hesabix-p">' . __( 'Cannot set Hesabix webHook. Error Message:', 'ssbhesabix' ) . $response->ErrorMessage . '</p>';
echo '</div>';
update_option( 'ssbhesabix_business_expired', 0 );
}
HesabixLogService::log( array("Cannot set Hesabix webHook. Error Message: $response->ErrorMessage. Error Code: $response->ErrorCode") ); HesabixLogService::log( array("Cannot set Hesabix webHook. Error Message: $response->ErrorMessage. Error Code: $response->ErrorCode") );
} }
} else { } else {
update_option( 'ssbhesabix_live_mode', 0 ); update_option( 'ssbhesabix_live_mode', 0 );
echo '<div class="error">'; echo '<div class="error">';
echo '<p class="hesabix-p">' . __( 'Cannot connect to Hesabix servers. Please check your Internet connection', 'ssbhesabix' ) . '</p>'; echo '<p class="hesabix-p">' . __( 'Cannot connect to Hesabix servers. Please check your Internet connection', 'ssbhesabix' ) . '</p>';
echo '</div>'; echo '</div>';

View file

@ -40,8 +40,8 @@ class Ssbhesabix_Activator {
add_option('ssbhesabix_do_not_submit_product_automatically', "no"); add_option('ssbhesabix_do_not_submit_product_automatically', "no");
add_option('ssbhesabix_do_not_update_product_price_in_hesabix', "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_contact_add_additional_checkout_fields_hesabix', 1);
add_option('ssbhesabix_account_bid', 1); add_option('ssbhesabix_account_bid', 0);
add_option('ssbhesabix_account_year', 1); add_option('ssbhesabix_account_year', 0);
self::ssbhesabix_create_database_table(); self::ssbhesabix_create_database_table();
} }

View file

@ -374,7 +374,7 @@ class Ssbhesabix_Api
//================================================================================================ //================================================================================================
public function settingGetChanges($start = 0) public function settingGetChanges($start = 0)
{ {
$method = 'setting/GetChanges'; $method = 'hooks/setting/GetChanges';
$data = array( $data = array(
'start' => $start, 'start' => $start,
); );
@ -413,7 +413,7 @@ class Ssbhesabix_Api
//================================================================================================ //================================================================================================
public function settingGetCurrency() public function settingGetCurrency()
{ {
$method = 'setting/getCurrency'; $method = 'hooks/setting/getCurrency';
return $this->apiRequest($method); return $this->apiRequest($method);
} }