ignited/omnipay-zippay

为 Omnipay 支付处理库提供 ZipPay 支持

1.3 2021-05-21 05:19 UTC

This package is auto-updated.

Last update: 2024-09-21 12:32:14 UTC


README

Omnipay PHP 支付处理库的 ZipPay 网关

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Omnipay 是一个与框架无关的多网关支付处理库,适用于 PHP 5.3+。此包实现了 Omnipay 的 ZipPay 支持。

安装

使用 require 安装网关。需要 league/omnipay 基础包和此网关。

$ composer require league/omnipay ignited/omnipay-zippay

使用方法

此包提供以下网关

  • ZipPay

有关一般使用说明,请参阅主要的 Omnipay 仓库。

一个快速示例如下

处理您的授权

$omniZip = Omnipay::create('ZipPay_Rest');
$omniZip->setApiKey($zipApiKey);
$authTx = $omniZip->authorize([
  'reference'=> $ref,
  'amount' => 10.00,
  'currency' => 'AUD',
  'returnUrl' => 'https://mysite.com/zip/return',
  'card' => $this->OmniPayCardFactory(), //Customers Details, no credit card number
  'items' => $this->zipItemList(), // Array of items implementing Omnipay\ZipPay\ItemInterface   
]);
$result = $authTx->send();
if($response->isRedirect()) { // Authorize worked
  $resData = $result->getData();
  $this->saveAuthorizeId($resData['id']);
  $response->redirect(); //Sends customer off to ZipPay to complete signup
}

返回 URL(例如 /zip/return)

if (!isset($_REQUEST['result']) || $_REQUEST['result'] !== 'approved') 
  throw new \RuntimeError('Problem with your authorization');
$omniZip = Omnipay::create('ZipPay_Rest');
$omniZip->setApiKey($zipApiKey);
$compTx = $omniZip->completeAuthorize([
  'authorityType' => 'checkout_id',
  'authorityValue' => $this->getAuthorizeId(),
  'amount' => 10.00,
  'currency' => 'AUD',
  'captureFunds' => true;
]);
$result = $compTx->send();
if($result->isSuccessful())
  $this->paid();
else
  $this->paymentFailed();

支持

如果您对 Omnipay 有任何一般性问题,我们建议在 Stack Overflow 上发布。请确保添加 omnipay 标签,以便可以轻松找到。

如果您想了解发布公告,讨论项目想法或提出更详细的问题,还有一个您可订阅的 邮件列表

如果您认为您发现了一个错误,请使用 GitHub 问题跟踪器 报告,或者更好的方法是分叉库并提交一个 pull request。

变更日志

有关最近更改的更多信息,请参阅 CHANGELOG

测试

$ composer test

贡献

有关详细信息,请参阅 CONTRIBUTING

安全

如果您发现任何与安全相关的问题,请通过电子邮件 daniel@ignitedlabs.com.au 联系,而不是使用问题跟踪器。

致谢

许可

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