1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
result_rec.php
См. документацию.
1
<?
if
(!defined(
"B_PROLOG_INCLUDED"
) || B_PROLOG_INCLUDED !==
true
)
die
();?><?
2
3
$orderIsPaid
= $_POST[
"orderIsPaid"
];
4
$orderSumAmount
= $_POST[
"orderSumAmount"
];
5
$orderSumCurrencyPaycash
= $_POST[
"orderSumCurrencyPaycash"
];
6
$orderSumBankPaycash
= $_POST[
"orderSumBankPaycash"
];
7
$action
= $_POST[
"action"
];
8
$orderCreatedDatetime
= $_POST[
"orderCreatedDatetime"
];
9
$paymentType
= $_POST[
"paymentType"
];
10
$customerNumber
= intval($_POST[
"customerNumber"
]);
11
$invoiceId
= $_POST[
"invoiceId"
];
12
$md5
= $_POST[
"md5"
];
13
$paymentDateTime
= $_POST[
"paymentDateTime"
];
14
15
$bCorrectPayment
= True;
16
if
(!($arOrder = CSaleOrder::GetByID(
$customerNumber
)))
17
{
18
$bCorrectPayment
= False;
19
$code
=
"200"
;
//неверные параметры
20
$techMessage =
"ID заказа неизвестен."
;
21
}
22
23
if
(
$bCorrectPayment
)
24
CSalePaySystemAction::InitParamArrays($arOrder, $arOrder[
"ID"
]);
25
26
$Sum
=
CSalePaySystemAction::GetParamValue
(
"SHOULD_PAY"
);
27
$Sum
= number_format(
$Sum
, 2,
','
,
''
);
28
$shopId
=
CSalePaySystemAction::GetParamValue
(
"SHOP_ID"
);
29
$scid
=
CSalePaySystemAction::GetParamValue
(
"SCID"
);
30
$customerNumber
=
CSalePaySystemAction::GetParamValue
(
"ORDER_ID"
);
31
$changePayStatus
= trim(
CSalePaySystemAction::GetParamValue
(
"CHANGE_STATUS_PAY"
));
32
$shopPassword
=
CSalePaySystemAction::GetParamValue
(
"SHOP_KEY"
);
33
34
if
(
$shopPassword
==
''
)
35
$bCorrectPayment
= False;
36
37
$strCheck
= md5(implode(
";"
,
array
(
$orderIsPaid
,
$orderSumAmount
,
$orderSumCurrencyPaycash
,
$orderSumBankPaycash
,
$shopId
,
$invoiceId
,
$customerNumber
,
$shopPassword
)));
38
39
if
(
$bCorrectPayment
&&
ToUpper
(
$md5
) !=
ToUpper
(
$strCheck
))
40
{
41
$bCorrectPayment
= False;
42
$code
=
"1"
;
// ошибка авторизации
43
}
44
45
if
(
$bCorrectPayment
)
46
{
47
if
(
$action
==
"Check"
)
48
{
49
if
(DoubleVal($arOrder[
"PRICE"
]) == DoubleVal(
$orderSumAmount
))
50
$code
=
"0"
;
51
else
52
{
53
$code
=
"100"
;
//неверные параметры
54
$techMessage =
"Сумма заказа не верна."
;
55
}
56
}
57
elseif
(
$action
==
"PaymentSuccess"
)
58
{
59
$strPS_STATUS_DESCRIPTION =
""
;
60
$strPS_STATUS_DESCRIPTION .=
"номер плательщика - "
.$customerNumber.
"; "
;
61
$strPS_STATUS_DESCRIPTION .=
"дата платежа - "
.$paymentDateTime.
"; "
;
62
$strPS_STATUS_DESCRIPTION .=
"код подтверждения платежа - "
.$orderIsPaid.
"; "
;
63
$strPS_STATUS_MESSAGE =
""
;
64
65
$arFields
=
array
(
66
"PS_STATUS"
=>
"Y"
,
67
"PS_STATUS_CODE"
=> mb_substr(
$action
, 0, 5),
68
"PS_STATUS_DESCRIPTION"
=> $strPS_STATUS_DESCRIPTION,
69
"PS_STATUS_MESSAGE"
=> $strPS_STATUS_MESSAGE,
70
"PS_SUM"
=>
$orderSumAmount
,
71
"PS_CURRENCY"
=>
$orderSumCurrencyPaycash
,
72
"PS_RESPONSE_DATE"
=> Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat(
"FULL"
, LANG))),
73
);
74
75
// You can comment this code if you want PAYED flag not to be set automatically
76
if
(FloatVal($arOrder[
"PRICE"
]) == FloatVal(
$orderSumAmount
) && intval(
$orderIsPaid
) == 1)
77
{
78
if
(
$changePayStatus
==
"Y"
)
79
{
80
if
($arOrder[
"PAYED"
] ==
"Y"
)
81
$code
=
"0"
;
82
else
83
{
84
if
(!CSaleOrder::PayOrder($arOrder[
"ID"
],
"Y"
,
true
,
true
))
85
{
86
$code
=
"1000"
;
87
$techMessage =
"Ошибка оплаты заказа."
;
88
}
89
else
90
$code
=
"0"
;
91
}
92
}
93
}
94
else
95
{
96
$code
=
"200"
;
//неверные параметры
97
$techMessage =
"Сумма заказа не верна."
;
98
}
99
100
if
(
CSaleOrder::Update
($arOrder[
"ID"
],
$arFields
))
101
if
($techMessage ==
''
&&
$code
==
''
)
102
$code
=
"0"
;
103
}
104
else
105
{
106
$code
=
"200"
;
//неверные параметры
107
$techMessage =
"Не известен тип запроса."
;
108
}
109
}
110
111
$APPLICATION
->RestartBuffer();
112
$dateISO
= date(
"Y-m-d\TH:i:s"
).mb_substr(date(
"O"
), 0, 3).
":"
.mb_substr(date(
"O"
), -2, 2);
113
header(
"Content-Type: text/xml"
);
114
header(
"Pragma: no-cache"
);
115
$text
=
"<"
.
"?xml version=\"1.0\" encoding=\"windows-1251\"?"
.
">\n"
;
116
$text
.=
"<response performedDatetime=\""
.$dateISO.
"\">"
;
117
if
($techMessage <>
''
)
118
$text
.=
"<result code=\""
.$code.
"\" action=\""
.
htmlspecialcharsbx
(
$action
).
"\" shopId=\""
.
$shopId
.
"\" invoiceId=\""
.
htmlspecialcharsbx
(
$invoiceId
).
"\" techMessage=\""
.$techMessage.
"\"/>"
;
119
else
120
$text
.=
"<result code=\""
.$code.
"\" action=\""
.
htmlspecialcharsbx
(
$action
).
"\" shopId=\""
.
$shopId
.
"\" invoiceId=\""
.
htmlspecialcharsbx
(
$invoiceId
).
"\"/>"
;
121
$text
.=
"</response>"
;
122
echo
$text
;
123
die
();
124
?>
$APPLICATION
global $APPLICATION
Определения
include.php:80
CAllSalePaySystemAction\GetParamValue
static GetParamValue($key, $defaultValue=null)
Определения
pay_system_action.php:76
CSaleOrder\Update
static Update($ID, $arFields, $bDateUpdate=true)
Определения
order.php:140
$arFields
$arFields
Определения
dblapprove.php:5
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
ToUpper
ToUpper($str)
Определения
tools.php:2247
htmlspecialcharsbx
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения
tools.php:2701
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
die
die
Определения
quickway.php:367
$text
$text
Определения
template_pdf.php:79
$shopId
$shopId
Определения
refund.php:14
$Sum
$Sum
Определения
payment.php:2
$scid
$scid
Определения
payment.php:4
$customerNumber
$customerNumber
Определения
payment.php:5
$md5
$md5
Определения
result_rec.php:12
$paymentDateTime
$paymentDateTime
Определения
result_rec.php:13
$bCorrectPayment
$bCorrectPayment
Определения
result_rec.php:15
$orderSumBankPaycash
$orderSumBankPaycash
Определения
result_rec.php:6
$dateISO
$dateISO
Определения
result_rec.php:112
$paymentType
$paymentType
Определения
result_rec.php:9
$orderSumAmount
$orderSumAmount
Определения
result_rec.php:4
$orderCreatedDatetime
$orderCreatedDatetime
Определения
result_rec.php:8
$invoiceId
$invoiceId
Определения
result_rec.php:11
$shopPassword
$shopPassword
Определения
result_rec.php:32
$orderIsPaid
$orderIsPaid
Определения
result_rec.php:3
$orderSumCurrencyPaycash
$orderSumCurrencyPaycash
Определения
result_rec.php:5
$strCheck
$strCheck
Определения
result_rec.php:37
$changePayStatus
$changePayStatus
Определения
result.php:13
$action
$action
Определения
file_dialog.php:21
bitrix
modules
sale
ru
payment
yandex
result_rec.php
Создано системой
1.14.0