kamerk22/amazongiftcode

Laravel 包用于 Amazon 礼品卡。

v1.0.5 2023-03-17 12:01 UTC

This package is auto-updated.

Last update: 2024-08-31 00:26:49 UTC


README

Buy Me A Coffee

Scrutinizer Code Quality Build Status Code Intelligence Status Latest Version on Packagist Total Downloads

AmazonGiftCode 是 Laravel 包,用于 Amazon 礼品卡 On Demand (AGCOD)。集成 Amazon 激励 API。更多信息请查看 https://developer.amazon.com/amazon-incentives-api

此包将为您提供最简单的 API 来创建/取消 Amazon 礼品卡 On Demand。

安装

您可以通过 Composer 安装此包。

$ composer require kamerk22/amazongiftcode

.env 文件中设置以下环境变量。

GIFT_CARD_ENDPOINT=agcod-v2-gamma.amazon.com
GIFT_CARD_KEY=AWS_ACCESS_KEY
GIFT_CARD_SECRET=AWS_SECRET
GIFT_CARD_PARTNER_ID=AWS_PARTNER_ID

该包将自动注册。可选地发布包的配置文件

$ php artisan vendor:publish --provider="kamerk22\AmazonGiftCode\AmazonGiftCodeServiceProvider" --tag="config"

用法

创建 Amazon 礼品卡

$aws = AmazonGiftCode::make()->buyGiftCard($value);

使用您的 $creationRequestId 创建 Amazon 礼品卡(否则会生成)

$aws = AmazonGiftCode::make()->buyGiftCard($value, $creationRequestId);

取消 Amazon 礼品卡

$aws = AmazonGiftCode::make()->cancelGiftCard($creationRequestId, $gcId);

获取可用资金余额

$aws = AmazonGiftCode::make()->getAvailableFunds();

可用方法

动态更改客户端配置。如果您只传递 $key 或其他参数,将使用默认配置的值。

$aws = AmazonGiftCode::make($key, $secret, $partner, $endpoint, $currency)->buyGiftCard($value);

CreateGiftCard

getStatus()

获取执行请求的状态。(status

$status = $aws->getStatus();

getId()

获取唯一的 Amazon 礼品卡 ID。(gcId

$gcId = $aws->getId();

getCreationRequestId()

原始创建请求 ID。(creationRequestId

$creationRequestId = $aws->getCreationRequestId();

getClaimCode()

用于的 Amazon 礼品卡索赔代码。(gcClaimCode

$gcClaimCode = $aws->getClaimCode();

getValue()

生成的礼品卡金额。(amount

$amount = $aws->getValue();

getCurrency()

生成的礼品卡的货币代码。(currencyCode

$currencyCode = $aws->getCurrency();

getRawJson()

获取原始 JSON 响应。(原始响应)

$rawJson = $aws->getRawJson();

CancelGiftCard

getStatus()

获取执行请求的状态。(status

$status = $aws->getStatus();

getId()

获取唯一的 Amazon 礼品卡 ID。(gcId

$gcId = $aws->getId();

getCreationRequestId()

原始创建请求 ID。(creationRequestId

$creationRequestId = $aws->getCreationRequestId();

getRawJson()

获取原始 JSON 响应。(原始响应)

$rawJson = $aws->getRawJson();

GetAvailableFunds

getStatus()

获取执行请求的状态。(status

$status = $aws->getStatus();

getAmount()

获取可用余额金额。(amount

$amount = $aws->getAmount();

getCurrency()

获取货币。(currency

$currency = $aws->getCurrency();

getTimestamp()

获取请求时间戳。(getTimestamp

$timestamp = $aws->getTimestamp();

getRawJson()

获取原始 JSON 响应。(原始响应)

$rawJson = $aws->getRawJson();

变更日志

请查看 changelog 以获取最近更改的更多信息。

贡献

请查看 contributing.md 获取详细信息和一个待办事项列表。

安全性

如果您发现任何安全相关的问题,请通过电子邮件 kashyapk62@gmail.com 而不是使用问题跟踪器。

鸣谢

许可

MIT。请查看 许可文件 以获取更多信息。