@@ -38,7 +38,7 @@ |
||
| 38 | 38 | public static function make($name, array $config) |
| 39 | 39 | { |
| 40 | 40 | $namespace = Str::studly($name); |
| 41 | - $application = __NAMESPACE__."\\{$namespace}\\Application"; |
|
| 41 | + $application = __NAMESPACE__ . "\\{$namespace}\\Application"; |
|
| 42 | 42 | |
| 43 | 43 | if (class_exists($application)) { |
| 44 | 44 | // Instantiation application |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function __call($name, $arguments) |
| 57 | 57 | { |
| 58 | - return call_user_func_array([$this['base'], $name], $arguments); |
|
| 58 | + return call_user_func_array([ $this[ 'base' ], $name ], $arguments); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | public function app(array $params) |
| 33 | 33 | { |
| 34 | 34 | $method = 'alipay.trade.app.pay'; |
| 35 | - $params['timeout_express'] = $params['timeout_express'] ?? '1c'; |
|
| 35 | + $params[ 'timeout_express' ] = $params[ 'timeout_express' ] ?? '1c'; |
|
| 36 | 36 | $this->app->setEndpointConfig($method, [ |
| 37 | - 'return_url' => $this->app['config']->get('return_url'), |
|
| 38 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 37 | + 'return_url' => $this->app[ 'config' ]->get('return_url'), |
|
| 38 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 39 | 39 | ]); |
| 40 | 40 | |
| 41 | 41 | return $this->sdkExecute($method, [ |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | public function wap(array $params, string $httpMethod = 'POST') |
| 57 | 57 | { |
| 58 | 58 | $method = 'alipay.trade.wap.pay'; |
| 59 | - $params['timeout_express'] = $params['timeout_express'] ?? '1c'; |
|
| 59 | + $params[ 'timeout_express' ] = $params[ 'timeout_express' ] ?? '1c'; |
|
| 60 | 60 | $this->app->setEndpointConfig($method, [ |
| 61 | - 'return_url' => $this->app['config']->get('return_url'), |
|
| 62 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 61 | + 'return_url' => $this->app[ 'config' ]->get('return_url'), |
|
| 62 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 63 | 63 | ]); |
| 64 | 64 | |
| 65 | 65 | return $this->pageExecute($method, [ |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $method = 'alipay.trade.page.pay'; |
| 83 | 83 | $params = array_merge([ |
| 84 | - 'timeout_express' => $params['timeout_express'] ?? '1c', |
|
| 84 | + 'timeout_express' => $params[ 'timeout_express' ] ?? '1c', |
|
| 85 | 85 | 'product_code' => 'FAST_INSTANT_TRADE_PAY', |
| 86 | 86 | ], $params); |
| 87 | 87 | $this->app->setEndpointConfig($method, [ |
| 88 | - 'return_url' => $this->app['config']->get('return_url'), |
|
| 89 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 88 | + 'return_url' => $this->app[ 'config' ]->get('return_url'), |
|
| 89 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 90 | 90 | ]); |
| 91 | 91 | |
| 92 | 92 | return $this->pageExecute($method, [ |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | public function run(Closure $closure): Response |
| 73 | 73 | { |
| 74 | 74 | try { |
| 75 | - $response = \call_user_func($closure, $this->getMessage(), [$this, 'response']); |
|
| 75 | + $response = \call_user_func($closure, $this->getMessage(), [ $this, 'response' ]); |
|
| 76 | 76 | } catch (\Exception $e) { |
| 77 | - $this->app['logger']->error('Alipay asynchronous notification fatal error:'.$e->getMessage()); |
|
| 77 | + $this->app[ 'logger' ]->error('Alipay asynchronous notification fatal error:' . $e->getMessage()); |
|
| 78 | 78 | $response = $this->response(false); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function getMessage(): Collection |
| 109 | 109 | { |
| 110 | - $signData = $request = $this->app['request']->request->all(); |
|
| 111 | - unset($signData['sign'], $signData['sign_type']); |
|
| 112 | - if ($this->verify($this->getSignContentUrlencode($signData), $request['sign'], $request['sign_type'])) { |
|
| 110 | + $signData = $request = $this->app[ 'request' ]->request->all(); |
|
| 111 | + unset($signData[ 'sign' ], $signData[ 'sign_type' ]); |
|
| 112 | + if ($this->verify($this->getSignContentUrlencode($signData), $request[ 'sign' ], $request[ 'sign_type' ])) { |
|
| 113 | 113 | return new Collection($request); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | public function pay(array $params) |
| 35 | 35 | { |
| 36 | 36 | $method = 'alipay.trade.pay'; |
| 37 | - $params['scene'] = $params['scene'] ?? 'bar_code'; |
|
| 37 | + $params[ 'scene' ] = $params[ 'scene' ] ?? 'bar_code'; |
|
| 38 | 38 | $this->app->setEndpointConfig($method, [ |
| 39 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 39 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 40 | 40 | ]); |
| 41 | 41 | |
| 42 | 42 | return $this->request($method, [ |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $method = 'alipay.trade.create'; |
| 61 | 61 | $this->app->setEndpointConfig($method, [ |
| 62 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 62 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 63 | 63 | ]); |
| 64 | 64 | |
| 65 | 65 | return $this->request($method, [ |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | $method = 'alipay.trade.precreate'; |
| 84 | 84 | $this->app->setEndpointConfig($method, [ |
| 85 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 85 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 86 | 86 | ]); |
| 87 | 87 | |
| 88 | 88 | return $this->request($method, [ |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | 'trade_no' => $tradeNo, |
| 112 | 112 | 'out_trade_no' => $outTradeNo, |
| 113 | 113 | 'operator_id' => $operatorId, |
| 114 | - ], function ($value) { |
|
| 114 | + ], function($value) { |
|
| 115 | 115 | return !($this->checkEmpty($value)); |
| 116 | 116 | }); |
| 117 | 117 | $this->app->setEndpointConfig($method, [ |
| 118 | - 'notify_url' => $this->app['config']->get('notify_url'), |
|
| 118 | + 'notify_url' => $this->app[ 'config' ]->get('notify_url'), |
|
| 119 | 119 | ]); |
| 120 | 120 | |
| 121 | 121 | return $this->request($method, [ |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | * @throws \WannanBigPig\Alipay\Kernel\Exceptions\InvalidSignException |
| 138 | 138 | * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
| 139 | 139 | */ |
| 140 | - public function refund(string $tradeNo, $amount, string $outTradeNo = null, array $params = []) |
|
| 140 | + public function refund(string $tradeNo, $amount, string $outTradeNo = null, array $params = [ ]) |
|
| 141 | 141 | { |
| 142 | 142 | $params = array_merge(array_filter([ |
| 143 | 143 | 'trade_no' => $tradeNo, |
| 144 | 144 | 'out_trade_no' => $outTradeNo, |
| 145 | 145 | 'refund_amount' => $amount, |
| 146 | - ], function ($value) { |
|
| 146 | + ], function($value) { |
|
| 147 | 147 | return !($this->checkEmpty($value)); |
| 148 | 148 | }), $params); |
| 149 | 149 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | 'trade_no' => $tradeNo, |
| 172 | 172 | 'out_trade_no' => $outTradeNo, |
| 173 | 173 | 'org_pid' => $orgPid, |
| 174 | - ], function ($value) { |
|
| 174 | + ], function($value) { |
|
| 175 | 175 | return !($this->checkEmpty($value)); |
| 176 | 176 | }); |
| 177 | 177 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $params = array_filter([ |
| 198 | 198 | 'trade_no' => $tradeNo, |
| 199 | 199 | 'out_trade_no' => $outTradeNo, |
| 200 | - ], function ($value) { |
|
| 200 | + ], function($value) { |
|
| 201 | 201 | return !($this->checkEmpty($value)); |
| 202 | 202 | }); |
| 203 | 203 | |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function orderSettle(string $outRequestNo, string $tradeNo, array $royaltyParameters, string $operatorId = null) |
| 224 | 224 | { |
| 225 | - $royalty = []; |
|
| 225 | + $royalty = [ ]; |
|
| 226 | 226 | if (count($royaltyParameters) === count($royaltyParameters, COUNT_RECURSIVE)) { |
| 227 | - $royalty[0] = $royaltyParameters; |
|
| 227 | + $royalty[ 0 ] = $royaltyParameters; |
|
| 228 | 228 | } else { |
| 229 | 229 | $royalty = $royaltyParameters; |
| 230 | 230 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | 'trade_no' => $tradeNo, |
| 234 | 234 | 'royalty_parameters' => $royalty, |
| 235 | 235 | 'operator_id' => $operatorId, |
| 236 | - ], function ($value) { |
|
| 236 | + ], function($value) { |
|
| 237 | 237 | return !($this->checkEmpty($value)); |
| 238 | 238 | }); |
| 239 | 239 | |
@@ -264,12 +264,12 @@ discard block |
||
| 264 | 264 | 'out_request_no' => $outRequestNo, |
| 265 | 265 | 'orig_request_no' => $origRequestNo, |
| 266 | 266 | 'biz_type' => $bizType, |
| 267 | - ], function ($value) { |
|
| 267 | + ], function($value) { |
|
| 268 | 268 | return !($this->checkEmpty($value)); |
| 269 | 269 | }); |
| 270 | 270 | |
| 271 | 271 | if (!($this->checkEmpty($orderBizInfo))) { |
| 272 | - $params['order_biz_info'] = json_encode(['status' => $orderBizInfo]); |
|
| 272 | + $params[ 'order_biz_info' ] = json_encode([ 'status' => $orderBizInfo ]); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | return $this->request('alipay.trade.orderinfo.sync', [ |
@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
| 32 | 32 | */ |
| 33 | - public function sdkExecute(string $endpoint, array $params = []) |
|
| 33 | + public function sdkExecute(string $endpoint, array $params = [ ]) |
|
| 34 | 34 | { |
| 35 | 35 | // Get api system parameters |
| 36 | 36 | $sysParams = $this->app->apiCommonConfig($endpoint); |
| 37 | 37 | // Filter system parameters |
| 38 | - $sysParams = array_filter($sysParams, function ($value) { |
|
| 38 | + $sysParams = array_filter($sysParams, function($value) { |
|
| 39 | 39 | return !($this->checkEmpty($value)); |
| 40 | 40 | }); |
| 41 | 41 | $params = array_merge($sysParams, $this->json($params)); |
| 42 | 42 | // Set the signature |
| 43 | - $params['sign'] = $this->generateSign($params, $sysParams['sign_type']); |
|
| 43 | + $params[ 'sign' ] = $this->generateSign($params, $sysParams[ 'sign_type' ]); |
|
| 44 | 44 | |
| 45 | 45 | ksort($params); |
| 46 | 46 | |
@@ -58,24 +58,24 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
| 60 | 60 | */ |
| 61 | - public function pageExecute(string $endpoint, array $params = [], string $httpMethod = "POST") |
|
| 61 | + public function pageExecute(string $endpoint, array $params = [ ], string $httpMethod = "POST") |
|
| 62 | 62 | { |
| 63 | 63 | |
| 64 | 64 | // Get api system parameters |
| 65 | 65 | $sysParams = $this->app->apiCommonConfig($endpoint); |
| 66 | 66 | // Filter system parameters |
| 67 | - $sysParams = array_filter($sysParams, function ($value) { |
|
| 67 | + $sysParams = array_filter($sysParams, function($value) { |
|
| 68 | 68 | return !($this->checkEmpty($value)); |
| 69 | 69 | }); |
| 70 | 70 | $params = array_merge($sysParams, $this->json($params)); |
| 71 | 71 | // Set the signature |
| 72 | - $params['sign'] = $this->generateSign($params, $sysParams['sign_type']); |
|
| 72 | + $params[ 'sign' ] = $this->generateSign($params, $sysParams[ 'sign_type' ]); |
|
| 73 | 73 | |
| 74 | 74 | if ("GET" === strtoupper($httpMethod)) { |
| 75 | 75 | // value urlencode |
| 76 | 76 | $preString = $this->getSignContentUrlencode($params); |
| 77 | 77 | // Stitching GET request string |
| 78 | - $requestUrl = $this->app->getGateway()."?".$preString; |
|
| 78 | + $requestUrl = $this->app->getGateway() . "?" . $preString; |
|
| 79 | 79 | |
| 80 | 80 | return $requestUrl; |
| 81 | 81 | } else { |
@@ -93,21 +93,21 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | protected function buildRequestForm(array $paraTemp) |
| 95 | 95 | { |
| 96 | - $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='". |
|
| 97 | - $this->app->getGateway()."?charset=".trim($paraTemp['charset']). |
|
| 96 | + $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='" . |
|
| 97 | + $this->app->getGateway() . "?charset=" . trim($paraTemp[ 'charset' ]) . |
|
| 98 | 98 | "' method='POST'>"; |
| 99 | 99 | |
| 100 | 100 | foreach ($paraTemp as $key => $val) { |
| 101 | 101 | if (false === $this->checkEmpty($val)) { |
| 102 | 102 | $val = str_replace("'", "'", $val); |
| 103 | - $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>"; |
|
| 103 | + $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Submit button control please do not include the name attribute |
| 108 | - $sHtml = $sHtml."<input type='submit' value='ok' style='display:none;''></form>"; |
|
| 108 | + $sHtml = $sHtml . "<input type='submit' value='ok' style='display:none;''></form>"; |
|
| 109 | 109 | |
| 110 | - $sHtml = $sHtml."<script>document.forms['alipaysubmit'].submit();</script>"; |
|
| 110 | + $sHtml = $sHtml . "<script>document.forms['alipaysubmit'].submit();</script>"; |
|
| 111 | 111 | |
| 112 | 112 | return $sHtml; |
| 113 | 113 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'out_trade_no' => $outTradeNo, |
| 42 | 42 | 'out_request_no' => $outRequestNo ?: $outTradeNo, |
| 43 | 43 | 'orgPid' => $orgPid, |
| 44 | - ], function ($value) { |
|
| 44 | + ], function($value) { |
|
| 45 | 45 | return !($this->checkEmpty($value)); |
| 46 | 46 | }); |
| 47 | 47 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
| 66 | 66 | */ |
| 67 | - public function page(string $tradeNo, $amount, string $outRequestNo, string $outTradeNo = null, array $params = [], string $httpMethod = 'POST') |
|
| 67 | + public function page(string $tradeNo, $amount, string $outRequestNo, string $outTradeNo = null, array $params = [ ], string $httpMethod = 'POST') |
|
| 68 | 68 | { |
| 69 | 69 | $method = 'alipay.trade.page.refund'; |
| 70 | 70 | $params = array_merge(array_filter([ |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | 'out_trade_no' => $outTradeNo, |
| 73 | 73 | 'refund_amount' => $amount, |
| 74 | 74 | 'out_request_no' => $outRequestNo, |
| 75 | - ], function ($value) { |
|
| 75 | + ], function($value) { |
|
| 76 | 76 | return !($this->checkEmpty($value)); |
| 77 | 77 | }), $params); |
| 78 | 78 | $this->app->setEndpointConfig($method, [ |
| 79 | - 'return_url' => $this->app['config']->get('return_url'), |
|
| 79 | + 'return_url' => $this->app[ 'config' ]->get('return_url'), |
|
| 80 | 80 | ]); |
| 81 | 81 | |
| 82 | 82 | return $this->pageExecute($method, [ |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function register(Container $pimple) |
| 32 | 32 | { |
| 33 | - $pimple['config'] = function (App $app) { |
|
| 33 | + $pimple[ 'config' ] = function(App $app) { |
|
| 34 | 34 | return new Config($app->getConfig()); |
| 35 | 35 | }; |
| 36 | 36 | } |
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function register(Container $pimple) |
| 30 | 30 | { |
| 31 | - foreach ($pimple['app_client_providers'] as $key => $value) { |
|
| 32 | - $pimple[$key] = function ($app) use ($value) { |
|
| 31 | + foreach ($pimple[ 'app_client_providers' ] as $key => $value) { |
|
| 32 | + $pimple[ $key ] = function($app) use ($value) { |
|
| 33 | 33 | return new $value($app); |
| 34 | 34 | }; |
| 35 | 35 | } |