feat: 微信退款自动增加回调url (#649)

This commit is contained in:
yansongda 2022-08-20 12:00:17 +08:00 committed by GitHub
parent 02bf68d1fb
commit 8d4be495df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
98 changed files with 319 additions and 35 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ composer.lock
*.DS_Store
.idea/
.phpunit.cache/
.phpunit.result.cache

View File

@ -1,3 +1,9 @@
## v3.1.11
### added
- feat: 微信退款自动增加回调url(#649)
## v3.1.10
### added

View File

@ -12,11 +12,11 @@ interface ProviderInterface
/**
* pay.
*
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*/
public function pay(array $plugins, array $params);

View File

@ -300,9 +300,9 @@ if (!function_exists('decrypt_wechat_resource')) {
if (!function_exists('decrypt_wechat_resource_aes_256_gcm')) {
/**
* @throws \Yansongda\Pay\Exception\InvalidResponseException
*
* @return array|string
*
* @throws \Yansongda\Pay\Exception\InvalidResponseException
*/
function decrypt_wechat_resource_aes_256_gcm(string $ciphertext, string $secret, string $nonce, string $associatedData)
{

View File

@ -79,10 +79,10 @@ class Pay
}
/**
* @return mixed
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return mixed
*/
public static function __callStatic(string $service, array $config)
{
@ -143,9 +143,9 @@ class Pay
}
/**
* @throws \Yansongda\Pay\Exception\ContainerException
*
* @return mixed
*
* @throws \Yansongda\Pay\Exception\ContainerException
*/
public static function make(string $service, array $parameters = [])
{
@ -167,10 +167,10 @@ class Pay
}
/**
* @return mixed
*
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
* @throws \Yansongda\Pay\Exception\ContainerException
*
* @return mixed
*/
public static function get(string $service)
{

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_6_1.shtml
*/
class ApplyPlugin extends GeneralPlugin
{
/**

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_6_2.shtml
*/
class FindPlugin extends GeneralPlugin
{
/**

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_6_5.shtml
*/
class FindReturnAdvancePlugin extends GeneralPlugin
{
/**

View File

@ -10,6 +10,9 @@ use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Collection;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_6_4.shtml
*/
class ReturnAdvancePlugin extends GeneralPlugin
{
/**

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_7.shtml
*/
class CreateBillReceiptPlugin extends GeneralPlugin
{
/**

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_9.shtml
*/
class CreateDetailReceiptPlugin extends GeneralPlugin
{
/**

View File

@ -10,6 +10,9 @@ use Yansongda\Pay\Rocket;
use Yansongda\Pay\Traits\HasWechatEncryption;
use Yansongda\Supports\Collection;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_1.shtml
*/
class CreatePlugin extends GeneralPlugin
{
use HasWechatEncryption;

View File

@ -10,6 +10,9 @@ use Yansongda\Pay\Parser\OriginResponseParser;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_11.shtml
*/
class DownloadReceiptPlugin extends GeneralPlugin
{
/**

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_3.shtml
*/
class QueryBatchDetailIdPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_2.shtml
*/
class QueryBatchIdPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_8.shtml
*/
class QueryBillReceiptPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_10.shtml
*/
class QueryDetailReceiptPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_6.shtml
*/
class QueryOutBatchDetailNoPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_5.shtml
*/
class QueryOutBatchNoPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -40,9 +40,9 @@ class LaunchPlugin implements PluginInterface
}
/**
* @throws \Yansongda\Pay\Exception\InvalidResponseException
*
* @return array|\Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|null
*
* @throws \Yansongda\Pay\Exception\InvalidResponseException
*/
protected function validateResponse(Rocket $rocket)
{

View File

@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Marketing\Coupon;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_1.shtml
*/
class CreatePlugin extends GeneralPlugin
{
protected function doSomething(Rocket $rocket): void

View File

@ -10,6 +10,9 @@ use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Collection;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_13.shtml
*/
class PausePlugin extends GeneralPlugin
{
/**

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_9.shtml
*/
class QueryCouponDetailPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_5.shtml
*/
class QueryStockDetailPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_8.shtml
*/
class QueryStockItemsPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_7.shtml
*/
class QueryStockMerchantsPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_11.shtml
*/
class QueryStockRefundFlowPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_10.shtml
*/
class QueryStockUseFlowPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Marketing\Coupon;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_4.shtml
*/
class QueryStocksPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_9.shtml
*/
class QueryUserCouponsPlugin extends GeneralPlugin
{
protected function getMethod(): string

View File

@ -10,6 +10,9 @@ use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Collection;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_14.shtml
*/
class RestartPlugin extends GeneralPlugin
{
/**

View File

@ -10,6 +10,9 @@ use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Collection;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_2.shtml
*/
class SendPlugin extends GeneralPlugin
{
protected function doSomething(Rocket $rocket): void

View File

@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Marketing\Coupon;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_12.shtml
*/
class SetCallbackPlugin extends GeneralPlugin
{
/**

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Plugin\Wechat\GeneralPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_1_3.shtml
*/
class StartPlugin extends GeneralPlugin
{
protected function doSomething(Rocket $rocket): void

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\App;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_3.shtml
*/
class ClosePlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\ClosePlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\App;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_8.shtml
*/
class DownloadBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\DownloadBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\App;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_10.shtml
*/
class FindRefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\FindRefundPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\App;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_7.shtml
*/
class GetFlowBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetFlowBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\App;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_6.shtml
*/
class GetTradeBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetTradeBillPlugin
{
}

View File

@ -9,6 +9,9 @@ use Yansongda\Supports\Collection;
use Yansongda\Supports\Config;
use Yansongda\Supports\Str;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_4.shtml
*/
class InvokePrepayPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\InvokePrepayPlugin
{
/**

View File

@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\App;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_1.shtml
*/
class PrepayPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\PrepayPlugin
{
protected function getUri(Rocket $rocket): string

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\App;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_2.shtml
*/
class QueryPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\QueryPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\App;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_9.shtml
*/
class RefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\RefundPlugin
{
}

View File

@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
use Yansongda\Pay\Plugin\Wechat\Pay\Common\CombinePrepayPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_1.shtml
*/
class AppPrepayPlugin extends CombinePrepayPlugin
{
protected function getUri(Rocket $rocket): string

View File

@ -9,6 +9,9 @@ use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Collection;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_12.shtml
*/
class ClosePlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\ClosePlugin
{
protected function getUri(Rocket $rocket): string

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_19.shtml
*/
class DownloadBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\DownloadBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_15.shtml
*/
class FindRefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\FindRefundPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_18.shtml
*/
class GetFlowBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetFlowBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_17.shtml
*/
class GetTradeBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetTradeBillPlugin
{
}

View File

@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
use Yansongda\Pay\Plugin\Wechat\Pay\Common\CombinePrepayPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_2.shtml
*/
class H5PrepayPlugin extends CombinePrepayPlugin
{
protected function getUri(Rocket $rocket): string

View File

@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
use Yansongda\Pay\Plugin\Wechat\Pay\App\InvokePrepayPlugin;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_6.shtml
*/
class InvokeAppPrepayPlugin extends InvokePrepayPlugin
{
}

View File

@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
use Yansongda\Pay\Plugin\Wechat\Pay\Jsapi\InvokePrepayPlugin;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_8.shtml
*/
class InvokeJsapiPrepayPlugin extends InvokePrepayPlugin
{
}

View File

@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
use Yansongda\Pay\Plugin\Wechat\Pay\Mini\InvokePrepayPlugin;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_9.shtml
*/
class InvokeMiniPrepayPlugin extends InvokePrepayPlugin
{
}

View File

@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
use Yansongda\Pay\Plugin\Wechat\Pay\Common\CombinePrepayPlugin;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_3.shtml
*/
class JsapiPrepayPlugin extends CombinePrepayPlugin
{
}

View File

@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
use Yansongda\Pay\Plugin\Wechat\Pay\Common\CombinePrepayPlugin;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_4.shtml
*/
class MiniPrepayPlugin extends CombinePrepayPlugin
{
}

View File

@ -7,6 +7,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
use Yansongda\Pay\Plugin\Wechat\Pay\Common\CombinePrepayPlugin;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_5.shtml
*/
class NativePrepayPlugin extends CombinePrepayPlugin
{
protected function getUri(Rocket $rocket): string

View File

@ -8,6 +8,9 @@ use Yansongda\Pay\Exception\Exception;
use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_11.shtml
*/
class QueryPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\QueryPlugin
{
protected function getUri(Rocket $rocket): string

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Combine;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_14.shtml
*/
class RefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\RefundPlugin
{
}

View File

@ -22,11 +22,16 @@ class RefundPlugin extends GeneralPlugin
protected function doSomething(Rocket $rocket): void
{
$config = get_wechat_config($rocket->getParams());
$payload = $rocket->getPayload();
if (empty($payload->get('notify_url'))) {
$merge['notify_url'] = $config->get('notify_url', '');
}
if (Pay::MODE_SERVICE == $config->get('mode')) {
$rocket->mergePayload([
'sub_mchid' => $rocket->getPayload()->get('sub_mchid', $config->get('sub_mch_id')),
]);
$merge['sub_mchid'] = $payload->get('sub_mchid', $config->get('sub_mch_id'));
}
$rocket->mergePayload($merge ?? []);
}
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\H5;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_3.shtml
*/
class ClosePlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\ClosePlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\H5;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_8.shtml
*/
class DownloadBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\DownloadBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\H5;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_10.shtml
*/
class FindRefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\FindRefundPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\H5;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_7.shtml
*/
class GetFlowBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetFlowBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\H5;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_6.shtml
*/
class GetTradeBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetTradeBillPlugin
{
}

View File

@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\H5;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_1.shtml
*/
class PrepayPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\PrepayPlugin
{
protected function getUri(Rocket $rocket): string

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\H5;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_2.shtml
*/
class QueryPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\QueryPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\H5;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_9.shtml
*/
class RefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\RefundPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Jsapi;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_3.shtml
*/
class ClosePlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\ClosePlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Jsapi;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_8.shtml
*/
class DownloadBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\DownloadBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Jsapi;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_10.shtml
*/
class FindRefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\FindRefundPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Jsapi;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_7.shtml
*/
class GetFlowBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetFlowBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Jsapi;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_6.shtml
*/
class GetTradeBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetTradeBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Jsapi;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_4.shtml
*/
class InvokePrepayPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\InvokePrepayPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Jsapi;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml
*/
class PrepayPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\PrepayPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Jsapi;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_2.shtml
*/
class QueryPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\QueryPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Jsapi;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_9.shtml
*/
class RefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\RefundPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Mini;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_3.shtml
*/
class ClosePlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\ClosePlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Mini;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_8.shtml
*/
class DownloadBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\DownloadBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Mini;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_10.shtml
*/
class FindRefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\FindRefundPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Mini;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_7.shtml
*/
class GetFlowBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetFlowBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Mini;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_6.shtml
*/
class GetTradeBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetTradeBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Mini;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_4.shtml
*/
class InvokePrepayPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\InvokePrepayPlugin
{
protected function getConfigKey(): string

View File

@ -8,6 +8,9 @@ use Yansongda\Pay\Pay;
use Yansongda\Pay\Rocket;
use Yansongda\Supports\Config;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_1.shtml
*/
class PrepayPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\PrepayPlugin
{
protected function getWechatId(Config $config, Rocket $rocket): array

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Mini;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_2.shtml
*/
class QueryPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\QueryPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Mini;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_9.shtml
*/
class RefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\RefundPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Native;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_3.shtml
*/
class ClosePlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\ClosePlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Native;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_8.shtml
*/
class DownloadBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\DownloadBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Native;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_10.shtml
*/
class FindRefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\FindRefundPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Native;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_7.shtml
*/
class GetFlowBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetFlowBillPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Native;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_6.shtml
*/
class GetTradeBillPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\GetTradeBillPlugin
{
}

View File

@ -6,6 +6,9 @@ namespace Yansongda\Pay\Plugin\Wechat\Pay\Native;
use Yansongda\Pay\Rocket;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_1.shtml
*/
class PrepayPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\PrepayPlugin
{
protected function getUri(Rocket $rocket): string

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Native;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_2.shtml
*/
class QueryPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\QueryPlugin
{
}

View File

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yansongda\Pay\Plugin\Wechat\Pay\Native;
/**
* @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_9.shtml
*/
class RefundPlugin extends \Yansongda\Pay\Plugin\Wechat\Pay\Common\RefundPlugin
{
}

View File

@ -25,11 +25,11 @@ use Yansongda\Supports\Pipeline;
abstract class AbstractProvider implements ProviderInterface
{
/**
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*/
public function call(string $plugin, array $params = [])
{
@ -46,10 +46,10 @@ abstract class AbstractProvider implements ProviderInterface
}
/**
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
*
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*/
public function pay(array $plugins, array $params)
{

View File

@ -37,11 +37,11 @@ class Alipay extends AbstractProvider
];
/**
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*/
public function __call(string $shortcut, array $params)
{
@ -54,11 +54,11 @@ class Alipay extends AbstractProvider
/**
* @param string|array $order
*
* @return array|\Yansongda\Supports\Collection
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return array|\Yansongda\Supports\Collection
*/
public function find($order)
{
@ -72,11 +72,11 @@ class Alipay extends AbstractProvider
/**
* @param string|array $order
*
* @return array|\Yansongda\Supports\Collection
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return array|\Yansongda\Supports\Collection
*/
public function cancel($order)
{
@ -90,11 +90,11 @@ class Alipay extends AbstractProvider
/**
* @param string|array $order
*
* @return array|\Yansongda\Supports\Collection
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return array|\Yansongda\Supports\Collection
*/
public function close($order)
{
@ -106,11 +106,11 @@ class Alipay extends AbstractProvider
}
/**
* @return array|\Yansongda\Supports\Collection
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return array|\Yansongda\Supports\Collection
*/
public function refund(array $order)
{

View File

@ -40,11 +40,11 @@ class Wechat extends AbstractProvider
];
/**
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return \Psr\Http\Message\MessageInterface|\Yansongda\Supports\Collection|array|null
*/
public function __call(string $shortcut, array $params)
{
@ -57,11 +57,11 @@ class Wechat extends AbstractProvider
/**
* @param array|string $order
*
* @return array|\Yansongda\Supports\Collection
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return array|\Yansongda\Supports\Collection
*/
public function find($order)
{
@ -99,11 +99,11 @@ class Wechat extends AbstractProvider
}
/**
* @return array|\Yansongda\Supports\Collection
*
* @throws \Yansongda\Pay\Exception\ContainerException
* @throws \Yansongda\Pay\Exception\InvalidParamsException
* @throws \Yansongda\Pay\Exception\ServiceNotFoundException
*
* @return array|\Yansongda\Supports\Collection
*/
public function refund(array $order)
{

View File

@ -66,4 +66,17 @@ class RefundPluginTest extends TestCase
self::assertEquals('123', $payload->get('sub_mchid'));
}
public function testNormalNotifyUrl()
{
$rocket = (new Rocket())
->setParams([])->setPayload(new Collection());
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals('pay.yansongda.cn', $result->getPayload()->get('notify_url'));
$rocket = (new Rocket())
->setParams([])->setPayload(new Collection(['notify_url' => 'yansongda.cn']));
$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });
self::assertEquals('yansongda.cn', $result->getPayload()->get('notify_url'));
}
}

View File

@ -30,6 +30,7 @@ class TestCase extends \PHPUnit\Framework\TestCase
'mch_secret_key' => '53D67FCB97E68F9998CBD17ED7A8D1E2',
'mch_secret_cert' => __DIR__.'/Cert/wechatAppPrivateKey.pem',
'mch_public_cert_path' => __DIR__.'/Cert/wechatAppPublicKey.pem',
'notify_url' => 'pay.yansongda.cn',
'wechat_public_cert_path' => [
'45F59D4DABF31918AFCEC556D5D2C6E376675D57' => __DIR__.'/Cert/wechatPublicKey.crt',
'yansongda' => __DIR__.'/Cert/wechatPublicKey.crt',