mehr-it/otto-orders-api-client
Composer 安装命令:
composer require mehr-it/otto-orders-api-client
包简介
PHP client for Otto orders API generated using Swagger
README 文档
README
This API documentation describes all endpoints for orders - version 3
This PHP package is automatically generated by the Swagger Codegen project:
- API version: v3
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
Requirements
PHP 5.5 and later
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/mehr-it/otto-orders-api-client.git"
}
],
"require": {
"mehr-it/otto-orders-api-client": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php:
require_once('/path/to/./vendor/autoload.php');
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $sales_order_id = "sales_order_id_example"; // string | The Sales Order Id of the order to cancel $position_item_id = array("position_item_id_example"); // string[] | The ids of the PositionItems to cancel try { $apiInstance->cancelPartnerOrderPositionItems($sales_order_id, $position_item_id); } catch (Exception $e) { echo 'Exception when calling ALLApi->cancelPartnerOrderPositionItems: ', $e->getMessage(), PHP_EOL; } $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $sales_order_id = array("sales_order_id_example"); // string[] | The Sales Order Id of the order to cancel try { $apiInstance->cancelPartnerOrders($sales_order_id); } catch (Exception $e) { echo 'Exception when calling ALLApi->cancelPartnerOrders: ', $e->getMessage(), PHP_EOL; } $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $from_date = "from_date_example"; // string | Defines, which minimum change date the returned order should have. In ISO 8601 format. $from_order_date = "from_order_date_example"; // string | Lower boundary of filter by order date: Only orders newer than the date specified will be returned. In ISO 8601 format. $to_order_date = "to_order_date_example"; // string | Upper boundary of filter by order date: Only orders older than the date specified will be returned. In ISO 8601 format. $fulfillment_status = "fulfillment_status_example"; // string | Defines, which minimum state the returned orders should have.<br>If ANNOUNCED is given, all orders, which have at least one PositionItem in ANNOUNCED state are returned.<br>If PROCESSABLE is given, all orders, which have at least one PositionItem in PROCESSABLE state and none in ANNOUNCED state are returned.<br>If SENT is given, all orders, which have at least one PositionItem in SENT state and none in either ANNOUNCED or PROCESSABLE state are returned.<br>If RETURNED is given, all orders, which have at least one PositionItem in RETURNED state and none in either ANNOUNCED or PROCESSABLE or SENT state are returned.<br>If CANCELLED_BY_PARTNER is given, all orders, which have at least one PositionItem in CANCELLED_BY_PARTNER state are returned.<br>If CANCELLED_BY_MARKETPLACE is given, all orders, which have at least one PositionItem in CANCELLED_BY_MARKETPLACE state are returned.<br>If none is provided, all status will be returned.<br>Several values can be passed via request param array, when multiple values passed, search result will be combination of multiple fulfillmentStatuses - no duplicates will appear.<br>Example: ?fulfillmentStatus=PROCESSABLE&fulfillmentStatus=CANCELLED_BY_MARKETPLACE - will return orders in these 3 fulfillmentStatuses.<br>Alternatively, mode can be passed for a different search type. BUCKET/AT_LEAST_ONE, where BUCKET is default behaviour explained above and AT_LEAST_ONE checks if there is at least 1 PositionItem with passed fulfillmentStatus/fulfillmentStatuses. $limit = 128; // int | The maximum amount of returned orders $order_direction = "ASC"; // string | $order_column_type = "ORDER_LIFECYCLE_DATE"; // string | $mode = "BUCKET"; // string | The search mode. Default search mode is bucket search $nextcursor = "nextcursor_example"; // string | For paging request this cursor is required. If a next cursor is provided, the only other request parameter being considered is 'limit'.<br>Only the cursor string is required, not the whole link to the cursor.<br>Example: nextcursor=eyJmZiI6MTU5NDg5NDQ3MTA1OCwicGlmIjoiNDcxM... $search_term = "search_term_example"; // string | The search term for partial text search. try { $result = $apiInstance->findPartnerOrders($from_date, $from_order_date, $to_order_date, $fulfillment_status, $limit, $order_direction, $order_column_type, $mode, $nextcursor, $search_term); print_r($result); } catch (Exception $e) { echo 'Exception when calling ALLApi->findPartnerOrders: ', $e->getMessage(), PHP_EOL; } $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $order_number = "order_number_example"; // string | The Order Number used for searching try { $result = $apiInstance->getPartnerOrderByOrderNumber($order_number); print_r($result); } catch (Exception $e) { echo 'Exception when calling ALLApi->getPartnerOrderByOrderNumber: ', $e->getMessage(), PHP_EOL; } $apiInstance = new MehrIt\OttoOrdersApiClient\Api\ALLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $sales_order_id = "sales_order_id_example"; // string | The Sales Order Id used for searching try { $result = $apiInstance->getPartnerOrderBySalesOrderId($sales_order_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling ALLApi->getPartnerOrderBySalesOrderId: ', $e->getMessage(), PHP_EOL; } ?>
Documentation for API Endpoints
All URIs are relative to https://live.api.otto.market
| Class | Method | HTTP request | Description |
|---|---|---|---|
| ALLApi | cancelPartnerOrderPositionItems | POST /v3/orders/{salesOrderId}/positionItems/{positionItemId}/cancellation | Cancels PositionItems of an order by ids |
| ALLApi | cancelPartnerOrders | POST /v3/orders/{salesOrderId}/cancellation | Cancel all PositionItems of an order |
| ALLApi | findPartnerOrders | GET /v3/orders | Get a list of orders which can be filtered on fulfillmentStatus. |
| ALLApi | getPartnerOrderByOrderNumber | GET /v3/orders/{orderNumber} | Get a single order via Order Number |
| ALLApi | getPartnerOrderBySalesOrderId | GET /v3/orders/{salesOrderId} | Get a single order via Sales Order Id |
| OrdersApi | cancelPartnerOrders | POST /v3/orders/{salesOrderId}/cancellation | Cancel all PositionItems of an order |
| OrdersApi | findPartnerOrders | GET /v3/orders | Get a list of orders which can be filtered on fulfillmentStatus. |
| OrdersApi | getPartnerOrderByOrderNumber | GET /v3/orders/{orderNumber} | Get a single order via Order Number |
| OrdersApi | getPartnerOrderBySalesOrderId | GET /v3/orders/{salesOrderId} | Get a single order via Sales Order Id |
| PositionItemsApi | cancelPartnerOrderPositionItems | POST /v3/orders/{salesOrderId}/positionItems/{positionItemId}/cancellation | Cancels PositionItems of an order by ids |
Documentation For Models
- Address
- Amount
- InitialServiceFee
- Link
- OrderLifecycleInformation
- PartnerOrder
- PartnerOrderList
- PositionItem
- Product
- TrackingInfo
Documentation For Authorization
All endpoints do not require authorization.
Author
mehr-it/otto-orders-api-client 适用场景与选型建议
mehr-it/otto-orders-api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 112 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 11 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「orders」 「sdk」 「swagger」 「otto」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mehr-it/otto-orders-api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mehr-it/otto-orders-api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mehr-it/otto-orders-api-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Add Shopify like fulfillments to your Craft Commerce orders.
A PSR-7 compatible library for making CRUD API endpoints
A PHP (and Laravel) package to interface with the Snipcart api.
Silverstripe module for creating and managing generic 'Order' objects
PayPal's PHP SDK for Checkout REST APIs
Package set to provide shop or e-commerce functionality (such as CART, ORDERS, TRANSACTIONS and ITEMS) to Laravel for customizable builds.
统计信息
- 总下载量: 112
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-27