2
This commit is contained in:
parent
8936a69769
commit
8829a29da3
@ -81,41 +81,41 @@ class UserController extends AbstractController
|
|||||||
// dump($wx_info_data);die;
|
// dump($wx_info_data);die;
|
||||||
|
|
||||||
// 发起支付
|
// 发起支付
|
||||||
$out_trade_no = $this->request->input('out_trade_no');
|
// $out_trade_no = $this->request->input('out_trade_no');
|
||||||
$generator = $this->container->get(IdGeneratorInterface::class);
|
// $generator = $this->container->get(IdGeneratorInterface::class);
|
||||||
|
//
|
||||||
$WechatPay = new WechatPay(1);
|
|
||||||
|
|
||||||
// 获取预支付交易会话标识
|
|
||||||
$total = 0.01 * 100;
|
|
||||||
$prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8");
|
|
||||||
if (empty($prepay)){
|
|
||||||
return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取小程序支付配置
|
|
||||||
$pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
|
|
||||||
return $this->response->json($pay_config);
|
|
||||||
|
|
||||||
// 发起退款
|
|
||||||
// $WechatPay = new WechatPay(1);
|
// $WechatPay = new WechatPay(1);
|
||||||
//
|
//
|
||||||
// $params = array();
|
// // 获取预支付交易会话标识
|
||||||
// $params['order_inquiry_id'] = 1;
|
// $total = 0.01 * 100;
|
||||||
// $order_inquiry = OrderInquiry::getOne($params);
|
// $prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8");
|
||||||
|
// if (empty($prepay)){
|
||||||
|
// return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
//
|
// // 获取小程序支付配置
|
||||||
// $options = array();
|
// $pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
|
||||||
// $options['transaction_id'] = $order_inquiry['escrow_trade_no'];
|
// return $this->response->json($pay_config);
|
||||||
// $options['out_refund_no'] = $order_inquiry['inquiry_refund_no'];
|
|
||||||
// $options['reason'] = "退款原因";
|
// 发起退款
|
||||||
// $options['amount'] = [
|
$WechatPay = new WechatPay(1);
|
||||||
// 'refund' => (int)1,
|
|
||||||
// 'total' => (int)1,
|
$params = array();
|
||||||
// 'currency' => "CNY",
|
$params['order_inquiry_id'] = 1;
|
||||||
// ];
|
$order_inquiry = OrderInquiry::getOne($params);
|
||||||
//
|
|
||||||
// $result = $WechatPay->refund($options);
|
|
||||||
// dump($result);
|
$options = array();
|
||||||
|
$options['transaction_id'] = $order_inquiry['escrow_trade_no'];
|
||||||
|
$options['out_refund_no'] = $order_inquiry['inquiry_refund_no'];
|
||||||
|
$options['reason'] = "退款原因";
|
||||||
|
$options['amount'] = [
|
||||||
|
'refund' => (int)1,
|
||||||
|
'total' => (int)1,
|
||||||
|
'currency' => "CNY",
|
||||||
|
];
|
||||||
|
|
||||||
|
$result = $WechatPay->refund($options);
|
||||||
|
dump($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ class WechatPay
|
|||||||
$app = $this->createApp();
|
$app = $this->createApp();
|
||||||
|
|
||||||
$options['notify_url'] = env('DOMAIN_NAME_DEV') . $this->config['refund_notify_url'];
|
$options['notify_url'] = env('DOMAIN_NAME_DEV') . $this->config['refund_notify_url'];
|
||||||
dump($options);die;
|
|
||||||
$response = $app->getClient()->postJson("v3/refund/domestic/refunds", $options);
|
$response = $app->getClient()->postJson("v3/refund/domestic/refunds", $options);
|
||||||
if ($response->isFailed()) {
|
if ($response->isFailed()) {
|
||||||
// 出错了,处理异常
|
// 出错了,处理异常
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user