Skip to content

Commit

Permalink
optimize: 优化预下单失败时错误提示 (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
yansongda authored Jun 24, 2023
1 parent 7188d6a commit da90865
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## v3.4.1

### optimized

- optimize: 优化无签名时错误提示(#813)
- optimize: 优化预下单失败时错误提示(#814)

## v3.4.0

### added
Expand Down
8 changes: 5 additions & 3 deletions src/Plugin/Wechat/Pay/Common/InvokePrepayPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ public function assembly(Rocket $rocket, Closure $next): Rocket

Logger::debug('[wechat][InvokePrepayPlugin] 插件开始装载', ['rocket' => $rocket]);

$prepayId = $rocket->getDestination()->get('prepay_id');
$destination = $rocket->getDestination();

$prepayId = $destination->get('prepay_id');

if (is_null($prepayId)) {
Logger::error('[wechat][InvokePrepayPlugin] 预下单失败:响应缺少 prepay_id 参数,请自行检查参数是否符合微信要求', $rocket->getDestination()->all());
Logger::error('[wechat][InvokePrepayPlugin] 预下单失败:响应缺少 prepay_id 参数,请自行检查参数是否符合微信要求', $destination->all());

throw new InvalidResponseException(Exception::RESPONSE_MISSING_NECESSARY_PARAMS, 'Prepay Response Error: Missing PrepayId', $rocket->getDestination()->all());
throw new InvalidResponseException(Exception::RESPONSE_MISSING_NECESSARY_PARAMS, $destination->get('message', '预下单失败:响应缺少 prepay_id 参数,请自行检查参数是否符合微信要求'), $destination->all());
}

$config = $this->getInvokeConfig($rocket, $prepayId);
Expand Down

0 comments on commit da90865

Please # to comment.