phpieces / anz-egate
这是一个用于简化ANZ支付网关使用的包装器。
0.2.0
2017-04-27 11:33 UTC
Requires
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^2.3
This package is not auto-updated.
Last update: 2024-09-20 22:23:47 UTC
README
这是一个用于简化ANZ支付网关使用的包装器。此产品并非由ANZ生产,不提供任何保证。然而,代码经过彻底测试并在生产中使用。
安装
将仓库添加到您的composer文件中
{ "require": { "PHPieces/anz-egate": "dev-master" } }
使用方法
获取字段
use PHPieces\ANZGateway\ChargeRequest; $fields = ChargeRequest::getFields();
这将返回所有字段,包括与商家详情相关的字段。您可能只想获取信用卡字段。
use PHPieces\ANZGateway\models\Card; $fields = Card::getFields();
渲染
<? foreach($fields as $label => $name) : ?> <div class="form-group"> <label for="<?= $name ?>"><?= $label ?></label> <input type="text" class="form-control" id="<?= $name ?>" name="<?= $name ?>" > </div> <? endforeach; ?>
处理
use PHPieces\ANZGateway\enums\FormFields\CardFields; use PHPieces\ANZGateway\Gateway; $gateway = Gateway::create(); $gateway->setAccessCode('mycode'); $gateway->setMerchantID('myid'); $response = $gateway->purchase([ // This field must be unique for every transaction attempt. 'vpc_MerchTxnRef' => 'mymerchid', // This field will show up on the merchant account and is the primary way to search for transactions. 'vpc_OrderInfo' => 'orderid', // cents AUD 'vpc_Amount' => '100', // using the available enum values for the form fields CardFields::CARD_NUMBER => $_POST[CardFields::CARD_NUMBER], //YYmm CardFields::CARD_EXPIRY_DATE => $_POST[CardFields::CARD_EXPIRY_DATE], // code from back of card CardFields::CARD_SECURITY_CODE => $_POST[CardFields::CARD_SECURITY_CODE], ])->send(); if($response->isSuccess()) { //proceed... } else { $error = $response->getMessage(); }
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。