Merge pull request #82 from Frosin/master
Добавлены обработки ошибок при сохранении платежей.
This commit is contained in:
commit
58b2348ce3
@ -774,7 +774,10 @@ class RetailCrmHistory
|
||||
if (array_key_exists($orderPayment->getField('XML_ID'), $newHistoryPayments)) {
|
||||
$paymentId = $orderPayment->getId();
|
||||
$paymentExternalId = RCrmActions::generatePaymentExternalId($paymentId);
|
||||
|
||||
if (is_null($paymentId)) {
|
||||
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'paymentsUpdate', 'Save payment error, order=' . $order['number']);
|
||||
continue;
|
||||
}
|
||||
if ($paymentExternalId) {
|
||||
$newHistoryPayments[$orderPayment->getField('XML_ID')]['externalId'] = $paymentExternalId;
|
||||
RCrmActions::apiMethod($api, 'paymentEditById', __METHOD__, $newHistoryPayments[$orderPayment->getField('XML_ID')]);
|
||||
@ -1166,7 +1169,7 @@ class RetailCrmHistory
|
||||
|
||||
unset($paymentsList[$nowPaymentId]);
|
||||
}
|
||||
} else {
|
||||
} elseif (array_key_exists($paymentCrm['type'], $optionsPayTypes)) {
|
||||
$newHistoryPayments[$paymentCrm['id']] = $paymentCrm;
|
||||
$newPayment = $paymentColl->createItem();
|
||||
$newPayment->setField('SUM', $paymentCrm['amount']);
|
||||
@ -1183,6 +1186,8 @@ class RetailCrmHistory
|
||||
$newPaymentId = $newPayment->getId();
|
||||
|
||||
unset($paymentsList[$newPaymentId]);
|
||||
} else {
|
||||
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'paymentsUpdate', 'Save payment error, incorrect type: ' . $paymentCrm['type']);
|
||||
}
|
||||
|
||||
if ($optionsPayment[$paymentCrm['status']] == 'Y') {
|
||||
|
Loading…
Reference in New Issue
Block a user