multboy / desafio
此包是 Codificar API 的连接网关
1.0.7
2024-04-22 20:36 UTC
Requires
- filipegar/cielo-api-3.0-php: ^1.3.2
- illuminate/support: ^10.0|^11.0
- phpunit/phpunit: ^11.0.1
README
此包是与支付网关的集成,标准化所有数据输入和输出。
先决条件
使用此包的主要要求已在 composer.json 文件中引用,但建议使用 PHP8.1 和 LARAVEL10,因为尚未在其他版本上执行测试。
此代码使用 mysql 数据库保存配置。已测试 MYSQL8.0.36 版本。
安装
1. 通过 composer 安装此包
composer require multboy/desafio
2. 运行迁移以创建和填充配置表
php artisan migrate
3. 为使用此包,导入并实例化默认网关如下
updateGatewayConfig($resolver::GATEWAY_CIELO, 'merchant_id', '93fa44b4-fb61-476e-8cab-8950efed518e'); $resolver->updateGatewayConfig($resolver::GATEWAY_CIELO, 'merchant_key', 'RHNRVSJCXMNPOTKGOKMSOZLZJQXCQJVAMGDBVYDP'); $current = $resolver->resolveCurrent('gateway_cielo', true); //true 表示 devMode (sandbox) 用于测试 $current->cardCreate('5171407457820511', '12', '30', '123', 'Teste Holder'); //tokenize card $current->cardCharge(11, 'master', '00555af3-34a1-4e03-acb1-b02443b26a19', '123'); //创建卡授权支付 $current->cardCharge(15.10, 'master', '00555af3-34a1-4e03-acb1-b02443b26a19', '123', true);//创建卡授权支付并即时扣款 $current->cardCapture('791c7e11-7904-4a22-aaea-9cdf485ea7c1', 11); //扣款先前授权的卡支付 4. 沙盒 Cielo 的信息在 https://developercielo.github.io/manual/'?shell#cart%C3%A3o-de-cr%C3%A9dito-em-sandbox,但您可以使用此:卡号:5171407457820511 到期月份:12 到期年份:2030 或 30 安全码:123 持卡人姓名:Teste Holder 5. 此包有 phpunit 单元测试。运行 `./vendor/bin/phpunit vendor/multboy/desafio/src/tests/unit/GatewaysTest.php` 以执行这些测试。