|
| 1 | +# Omnipay: NAB Transact |
| 2 | + |
| 3 | +**NAB Transact driver for the Omnipay PHP payment processing library** |
| 4 | + |
| 5 | +[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment |
| 6 | +processing library for PHP 5.3+. This package implements NAB Transact support for Omnipay. |
| 7 | + |
| 8 | +[](https://styleci.io/repos/73980655) |
| 9 | +[](https://travis-ci.org/sudiptpa/nabtransact) |
| 10 | +[](https://scrutinizer-ci.com/g/sudiptpa/nabtransact/?branch=master) |
| 11 | +[](https://packagist.org/packages/sudiptpa/nabtransact) |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it |
| 16 | +to your `composer.json` file: |
| 17 | + |
| 18 | +```json |
| 19 | +{ |
| 20 | + "require": { |
| 21 | + "sudiptpa/nabtransact": "~2.0" |
| 22 | + } |
| 23 | +} |
| 24 | +``` |
| 25 | + |
| 26 | +And run composer to update your dependencies: |
| 27 | + |
| 28 | + $ curl -s http://getcomposer.org/installer | php |
| 29 | + $ php composer.phar update |
| 30 | + |
| 31 | +## Basic Usage |
| 32 | + |
| 33 | +The following gateways are provided by this package: |
| 34 | + |
| 35 | +* NAB Transact SecureXML API* |
| 36 | + |
| 37 | +```php |
| 38 | + use Omnipay\Omnipay; |
| 39 | + use Omnipay\Common\CreditCard; |
| 40 | + |
| 41 | + $gateway = Omnipay::create('NABTransact_SecureXML'); |
| 42 | + $gateway->setMerchantId('ABC0001'); |
| 43 | + $gateway->setTransactionPassword('abc123'); |
| 44 | + $gateway->setTestMode(true); |
| 45 | + |
| 46 | + $card = new CreditCard( |
| 47 | + [ |
| 48 | + 'number' => '4444333322221111', |
| 49 | + 'expiryMonth' => '6', |
| 50 | + 'expiryYear' => '2020', |
| 51 | + 'cvv' => '123', |
| 52 | + ] |
| 53 | + ); |
| 54 | + |
| 55 | + $transaction = $gateway->purchase( |
| 56 | + [ |
| 57 | + 'amount' => '10.00', |
| 58 | + 'currency' => 'AUD', |
| 59 | + 'transactionId' => 'XYZ100', |
| 60 | + 'card' => $card, |
| 61 | + ] |
| 62 | + ); |
| 63 | + |
| 64 | + $response = $transaction->send(); |
| 65 | + |
| 66 | + if ($response->isSuccessful()) { |
| 67 | + echo sprintf('Transaction %s was successful!', $response->getTransactionReference()); |
| 68 | + } else { |
| 69 | + echo sprintf('Transaction %s failed: %s', $response->getTransactionReference(), $response->getMessage()); |
| 70 | + } |
| 71 | + |
| 72 | +``` |
| 73 | + |
| 74 | +For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay) |
| 75 | +repository. |
| 76 | + |
| 77 | +## Support |
| 78 | + |
| 79 | +If you are having general issues with Omnipay, we suggest posting on |
| 80 | +[Stack Overflow](http://stackoverflow.com/). Be sure to add the |
| 81 | +[omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) so it can be easily found. |
| 82 | + |
| 83 | +If you want to keep up to date with release anouncements, discuss ideas for the project, |
| 84 | +or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which |
| 85 | +you can subscribe to. |
| 86 | + |
| 87 | +If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/sudiptpa/nabtransact/issues), |
| 88 | +or better yet, fork the library and submit a pull request. |
0 commit comments