@@ -619,13 +619,20 @@ function order_status()
619619 $ remaining_pending = $ calc ['remaining_pending ' ];
620620 $ remaining_fiat = $ calc ['remaining_fiat ' ];
621621
622+ $ hide_refresh = 0 ;
623+
622624 $ cryptapi_pending = 0 ;
625+
626+ $ counter_calc = (int )$ order ->get_meta ('cryptapi_last_price_update ' ) + (int )$ this ->refresh_value_interval - time ();
627+
628+ if ($ already_paid > 0 ) {
629+ $ hide_refresh = 1 ;
630+ }
631+
623632 if ($ remaining_pending <= 0 && !$ order ->is_paid ()) {
624633 $ cryptapi_pending = 1 ;
625634 }
626635
627- $ counter_calc = (int )$ order ->get_meta ('cryptapi_last_price_update ' ) + (int )$ this ->refresh_value_interval - time ();
628-
629636 if ($ counter_calc <= 0 && !$ order ->is_paid ()) {
630637 $ this ->ca_cronjob ();
631638 }
@@ -653,7 +660,8 @@ function order_status()
653660 'remaining ' => $ remaining_pending <= 0 ? 0 : $ remaining_pending ,
654661 'fiat_remaining ' => $ remaining_fiat <= 0 ? 0 : $ remaining_fiat ,
655662 'already_paid_fiat ' => floatval ($ already_paid_fiat ) <= 0 ? 0 : floatval ($ already_paid_fiat ),
656- 'fiat_symbol ' => get_woocommerce_currency_symbol ()
663+ 'fiat_symbol ' => get_woocommerce_currency_symbol (),
664+ 'hide_refresh ' => $ hide_refresh ,
657665 ];
658666
659667 echo json_encode ($ data );
@@ -676,8 +684,7 @@ function validate_logs($order, $history)
676684 $ request_url = parse_url ($ logs [0 ]->request_url );
677685 parse_str ($ request_url ['query ' ], $ data );
678686
679- if (empty ($ history [$ callback ->uuid ]) || (!empty ($ history [$ callback ->uuid ]) && (int )$ data ['pending ' ] === 0 )) {
680-
687+ if (empty ($ history [$ callback ->uuid ]) || (!empty ($ history [$ callback ->uuid ]) && (int )$ history [$ callback ->uuid ]['pending ' ] === 1 && (int )$ data ['pending ' ] === 0 )) {
681688 $ this ->process_callback_data ($ data , $ order , true );
682689 }
683690 }
@@ -1120,7 +1127,7 @@ function ca_cronjob()
11201127 }
11211128
11221129 if ($ value_refresh !== 0 && $ last_price_update + $ value_refresh <= time () && !empty ($ last_price_update )) {
1123- if ($ remaining === $ remaining_pending ) {
1130+ if ($ already_paid === 0 ) {
11241131 $ cryptapi_coin = $ order ->get_meta ('cryptapi_currency ' );
11251132
11261133 $ crypto_total = CryptAPI \Helper::sig_fig (CryptAPI \Helper::get_conversion ($ woocommerce_currency , $ cryptapi_coin , $ order ->get_total ('edit ' ), $ this ->disable_conversion ), 6 );
0 commit comments