@@ -602,7 +602,10 @@ function order_status() {
602602
603603 $ history = json_decode ( $ order ->get_meta ( 'cryptapi_history ' ), true );
604604
605- $ calc = $ this ->calc_order ( $ history , $ order ->get_meta ( 'cryptapi_total ' ), $ order ->get_meta ( 'cryptapi_total_fiat ' ) );
605+ $ cryptapi_total = $ order ->get_meta ( 'cryptapi_total ' );
606+ $ order_total = $ order ->get_total ( 'edit ' );
607+
608+ $ calc = $ this ->calc_order ( $ history , $ cryptapi_total , $ order_total );
606609
607610 $ already_paid = $ calc ['already_paid ' ];
608611 $ already_paid_fiat = $ calc ['already_paid_fiat ' ];
@@ -1143,7 +1146,10 @@ function ca_cronjob($force = false, $order_id = '') {
11431146
11441147 $ min_tx = (float ) $ order ->get_meta ( 'cryptapi_min ' );
11451148
1146- $ calc = $ this ->calc_order ( $ history , $ order ->get_meta ( 'cryptapi_total ' ), $ order ->get_meta ( 'cryptapi_total_fiat ' ) );
1149+ $ cryptapi_total = $ order ->get_meta ( 'cryptapi_total ' );
1150+ $ order_total = $ order ->get_total ( 'edit ' );
1151+
1152+ $ calc = $ this ->calc_order ( $ history , $ cryptapi_total , $ order_total );
11471153
11481154 $ remaining = $ calc ['remaining ' ];
11491155 $ remaining_pending = $ calc ['remaining_pending ' ];
@@ -1155,10 +1161,11 @@ function ca_cronjob($force = false, $order_id = '') {
11551161 if ( ($ remaining === $ remaining_pending && $ remaining_pending > 0 ) || ((int )$ order_id === $ order ->get_id () && $ force && $ remaining === $ remaining_pending && $ remaining_pending > 0 )) {
11561162 $ cryptapi_coin = $ order ->get_meta ( 'cryptapi_currency ' );
11571163
1158- $ crypto_total = CryptAPI \Helper::sig_fig ( CryptAPI \Helper::get_conversion ( $ woocommerce_currency , $ cryptapi_coin , $ order ->get_total ( 'edit ' ), $ this ->disable_conversion ), 6 );
1164+ $ crypto_conversion = (float ) CryptAPI \Helper::get_conversion ( $ woocommerce_currency , $ cryptapi_coin , $ order_total , $ this ->disable_conversion );
1165+ $ crypto_total = CryptAPI \Helper::sig_fig ($ crypto_conversion , 6 );
11591166 $ order ->update_meta_data ( 'cryptapi_total ' , $ crypto_total );
11601167
1161- $ calc_cron = $ this ->calc_order ( $ history , $ order -> get_meta ( ' cryptapi_total ' ) , $ order -> get_meta ( ' cryptapi_total_fiat ' ) );
1168+ $ calc_cron = $ this ->calc_order ( $ history , $ crypto_total , $ order_total );
11621169 $ crypto_remaining_total = $ calc_cron ['remaining_pending ' ];
11631170
11641171 if ( $ remaining_pending <= $ min_tx && ! $ remaining_pending <= 0 ) {
@@ -1171,7 +1178,7 @@ function ca_cronjob($force = false, $order_id = '') {
11711178 }
11721179
11731180 $ order ->update_meta_data ( 'cryptapi_last_price_update ' , time () );
1174- $ order ->save ();
1181+ $ order ->save_meta_data ();
11751182 }
11761183
11771184 if ( $ order_timeout !== 0 && ( $ order_timestamp + $ order_timeout ) <= time () && $ already_paid <= 0 && (int ) $ order ->get_meta ( 'cryptapi_cancelled ' ) === 0 ) {
0 commit comments