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

add codestylefix after review

This commit is contained in:
Sergey Chazov 2020-10-21 18:11:13 +03:00
parent 4a4ff43036
commit ae43e69971
7 changed files with 30 additions and 28 deletions

View file

@ -6,6 +6,7 @@ use Bitrix\Main\ArgumentException;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\ObjectPropertyException;
use Bitrix\Main\SystemException;
use Intaro\RetailCrm\Component\Constants;
use Intaro\RetailCrm\Repository\PaySystemActionRepository;
/**
@ -14,25 +15,23 @@ use Intaro\RetailCrm\Repository\PaySystemActionRepository;
* @var $APPLICATION CMain
*/
if ($arParams["SET_TITLE"] == "Y")
{
$APPLICATION->SetTitle(Loc::getMessage("SOA_ORDER_COMPLETE"));
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle(Loc::getMessage("SOA_ORDER_COMPLETE"));
}
?>
<?php if (!empty($arResult["ORDER"])): ?>
<?php
$order = Bitrix\Sale\Order::load($arResult["ORDER"]['ID']);
$paymentCollection = $order->getPaymentCollection();
/** @var \Bitrix\Sale\Payment $payment */
foreach ($paymentCollection as $payment) {
$isPaid = $payment->isPaid();
$checkId = $payment->getField('COMMENTS');
try {
$paySystemAction = PaySystemActionRepository::getFirstByWhere(
['*'],
$paySystemAction = PaySystemActionRepository::getFirstByWhere(
['*'],
[
[
'ID',
@ -42,24 +41,25 @@ if ($arParams["SET_TITLE"] == "Y")
]
);
} catch (ObjectPropertyException | ArgumentException | SystemException $e) {
AddMessage2Log($e->getMessage());
AddMessage2Log($e->getMessage());
}
//если есть бонусная оплата и она не оплачена, то отрисовываем форму введения кода верификации
$isPaid=false;//TODO заглушка - убрать после теста
$isPaid = false;//TODO заглушка - убрать после теста
if (isset($paySystemAction)
&& !$isPaid
&& !empty($checkId)
&& $paySystemAction->get('CODE') === 'INTARO_BONUS'
) {
&& $paySystemAction->get('CODE') === Constants::BONUS_PAYMENT_CODE
) {
?>
<div id="orderConfirm">
<b><?= GetMessage('CONFIRM_MESSAGE')?></b><br>
<b><?=GetMessage('CONFIRM_MESSAGE')?></b><br>
<div id="orderVerificationCodeBlock">
<b><?= GetMessage('SEND_VERIFICATION_CODE')?></b><br>
<b><?=GetMessage('SEND_VERIFICATION_CODE')?></b><br>
<label for="orderVerificationCode"></label>
<input type="text" id="orderVerificationCode" placeholder="<?= GetMessage('VERIFICATION_CODE')?>">
<input type="button" onclick="sendVerificationCode(<?= $arResult["ORDER"]['ID'] ?>, '<?= $checkId ?>')" value="<?= GetMessage('SEND')?>"/>
<input type="text" id="orderVerificationCode" placeholder="<?=GetMessage('VERIFICATION_CODE')?>">
<input type="button" onclick="sendVerificationCode(<?=$arResult["ORDER"]['ID']?>, '<?=$checkId?>')" value="<?=GetMessage('SEND')?>"/>
</div>
<div id="msg"></div>
</div>
@ -176,4 +176,4 @@ if ($arParams["SET_TITLE"] == "Y")
</tr>
</table>
<? endif ?>
<? endif ?>

View file

@ -8312,17 +8312,15 @@ BX.namespace('BX.Sale.OrderAjaxComponent');
if (this.personalLoyaltyStatus === '1' && this.loyaltyStatus === 'Y') {
//добавление строки с бонусами
if (this.result.TOTAL.BONUS_PAYMENT !== undefined && this.result.TOTAL.BONUS_PAYMENT > 0) {
let bonusPayment = this.result.TOTAL.BONUS_PAYMENT.toString();
bonusPayment = this.bonusCurrency
let bonusPayment = this.bonusCurrency
.replace('&#8381;', '₽')
.replace('&euro;', '€')
.replace('&#8372;', '¥')
.replace('#', bonusPayment);
.replace('#', this.result.TOTAL.BONUS_PAYMENT.toString());
this.totalInfoBlockNode.appendChild(this.createTotalUnit('Бонусная скидка:', bonusPayment));
}
const willBeCredited = this.willBeCredited;
this.totalInfoBlockNode.appendChild(this.createTotalUnit('Будет начислено бонусов:', willBeCredited, {highlighted: true}));
this.totalInfoBlockNode.appendChild(this.createTotalUnit('Будет начислено бонусов:', this.willBeCredited, {highlighted: true}));
}
if (this.options.showPayedFromInnerBudget)

View file

@ -34,7 +34,7 @@ if ($calculate->success) {
//TODO убрать заглушку после появления реальных методов
$arResult['LP_CALCULATE_SUCCESS'] = true;
$arResult['AVAILABLE_BONUSES'] = 300; //доступно
$arResult['TOTAL_BONUSES_COUNT'] = 600; //всего на щету
$arResult['TOTAL_BONUSES_COUNT'] = 600; //всего на счету
$arResult['WILL_BE_CREDITED'] = 245; //будет начислено
$component = $this->__component;
$component::scaleImages($arResult['JS_DATA'], $arParams['SERVICES_IMAGES_SCALING']);

View file

@ -48,4 +48,4 @@ function sendVerificationCode(orderId, checkId) {
}
}
)
}
}

View file

@ -71,4 +71,5 @@ class Constants
public const CORPORATE_CONTRAGENT_TYPE = 'legal-entity';
public const LOYALTY_PROGRAM_TOGGLE = 'loyalty_program_toggle';
public const CLIENT_ID = 'client_id';
public const BONUS_PAYMENT_CODE = 'INTARO_BONUS';
}

