2017 © Pedro Peláez
 

library pep-gateway

PEP IPG code for using in PHP projects.

image

gdpa/pep-gateway

PEP IPG code for using in PHP projects.

  • Wednesday, November 22, 2017
  • by gdpa
  • Repository
  • 1 Watchers
  • 0 Stars
  • 55 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 28 % Grown

The README.md

PepGateway

PepGateway provides Pardakht Electronic Pasargad (_PEP_) internet payment gateway (_IPG_) code for using in PHP projects.
This package is base on PEP company sample code (pep-phpsample(v3.3.3).rar) that is provided in their website.
For more information you can see their documentation at pep.co.ir., (*1)

Usage

$ composer require "gdpa/pep-gateway":"dev-master", (*2)

Create pep-certificate.xml in your root directory and provide your private key provided by PEP company in it., (*3)

In your classes you can use package this way:, (*4)

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 is contain all necessary fields for using in sending user to gateway:
    • formAction (_Using in form action_)
    • action
    • merchantCode
    • terminalCode
    • invoiceNumber
    • invoiceDate
    • amount
    • redirectAddress (_Your redirect address that you implement settlement codes_)
    • timestamp
  • $verify values:
    • result (true or false)
    • resultMessage
  • $refund values:
    • result (true or false)
    • resultMessage
  • $check values:
    • result (true or false)
    • resultMessage

MPG 'isValid' function also added. (See Their MPG documents.)., (*5)

The Versions

22/11 2017

dev-master

9999999-dev

PEP IPG code for using in PHP projects.

  Sources   Download

MIT

The Requires

  • php >=5.5
  • ext-soap *
  • ext-bcmath *

 

The Development Requires

by Morteza Poussaneh

pepgateway