PageRefundPlugin.php 814 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. declare(strict_types=1);
  3. namespace Yansongda\Pay\Plugin\Alipay\Trade;
  4. use Closure;
  5. use Yansongda\Pay\Contract\PluginInterface;
  6. use Yansongda\Pay\Direction\ResponseDirection;
  7. use Yansongda\Pay\Logger;
  8. use Yansongda\Pay\Rocket;
  9. class PageRefundPlugin implements PluginInterface
  10. {
  11. public function assembly(Rocket $rocket, Closure $next): Rocket
  12. {
  13. Logger::debug('[alipay][PageRefundPlugin] 插件开始装载', ['rocket' => $rocket]);
  14. $rocket->setDirection(ResponseDirection::class)
  15. ->mergePayload([
  16. 'method' => 'alipay.trade.page.refund',
  17. 'biz_content' => $rocket->getParams(),
  18. ])
  19. ;
  20. Logger::info('[alipay][PageRefundPlugin] 插件装载完毕', ['rocket' => $rocket]);
  21. return $next($rocket);
  22. }
  23. }