Giter Club home page Giter Club logo

laravel-gmo-payment-api's Introduction

laravel-gmo-payment-api

MIT License

Install

composer require shibuyakosuke/laravel-gmo-payment-api

Publish config file.

php artisan vendor:publish --provider="ShibuyaKosuke\LaravelGmoPaymentApi\Providers\GmoServiceProvider"

Append .env

GMO_TIMEOUT=10
GMO_API_BASE_URL="https://pt01.mul-pay.jp/payment"
GMO_SITE_ID=tsite00000000
GMO_SITE_PASSWORD={site_password}
GMO_SHOP_ID=tshop00000000
GMO_SHOP_PASSWORD={shop_password}

Usage

メソッド名は、エンドポイント名のキャメルケースに一致します。

GmoApi::saveMember([
    'MemberID' => '0000012345',
    'MemberName' => '鈴木太郎',
]);

How to use fake response in test code.

// On Success
/** @var array $response */
$response = GmoApi::setFake([
        '*' => Http::response('ACS=0&OrderID=SampleOrderID&Forward=2a99662&Method=1&PayTimes=&Approve=040128&TranID=2107071507111111111111813673&TranDate=20210707151900&CheckString=cd5678b1bca0559b36459f3f9dfd4952', 200),
    ])
    ->execTran([
        'AccessID'        => 'SampleAccessID',
        'AccessPass'      => 'SampleAccessPass',
        'OrderID'         => 'SampleOrderID',
        'Method'          => '2',
        'PayTimes'        => '2',
        'Token'           => 'SampleToken',
        'HttpAccept'      => 'SampleHttpAccept',
        'HttpUserAgent'   => 'HttpUserAgent',
        'DeviceCategory'  => '0',
        'ClientField1'    => 'SampleClientField1',
        'ClientField2'    => 'SampleClientField2',
        'ClientField3'    => 'SampleClientField3',
        'ClientFieldFlag' => '0',
        'TokenType'       => '1',
        'RetUrl'          => 'https://example.com/xxxxx'
    ]);

// On Error

$this->expectException(GmoApiException::class);

/** @var array $response */
$response = GmoApi::setFake([
        '*' => Http::response('ErrCode=E01&ErrInfo=E01040001', 200),
    ])
    ->execTran([
        'AccessID'        => 'SampleAccessID',
        'AccessPass'      => 'SampleAccessPass',
        'OrderID'         => 'SampleOrderID',
        'Method'          => '2',
        'PayTimes'        => '2',
        'Token'           => 'SampleToken',
        'HttpAccept'      => 'SampleHttpAccept',
        'HttpUserAgent'   => 'HttpUserAgent',
        'DeviceCategory'  => '0',
        'ClientField1'    => 'SampleClientField1',
        'ClientField2'    => 'SampleClientField2',
        'ClientField3'    => 'SampleClientField3',
        'ClientFieldFlag' => '0',
        'TokenType'       => '1',
        'RetUrl'          => 'https://example.com/xxxxx'
    ]);

Package testing

./vendor/bin/testbench package:test

laravel-gmo-payment-api's People

Contributors

haruemurakami77 avatar shibuyakosuke avatar kadariyaujwal avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.