grisgruis / omnipay-ticketasa
支持Omnipay支付处理库的Ticketasa
dev-main
2022-11-11 00:36 UTC
Requires
- php: ^7.2
- omnipay/common: ^3
This package is auto-updated.
Last update: 2024-09-11 04:28:08 UTC
README
TicketAsaGT Commerce网关,适用于Omnipay PHP支付处理库
Omnipay 是一个不依赖于框架、支持多网关的PHP 5.3+支付处理库。此包实现了对Omnipay的TicketAsaGT 2.4的支持。
安装
通过Composer
$ composer require vincsis/omnipay-ticketasa
网关操作默认值
此网关驱动默认在3DS模式下运行,并需要通过 'setNotifyURL' 方法提供通知URL。
用法
有关通用使用说明,请参阅Omnipay 的主仓库。
3DS交易(直接集成)
'NotifyURL' 是必需的。URL必须是 https://
use Omnipay\Omnipay; try { $gateway = Omnipay::create('Ticketasa'); $gateway ->setTestMode(true) // false to use productions links , true to use test links ->setPWTId('xxxxxxxx') ->setPWTPwd('xxxxxxxx') // **Required and must be https:// ->setNotifyUrl('https://localhost/webhook.php') // **Required and must be https:// ->setReturnUrl('https://localhost/webhook.php') ->setDiscount(false); $cardData = [ 'firstName' => 'Gabriel', //optional 'LastName' => 'Arzu', // optional ]; $transactionData = [ 'card' => $cardData, 'amount' => '1.00', // Mandatory 'TransactionId' => '2100001', // mandatory, must be unique in each transaction ]; $response = $gateway->purchase($transactionData)->send(); if($response->isSuccessful()) $response->getHostedPageURL(); // return the link with encrypted params $response->redirectToHostedPage(); //Redirect automatically to payment form } catch (Exception $e){ $e->getMessage(); }
webhook响应 来自TicketasaGT的交易响应。
{ "TransactionType": 1, "Approved": true, // must be true "AuthorizationCode": "123456", // Authorization number from bank "TransactionIdentifier": "3dbff695-d7e0-4e90-8187-1e93cf13bb40", // Order Number "TotalAmount": 1, //Mount "CurrencyCode": "320", "RRN": "227603509881", "CardBrand": "Visa", "IsoResponseCode": "00", "ResponseMessage": "Transaction is approved", // Message Approvement. "OrderIdentifier": "TICKET-ASA-3dbff695-d7e0-4e90-8187-1e93cf13bb40" // Order Identifier PREFIX + Order Number }
获取状态交易(直接集成)
'fetchTransaction' 是必需的。TransactionId
use Omnipay\Omnipay; try { $gateway = Omnipay::create('Ticketasa'); $gateway ->setTestMode(true) // false to use productions links , true to use test links ->setPWTId('xxxxxxxx') ->setPWTPwd('xxxxxxxx'); $transactionData = [ 'TransactionId' => '2100001', // mandatory, must be unique in each transaction ]; $response = $gateway->fetchTransaction($transactionData)->send(); $response->getData(); //return the response object $response->isSuccessful() // if IsoResponseCode is 00 return true $response->getTransactionId() // return transactionId from object response $response->getTotalAmount() // return Amount from object response $response->getAuthorizationCode() // return authorizationCode from object response $response->getLastCaptureDateTime() // return date capture payment from object response $response->getTransactionDateTime() // return date transaction payment from object response } catch (Exception $e){ $e->getMessage(); }
PowerTranz响应 从powerTranz获取交易响应。
{ "AuthorizationCode": "123456", "CurrencyCode": "320", "IsoResponseCode": "00", // successfull is 00 "OrderSummary": { "CaptureCount": 1, "CreditCount": 0, "CurrencyCode": "320", "LastCaptureDateTime": "2022-10-31T21:38:49.663", "OrderIdentifier": "TICKET-ASA-4e895e54-3f5a-428c-ac30-1c0e7bd8ab86", "OriginalTrxnDateTime": "2022-10-31T21:38:49.663", "OriginalTrxnIdentifier": "4e895e54-3f5a-428c-ac30-1c0e7bd8ab86", "SettledAmount": 1.00, "TotalCaptureAmount": 1.00, "TotalCreditAmount": 0.00 }, "OtherAmount": 0.00, "TaxAmount": 0.00, "TipAmount": 0.00, "TotalAmount": 1.00, "TransactionDateTime": "2022-10-31T21:38:20.193", "TransactionIdentifier": "4e895e54-3f5a-428c-ac30-1c0e7bd8ab86", "TransactionType": 2 }
退款支付(直接集成)
'fetchTransaction' 是必需的。TransactionId
use Omnipay\Omnipay; try { $gateway = Omnipay::create('Ticketasa'); $gateway ->setTestMode(true) // false to use productions links , true to use test links ->setPWTId('xxxxxxxx') ->setPWTPwd('xxxxxxxx'); $transactionData = [ 'amount' => '1.00', // Mandatory 'TransactionId' => '2100001', // mandatory, must be unique in each transaction ]; $response = $gateway->refund($transactionData)->send(); $response->getData(); //return the response object $response->isSuccessful() // if Approved response $response->getExternalIdentifier() // return transactionId from object response $response->getTotalAmount() // return Amount from object response $response->getOriginalTrxnIdentifier() // return transactionId from object response $response->getErrorCode() // return the error code $response->getErrorMessage() // return the error message $response->getIsoResponseCode() // return the iso Code $response->getResponseMessage() // return the error general message } catch (Exception $e){ $e->getMessage(); }
PowerTranz响应 来自powerTranz的退款交易响应。
{ "OriginalTrxnIdentifier": "a", "TransactionType": 5, "Approved": false, "TransactionIdentifier": "27909349-a43f-411a-9cc1-1ec6e3ab4d89", "TotalAmount": 1.00, "CurrencyCode": "220", "RRN": "230714276757", "IsoResponseCode": "96", "ResponseMessage": "System error", "ExternalIdentifier": "-81aa-42c1-960e-6b535c5f4ae3", "Errors": [ { "Code": "451", "Message": "General processor error" } ] }
支持
如果您对Omnipay有任何通用问题,我们建议在Stack Overflow 上发布。请确保添加omnipay标签,以便容易找到。
如果您认为您找到了一个bug,请使用GitHub问题跟踪器报告它,或者更好的是,分支库并提交一个pull request。