wsw / allnations
该软件包已被放弃,不再维护。没有建议的替代软件包。
用于与AllNations API集成的客户端
v1.0.1
2016-03-14 21:40 UTC
Requires
- cakephp/utility: ^3.0
- guzzlehttp/guzzle: ^6.1
Requires (Dev)
This package is auto-updated.
Last update: 2019-12-18 11:33:55 UTC
README
======= 用于PHP 5.5+的与All Nations Web Service集成的API,应使用兼容PSR-4的Autoloader。
安装
可以使用Composer安装此库。
基本示例
本版本可以管理:
- 按日期列出产品;
- 按日期列出库存中的产品;
访问凭证
要向WS All Nations发出请求,您必须配置访问凭证
<?php // Consideramos que já existe um autoloader compatível com a PSR-4 registrado use WSW\AllNations\Credentials; $credentials = new Credentials(':CodigoCliente', ':Senha');
请求
一组用于请求订单列表的服务。
此服务负责请求产品,其基本流程是:
- (A) 商店创建一个列出订单的请求;
- (B) All Nations处理请求;
- (C) All Nations发送请求的响应(如果有错误,将提供错误信息);
以下代码可以作为请求产品的基本示例:
<?php // Consideramos que já existe um autoloader compatível com a PSR-4 registrado e as credenciais foram configuradas em $credentials use WSW\AllNations\Products\Products; use WSW\AllNations\AllNationsException; try { $Products = new Products($Credentials); /** * use Products::PRODUCT_LIST Para listar todos os produtos relacionandos a data da pesquisa. * use Products::PRODUCT_STOCK Para listar todos os produtos em estoque relacionados a data da pesquisa */ $result = $Products->setDate('10/10/2015')->send(Products::PRODUCT_LIST); } catch (AllNationsException $e) { echo $e->getMessage(); }
使用许可
此库遵循The MIT License (MIT)的使用条款