dann95/g2a-sdk 问题修复 & 功能扩展

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

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

dann95/g2a-sdk

Composer 安装命令:

composer require dann95/g2a-sdk

包简介

G2A SDK

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License Build Status StyleCI composer.lock

This SDK is an unofficial software with no warranties by G2A PAY ®, you can check more about G2A in: https://www.g2a.com/

Contents

Requirements

  • PHP 7.0 and later.
  • Guzzle 6

Composer

You can install the sdk via Composer. Run the following command:

composer require dann95/g2a-sdk

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Available resources

Due some API limitations from G2A, this SDK is restricted to few operations, see the table below to know what this SDK can do. API means that this is available on this SDK

EMAIL means that is only available by e-mail contact

DASHBOARD means that is only available in merchant dashboard

Payments

create query refund
API API EMAIL

Subscriptions

create cancel query refund list transactions
API DASHBOARD DASHBOARD EMAIL DASHBOARD

Getting Started

Normal Integration

Setting up credentials be like:

$hash   = '485d733d-7937-414a-8d42-6781397b1c0a';
$mail   = 'merchant@my-test-store.com';
$secret = 'pSO_-N%GZDGfpLu!a5qOUnA>T7QqOro?4?z~Lt5u@LKgg>X247PYvZX8gwy~YY=c';
$env    = 'SANDBOX';
$sdk = new \G2A\Sdk(
    $hash,
    $mail,
    $secret,
    $env
);
 

Laravel integration (optional integration)

Insert the provider into providers array in config/app.php

'providers' => [
    // previous providers
     \G2A\Integrations\Laravel\G2aServiceProvider::class,   
    // next providers
]

Then run the following command:

php artisan vendor:publish --tag=g2a

Edit the file configs/g2a.php, you will have something like this

prefer use env() helper instead of strings to save your credentials

<?php
/**
 * to obtain hash and secret, go to:
 * https://www.test.pay.g2a.com/setting/merchant (in case of SANDBOX)
 * https://www.pay.g2a.com/setting/merchant (in case of PRODUCTION)
 * email is your account e-mail.
 */
return [
    'hash' => '',
    'secret' => '',
    'email' => '',
    'environment' => 'SANDBOX', // SANDBOX || PRODUCTION
];

Now when you do, it will give you a fresh instance of SDK using settings on config/g2a.php:

$sdk = app('G2A');

Or, when inside a Controller/any part of Laravel where Auto Dependency Injection is available:

class FooBarController extends Controller
{
    public function checkout(\G2A\Sdk $sdk)
    {
        dd($sdk);
    }
}

Goals/Todo

  • 100% Unit coverage
  • Use abstraction of HttpClient instead of Guzzle
  • Do a Legacy version, for php 5.4+
  • Full error detailed Exceptions and Entities
  • Release first stable version (1.0.0)

Contribute

Feel free to contribute to this repository.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固