yaoliyong / think-withdraw
withdraw terminal service api sdk for thinkphp
Installs: 40
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:think-extend
pkg:composer/yaoliyong/think-withdraw
Requires
- php: ^7.2.0
- ext-bcmath: *
- ext-curl: *
- ext-json: *
- ext-openssl: *
- php-curl-class/php-curl-class: 10.0.1
- topthink/framework: ^5.0 || ^6.0.0
- yunzhanghuopen/sdk-php: 2.0.22
Requires (Dev)
- phpunit/phpunit: ^9.6
README
如果觉得
think-withdraw
不错,欢迎给个 star,谢谢。
目录结构
src/config/withdraw.php // 渠道配置文件,写好每个厂商的配置参数模版,记住是模版,不要把真实参数提交 src/dto/ // 接口数据传输对象 src/exception/ // 接口异常,不细分不需要再定义 src/extend/ // 接口扩展,你在对接时定义的工具类 src/provider/ // 接口服务提供者,一个厂商一个包,每个包里新建 `README.md` 文件,里面写厂商的接口文档 src/phpmate/ // 该目录下的文件未来将独立出去进行单独维护的,你不可以在此包下添加文件
使用方法
// 1. 在你的 tp 项目下面安装 `yaoliyong/think-withdraw` 包 composer require yaoliyong/think-withdraw // 2. 项目根路径执行脚本,然后按照服务商的配置进行配置 php vendor/yaoliyong/think-withdraw/src/installer.php // 3. 构建 withdraw 策略业务 $configParams = [];// 服务商配置参数 $WithdrawStrategy = WithdrawStrategyFactory::create('yunzhanghu', $configParams); $requestDto = new CreateOrderRequestDto(); // 省略Dto设置参数 $WithdrawStrategy->createOrder($requestDto);
测试
vendor/bin/phpunit --filter "XzbPayTest::testQueryBalance" --configuration phpunit.xml vendor/bin/phpunit --filter "XzbPayTest::testUserSign" --configuration phpunit.xml vendor/bin/phpunit --filter "XzbPayTest::testCreateOrder" --configuration phpunit.xml vendor/bin/phpunit --filter "XzbPayTest::testQueryOrder" --configuration phpunit.xml vendor/bin/phpunit --filter "XzbPayTest::testHandleCallbackOfWithdraw" --configuration phpunit.xml