1
0
mirror of synced 2024-11-25 23:06:08 +03:00
bitrix-module/intaro.retailcrm/lib/controller/loyalty/basket.php
Сергей Чазов 34e8105583
Loyalty (#241)
* Loyalty program
* fix dot bug for shops-exoprt option
* delete credantials request from services
* add CurlException for credentials catch
* add catching CurlException
* edit error msgs
* add supportind double bonuses
* add any step for bonus-input field in sale.order.ajax template
* recalculate bonuses
* fix bonus rounded
* strtoupper for params in icml
* change delivery service code
2022-03-02 15:40:53 +03:00

61 lines
1.5 KiB
PHP

<?php
/**
* PHP version 7.1
*
* @category Integration
* @package Intaro\RetailCrm\Controller\Loyalty
* @author RetailCRM <integration@retailcrm.ru>
* @license MIT
* @link http://retailcrm.ru
* @see http://retailcrm.ru/docs
*/
namespace Intaro\RetailCrm\Controller\Loyalty;
use Bitrix\Main\Engine\Controller;
use Bitrix\Main\Request;
use Exception;
use Intaro\RetailCrm\Component\ServiceLocator;
use Intaro\RetailCrm\Service\LoyaltyService;
/**
* Class AdminPanel
* @package Intaro\RetailCrm\Controller\Loyalty
*/
class Basket extends Controller
{
/** @var LoyaltyService */
private $service;
/**
* AdminPanel constructor.
*
* @param \Bitrix\Main\Request|null $request
*/
public function __construct(Request $request = null)
{
/** @var LoyaltyService */
$this->service = ServiceLocator::get(LoyaltyService::class);
parent::__construct($request);
}
/**
* Добавляет данные, полученные при расчете привилегии, в массив корзины
*
* @param array $basketData
* @return array
*/
public function addLoyaltyToBasketAction(array $basketData): array
{
$calculateBasket = [];
$calculate = $this->service->getLoyaltyCalculate($basketData['BASKET_ITEM_RENDER_DATA']);
if ($calculate->success) {
$calculateBasket = $this->service->addLoyaltyToBasket($basketData, $calculate);
}
return $calculateBasket;
}
}