incenteev/async-amazon-incentives 问题修复 & 功能扩展

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

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

incenteev/async-amazon-incentives

最新稳定版本:v1.1.1

Composer 安装命令:

composer require incenteev/async-amazon-incentives

包简介

SDK for the Amazon Incentives API based on the structure of the async-aws project

README 文档

README

This package provides an unofficial SDK for the Amazon Incentives API.

Installation

Use Composer to install the library:

$ composer require incenteev/async-amazon-incentives

Usage

use AsyncAws\Core\Configuration;
use Incenteev\AsyncAmazonIncentives\AmazonIncentivesClient;
use Incenteev\AsyncAmazonIncentives\Enum\CurrencyCode;
use Incenteev\AsyncAmazonIncentives\Exception\SystemTemporarilyUnavailableException;
use Incenteev\AsyncAmazonIncentives\Region;
use Incenteev\AsyncAmazonIncentives\ValueObject\MoneyAmount;

// Get your credentials in the Amazon Incentives portal
$accessKey = '';
$secretKey = '';
$partnerId = '';

// Choose the region corresponding to your partnership, with either the sandbox or production one.
$region = Region::EUROPE_AND_ASIA_SANDBOX;

$client = new AmazonIncentivesClient([
    Configuration::OPTION_ACCESS_KEY_ID => $accessKey,
    Configuration::OPTION_SECRET_ACCESS_KEY => $secretKey,
    Configuration::OPTION_REGION => $region,
]);

try {
    $result = $client->createGiftCard([
        'partnerId' => $partnerId,
        'creationRequestId' => '', // Create the proper request id
        'value' => new MoneyAmount(['amount' => 10, 'currencyCode' => CurrencyCode::EUR]),
    ]);

    $code = $result->getGcClaimCode();
} catch (SystemTemporarilyUnavailableException $e) {
    // TODO handle temporary failures according to the Amazon Incentives best practices
}

Note: due to the async nature of the project, the exception is not actually thrown by the call to createGiftCard but when the Result object gets resolved.

License

This package is under the MIT license.

Reporting an issue or a feature request

Issues and feature requests are tracked in the GitHub issue tracker.

统计信息

  • 总下载量: 129.76k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知