csweb/bin-pagamentos
Composer 安装命令:
composer require csweb/bin-pagamentos
包简介
Integracao com a BIN pagamentos
README 文档
README
Testes
Para a realização de alguns testes, é necessário o uso de certificados
digitais. Para este package foram gerados alguns certificados
auto-assinados, que se encontram em tests/fixtures/certs.
A senha do certificado private_key.pem é muito simples: 123456
Estes certificados tem validade de 4 anos. Caso deseja gerar outros, faça
# generate private key and enter pass phrase openssl genrsa -des3 -out private_key.pem 2048 # create certificate signing request, enter "*.example.com" as a "Common Name", leave "challenge password" blank openssl req -new -sha256 -key private_key.pem -out server.csr # generate self-signed certificate for 1 year openssl req -x509 -sha256 -days 365 -key private_key.pem -in server.csr -out server.pem # validate the certificate openssl req -in server.csr -text -noout | grep -i "Signature.*SHA256" && echo "All is well" || echo "This certificate doesn't work in 2017! You must update OpenSSL to generate a widely-compatible certificate"
Criando uma nova venda
Para Criação de uma nova venda, faça
<?php require_once __DIR__ . './vendor/autoload.php'; use CSWeb\BIN\Environment; use CSWeb\BIN\Transactions\Sale; use CSWeb\BIN\Bin; $payload = [ 'CreditCardTxType' => [ 'Type' => 'sale' ], 'CreditCardData' => [ 'CardNumber' => 411111111111, 'ExpMonth' => 12, 'ExpYear' => 30, 'CardCodeValue' => 123 ], 'Payment' => [ 'NumberOfInstallments' => 1, // Opcional 'ChargeTotal' => 10.0, 'Currency' => 986 // REAL formato ISO ], 'TransactionDetails' => [ 'OrderId', 'TDate' ], 'cardFunction' => 'credit' ]; $sale = new Sale($payload, 'v1'); $env = new Environment('username', 'password', 'path/to/cert', 'path/to/key', 'ssl_key'); $bin = new Bin($env); $response = $bin->send($sale);
Cancelando uma venda
Para cancelar uma venda, faça o seguinte
<?php require_once __DIR__ . './vendor/autoload.php'; use CSWeb\BIN\Environment; use CSWeb\BIN\Transactions\RevokeSale; use CSWeb\BIN\Bin; $payload = [ 'CreditCardTxType' => [ 'Type' => 'void' ], 'TransactionDetails' => [ 'OrderId' => 1, 'TDate' => 1190244932 ] ]; $sale = new RevokeSale($payload, 'v1'); $env = new Environment('username', 'password', 'path/to/cert', 'path/to/key', 'ssl_key'); $bin = new Bin($env); $response = $bin->send($sale);
csweb/bin-pagamentos 适用场景与选型建议
csweb/bin-pagamentos 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 09 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 csweb/bin-pagamentos 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 csweb/bin-pagamentos 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-28