View file

@ -181,7 +181,8 @@ class EventsHandlers
$newPayment->setField('SUM', $bonusCount);
//если верификация необходима, но не пройдена
if (isset($response->verification, $response->verification->checkId) && !isset($response->verification->verifiedAt)
if (isset($response->verification, $response->verification->checkId)
&& !isset($response->verification->verifiedAt)
) {
$newPayment->setPaid('N');
$newPayment->setField('COMMENTS', $response->verification->checkId);

View file

@ -22,9 +22,11 @@ use Bitrix\Main\ObjectPropertyException;
use Bitrix\Main\Request;
use Bitrix\Main\SystemException;
use Exception;
use Intaro\RetailCrm\Component\Constants;
use Intaro\RetailCrm\Component\ServiceLocator;
use Intaro\RetailCrm\Repository\PaySystemActionRepository;
use Intaro\RetailCrm\Service\UserVerificationService;
use Bitrix\Sale\Order as BitrixOrder;
/**
* Class AdminPanel
@ -64,10 +66,10 @@ class Order extends Controller
try {
Loader::includeModule('sale');
$order = \Bitrix\Sale\Order::load($orderId);
$order = BitrixOrder::load($orderId);
if (!$order) {
AddMessage2Log('ОШибка списания бонусов (не удалось получить заказ) по заказу №'.$orderId);
AddMessage2Log('Ошибка списания бонусов (не удалось получить объект Order) по заказу №' . $orderId);
return [
'status' => 'error',
'msg' => 'Ошибка',
@ -94,7 +96,7 @@ class Order extends Controller
if (isset($paySystemAction)
&& !$isPaid
&& $paySystemAction->get('CODE') === 'INTARO_BONUS'
&& $paySystemAction->get('CODE') === Constants::BONUS_PAYMENT_CODE
) {
$payment->setPaid('Y');
$order->save();
@ -132,4 +134,4 @@ class Order extends Controller
],
];
}
}
}