12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace refill\by_online_cb;
- require_once(BASE_HELPER_RAPI_PATH . '/by_online_cb/config.php');
- use refill;
- use QueueClient;
- class RefillCallBack implements refill\IRefillCallBack
- {
- public function verify($params): bool
- {
- $input = $params;
- unset($input['sign']);
- $sign = config::sign($input);
- if ($params['sign'] == $sign) {
- return true;
- } else {
- return false;
- }
- }
- public function notify($params)
- {
- $status = intval($params['order_status']);
- $order_sn = $params['merchantorder_no'];
- $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
- if (empty($order_info)) {
- return [false, false, false, false];
- }
- $order_id = $order_info['order_id'];
- if ($status === 7) {
- $data['official_sn'] = strtolower($params['charge_id']) == 'null' ? '' : $params['charge_id'];
- Model('refill_order')->edit($order_id, $data);
- QueueClient::async_push("onHnydCbSuccess", ['order_id' => $order_id], 1);
- return [$order_id, true, false, true];
- }
- elseif (in_array($status, [3, 4, 6], true)) {
- return [$order_id, false, true, true];
- }
- else {
- return [$order_id, false, false, false];
- }
- }
- }
|