for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat;
use function Yansongda\Pay\get_wechat_config;
use Yansongda\Pay\Rocket;
abstract class GeneralV2Plugin extends GeneralPlugin
{
protected function getHeaders(): array
return [
'Content-Type' => 'application/xml',
'User-Agent' => 'yansongda/pay-v3',
];
}
/**
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*/
protected function doSomething(Rocket $rocket): void
$config = get_wechat_config($rocket->getParams());
$configKey = $this->getConfigKey($rocket->getParams());
$rocket->mergeParams(['_version' => 'v2']);
$rocket->mergePayload([
'appid' => $config[$configKey] ?? '',
'mch_id' => $config['mch_id'] ?? '',
]);
abstract protected function getUri(Rocket $rocket): string;