alegra/omnipay-payu 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alegra/omnipay-payu

Composer 安装命令:

composer require alegra/omnipay-payu

包简介

Payu gateway for Omnipay payment processing library

README 文档

README

Build Status Total Downloads Latest Stable Version License

Payu gateway for Omnipay V3 payment processing library

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 7.3+. This package implements PayU Online Payment Gateway support for Omnipay.

PayU ALU V3 API documentation

Requirement

  • PHP >= 7.3.x,
  • Omnipay V.3 repository,
  • PHPUnit to run tests

Autoload

You have to install omnipay V.3

composer require league/omnipay:^3

Then you have to install omnipay-payu package:

composer require alegra/omnipay-payu

payment-payu follows the PSR-4 convention names for its classes, which means you can easily integrate payment-payu classes loading in your own autoloader.

Basic Usage

  • You can use /examples folder to execute examples. This folder is exists here only to show you examples, it is not for production usage.
  • First in /examples folder:
composer install

Purchase Example

  • You can check purchase.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\PayU\PayUGateway;
use Examples\Helper;

$gateway = new PayUGateway();

$helper = new Helper();
$params = $helper->getPurchaseParams();
$response = $gateway->purchase($params)->send();

$result = [
    'status' => $response->isSuccessful() ?: 0,
    'redirect' => $response->isRedirect() ?: 0,
    'message' => $response->getMessage(),
    'transactionId' => $response->getTransactionReference(),
    'requestParams' => $response->getServiceRequestParams(),
    'response' => $response->getData()
];

print("<pre>" . print_r($result, true) . "</pre>");

Purchase 3d Example

  • You can check purchase3d.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\PayU\PayUGateway;
use Examples\Helper;

$gateway = new PayUGateway();

$helper = new Helper();
$params = $helper->getPurchase3dParams();
$response = $gateway->purchase($params)->send();

$result = [
    'status' => $response->isSuccessful() ?: 0,
    'redirect' => $response->isRedirect() ?: 0,
    'redirectUrl' => $response->getRedirectUrl() ?: null,
    'message' => $response->getMessage(),
    'transactionId' => $response->getTransactionReference(),
    'requestParams' => $response->getServiceRequestParams(),
    'response' => $response->getData()
];

print("<pre>" . print_r($result, true) . "</pre>");

Confirmation Service Example

  • You can check completeAuthorize.php file in /examples folder.
  • The confirmation service is only for merchants working on the pre-motorization model, you can go with your sales representative for detailed information.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\PayU\PayUGateway;
use Examples\Helper;

$gateway = new PayUGateway();

$helper = new Helper();
$params = $helper->getCompleteAuthorizeParams();
$response = $gateway->completeAuthorize($params)->send();

$result = [
    'status' => $response->isSuccessful() ?: 0,
    'message' => $response->getMessage(),
    'transactionId' => $response->getTransactionReference(),
    'requestParams' => $response->getServiceRequestParams(),
    'response' => $response->getData()
];

print("<pre>" . print_r($result, true) . "</pre>");

Refund Example

  • You can check refund.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\PayU\PayUGateway;
use Examples\Helper;

$gateway = new PayUGateway();

$helper = new Helper();
$params = $helper->getRefundParams();
$response = $gateway->refund($params)->send();

$result = [
    'status' => $response->isSuccessful() ?: 0,
    'message' => $response->getMessage(),
    'transactionId' => $response->getTransactionReference(),
    'requestParams' => $response->getServiceRequestParams(),
    'response' => $response->getData()
];

print("<pre>" . print_r($result, true) . "</pre>");

Fetch Transaction Example

  • You can check fetchTransaction.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\PayU\PayUGateway;
use Examples\Helper;

$gateway = new PayUGateway();

$helper = new Helper();
$params = $helper->getFetchTransactionParams();
$response = $gateway->fetchTransaction($params)->send();

$result = [
    'status' => $response->isSuccessful() ?: 0,
    'message' => $response->getMessage(),
    'transactionId' => $response->getTransactionReference(),
    'orderReferenceNo' => $response->getOrderReferenceNoExt(),
    'requestParams' => $response->getServiceRequestParams(),
    'response' => $response->getData()
];

print("<pre>" . print_r($result, true) . "</pre>");

Card Information V1 Example

  • You can check cardInfoV1.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\PayU\PayUGateway;
use Examples\Helper;

$gateway = new PayUGateway();

$helper = new Helper();
$params = $helper->getCardInfoV1Params();
$response = $gateway->cardInfoV1($params)->send();

$result = [
    'status' => $response->isSuccessful() ?: 0,
    'message' => $response->getMessage(),
    'requestParams' => $response->getServiceRequestParams(),
    'response' => $response->getData()
];

print("<pre>" . print_r($result, true) . "</pre>");

Card Information V2 Example

  • You can check cardInfoV2.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\PayU\PayUGateway;
use Examples\Helper;

$gateway = new PayUGateway();

$helper = new Helper();
$params = $helper->getCardInfoV2Params();
$response = $gateway->cardInfoV2($params)->send();

$result = [
    'status' => $response->isSuccessful() ?: 0,
    'message' => $response->getMessage(),
    'requestParams' => $response->getServiceRequestParams(),
    'response' => $response->getData()
];

print("<pre>" . print_r($result, true) . "</pre>");

requestParams:

System send request to payU api. It shows request information.

Licensing

GNU General Public Licence v3.0

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

统计信息

  • 总下载量: 228
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 5
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固