From 5407d9111f29312ecfc7e6c0a977920677a21606 Mon Sep 17 00:00:00 2001 From: Dima Uryvskiy Date: Fri, 10 Dec 2021 10:13:39 +0300 Subject: [PATCH] Fix transfer payment status --- .../class-wc-retailcrm-history-assembler.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/include/components/class-wc-retailcrm-history-assembler.php b/src/include/components/class-wc-retailcrm-history-assembler.php index 15d4df9..82d1b62 100644 --- a/src/include/components/class-wc-retailcrm-history-assembler.php +++ b/src/include/components/class-wc-retailcrm-history-assembler.php @@ -65,10 +65,18 @@ class WC_Retailcrm_History_Assembler if (isset($fields['item'][$change['field']]) && $fields['item'][$change['field']]) { $orders[$change['order']['id']]['items'][$change['item']['id']][$fields['item'][$change['field']]] = $change['newValue']; } - } elseif ($change['field'] == 'payments' && isset($change['payment'])) { + } + + if ($change['field'] == 'payments' && isset($change['payment'])) { if ($change['newValue'] !== null) { $orders[$change['order']['id']]['payments'][] = self::newValue($change['payment']); } + } + + if ($change['field'] == 'payments.status') { + if ($change['newValue'] !== null) { + $orders[$change['order']['id']]['payment']['id']['status'] = self::newValue($change['newValue']); + } } else { if (isset($fields['delivery'][$change['field']]) && $fields['delivery'][$change['field']] == 'service') { $orders[$change['order']['id']]['delivery']['service']['code'] = self::newValue($change['newValue']);