park-holidays-uk / omnipay-verifone
该软件包已被废弃,不再维护。未建议替代包。
适用于 Omnipay (现场支付网关) 的 WIP Verifone (Commidea) 软件包,使用 Chris Yallop 的代码:https://github.com/adnamsplc/verifone
v1.0.0
2016-09-15 09:04 UTC
Requires
- omnipay/common: ~2.0
- zendframework/zend-soap: ^2.6
This package is not auto-updated.
Last update: 2020-01-24 16:23:41 UTC
README
Verifone (Commidea) 软件包用于 Omnipay
使用 Omnipay 的 setSetting('value') 方法将设置发送到网关。
使用示例
设置网关和卡
use Omnipay\Omnipay;
use Omnipay\Common\CreditCard;
class WhateverController extends Controller
{
//Set up gateway
$verifone = Omnipay::create('Verifone');
$cardDetails = [
'title' => 'Mr',
'firstName' => 'Loopy',
'surname' => 'Rabbit',
'number' => '1234123412341234',
'cvv' => '927',
'expiryMonth' => '6',
'expiryYear' => '18'
];
//Create card
$card = new CreditCard($cardDetails);
$transactionId = '123456'; //Create a transaction id
$amount = '1'; //How much is payment for?
//Validate card (will return an error response if invalid, with some error details)
$validateResult = $card->validate();
方法 1:分别授权和捕获
//Authorise
$response = $verifone->authorize([
'card' => $card,
'amount' => $amount,
'transactionId' => $transactionId
])->send();
if($response->isSuccessful())
{
//Capture
$transactionResponse = $verifone->capture($response)->send();
if($transactionResponse->isSuccessful())
{
return $transactionResponse->getData();
}
//If capture not successful
return $transactionResponse->getMessage();
}
return $response->getMessage();
方法 2:一次性授权和捕获
$transactionResponse = $verifone->purchase([
'card' => $card,
'amount' => $amount,
'transactionId' => $transactionId
])->send();
if($transactionResponse->isSuccessful())
{
return $transactionResponse->getData();
}
return $transactionResponse->getMessage();