1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
result.php
См. документацию.
1
<?
if
(!defined(
"B_PROLOG_INCLUDED"
) || B_PROLOG_INCLUDED !==
true
)
die
();
2
3
use
Bitrix\Main\Web\HttpClient
;
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Main\IO\Path
;
6
7
Loc::loadLanguageFile(Path::combine(__DIR__,
"statuses.php"
));
8
9
$orderID
=
CSalePaySystemAction::GetParamValue
(
"ORDER_ID"
) <>
''
?
CSalePaySystemAction::GetParamValue
(
"ORDER_ID"
) :
$GLOBALS
[
"SALE_INPUT_PARAMS"
][
"ORDER"
][
"ID"
];
10
$login
=
CSalePaySystemAction::GetParamValue
(
"API_LOGIN"
);
11
$password
=
CSalePaySystemAction::GetParamValue
(
"API_PASSWORD"
);
12
$shopId
=
CSalePaySystemAction::GetParamValue
(
"SHOP_ID"
);
13
$changePayStatus
=
CSalePaySystemAction::GetParamValue
(
"CHANGE_STATUS_PAY"
) ==
"Y"
;
14
$statusUrl
=
"https://w.qiwi.com/api/v2/prv/{prv_id}/bills/{bill_id}"
;
15
16
$request
=
new
HttpClient();
17
$request
->setAuthorization(
$login
,
$password
);
18
$request
->setHeader(
"Accept"
,
"text/json"
);
19
$request
->setCharset(
"utf-8"
);
20
21
$response
=
$request
->get(str_replace(
22
array
(
"{prv_id}"
,
"{bill_id}"
),
23
array
(
$shopId
,
$orderID
),
24
$statusUrl
25
));
26
27
if
(
$response
===
false
)
28
return
1;
29
30
$response
= (
array
)json_decode(
$response
);
31
if
(!
$response
|| !isset(
$response
[
'response'
]))
32
return
1;
33
$response
= (
array
)
$response
[
'response'
];
34
35
if
((
int
)
$response
[
'result_code'
])
36
{
37
CSaleOrder::Update
(
$orderID
,
array
(
38
"PS_STATUS"
=>
"N"
,
39
"PS_STATUS_CODE"
=>
$response
[
'result_code'
],
40
"PS_STATUS_MESSAGE"
=> Loc::getMessage(
"SALE_QWH_ERROR_CODE_"
.
$response
[
'result_code'
]),
41
"PS_STATUS_DESCRIPTION"
=> isset(
$response
[
'description'
]) ?
$response
[
'description'
] :
""
,
42
"PS_RESPONSE_DATE"
=> \
Bitrix
\Main\Type\DateTime::createFromTimestamp(time())
43
));
44
}
45
elseif
(isset(
$response
[
'bill'
]))
46
{
47
$bill = (
array
)
$response
[
'bill'
];
48
49
if
(
$order
= CSaleOrder::getByID($bill[
'bill_id'
]))
50
{
51
$paidInfo =
array
(
52
"PS_STATUS"
=> $bill[
'status'
] ==
"paid"
?
"Y"
:
"N"
,
53
"PS_STATUS_CODE"
=> mb_substr($bill[
'status'
], 0, 10),
54
"PS_STATUS_MESSAGE"
=> Loc::getMessage(
"SALE_QWH_STATUS_MESSAGE_"
.mb_strtoupper($bill[
'status'
])),
55
"PS_RESPONSE_DATE"
=> \
Bitrix
\Main\Type\DateTime::createFromTimestamp(time()),
56
"PS_SUM"
=> (
double
)$bill[
'amount'
],
57
"PS_CURRENCY"
=> $bill[
'ccy'
],
58
'PS_STATUS_DESCRIPTION'
=>
''
59
);
60
61
foreach
($bill as
$key
=> $value)
62
$paidInfo[
'PS_STATUS_DESCRIPTION'
] .=
"{$key}:{$value}, "
;
63
64
CSaleOrder::Update
(
$orderID
, $paidInfo);
65
66
if
($bill[
'status'
] ==
"paid"
&& (
double
)$bill[
'amount'
] == (
double
)
$order
[
'PRICE'
] &&
$changePayStatus
)
67
{
68
CSaleOrder::payOrder(
$orderID
,
"Y"
,
true
,
true
);
69
}
70
}
71
}
72
?>
$request
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения
catalog_reindex.php:36
$login
$login
Определения
change_password.php:8
Bitrix\Main\IO\Path
Определения
path.php:12
Bitrix\Main\Localization\Loc
Определения
loc.php:12
Bitrix\Main\Web\HttpClient
Определения
httpclient.php:24
CAllSalePaySystemAction\GetParamValue
static GetParamValue($key, $defaultValue=null)
Определения
pay_system_action.php:76
CSaleOrder\Update
static Update($ID, $arFields, $bDateUpdate=true)
Определения
order.php:140
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix
$order
$order
Определения
payment.php:8
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
die
die
Определения
quickway.php:367
$shopId
$shopId
Определения
refund.php:14
$password
$password
Определения
result.php:7
$statusUrl
$statusUrl
Определения
result.php:14
$changePayStatus
$changePayStatus
Определения
result.php:13
$orderID
$orderID
Определения
result.php:9
$response
$response
Определения
result.php:21
$GLOBALS
$GLOBALS['_____370096793']
Определения
update_client.php:1
bitrix
modules
sale
payment
qiwi
result.php
Создано системой
1.14.0