1
0
Fork 0
mirror of synced 2025-04-20 01:21:01 +00:00

add loyalty_level when the order is saved

This commit is contained in:
Sergey Chazov 2020-10-29 18:41:39 +03:00
parent 2ec5514886
commit ebeb378dd1
4 changed files with 9 additions and 8 deletions

View file

@ -284,10 +284,6 @@ class RetailCrmOrder
if (count($payments) > 0) {
$order['payments'] = $payments;
}
if (ConfigProvider::getLoyaltyProgramStatus() === 'Y') {
$order['privilegeType'] = 'loyalty_level';
}
//send
if (function_exists('retailCrmBeforeOrderSend')) {
@ -313,7 +309,12 @@ class RetailCrmOrder
$order = $normalizer->normalize($order, 'orders');
Logger::getInstance()->write($order, 'orderSend');
if (ConfigProvider::getLoyaltyProgramStatus() === 'Y') {
$order['privilegeType'] = 'loyalty_level';
}
if ($send) {
if (!RCrmActions::apiMethod($api, $methodApi, __METHOD__, $order, $site)) {
return false;

View file

@ -13,7 +13,7 @@ Loader::includeModule('intaro.retailcrm');
$arResult['LOYALTY_STATUS'] = ConfigProvider::getLoyaltyProgramStatus();
global $USER;
//Активна ПЛ ?
if ($arResult['LOYALTY_STATUS'] === 'Y' && $USER->IsAuthorized()) {
$service = new LoyaltyService();
$arResult['LP_REGISTER'] = $service->checkRegInLp();

View file

@ -156,7 +156,7 @@ class EventsHandlers
try {
$orderService->saveOrderInCRM($event);
$isNew = $event->getParameter("IS_NEW");
if (isset($_POST['bonus-input'], $_POST['available-bonuses'])

View file

@ -398,7 +398,7 @@ class LoyaltyService
* @param array $userFields
* @return array
*/
private function getFields(array $userFields)
private function getFields(array $userFields): array
{
$standartFields = $this->getStandardFields($userFields);
$externalFields = $this->getExternalFields();