vload/merchant-connector
Composer 安装命令:
composer require vload/merchant-connector
包简介
VLoad API connector for merchants
README 文档
README
Installation
composer require vload/merchant-connector
Usage
MerchantConnector {
public __construct(\Vload\Common\Api\Config $config)
public validate(string $pin)
public charge(string $orderId, string $pin, \Vload\MerchantConnector\VO\Customer $customer [, string $description)
}
Create connector instance
Vanilla PHP
$secret = 'vload_secret_key'; //Merchant secret key provided by VLoad $config = \Vload\Common\Api\Config::init($secret); $connector = new MerchantConnector($config);
Symfony service conatiner
# config/services.yaml services: # ... vload.config: class: Vload\Common\Api\Config factory: ['Vload\Common\Api\Config', init] arguments: ['Your-VLoad-secret'] Vload\MerchantConnector\MerchantConnector: class: Vload\MerchantConnector\MerchantConnector arguments: ["@vload.config"]
Validate voucher
$pin = '3156391887289068'; $voucher = $connector->validate($pin);
Parameters
pin (required)
Vocucher pin
Returns
Method returns \Vload\Common\VO\Voucher object on success or throws an exception on failure.
Charge voucher
$orderId = '12345678'; $pin = '3156391887289068'; $customer = new \Vload\Common\VO\Customer(...); $description = 'Test redeem'; $charge = $connetor->charge($orderId, $pin, $customer, $description);
Parameters
orderId (required)
Order reference in your system
pin (required)
VLoad voucher's pin number
customer (required)
Customer object in you system. Check samples for proper customer creation code.
description (optional)
Description of the charge
Returns
Method returns \Vload\Common\VO\Charge object on success or throws an exception on failure.
Retrieve charge
$chargeId = 'AWT_fCCMh9GTrU2CKeaeXw=='; $charge = $connector->retrieveCharge($chargeId);
Parameters
chargeId (required)
The ID of the charge to be retrieved, as returned from charge voucher.
Returns
Method returns \Vload\Common\VO\Charge object on success or throws an exception on failure.
Exceptions
Connector methods will throw following exceptions from \Vload\Common\Exception namespace if requested operations does not succeed at the VLoad API.
InvalidInput
The request was unacceptable, often due to missing a required parameter.
NotFound
Object you requested does not exist (e.g. invalid or inactive voucher)
Unauthorized
No valid API key provided.
Conflict
The request conflicts with another request (perhaps due to using the same idempotent key).
CommunicationFailed
Some internal API error occured.
Samples
See samples directory for more information.
vload/merchant-connector 适用场景与选型建议
vload/merchant-connector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.76k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 08 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vload/merchant-connector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vload/merchant-connector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.76k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-08-21