redberry/georgian-card-gateway 问题修复 & 功能扩展

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

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

redberry/georgian-card-gateway

Composer 安装命令:

composer require redberry/georgian-card-gateway

包简介

Simplify your payments with Georgian Card Gateway.

README 文档

README

Georgian Card Gateway is easy to use package. it takes a lot of work off your back.

With this package you can make:

  • regular payments ( requiring input of user's credit card information on each transaction)
  • recurrent payments (basically with this method you can save user's credit card into merchant and then make payments without asking user credit card info every time. )

Installation

Installation is fairly simple:

$ composer require redberry/georgian-card-gateway

Set Up

1. env

you have to enter necessary credentials for your merchant in the enviroment variables file.

MERCHANT_ID=---YOUR-MERCHANT-ID---
PAGE_ID=---YOUR-PAGE-ID---
ACCOUNT_ID=---YOUR-ACCOUNT-ID---
CCY=---YOUR-CURRENCY-CODE---
REFUND_API_PASS=---YOUR-REFUND-API-PASSWORD---
BACK_URL_S=https://your-website.ge/payment/succeed
BACK_URL_F=https://your-website.ge/payment/failed
MERCHANT_ID

Represents your merchant's identificator, which will be given to you from BOG.

PAGE_ID

Represents the identificator of the payments page, which can be customized and styled with your preferences.

ACCOUNT_ID

On merchant there can be meny pos terminals. And on each terminal there will be account, on which the payments will be directed. Most likely you will need only one terminal. But in this doc we will also see how can we manage payments on multiple terminals.

CCY

Represents in which currency transaction should happen. you will most probably use 981 which represents Lari. see more

REFUND_API_PASS

Represents password for making refunds of your transactions.

BACK_URL_S

The url which will be visited after successfull transaction. for example: https://your-web-site.ge/payments/success

BACK_URL_F

The url which will be visited after failed transaction. for example: https://your-web-site.ge/payments/success

2. vendor publish

php artisan vendor:publish --provider="Redberry\GeorgianCardGateway\Support\ServiceProvider"

3. bind georgian card handler

For you to be able to make transaction records in database, make reccurent transaction or do something on failed/success ending, it's nessessary to create class for Georgian card and bind it into container.

So... let's create class, which will have path: "app/Library/GeorgianCard.php" and will implement GeorgianCardHandler interface:

<?php

namespace App\Library;

use Redberry\GeorgianCardGateway\Contracts\GeorgianCardHandler;
use Illuminate\Http\Request;

class GeorgianCard implements GeorgianCardHandler
{
  /**
   * Get primary transaction id
   * for recurrent transactions.
   * 
   * @param   Request $request
   * @return  string|null
   */
  public function getPrimaryTransactionId( Request $request )
  {
    // Return primary transaction id
  }

  /**
   * Determine if it should save card or pay
   * and proceed accordingly.
   * 
   * @param   Request  $request
   * 
   * @return  void
   */
  public function update( Request $request )
  {
    // Do things...
  }

  /**
   * Success method will be executed if
   * transaction is to end successfully.
   * 
   * @return mixed
   */
  public function success()
  {
    dump( 'Success' );
  }

  /**
   * Failed method will be executed if
   * transaction is to end with failure.
   * 
   * @return mixed
   */
  public function failure()
  {
    dump( 'Failure' );
  }
}

Now bind it into our app service provider:

namespace App\Providers;

use App\Library\GeorgianCard;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this -> app -> bind( 'redberry.georgian-card.handler', GeorgianCard :: class );
    }

Now you can make simple regular transaction

use Redberry\GeorgianCardGateway\Transaction;

$transaction = new Transaction;

$transaction 
      -> setOrderId   ( $orderId    )
      -> setAmount    ( $amount     ) // 100 = 1 lari
      -> setUserId    ( $userId     ) // optional
      -> setUserCardId( $userCardId ) // optional
      -> set( 'rame'  , 'rume' ) 
      -> execute();

All this fields that we set when making new instance of Transaction, will be available for us to see with bunch of other BOG info, when our GeorgianCard -> update() method will be executed. and in that moment you can save db records and so on...

Making refund of the transaction

use Redberry\GeorgianCardGateway\Refund;

$refund =  new Refund;

$refund
      -> setTrxId ( $trxId  )
      -> setRRN   ( $RRN    )
      -> setAmount( $amount )
      -> execute();
TrxId and RRN

TrxId and RRNs are transaction ids, which will be given to you in the GeorgianCard -> update method, you have to save it in DB and then use it to make refund of that transaction.

redberry/georgian-card-gateway 适用场景与选型建议

redberry/georgian-card-gateway 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 07 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payments」 「bog」 「Georgian Card」 「Bank of Georgia」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 redberry/georgian-card-gateway 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 redberry/georgian-card-gateway 我们能提供哪些服务?
定制开发 / 二次开发

基于 redberry/georgian-card-gateway 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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