edfa3ly-backend/seller-center-sdk

卖家中心API服务的PHP SDK

2.0.5 2019-04-14 09:13 UTC

This package is auto-updated.

Last update: 2024-09-29 05:28:17 UTC


README

Build Status codecov Software License Latest Stable Version Total Downloads

安装

通过Composer

$ composer require edfa3ly-backend/seller-center-sdk

依赖注入(Symfony 4)

确保注册 SellerCenterBundle::class 以使用依赖注入。

卖家中心文档

https://sellerapi.sellercenter.net/docs

可用操作

  • 分类属性
    • getCategoryAttributes
  • 数据包
    • getFeedStatus
  • 订单
    • cancelOrder
    • getMultipleOrderItems
    • getMultipleOrdersWithOrderItems
    • getOrder
    • getOrderItems
    • getOrderWithOrderItems
    • getOrders
    • setOrderStatusToDelivered
    • setOrderStatusToFailedDelivery
    • setOrderStatusToReadyToShip
    • setOrderStatusToShipped
  • 产品
    • createProducts
    • getProducts
    • updateProducts
  • 产品图片
    • createImages

使用说明

class Example
{  
    public function index() {
        $configuration = new Configuration('https://sellercenter-api.x.com.y','email@example.com','apiKey','apiPassword','username','v1');
        $configuration->setMinAttemptsDelay(1);  // in seconds default : 1
        $configuration->setMaxAttemptsDelay(10);  // in seconds default : 5
        $configuration->setRequestAttemptsThreshold(15) ; // number of failure retries default : 10  
        $productService = new ProductService();
        $products = $productService->getProducts($configuration,[]);
    }
}

渲染支持

当执行以下操作之一时

  • createProducts
  • updateProducts
  • createImages

您需要将xml表示形式发送到服务,现在您可以使用此包提供的Renderer服务。

class Example
{  
    public function index() {
        $configuration = new Configuration('https://sellercenter-api.x.com.y','email@example.com','apiKey','apiPassword','username','v1');
        $configuration->setMinAttemptsDelay(1);  // in seconds default : 1
        $configuration->setMaxAttemptsDelay(10);  // in seconds default : 5
        $configuration->setRequestAttemptsThreshold(15) ; // number of failure retries default : 10  
        $productService = new ProductService();
        $products = $productService->getProducts($configuration,[]);
        $renderer = new ProductUpdateRenderer();
        $xml = $renderer->render($products);
        $productService->updateProducts($configuration,$xml);
    }
}

日志支持

设置配置以启用日志记录

 $configuration->setLoggingEnabled(true);

如何测试

$ make test

安全

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

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件