diff --git a/src/include/order/class-wc-retailcrm-order-payment.php b/src/include/order/class-wc-retailcrm-order-payment.php index 7704f5c..a36a732 100644 --- a/src/include/order/class-wc-retailcrm-order-payment.php +++ b/src/include/order/class-wc-retailcrm-order-payment.php @@ -57,6 +57,8 @@ class WC_Retailcrm_Order_Payment extends WC_Retailcrm_Abstracts_Data && $this->settings['send_payment_amount'] === WC_Retailcrm_Base::YES ) { $data['amount'] = (double) $order->get_total(); + } else { + unset($data['amount']); } if (!$this->is_new) { diff --git a/tests/test-wc-retailcrm-history.php b/tests/test-wc-retailcrm-history.php index f28515b..4df2134 100644 --- a/tests/test-wc-retailcrm-history.php +++ b/tests/test-wc-retailcrm-history.php @@ -2,8 +2,13 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper { + /** @var WC_Retailcrm_Proxy */ protected $apiMock; + + /** @var WC_Retailcrm_Response_Helper */ protected $customersHistoryResponse; + + /** @var WC_Retailcrm_Response_Helper */ protected $ordersHistoryResponse; const STATUS_1 = 'status1'; @@ -44,6 +49,14 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper { $this->setOptions($api_version); + if (!add_option('retailcrm_orders_history_since_id', 0)) { + update_option('retailcrm_orders_history_since_id', 0); + } + + if (!add_option('retailcrm_customers_history_since_id', 0)) { + update_option('retailcrm_customers_history_since_id', 0); + } + $this->customersHistoryResponse->expects($this->any()) ->method('isSuccessful') ->willReturn(true); @@ -70,7 +83,7 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper $order_added = end($orders); if (!$order_added) { - $this->fail('$order_added is null'); + $this->fail('$order_added is null - no orders were added after receiving history'); } $order_added_items = $order_added->get_items();