You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rmiku
ecf9758d64
|
2 weeks ago | |
---|---|---|
.. | ||
config | 3 weeks ago | |
src | 2 weeks ago | |
tests | 3 weeks ago | |
.gitignore | 3 weeks ago | |
README.md | 3 weeks ago | |
composer.json | 3 weeks ago | |
phpunit.xml | 3 weeks ago |
README.md
Unify-Payment
方鼎统一支付平台v2,PHP接入版
使用
php环境需 >= 7.4
Composer 安装
- composer.json 的 repositories 项添加本地文件夹路径
{
"repositories": [
{
"type": "path",
"url": "./unify_payment"
}
]
}
- 执行require命令
$ composer require fd_wechat/unify_payment
基本用法
支付模块
miniClient / officialClient
<?php
require_once 'vendor/autoload.php';
use UnifyPayment\Factory;
use UnifyPayment\Cores\Struct\CreateWeChatOrder;
$order = new CreateOrder('当天挂号', 'FD2022080310000055123451223', 0.01, '1', '002197|测试', 'A', 'ovIGQwOy1e-Zptyug20l5hqI0P5Q', 'https://www.test.com');
// 小程序支付
Factory::pay($config)->mini->jsapi($order);
// 公众号支付
Factory::pay($config)->official->jsapi($order);
通用模块
orderClient
<?php
require_once 'vendor/autoload.php';
use UnifyPayment\Factory;
use UnifyPayment\Cores\Struct\QueryOrder;
use UnifyPayment\Cores\Struct\CloseOrder;
use UnifyPayment\Cores\Struct\RefundOrder;
use UnifyPayment\Cores\Struct\ConfirmOrderForEx;
// 订单查询
$order = new QueryOrder('FD2022080310000055123451223');
Factory::common($config)->order->query($order);
// 订单关闭
$order = new CloseOrder('FD2022080310000055123451223');
Factory::common($config)->order->close($order);
// 订单退款
$order = new RefundOrder('FD2022080310000055123451223', 'FD2022080310000055123451223_12345', 0.01, 'Test Refund');
Factory::common($config)->order->refund($order);
// 外部订单确认
$order = new ConfirmOrderForEx('FD2022080310000055123451223', 'ZSD0002974832', 'ow8NuxN_ALO2MzSvzj19hyxWjCVY', '4200067674202302063709953797');
Factory::common($config)->order->confirmForEx($order);
添加第三方Client
$app = Factory::pay($config);
$app->registerOtherClient('other', OtherClient::class);
$app->other->doSomeThing(...);
数据Mock
Mock数据类在目录 ./src/Mock
下
$mockHandler = new CreateWeChatOrderHandler(true);
Factory::pay($config)->official->setMockHandler([$mockHandler])->jsapi($order);