aaronkaa/ccpclient

此包最新版本(dev-master)没有提供许可证信息。

Laravel 的 Cloud Commerce Pro API 客户端

dev-master 2019-03-11 11:25 UTC

This package is not auto-updated.

Last update: 2024-09-18 19:54:19 UTC


README

Laravel 的 Cloud Commerce Pro API 客户端

此包处于非常早期阶段,但将会频繁更新,欢迎提出建议,所有拉取请求都欢迎。

入门

使用 composer 安装

composer require aaronkaa/ccpclient

使用以下命令发布配置

php artisan vendor:publish

将您的 'brand_id' 和 'hash' 添加到 config/ccpapi.php 文件中,这样应该就设置完成了。

用法

目前,每个独立的服务都有自己的对象

use AKaa\CCPClient\Client\ProductClient;
use AKaa\CCPClient\Client\ProductRangeClient;
use AKaa\CCPClient\Client\ProductOptionClient;
use AKaa\CCPClient\Client\OrderClient;
use AKaa\CCPClient\Client\PaymentClient;
use AKaa\CCPClient\Client\CustomerClient;

要使用 API,获取您想使用的服务的实例

$productClient = new ProductClient();

$result = $productClient->getProductByID(12345);

目前的返回值是 CCP 的标准响应,包含顶级结果对象(例如 'getProductByManufacturerSKUResult' 来自 getProductByManufacturerSKU)以及 'Success'、'ErrorLevel'、'Content' 和 'Errors'。