diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 3452dc8..6703c53 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -22,7 +22,7 @@ RUN apt-get install -y subversion RUN apt-get install -y wget RUN wget -O /usr/bin/phpunit https://phar.phpunit.de/phpunit-7.phar && chmod +x /usr/bin/phpunit -RUN curl --insecure https://getcomposer.org/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer +RUN curl --insecure https://getcomposer.org/download/1.9.3/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - RUN apt-get install -y nodejs diff --git a/src/include/class-wc-retailcrm-history.php b/src/include/class-wc-retailcrm-history.php index 2511de3..3fd203a 100644 --- a/src/include/class-wc-retailcrm-history.php +++ b/src/include/class-wc-retailcrm-history.php @@ -173,14 +173,14 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) : return; } - /** - * History orders - * - * @param string $date - * @param int $since_id - * - * @return boolean - */ + /** + * History orders + * + * @param string $date + * @param int $since_id + * + * @return boolean + */ protected function ordersHistory($date, $since_id) { $options = array_flip(array_filter($this->retailcrm_settings)); diff --git a/src/include/order/class-wc-retailcrm-order-payment.php b/src/include/order/class-wc-retailcrm-order-payment.php index a36a732..bc44905 100644 --- a/src/include/order/class-wc-retailcrm-order-payment.php +++ b/src/include/order/class-wc-retailcrm-order-payment.php @@ -57,8 +57,6 @@ 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) { @@ -105,6 +103,12 @@ class WC_Retailcrm_Order_Payment extends WC_Retailcrm_Abstracts_Data return array(); } + if (!empty($this->settings['send_payment_amount']) + && $this->settings['send_payment_amount'] === WC_Retailcrm_Base::NO + ) { + unset($data['amount']); + } + return $data; } diff --git a/tests/helpers/class-wc-retailcrm-test-case-helper.php b/tests/helpers/class-wc-retailcrm-test-case-helper.php index a7865a3..3063153 100644 --- a/tests/helpers/class-wc-retailcrm-test-case-helper.php +++ b/tests/helpers/class-wc-retailcrm-test-case-helper.php @@ -20,6 +20,7 @@ class WC_Retailcrm_Test_Case_Helper extends WC_Unit_Test_Case 'p_pending' => 'no', 'p_private' => 'no', 'p_publish' => 'no', + 'send_payment_amount' => 'yes', 'order_methods' => '', 'flat_rate_shipping' => 'delivery', 'free_shipping' => 'delivery2', diff --git a/tests/test-wc-retailcrm-history.php b/tests/test-wc-retailcrm-history.php index 4df2134..0f6ec7c 100644 --- a/tests/test-wc-retailcrm-history.php +++ b/tests/test-wc-retailcrm-history.php @@ -251,6 +251,7 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper 'call' => false, 'expired' => false, 'customer' => array( + 'type' => 'customer', 'segments' => array(), 'id' => 1, 'firstName' => 'Test',