wadify/wadify-sdk-php 问题修复 & 功能扩展

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

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

wadify/wadify-sdk-php

Composer 安装命令:

composer require wadify/wadify-sdk-php

包简介

Wadify SDK for PHP - Use Wadify Web Services in your PHP project

关键字:

README 文档

README

@wadifytech on Twitter Build Status

The Wadify SDK for PHP makes it easy for developers to access Wadify in their PHP code.

Resources

  • README file – For both getting started and in-depth SDK usage information
  • Issues – Report issues, submit pull requests, and get involved
  • @wadifytech – Follow us on Twitter

Features

  • Provides easy-to-use HTTP clients for all supported Wadify services and authentication protocols.
  • Is built on Guzzle, and utilizes many of its features, including persistent connections, asynchronous requests, middlewares, etc.

Getting started

  1. Sign up for Wadify - Before you begin, you need to sign up for a Wadify account and retrieve your Wadify credentials
  2. Minimum requirements - To run the SDK, your system will need to meet the minimum requirements, including having PHP >= 5.6 compiled with the cURL extension and cURL 7.16.2+ compiled with a TLS backend (e.g., NSS or OpenSSL).
  3. Install the SDK – Using Composer is the recommended way to install the Wadify SDK for PHP. The SDK is available via Packagist under the wadify/wadify-sdk-php package.
  4. Using the SDK – The best way to become familiar with how to use the SDK is to read the following section. The Getting Started Guide will help you become familiar with the basic concepts.

User guide

Installation

Via composer cli

composer require wadify/wadify-sdk-php

Via composer json

{
...
	"require": {
		...,
		"wadify/wadify-sdk-php": "^1.0",
	}
}

and then

composer update

Create a Wadify client

Example with only required options

<?php
// Require the Composer autoloader.
require __DIR__.'/vendor/autoload.php';

use Wadify\Client;

// Instantiate the client.
$client = new Client([
    'apiKey' => '{your-api-key}',
    'clientId' => '{your-client-id}',
    'clientSecret' => '{your-client-secret}'
]);

Example with different token provider

<?php
// Require the Composer autoloader.
require __DIR__.'/vendor/autoload.php';

use Wadify\Client;

// Instantiate the client.
$client = new Client([
    'apiKey' => '{your-api-key}',
    'clientId' => '{your-client-id}',
    'clientSecret' => '{your-client-secret}'
    'token' => [
        'provider' => '{your-provider-class-namespace}',
        'args' => [...]
    ]
]);

Required options

  • apiKey: API key
  • clientId: Client identifier
  • clientSecret: Client secret

Not required options

  • version: Block your desired api version. Ex. v1 or latest
  • sandbox: true or false. If you want to use production or sandbox mode. Production by default
  • token: Token configuration array.
    • provider: Provider class string. By default we are using the FileSystemProvider
    • args: Arguments we need in the provider. By default we are sending a standard path. /tmp/wadify/token.json

Use the Wadify Client

Get user

<?php
$user = $client->getUser(); // array

Get transactions

<?php
$transactions = $client->getTransactions(); // array

Get transaction

<?php
$transaction = $client->getTransaction('your-trasaction-id'); // array

Abort transaction

<?php
$id = ;
$transaction = $client->abortTransaction('your-trasaction-id'); // array

Create transaction

<?php
$data = [
    "amount" => 100,
    "subject" => "Transaction number one",
    "response_url" => "http://your.response.url/",
    "source_account" => "e76ad9ea-dbc1-11e5-a764-109add42947b",
    "destination_account" => [
        "name" => "Javier Rodriguez",
        "iban" => "ES1800491500042710151321"
    ],
    "fingerprint" => [
        "order" => "secret,amount,subject,response_url,source_account,destination_account.name,destination_account.iban",
        "hash" => "{hash}"
    ]
]
$transaction = $client->createTransaction($data); // array

Custom token storage provider

You can create your own token storage provider. By default we are using the FileSystemProvider.

Example of custom token storage provider

The arguments in the constructor are actually coming from the args value in the client configuration.

<?php

namespace Your\Namespace;

use Wadify\Token\StorageProvider\StorageProviderInterface;
use Wadify\Token\Token;

class CustomProvider implements StorageProviderInterface
{   
    public function get() 
    {
    ...
    }
    
    public function set(Token $token)
    {
    ...
    }
}

For further information about the data to send check the API Docs

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-04-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固