Sfoglia il codice sorgente

话费充值推送失败就退款

xialei 1 anno fa
parent
commit
c8a8562b52
1 ha cambiato i file con 20 aggiunte e 1 eliminazioni
  1. 20 1
      app/controller/api/Notify.php

+ 20 - 1
app/controller/api/Notify.php

@@ -58,7 +58,26 @@ class Notify
58 58
                             //话费充值支付成功推送
59 59
                             try{
60 60
                                 $Huafei = new Huafei();
61
-                                $Huafei->pushHf($order_data['uid'], $order_data['order_no'], $order_data['mobile'], $order_data['pay_price']);
61
+                                $pay_wx = systemConfig('pay_wx');
62
+                                $push = $Huafei->pushHf($order_data['uid'], $order_data['order_no'], $order_data['mobile'], $order_data['pay_price']);
63
+                                if($push['code'] != '0000'){
64
+                                    //推送失败 给新支付的这一笔退款
65
+                                    Db::name('log')->insert(['data' => '给新话费充值支付的这一笔退款']);
66
+                                    if ($pay_wx == 3){
67
+                                        $key='api_live_b0a687ec-5450-4ada-a0e4-65bac0f46871';
68
+                                    }else{
69
+                                        $key='api_live_90ef02e4-54ac-41ee-adf1-e4927d23d58f';
70
+                                    }
71
+                                    $refund_traits = [
72
+                                        'payment_id'  => $post_data_str['id'],
73
+                                        'app_id'      => $post['app_id'],
74
+                                        'order_no'    => app()->make(StoreRefundOrderRepository::class)->getNewOrderId(),
75
+                                        'reverse_amt' => $post_data_str['pay_amt'],
76
+                                        'notify_url'  => env('APP_URL') . "/api/hf_notify/reverse_order",
77
+                                    ];
78
+                                    $hf_refund_res = app()->make(StoreRefundOrderRepository::class)->payment_Reverse($refund_traits, $pay_type['pay_type'] == '1' ? 2 : 1, $pay_wx, $key);
79
+                                    Db::name('log')->insert(['data'=>'话费充值汇付支付撤销返回结果:'.json_encode($hf_refund_res)]);
80
+                                }
62 81
                             }catch (\Exception $e) {
63 82
                                 Db::name('log')->insert(['data'=>'话费充值支付回调推送订单错误:'.$e->getFile().':'.$e->getLine().'【'.$e->getMessage().'】']);
64 83
                             }