shamarkellman/omnipay-first-atlantic-commerce

omnipay-first-atlantic-commerce

v1.0.2 2021-03-10 16:54 UTC

This package is auto-updated.

Last update: 2024-09-19 18:51:17 UTC


README

第一个大西洋商业驱动器,用于Omnipay PHP支付处理库

Latest Version on Packagist GitHub Tests Action Status Total Downloads

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

支持我们

我们在创建开源产品上投入了大量资源。

我们非常感谢您从家乡寄给我们一张明信片,说明您正在使用我们哪个包。您可以在我们的联系页面上找到我们的地址。我们将所有收到的明信片发布在我们的虚拟明信片墙上

安装

您可以通过composer安装此包

composer require shamarkellman/omnipay-first-atlantic-commerce

使用

授权请求

$gateway = Omnipay::create('FirstAtlanticCommerce');
$gateway->setMerchantId('123456789');
$gateway->setMerchantPassword('abc123');
$gateway->setAcquirerId(12345);

$cardData = [
    'number' => '4242424242424242',
    'expiryMonth' => '6',
    'expiryYear' => '2016',
    'cvv' => '123'
];

$response = $gateway->authorize([
    'createCard' => true, //optional - Will return tokenized card if included
    'amount' => '10.00',
    'currency' => 'USD',
    'transactionId' => '1234',
    'card' => $cardData,
    'testMode' => true //use for calls to FAC sandbox
])->send();

if ( $response->isSuccessful() ) {
    print_r($response);
}
else {
    echo $response->getMessage();
}

单次购买请求

$gateway = Omnipay::create('FirstAtlanticCommerce');
$gateway->setMerchantId('123456789');
$gateway->setMerchantPassword('abc123');
$gateway->setAcquirerId(12345);

$cardData = [
    'number' => '4242424242424242',
    'expiryMonth' => '6',
    'expiryYear' => '2016',
    'cvv' => '123'
];

$response = $gateway->purchase([
    'createCard' => true, //optional - Will return tokenized card if included
    'amount' => '10.00',
    'currency' => 'USD',
    'transactionId' => '1234',
    'card' => $cardData,
    'testMode' => true //use for calls to FAC sandbox
])->send();

if ( $response->isSuccessful() ) {
    print_r($response);
}
else {
    echo $response->getMessage();
}

捕获前一笔交易

$gateway = Omnipay::create('FirstAtlanticCommerce');
$gateway->setMerchantId('123456789');
$gateway->setMerchantPassword('abc123');
$gateway->setAcquirerId(12345);

$response = $this->gateway->capture([
    'amount' => '10.00',
    'currency' => 'USD',
    'transactionId' => '1234',
])->send();

if ( $response->isSuccessful() ) {
    $response->getCode();
    $response->getResponseCode();
    $response->getMessage();
    $response->getOriginalResponseCode();
}
else {
    echo $response->getMessage();
}

托管页面请求

$gateway = Omnipay::create('FirstAtlanticCommerce');
$gateway->setMerchantId('123456789');
$gateway->setMerchantPassword('abc123');
$gateway->setAcquirerId(12345);

$response = $this->gateway->hostedPage([
    'amount' => '10.00',
    'currency' => 'USD',
    'transactionId' => '1234',
    'transactionCode' => TransactionCode::SINGLE_PASS + TransactionCode::REQUEST_TOKEN, //Use values based on requirements 
    'cardHolderResponseURL' => 'https://merchant/response/page.php',
    'pageSet' => 'pageSetFromPanel',
    'pageName' => 'pageNameFromPanel',
])->send();

if ( $response->isSuccessful() ) {
    $response->getRedirectUrl();
    $response->getToken(); //the single use token to build hosted page URL. See doc
}
else {
    echo $response->getCode();
    echo $response->getMessage();
}

托管页面结果请求

此操作返回托管支付的支付数据

$gateway = Omnipay::create('FirstAtlanticCommerce');
$gateway->setMerchantId('123456789');
$gateway->setMerchantPassword('abc123');
$gateway->setAcquirerId(12345);

$response = $this->gateway->hostedPageResult([
    'token' => '_JBfLQJNiEmFBtnF3AfoeQ2', //token is provided returned in callback after completes hosted page
]);

if ( $response->isSuccessful() ) {
    echo $response->getResponseCode();
    echo $response->getMessage();
    echo $response->getTransactionId();
    echo $response->getCardReference(); //if tokenization was requested
}
else {
    echo $response->getCode();
    echo $response->getMessage();
}

测试

composer test

变更日志

有关最近更改的更多信息,请参阅变更日志

贡献

有关详细信息,请参阅贡献指南

安全漏洞

有关如何报告安全漏洞的详细信息,请参阅我们的安全策略

鸣谢

许可

MIT许可(MIT)。有关更多信息,请参阅许可文件