承接 kevujin/comgate-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kevujin/comgate-client

最新稳定版本:1.3.2

Composer 安装命令:

composer require kevujin/comgate-client

包简介

Comgate client wrapper conatining all available developed request/responses

README 文档

README

Build Status Coverage Status

Comgate API client

Comgate API client wrapper conatining all available developed request/responses

Is forked from from tomasz-kusy/comgate-client and contains also updates from renat-magadiev/comgate-client which is the original developer

Requirements

Installation

$ composer require kevujin/comgate-client

Base usage - create a client

use Comgate\Client;

$client = new Client(
    'merchant', // your merchant ID you got from Comgate
    true, // if testing environment -> false = production
    'secret' // secret passphrase/token you got from Comgate
);

Create payment

use Comgate\Request\CreatePayment;

$createPayment = new CreatePayment(
    1000, // the price in cents 10.00 => 1000
    'orderId', // your ID
    'test@test.cz', // email of customer or some email for Comgate to communicate with if payment problems
    'Product name' // payment label
);

$createPaymentResponse = $client->send($createPayment);

$redirectUrl = $createPaymentResponse->getRedirectUrl();

CreatePayment class has the same props as described in Comgate documentation

Get payment status

use Comgate\Request\PaymentStatus;

$paymentStatus = new PaymentStatus(
    'transId' // Comgate ID you received from create payment process
);

$paymentStatusResponse = $client->send($paymentStatus);

PaymentStatus response class has the same props as described in Comgate documentation

Cancel payment

use Comgate\Request\CancelPayment;

$cancelPayment = new CancelPayment(
    'transId' // Comgate ID you received from create payment process
);

$cancelPaymentResponse = $client->send($cancelPayment);

CancelPayment response and request class has the same props as described in Comgate documentation

Get payment methods

use Comgate\Request\GetMethods;

$getMethods = new GetMethods(
    'currency', // currency to filter methods for, could be null to match all available
    'country' // country to filter methods available in, could be null to match all available
);

$getMethodsResponse = $client->send($getMethods);
var_dump($getMethodsResponse->methods);
var_dump($getMethodsResponse->getMethod('BANK_ALL')); // exact one method

GetMethods response and request class are described in Comgate documentation

List transfers

Get the list of fund transfer for provided date. There might be more transfers in one day than only one or there can be none. Transfers are used to be processed about 15:00 GMT.

use Comgate\Request\ListTransfers;

$listTransfers = new ListTransfers(
    date('Y-m-d') // let's look for today 
);

$listTransfersResponse = $client->send($listTransfers);
var_dump($listTransfersResponse->transfers); // collection of Response\Item\Transfer

ListTransfers response and request class are described in Comgate documentation

For each transfer there is another API call to get its detail (exact payments) which are included in such transfer

foreach ($listTransfersResponse->transfers as $transfer) { // transfer is object Response\Item\Transfer
    $getTransferRequest = $transfer->createRequest(); // Request\GetTransfer

    $getTransferResponse = $client->send($getTransferRequest);
    var_dump($getTransferResponse->transferItems); // collection of Response\Item\TransferItem
}

GetTransfer response and request class are described in Comgate documentation

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固