定制 jobmetric/voucher-usd 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jobmetric/voucher-usd

最新稳定版本:1.0.0

Composer 安装命令:

composer require jobmetric/voucher-usd

包简介

This package handles payment via the USD voucher website.

README 文档

README

Contributors Forks Stargazers MIT License LinkedIn

Voucher USD

A Laravel package for managing voucher USD, including authentication, balance checking, voucher creation, and retrieval.

Install via composer

Run the following command to pull in the latest version:

composer require jobmetric/voucher-usd

Documentation

Add the required environment variables in your .env file:

VOUCHER_USD_CLIENT_ID=your_client_id
VOUCHER_USD_CLIENT_SECRET=your_client_secret
VOUCHER_USD_AUTH_URL=https://example.com
VOUCHER_USD_BASE_URL=https://example.com

Usage

Authentication

To authenticate and retrieve an access token:

use JobMetric\VoucherUsd\Facades\VoucherUsd;

$response = VoucherUsd::auth();

if ($response['ok']) {
    echo "Access Token: " . $response['data']['token'];
} else {
    echo "Error: " . $response['message'];
}

Check Balance

To check the account balance:

$response = VoucherUsd::balance();

if ($response['ok']) {
    echo "Available Balance: " . $response['data']['available'];
    echo "Actual Balance: " . $response['data']['actual'];
} else {
    echo "Error: " . $response['message'];
}

Create a Voucher

To create a new voucher:

$data = [
    'amount' => 100, // Amount in USD
    'note' => 'Test voucher creation',
];

$response = VoucherUsd::createVoucher($data);

if ($response['ok']) {
    echo "Voucher Code: " . $response['data']['voucher_code'];
} else {
    echo "Error: " . $response['message'];
}

Retrieve All Vouchers

To retrieve a list of all vouchers:

$response = VoucherUsd::getVouchers();

if ($response['ok']) {
    echo "Vouchers: " . print_r($response['data']['vouchers'], true);
    echo "Report: " . print_r($response['data']['report'], true);
} else {
    echo "Error: " . $response['message'];
}

Retrieve a Single Voucher

To retrieve details of a specific voucher by its code:

$voucherCode = 'ABC123';

$response = VoucherUsd::showVoucher($voucherCode);

if ($response['ok']) {
    echo "Voucher Details: " . print_r($response['data'], true);
} else {
    echo "Error: " . $response['message'];
}

Events

This package contains several events for which you can write a listener as follows

Event Description
CreateVoucherUsdEvent Triggered after a voucher is successfully created.
InsufficientBalanceEvent Triggered when voucher creation fails due to insufficient balance.

Contributing

Thank you for considering contributing to the Laravel Ban Ip! The contribution guide can be found in the CONTRIBUTING.md.

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固