mirror of
https://gitee.com/yansongda/pay.git
synced 2024-12-04 21:29:29 +08:00
commit
a51e81990f
@ -334,7 +334,7 @@ class Alipay implements GatewayApplicationInterface
|
||||
* @throws InvalidSignException
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function extend(string $method, callable $function, bool $now = true): ?Collection
|
||||
public function extend(string $method, callable $function, bool $now = true, bool $response = false): ?Collection
|
||||
{
|
||||
if (!$now && !method_exists($this, $method)) {
|
||||
$this->extends[$method] = $function;
|
||||
@ -354,7 +354,7 @@ class Alipay implements GatewayApplicationInterface
|
||||
$this->payload = $customize;
|
||||
$this->payload['sign'] = Support::generateSign($this->payload);
|
||||
|
||||
return Support::requestApi($this->payload);
|
||||
return Support::requestApi($this->payload, $response);
|
||||
}
|
||||
|
||||
return $customize;
|
||||
|
@ -132,7 +132,7 @@ class Support
|
||||
* @throws InvalidConfigException
|
||||
* @throws InvalidSignException
|
||||
*/
|
||||
public static function requestApi(array $data): Collection
|
||||
public static function requestApi(array $data, bool $response = false): Collection
|
||||
{
|
||||
Events::dispatch(new Events\ApiRequesting('Alipay', '', self::$instance->getBaseUri(), $data));
|
||||
|
||||
@ -144,7 +144,7 @@ class Support
|
||||
|
||||
Events::dispatch(new Events\ApiRequested('Alipay', '', self::$instance->getBaseUri(), $result));
|
||||
|
||||
return self::processingApiResult($data, $result);
|
||||
return self::processingApiResult($data, $result, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -396,8 +396,12 @@ class Support
|
||||
* @throws InvalidConfigException
|
||||
* @throws InvalidSignException
|
||||
*/
|
||||
protected static function processingApiResult($data, $result): Collection
|
||||
protected static function processingApiResult($data, $result, $response = false): Collection
|
||||
{
|
||||
if ($response) {
|
||||
return new Collection($result);
|
||||
}
|
||||
|
||||
$method = str_replace('.', '_', $data['method']).'_response';
|
||||
|
||||
if (!isset($result['sign']) || '10000' != $result[$method]['code']) {
|
||||
|
Loading…
Reference in New Issue
Block a user