承接 selcom/selcom-apigw-client 相关项目开发

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

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

selcom/selcom-apigw-client

最新稳定版本:v1.0.5

Composer 安装命令:

composer require selcom/selcom-apigw-client

包简介

Client library to help access selcom apis

README 文档

README

Homepage

https://developers.selcommobile.com/

Description

This is a library containing functions that aid in the accessing of selcom api. IT is made up pf 4 functions. computeHeader

Installation

composer require selcom/selcom-apigw-client

Usage

require_once __DIR__ .'/vendor/autoload.php';
// use modeule
use Selcom\ApigwClient\Client;
//iniiatialize new Client with values of the base url, api key and api secret
$client = new Client($baseUrl, $apiKey, $apiSecret);
// computeHeader takes an array containing data to bes submitted
// computeHeader returns an array with values for the following header fields: 
//  Authorization, Timestamp, Digest, Signed-Fields
$client->computeHeader( $arrayData):

// postFuct takesa path relative to baseUrl. array containing data of query  
// It performs a POST request of the submitted data to the destniation url generatingg the header internally
// IT returns a json containing the response to the request
$client->postFunc($path, $arrayData)

// getFuct takes a path relative to baseUrl. array containing data of query 
// It performs a GET request adding the query to the  url and generatingg the header internally
// IT returns a json containing the response to the request
$client->getFunc($path, $arrayData)

// deletetFuct takes a path relative to baseUrl. array containing data of query 
// It performs a DELETE request adding the query to the  url and generatingg the header internally
// IT returns a json containing the response to the request
$client->deleteFunc($path, $arrayData)

Example

require_once __DIR__ .'/vendor/autoload.php';

// 
use Selcom\ApigwClient\Client;

# initalize a new apiAccess instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";


$client = new Client($baseUrl, $apiKey, $apiSecret);


//order data
$orderArray = array(
"vendor"=>"VENDORTILL",
"order_id"=>"1218d5Qb",
"buyer_email"=> "john@example.com",
"buyer_name"=> "John Joh",
"buyer_phone"=> "255682555555",
"amount"=>  8000,
"currency"=>"TZS",
"buyer_remarks"=>"None",
"merchant_remarks"=>"None",
"no_of_items"=>  1

)

// path relatiive to base url
$orderPath = "/v1/checkout/create-order-minimal"
// crate new order

$response = $client->postFunc($orderPath,$orderArray);

echo json_encode($response);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-02-25