承接 alldigitalrewards/channeladvisor 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

alldigitalrewards/channeladvisor

最新稳定版本:1.2.1

Composer 安装命令:

composer require alldigitalrewards/channeladvisor

包简介

Unofficial Channel Advisor library

关键字:

README 文档

README

Latest Version on Packagist StyleCI Total Downloads

This is a ChannelAdvisor API Wrapper Library

Install

Via Composer

composer require alldigitalrewards/channeladvisor

Usage

Create Client using construct.

<?php
$client = new \AllDigitalRewards\ChannelAdvisor\Client(
    "REFRESH_TOKEN",
    "APPLICATION_ID",
    "SHARED_SECRET",
    123456789
);

Create Client using Factory

When secrets are defined in the following environment variables, you may use the factory to obtain an instance of the ChannelAdvisor client.:

  • CHANNELADVISOR_REFRESH_TOKEN
  • CHANNELADVISOR_APPLICATION_ID
  • CHANNELADVISOR_SHARED_SECRET
  • CHANNELADVISOR_PROFILE_ID
<?php
$client = \AllDigitalRewards\ChannelAdvisor\ClientFactory::getClient();

Fetching Products

Create a client as seen above, then...

Fetch All Products (Paginated)

<?php
$productFetcher = new \AllDigitalRewards\ChannelAdvisor\ProductFetcher($client);
$next_link = null;
$counter = 0;

while(true) {
    $productCollection = $productFetcher->getProducts($next_link);

    // Do something with this page of products...
    // There should be about 100 products in the collection.
    echo count($productCollection) . " in collection {$counter}.\n";

    if($productCollection->isLastPage()) {
        // We're done iterating, break the cipher.
        break 1;
    }

    $next_link = $productCollection->getNextLink();
}

Create Order

$sampleOrderConfig = [
    "ProfileID" => 123456789, //Identifies the ChannelAdvisor profile
    "SiteOrderID" => "123456789-12341234", // This should be the Transaction GUID
    "TotalPrice" => 38.41,
    "BuyerEmailAddress" => "jmuto@alldigitalrewards.com",
    "ShippingTitle" => "Mr.",
    "ShippingFirstName" => "Joseph",
    "ShippingLastName" => "Muto",
    "ShippingSuffix" => null,
    "ShippingCompanyName" => null,
    "ShippingCompanyJobTitle" => null,
    "ShippingDaytimePhone" => "123456789",
    "ShippingEveningPhone" => null,
    "ShippingAddressLine1" => "935 Bungalow Ave",
    "ShippingAddressLine2" => "",
    "ShippingCity" => "Winter Park",
    "ShippingStateOrProvince" => "FL",
    "ShippingPostalCode" => "32789",
    "Items" => [
        [
            "Sku" => "72539",
            "Quantity" => 1,
            "UnitPrice" => 38.41,
        ]
    ]
]

Testing

$ composer test

Code Style

This repository implements PSR2 code style. Please run composer check-style before opening PRs.
If necessary composer fix-style can be used to automatically clean up issues.

References

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-17