ichhim/aba-payway

用于与ABA的Payway集成的包

此包的规范仓库似乎已消失,因此该包已被冻结。

v1.0.6 2019-01-04 07:24 UTC

This package is auto-updated.

Last update: 2022-02-04 14:22:18 UTC


README

一些描述。

功能

  • 创建事务 API 生成哈希值
  • 调用 检查事务 API 检查事务

示例

创建事务

use IchHim\AbaPayway\CreateTransaction;

$merchant_id = '112233'; // the `merchant_id` that provided by ABA
$api_key = 'some-unique-key'; // the `api_key` that provided by ABA

$create_transaction = new CreateTransaction($merchant_id, $api_key);

// the required params
$tran_id = uniqid();
$amount = 1.00;

return $create_transaction->getHash($tran_id, $amount);

检查事务

use IchHim\AbaPayway\CheckTransaction;

$merchant_id = '112233'; // the `merchant_id` that provided by ABA
$api_key = 'some-unique-key'; // the `api_key` that provided by ABA

$check_transaction = new CheckTransaction($merchant_id, $api_key);

// the required params
$tran_id = uniqid();
$api_url = 'https://www.google.com'; // the `api_url` that provided by ABA

list($status, $status_code, $contents) = $check_transaction->checkTransaction($tran_id, $api_url);

// on TRUE
return [
    $status, // true
    $status_code, // 200
    $contents, // {"status":0,"description":"approved","amount":"1.00","totalAmount":"1.00"}
];

// or FALSE
return [
    $status, // false
    $status_code, // 500
    $contents, // Internal Server Error
];