diff --git a/src/include/class-wc-retailcrm-history.php b/src/include/class-wc-retailcrm-history.php index 1c2cc62..50a0d03 100644 --- a/src/include/class-wc-retailcrm-history.php +++ b/src/include/class-wc-retailcrm-history.php @@ -487,17 +487,6 @@ if (!class_exists('WC_Retailcrm_History')) : } } - if (isset($order['paymentType'])) { - if (!empty($options[$order['paymentType']])) { - $payment = WC_Payment_Gateways::instance(); - $paymentTypes = $payment->payment_gateways(); - - if (isset($paymentTypes[$options[$order['paymentType']]])) { - $wcOrder->set_payment_method($paymentTypes[$options[$order['paymentType']]]); - } - } - } - if (isset($order['payments']) && !empty($order['payments'])) { $payment = WC_Payment_Gateways::instance(); $paymentTypes = $payment->payment_gateways(); @@ -742,6 +731,7 @@ if (!class_exists('WC_Retailcrm_History')) : $paymentTypes = $payment->payment_gateways(); $payments = $order['payments']; $paymentType = end($payments); + if (isset($options[$paymentType['type']]) && isset($paymentTypes[$options[$paymentType['type']]])) { $wcOrder->set_payment_method($paymentTypes[$options[$paymentType['type']]]); } diff --git a/src/include/components/class-wc-retailcrm-history-assembler.php b/src/include/components/class-wc-retailcrm-history-assembler.php index b4f336a..6bff4b5 100644 --- a/src/include/components/class-wc-retailcrm-history-assembler.php +++ b/src/include/components/class-wc-retailcrm-history-assembler.php @@ -82,7 +82,7 @@ class WC_Retailcrm_History_Assembler if ($change['field'] == 'payments.status') { if ($change['newValue'] !== null) { - $orders[$change['order']['id']]['payment']['id']['status'] = self::newValue($change['newValue']); + $orders[$change['order']['id']]['payments']['id']['status'] = self::newValue($change['newValue']); } } else { if (isset($fields['delivery'][$change['field']]) && $fields['delivery'][$change['field']] == 'service') {