gdpa / pep-gateway
用于PHP项目的PEP IPG代码。
v1.0
2020-12-30 17:48 UTC
Requires
- php: >=5.5
- ext-bcmath: *
- ext-curl: *
- ext-json: *
- ext-simplexml: *
- ext-soap: *
Requires (Dev)
- phpunit/phpunit: 6.3.*
This package is auto-updated.
Last update: 2024-09-29 04:42:51 UTC
README
PepGateway为使用在PHP项目中的Pardakht Electronic Pasargad(PEP)互联网支付网关(IPG)代码提供。
本软件包基于PEP公司提供的示例代码(pep-phpsample(v3.3.3).rar),该代码可在其网站上找到。
有关更多信息,您可以在其文档中查看pep.co.ir。
使用方法
$ composer require "gdpa/pep-gateway":"dev-master"
在您的根目录中创建pep-certificate.xml文件,并在其中提供PEP公司提供的私钥。
在您的类中,您可以按以下方式使用此包
use gdpa\PepGateway\PepGateway; class payment { protected $merchantCode; // Your merchand code protected $terminalCode; // Your terminal code protected $certificate; // Path to certificate xml public function buySomething() { $gateway = new PepGateway($this->merchantCode, $this->terminalCode, $this->certificate); $buyHiddenFields = $gateway->buy($invoiceNumber, $invoiceDate, $amount, $redirectAddress, $timestamp); ... } public function verifyPurchase() { $gateway = new PepGateway($this->merchantCode, $this->terminalCode, $this->certificate); $verify = $gateway->verify($invoiceNumber, $invoiceDate, $amount, $timestamp); } public function refundTransaction() { $gateway = new PepGateway($this->merchantCode, $this->terminalCode, $this->certificate); $refund = $gateway->refund($invoiceNumber, $invoiceDate, $amount, $timestamp); } public function check() { $gateway = new PepGateway($this->merchantCode, $this->terminalCode, $this->certificate); $check = $gateway->check($transactionReferenceID, $invoiceNumber, $invoiceDate); } }
$buyHiddenFields
包含发送用户到网关所需的所有字段- formAction(在表单动作中使用)
- action
- merchantCode
- terminalCode
- invoiceNumber
- invoiceDate
- amount
- redirectAddress(实现结算代码的您的重定向地址)
- timestamp
$verify
值- result(true 或 false)
- resultMessage
$refund
值- result(true 或 false)
- resultMessage
$check
值- result(true 或 false)
- resultMessage
MPG 'isValid' 函数也已添加。(请参阅他们的MPG文档。)