devbalu / wexnz-c
Wex.nz REST API PHP 客户端
2.1.0
2018-07-19 08:37 UTC
Requires
- php: ^7.1
- doctrine/annotations: ^1.4
- madmis/exchange-api: ^0.1.3
- symfony/options-resolver: ^3.3
Requires (Dev)
- phpunit/phpunit: ^6.2
- symfony/console: ^3.3
This package is auto-updated.
Last update: 2024-09-07 06:50:19 UTC
README
Wex.nz 提供了 REST API,您可以使用这些 API 以编程方式与平台交互。包括创建和兑换优惠券。
此 API 客户端将帮助您通过 REST API 与 Wex.nz 交互。
许可证
MIT 许可证
Btc-e REST API 参考文档
公共 API - https://wex.nz/api/3/docs
交易 API - https://wex.nz/tapi/docs
推送 API - https://wex.nz/pushAPI/docs
安装
composer require azkdev/wexnz-c
用法
基本用法
<?php
require __DIR__ . '/../vendor/autoload.php';
use azkdev\WexnzApi\WexnzApi;
$api = new WexnzApi(
'https://wex.nz/tapi', // maybe other wex.
'*******************', // public key.
'*******************' // secret key.
);
print_r($api->trade()->userInfo()); // prints all user wallet info.
要使用 createCoupon 或 redeemCoupon 方法,您需要 api 密钥的 'trade' 权限。有关 'trade' 权限的更多信息,请参阅此处。
$api->trade()->createCoupon('USD', 200, 'userName'); // Creating coupon with 'currency', 'amount' and 'user name'. User name can be empty string ''.
$api->trade()->redeemCoupon('**********'); // Redeem coupon. Argument is coupon code. Returns full info about transaction.
映射
错误处理
运行测试
要运行测试,您需要安装 phpunit。最简单的方法是通过 composer 进行安装。
composer install
测试需要运行 php 内置服务器在 8000 端口。
php -S localhost:8000
运行单元测试
php vendor/bin/phpunit -c phpunit.xml.dist