改进 支付网关环境判断

This commit is contained in:
iVampireSP.com 2022-09-06 01:05:46 +08:00
parent d4c8b0041c
commit f0ce106c72
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 9 additions and 3 deletions

View File

@ -76,7 +76,7 @@ public function show(Request $request, Balance $balance)
} }
try { try {
$result = AlipayFactory::payment()->page()->pay("支付", $balance->order_id, $balance->amount, 'http://rcrmqishil.sharedwithexpose.com/api/pay/return'); $result = AlipayFactory::payment()->page()->pay("支付", $balance->order_id, $balance->amount, route('balances.pay.show', ['balance' => $balance->order_id]));
$responseChecker = new ResponseChecker(); $responseChecker = new ResponseChecker();

View File

@ -38,14 +38,20 @@ public function boot()
}); });
AlipayFactory::setOptions($this->alipayOptions()); AlipayFactory::setOptions($this->alipayOptions());
} }
private function alipayOptions() private function alipayOptions()
{ {
$options = new AlipayConfig(); $options = new AlipayConfig();
$options->protocol = 'https'; $options->protocol = 'https';
// if local
if (app()->environment() == 'local') {
$options->gatewayHost = 'openapi.alipaydev.com'; $options->gatewayHost = 'openapi.alipaydev.com';
} else {
$options->gatewayHost = 'openapi.alipay.com';
}
$options->signType = 'RSA2'; $options->signType = 'RSA2';
$options->appId = config('alipay.app_id'); $options->appId = config('alipay.app_id');