|
@@ -8,9 +8,14 @@ class RefillCallBack implements refill\IRefillCallBack
|
|
|
{
|
|
|
public function verify($params): bool
|
|
|
{
|
|
|
- $input = $params;
|
|
|
- unset($input['sign']);
|
|
|
- $sign = config::sign($input);
|
|
|
+ $signer = function ($params) {
|
|
|
+ $body = "code={$params['memberId']}rechargeOrderId={$params['rechargeOrderId']}memberOrderId={$params['memberOrderId']}rechargeAccount={$params['rechargeAccount']}productId={$params['productId']}faceValue={$params['faceValue']}signkey=";
|
|
|
+ $body .= config::KEY;
|
|
|
+
|
|
|
+ return md5($body);
|
|
|
+ };
|
|
|
+
|
|
|
+ $sign = $signer($params);
|
|
|
if ($params['sign'] == $sign) {
|
|
|
return true;
|
|
|
} else {
|
|
@@ -21,25 +26,24 @@ class RefillCallBack implements refill\IRefillCallBack
|
|
|
//[$order_id, $success, $can_try, $need_handle, $official_sn]
|
|
|
public function notify($params): array
|
|
|
{
|
|
|
-
|
|
|
- $order_sn = $params['merchant_no'];
|
|
|
+ $order_sn = $params['memberOrderId'];
|
|
|
$order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
|
|
|
|
|
|
if (empty($order_info)) {
|
|
|
return [false, false, false, false, ''];
|
|
|
}
|
|
|
|
|
|
- $official_sn = strtolower($params['official_sn']) == 'null' ? '' : $params['official_sn'];
|
|
|
+ $official_sn = trim($params['supplyCert'] ?? '');
|
|
|
$order_id = $order_info['order_id'];
|
|
|
|
|
|
- $status = intval($params['recharge_status']);
|
|
|
- if ($status === 3) {
|
|
|
+ $code = intval($params['code']);
|
|
|
+ if ($code === 201) {
|
|
|
$data['ch_trade_no'] = $params['order_no'];
|
|
|
$data['official_sn'] = $official_sn;
|
|
|
Model('refill_order')->edit($order_id, $data);
|
|
|
return [$order_id, true, false, true, $official_sn];
|
|
|
}
|
|
|
- elseif (in_array($status,[4,5])) {
|
|
|
+ elseif (in_array($code, [202, 203, 204])) {
|
|
|
Model('refill_order')->edit($order_id, ['ch_trade_no' => $params['order_no']]);
|
|
|
return [$order_id, false, true, true, ''];
|
|
|
}
|