Fix error with integration payments
This commit is contained in:
parent
5838dde9eb
commit
ad15739798
@ -310,4 +310,11 @@ msgstr "Sincronización de inventario"
|
|||||||
msgid "Don't send to CRM"
|
msgid "Don't send to CRM"
|
||||||
msgstr "No enviar al CRM"
|
msgstr "No enviar al CRM"
|
||||||
|
|
||||||
|
msgid "Integration payment"
|
||||||
|
msgstr "Integración pago"
|
||||||
|
|
||||||
|
msgid "Attention!"
|
||||||
|
msgstr "¡Atención!"
|
||||||
|
|
||||||
|
msgid "If payment type linked to the CRM integration module choosed, payment must be proceed in the CRM"
|
||||||
|
msgstr "Al seleccionar en el enlace de tipos de pago un método de pago de integración en CRM, el pago se debe realizar por parte del CRM"
|
@ -319,6 +319,14 @@ msgstr "Синхронизация запасов"
|
|||||||
msgid "Don't send to CRM"
|
msgid "Don't send to CRM"
|
||||||
msgstr "Не отправлять в CRM"
|
msgstr "Не отправлять в CRM"
|
||||||
|
|
||||||
|
msgid "Integration payment"
|
||||||
|
msgstr "Интеграционная оплата"
|
||||||
|
|
||||||
|
msgid "Attention!"
|
||||||
|
msgstr "Внимание!"
|
||||||
|
|
||||||
|
msgid "If payment type linked to the CRM integration module choosed, payment must be proceed in the CRM"
|
||||||
|
msgstr "При указании в соответствии типа оплаты, привязанного к интеграционному модулю в CRM, оплата должна происходить на стороне CRM"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
/**
|
/**
|
||||||
* Shipping options
|
* Shipping options
|
||||||
*/
|
*/
|
||||||
$shipping_option_list = array();
|
$shipping_option_list = [];
|
||||||
$retailcrm_shipping_list = $this->apiClient->deliveryTypesList();
|
$retailcrm_shipping_list = $this->apiClient->deliveryTypesList();
|
||||||
|
|
||||||
if (!empty($retailcrm_shipping_list) && $retailcrm_shipping_list->isSuccessful()) {
|
if (!empty($retailcrm_shipping_list) && $retailcrm_shipping_list->isSuccessful()) {
|
||||||
@ -189,12 +189,12 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
|
|
||||||
$wc_shipping_list = get_wc_shipping_methods();
|
$wc_shipping_list = get_wc_shipping_methods();
|
||||||
|
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Delivery types', 'retailcrm'),
|
'title' => __('Delivery types', 'retailcrm'),
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'id' => 'shipping_options'
|
'id' => 'shipping_options'
|
||||||
);
|
];
|
||||||
|
|
||||||
foreach ($wc_shipping_list as $shipping_code => $shipping) {
|
foreach ($wc_shipping_list as $shipping_code => $shipping) {
|
||||||
if (isset($shipping['enabled']) && $shipping['enabled'] == static::YES) {
|
if (isset($shipping['enabled']) && $shipping['enabled'] == static::YES) {
|
||||||
@ -214,40 +214,64 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration
|
|||||||
/**
|
/**
|
||||||
* Payment options
|
* Payment options
|
||||||
*/
|
*/
|
||||||
$payment_option_list = array();
|
$crmPaymentsList = $this->apiClient->paymentTypesList();
|
||||||
$retailcrm_payment_list = $this->apiClient->paymentTypesList();
|
|
||||||
|
|
||||||
if (!empty($retailcrm_payment_list) && $retailcrm_payment_list->isSuccessful()) {
|
if (!empty($crmPaymentsList) && $crmPaymentsList->isSuccessful()) {
|
||||||
foreach ($retailcrm_payment_list['paymentTypes'] as $retailcrm_payment_type) {
|
$paymentsList = [];
|
||||||
if ($retailcrm_payment_type['active'] == false) {
|
$integrationPayments = [];
|
||||||
|
|
||||||
|
foreach ($crmPaymentsList['paymentTypes'] as $crmPaymentType) {
|
||||||
|
if ($crmPaymentType['active'] == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$payment_option_list[$retailcrm_payment_type['code']] = $retailcrm_payment_type['name'];
|
if (isset($crmPaymentType['integrationModule'])) {
|
||||||
|
$integrationPayments['code'][] = $crmPaymentType['code'];
|
||||||
|
$integrationPayments['name'][] = $crmPaymentType['name'];
|
||||||
|
|
||||||
|
$crmPaymentType['name'] .= ' - ' . __('Integration payment', 'retailcrm');
|
||||||
|
}
|
||||||
|
|
||||||
|
$paymentsList[$crmPaymentType['code']] = $crmPaymentType['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$wc_payment = WC_Payment_Gateways::instance();
|
$wc_payment = WC_Payment_Gateways::instance();
|
||||||
|
|
||||||
$this->form_fields[] = array(
|
$this->form_fields[] = [
|
||||||
'title' => __('Payment types', 'retailcrm'),
|
'id' => 'payment_options',
|
||||||
'type' => 'heading',
|
'type' => 'heading',
|
||||||
'description' => '',
|
'title' => __('Payment types', 'retailcrm'),
|
||||||
'id' => 'payment_options'
|
];
|
||||||
);
|
|
||||||
|
if (!empty($integrationPayments['name'])) {
|
||||||
|
$this->form_fields['payment_notification'] = [
|
||||||
|
'id' => 'payment_options',
|
||||||
|
'css' => 'max-width:400px;resize: none;',
|
||||||
|
'type' => 'textarea',
|
||||||
|
'title' => __('Attention!', 'retailcrm'),
|
||||||
|
'value' => '',
|
||||||
|
'placeholder' => __('If payment type linked to the CRM integration module choosed, payment must be proceed in the CRM', 'retailcrm'),
|
||||||
|
'custom_attributes' => ['readonly' => 'readonly'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($wc_payment->payment_gateways() as $payment) {
|
foreach ($wc_payment->payment_gateways() as $payment) {
|
||||||
$this->form_fields[$payment->id] = array(
|
$this->form_fields[$payment->id] = [
|
||||||
'title' => __($payment->method_title, 'woocommerce'),
|
'css' => 'min-width:350px;',
|
||||||
'description' => __($payment->method_description, 'woocommerce'),
|
'type' => 'select',
|
||||||
'css' => 'min-width:350px;',
|
'title' => __($payment->method_title, 'woocommerce'),
|
||||||
'class' => 'select',
|
'class' => 'select',
|
||||||
'type' => 'select',
|
'options' => $paymentsList,
|
||||||
'options' => $payment_option_list,
|
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
);
|
'description' => __($payment->method_description, 'woocommerce'),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($integrationPayments['code'])) {
|
||||||
|
update_option('retailcrm_integration_payments', $integrationPayments['code']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Statuses options
|
* Statuses options
|
||||||
*/
|
*/
|
||||||
|
@ -39,13 +39,13 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||||||
private $ordersGetRequestCache = array();
|
private $ordersGetRequestCache = array();
|
||||||
|
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $order = array();
|
private $order = [];
|
||||||
|
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $payment = array();
|
private $payment = [];
|
||||||
|
|
||||||
/**@var array */
|
/**@var array */
|
||||||
private $customFields = array();
|
private $customFields = [];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$retailcrm,
|
$retailcrm,
|
||||||
@ -290,29 +290,31 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||||||
|
|
||||||
$retailcrmOrder = $this->getCrmOrder($order->get_id());
|
$retailcrmOrder = $this->getCrmOrder($order->get_id());
|
||||||
|
|
||||||
if (!empty($retailcrmOrder)) {
|
if (empty($retailcrmOrder)) {
|
||||||
foreach ($retailcrmOrder['payments'] as $payment_data) {
|
return null;
|
||||||
$payment_external_id = explode('-', $payment_data['externalId']);
|
}
|
||||||
|
|
||||||
if ($payment_external_id[0] == $order->get_id()) {
|
foreach ($retailcrmOrder['payments'] as $paymentData) {
|
||||||
$payment = $payment_data;
|
$paymentId = explode('-', $paymentData['externalId']);
|
||||||
}
|
|
||||||
|
if ($paymentId[0] == $order->get_id()) {
|
||||||
|
$payment = $paymentData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($payment) && $payment['type'] == $this->retailcrm_settings[$order->get_payment_method()] && $order->is_paid()) {
|
if (empty($payment)) {
|
||||||
$payment = $this->sendPayment($order, true, $payment['externalId']);
|
return null;
|
||||||
|
|
||||||
return $payment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($payment) && $payment['type'] != $this->retailcrm_settings[$order->get_payment_method()]) {
|
if ($payment['type'] == $this->retailcrm_settings[$order->get_payment_method()] && $order->is_paid()) {
|
||||||
|
return $this->sendPayment($order, true, $payment['externalId']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($payment['type'] != $this->retailcrm_settings[$order->get_payment_method()]) {
|
||||||
$response = $this->retailcrm->ordersPaymentDelete($payment['id']);
|
$response = $this->retailcrm->ordersPaymentDelete($payment['id']);
|
||||||
|
|
||||||
if (!empty($response) && $response->isSuccessful()) {
|
if (!empty($response) && $response->isSuccessful()) {
|
||||||
$payment = $this->sendPayment($order);
|
return $this->sendPayment($order);
|
||||||
|
|
||||||
return $payment;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,11 +364,11 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||||||
$service = retailcrm_get_delivery_service($shipping['method_id'], $shipping['instance_id']);
|
$service = retailcrm_get_delivery_service($shipping['method_id'], $shipping['instance_id']);
|
||||||
|
|
||||||
if ($service) {
|
if ($service) {
|
||||||
$orderData['delivery']['service'] = array(
|
$orderData['delivery']['service'] = [
|
||||||
'name' => $service['title'],
|
'name' => $service['title'],
|
||||||
'code' => $service['instance_id'],
|
'code' => $service['instance_id'],
|
||||||
'active' => true
|
'active' => true
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,17 +382,16 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
$orderData['delivery']['address'] = $this->order_address->build($order)->get_data();
|
$orderData['delivery']['address'] = $this->order_address->build($order)->get_data();
|
||||||
$order_items = array();
|
$orderItems = [];
|
||||||
|
|
||||||
/** @var WC_Order_Item_Product $item */
|
/** @var WC_Order_Item_Product $item */
|
||||||
foreach ($order->get_items() as $item) {
|
foreach ($order->get_items() as $item) {
|
||||||
$order_items[] = $this->order_item->build($item)->get_data();
|
$orderItems[] = $this->order_item->build($item)->get_data();
|
||||||
$this->order_item->reset_data();
|
$this->order_item->reset_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
$orderData['items'] = $order_items;
|
$orderData['items'] = $orderItems;
|
||||||
|
$orderData['discountManualAmount'] = 0;
|
||||||
$orderData['discountManualAmount'] = 0;
|
|
||||||
$orderData['discountManualPercent'] = 0;
|
$orderData['discountManualPercent'] = 0;
|
||||||
|
|
||||||
if (!$update && $order->get_total() > 0) {
|
if (!$update && $order->get_total() > 0) {
|
||||||
@ -432,6 +433,16 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||||||
$this->order_payment->is_new = !$update;
|
$this->order_payment->is_new = !$update;
|
||||||
$payment = $this->order_payment->build($order, $externalId)->get_data();
|
$payment = $this->order_payment->build($order, $externalId)->get_data();
|
||||||
|
|
||||||
|
$integrationPayments = get_option('retailcrm_integration_payments');
|
||||||
|
|
||||||
|
if (is_array($integrationPayments)) {
|
||||||
|
$integrationPayments = array_flip($integrationPayments);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($update === true && isset($integrationPayments[$payment['type']])) {
|
||||||
|
return $payment;
|
||||||
|
}
|
||||||
|
|
||||||
if ($update === false) {
|
if ($update === false) {
|
||||||
$this->retailcrm->ordersPaymentCreate($payment);
|
$this->retailcrm->ordersPaymentCreate($payment);
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,7 +49,7 @@ class WC_Retailcrm_Order_Payment extends WC_Retailcrm_Abstracts_Data
|
|||||||
public function build($order, $externalId = false)
|
public function build($order, $externalId = false)
|
||||||
{
|
{
|
||||||
$this->reset_data();
|
$this->reset_data();
|
||||||
$data = array();
|
$data = [];
|
||||||
|
|
||||||
if (!$this->is_new) {
|
if (!$this->is_new) {
|
||||||
$data['externalId'] = $externalId;
|
$data['externalId'] = $externalId;
|
||||||
@ -57,9 +57,9 @@ class WC_Retailcrm_Order_Payment extends WC_Retailcrm_Abstracts_Data
|
|||||||
$data['externalId'] = uniqid($order->get_id() . "-");
|
$data['externalId'] = uniqid($order->get_id() . "-");
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['order'] = array(
|
$data['order'] = [
|
||||||
'externalId' => $order->get_id()
|
'externalId' => $order->get_id()
|
||||||
);
|
];
|
||||||
|
|
||||||
if ($order->is_paid()) {
|
if ($order->is_paid()) {
|
||||||
$data['status'] = 'paid';
|
$data['status'] = 'paid';
|
||||||
@ -77,7 +77,7 @@ class WC_Retailcrm_Order_Payment extends WC_Retailcrm_Abstracts_Data
|
|||||||
if (isset($this->settings[$order->get_payment_method()])) {
|
if (isset($this->settings[$order->get_payment_method()])) {
|
||||||
$data['type'] = $this->settings[$order->get_payment_method()];
|
$data['type'] = $this->settings[$order->get_payment_method()];
|
||||||
} else {
|
} else {
|
||||||
$data = array();
|
$data = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -17,77 +17,86 @@ class DataBaseRetailCrm
|
|||||||
{
|
{
|
||||||
public static function getResponseStatuses()
|
public static function getResponseStatuses()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'statuses' => array(
|
'statuses' => [
|
||||||
array(
|
[
|
||||||
'name' => 'status1',
|
'name' => 'status1',
|
||||||
'code' => 'status1',
|
'code' => 'status1',
|
||||||
'active' => true
|
'active' => true
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'name' => 'status2',
|
'name' => 'status2',
|
||||||
'code' => 'status2',
|
'code' => 'status2',
|
||||||
'active' => false
|
'active' => false
|
||||||
)
|
]
|
||||||
)
|
]
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getResponsePaymentTypes()
|
public static function getResponsePaymentTypes()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'paymentTypes' => array(
|
'paymentTypes' => [
|
||||||
array(
|
[
|
||||||
'name' => 'payment1',
|
'name' => 'payment1',
|
||||||
'code' => 'payment1',
|
'code' => 'payment1',
|
||||||
'active' => true
|
'active' => true
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'name' => 'payment2',
|
'name' => 'payment2',
|
||||||
'code' => 'payment2',
|
'code' => 'payment2',
|
||||||
'active' => false
|
'active' => false
|
||||||
)
|
],
|
||||||
)
|
[
|
||||||
);
|
'name' => 'payment3',
|
||||||
|
'code' => 'payment3',
|
||||||
|
'integrationModule' => [
|
||||||
|
'name' => 'test',
|
||||||
|
'active' => true,
|
||||||
|
],
|
||||||
|
'active' => true
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getResponseDeliveryTypes()
|
public static function getResponseDeliveryTypes()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'deliveryTypes' => array(
|
'deliveryTypes' => [
|
||||||
array(
|
[
|
||||||
'name' => 'delivery1',
|
'name' => 'delivery1',
|
||||||
'code' => 'delivery1',
|
'code' => 'delivery1',
|
||||||
'active' => true
|
'active' => true
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'name' => 'delivery2',
|
'name' => 'delivery2',
|
||||||
'code' => 'delivery2',
|
'code' => 'delivery2',
|
||||||
'active' => false
|
'active' => false
|
||||||
)
|
]
|
||||||
)
|
]
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getResponseOrderMethods()
|
public static function getResponseOrderMethods()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'orderMethods' => array(
|
'orderMethods' => [
|
||||||
array(
|
[
|
||||||
'name' => 'orderMethod1',
|
'name' => 'orderMethod1',
|
||||||
'code' => 'orderMethod1',
|
'code' => 'orderMethod1',
|
||||||
'active' => true
|
'active' => true
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'name' => 'orderMethod2',
|
'name' => 'orderMethod2',
|
||||||
'code' => 'orderMethod2',
|
'code' => 'orderMethod2',
|
||||||
'active' => false
|
'active' => false
|
||||||
)
|
]
|
||||||
)
|
]
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -76,29 +76,49 @@ class WC_Retailcrm_Base_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$integrationPayments = get_option('retailcrm_integration_payments');
|
||||||
|
|
||||||
|
$this->assertNotEmpty($integrationPayments);
|
||||||
|
$this->assertInternalType('array', $integrationPayments);
|
||||||
|
$this->assertEquals('payment3', $integrationPayments[0]);
|
||||||
|
|
||||||
foreach (wc_get_order_statuses() as $idx => $name) {
|
foreach (wc_get_order_statuses() as $idx => $name) {
|
||||||
$uid = str_replace('wc-', '', $idx);
|
$uid = str_replace('wc-', '', $idx);
|
||||||
$this->assertArrayHasKey($uid, $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey($uid, $this->baseRetailcrm->form_fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertArrayHasKey('corporate_enabled', $this->baseRetailcrm->form_fields);
|
//Order settings
|
||||||
$this->assertArrayHasKey('online_assistant', $this->baseRetailcrm->form_fields);
|
|
||||||
|
|
||||||
$this->assertArrayHasKey('order_methods', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('order_methods', $this->baseRetailcrm->form_fields);
|
||||||
$this->assertInternalType('array', $this->baseRetailcrm->form_fields['order_methods']);
|
$this->assertInternalType('array', $this->baseRetailcrm->form_fields['order_methods']);
|
||||||
|
|
||||||
|
//Payment settings
|
||||||
|
$this->assertArrayHasKey('payment_notification', $this->baseRetailcrm->form_fields);
|
||||||
|
$this->assertInternalType('array', $this->baseRetailcrm->form_fields['payment_notification']);
|
||||||
|
$this->assertEquals('textarea', $this->baseRetailcrm->form_fields['payment_notification']['type']);
|
||||||
|
|
||||||
|
//WhatsApp settings
|
||||||
$this->assertArrayHasKey('whatsapp_active', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('whatsapp_active', $this->baseRetailcrm->form_fields);
|
||||||
$this->assertArrayHasKey('whatsapp_location_icon', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('whatsapp_location_icon', $this->baseRetailcrm->form_fields);
|
||||||
$this->assertArrayHasKey('whatsapp_number', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('whatsapp_number', $this->baseRetailcrm->form_fields);
|
||||||
|
|
||||||
|
//Cron settings
|
||||||
$this->assertArrayHasKey('icml', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('icml', $this->baseRetailcrm->form_fields);
|
||||||
|
$this->assertArrayHasKey('history', $this->baseRetailcrm->form_fields);
|
||||||
|
|
||||||
|
//Export orders/customers settings
|
||||||
$this->assertArrayHasKey('export_selected_orders_ids', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('export_selected_orders_ids', $this->baseRetailcrm->form_fields);
|
||||||
$this->assertArrayHasKey('export_selected_orders_btn', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('export_selected_orders_btn', $this->baseRetailcrm->form_fields);
|
||||||
$this->assertArrayHasKey('history', $this->baseRetailcrm->form_fields);
|
|
||||||
|
//Debug info settings
|
||||||
|
$this->assertArrayHasKey('debug_mode', $this->baseRetailcrm->form_fields);
|
||||||
|
$this->assertArrayHasKey('debug-info', $this->baseRetailcrm->form_fields);
|
||||||
|
|
||||||
|
//Other settings
|
||||||
|
$this->assertArrayHasKey('corporate_enabled', $this->baseRetailcrm->form_fields);
|
||||||
|
$this->assertArrayHasKey('online_assistant', $this->baseRetailcrm->form_fields);
|
||||||
$this->assertArrayHasKey('deactivate_update_order', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('deactivate_update_order', $this->baseRetailcrm->form_fields);
|
||||||
$this->assertArrayHasKey('bind_by_sku', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('bind_by_sku', $this->baseRetailcrm->form_fields);
|
||||||
$this->assertArrayHasKey('update_number', $this->baseRetailcrm->form_fields);
|
$this->assertArrayHasKey('update_number', $this->baseRetailcrm->form_fields);
|
||||||
$this->assertArrayHasKey('debug_mode', $this->baseRetailcrm->form_fields);
|
|
||||||
$this->assertArrayHasKey('debug-info', $this->baseRetailcrm->form_fields);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_retailcrm_form_fields_value()
|
public function test_retailcrm_form_fields_value()
|
||||||
|
@ -241,8 +241,10 @@ class WC_Retailcrm_Orders_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
$this->assertEquals('US', $orderData['countryIso']);
|
$this->assertEquals('US', $orderData['countryIso']);
|
||||||
$this->assertEquals(0, $orderData['discountManualAmount']);
|
$this->assertEquals(0, $orderData['discountManualAmount']);
|
||||||
$this->assertEquals(0, $orderData['discountManualPercent']);
|
$this->assertEquals(0, $orderData['discountManualPercent']);
|
||||||
|
|
||||||
$this->assertEquals($orderData['customFields']['crm_order'], 'test_custom_fields');
|
$this->assertEquals($orderData['customFields']['crm_order'], 'test_custom_fields');
|
||||||
|
|
||||||
|
|
||||||
if (mb_strlen($orderData['delivery']['address']['index']) === 6) {
|
if (mb_strlen($orderData['delivery']['address']['index']) === 6) {
|
||||||
$this->assertEquals('123456', $orderData['delivery']['address']['index']);
|
$this->assertEquals('123456', $orderData['delivery']['address']['index']);
|
||||||
} else {
|
} else {
|
||||||
@ -263,7 +265,7 @@ class WC_Retailcrm_Orders_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
$this->assertEquals('payment1', $payment['type']);
|
$this->assertEquals('payment1', $payment['type']);
|
||||||
$this->assertArrayNotHasKey('amount', $payment);
|
$this->assertArrayNotHasKey('amount', $payment);
|
||||||
} else {
|
} else {
|
||||||
$this->assertEquals(array(), $payment);
|
$this->assertEquals([], $payment);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->assertEquals(null, $order);
|
$this->assertEquals(null, $order);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user