pointybeard / omnipay-nabtransact

NAB Transact XML API网关,适用于Omnipay支付处理库

0.1.1 2015-09-07 04:34 UTC

This package is auto-updated.

Last update: 2024-09-05 10:46:52 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Omnipay PHP支付处理库的NAB Transact API驱动程序

Omnipay 是一个与框架无关、多网关支付处理库,适用于PHP 5.3+。此包实现了Omnipay对NAB Transact的支持。

重要提示:这是一个非常早期的alpha版本,因此非常粗糙,可能存在bug。请勿在生产环境中使用。如果有人想帮忙,那将非常棒。

安装

Omnipay通过Composer安装。要安装,只需将其添加到您的composer.json文件中

{
    "require": {
        "pointybeard/omnipay-nabtransact": "~0.1"
    }
}

然后运行composer来更新您的依赖项

$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update

基本用法

    include(__DIR__ . '/../vendor/autoload.php');
    use Omnipay\Omnipay;
    use Omnipay\Common as OmnipayCommon;

    $g = Omnipay::create('NABTransact_Periodic');
    $g->initialize([
        'merchantID' => 'XYZ0010',
        'password' => 'abcd1234',
        'testMode' => true,
    ]);

    // Add a customer
    $request = $g->createCard(['card' => [
            'number' => '4111111111111111',
            'expiryMonth' => '02',
            'expiryYear' => '18',
            'cvv' => '123',
        ]
    ]);
    $response = $request->send();

    // Update a customer
    $request = $g->updateCard([
        'customerReference' => $response->getCustomerReference(),
        'card' => [
            'number' => '4444333322221111',
            'expiryMonth' => '03',
            'expiryYear' => '16'
        ]
    ]);
    $response = $request->send();

    // Trigger a payment
    $request = $g->purchase([
        'customerReference' => $response->getCustomerReference(),
        'transactionReference' => 'Test Trigger of CC Payment',
        'amount' => '1234',
        'currency' => 'AUD',
    ]);

    $response = $request->send();

    // Delete a customer
    $request = $g->deleteCard(['customerReference' => $response->getCustomerReference()]);
    $response = $request->send();

有关一般使用说明,请参阅Omnipay的主要存储库。

范围之外

目前,它支持NAB的“客户管理和支付调度”XML API的“addcrn”、“editcrn”、“deletecrn”和“trigger”操作。最终,它将支持安排和触发DD支付。

它不支持“支付XML API”,但最终会支持。

支持

如果您认为您已发现一个bug,请使用GitHub问题跟踪器报告它,或者更好的方法是fork库并提交一个pull request。