ShopifyServiceInterface.php 2.85 KB
Newer Older
1 2 3 4 5 6 7 8
<?php
/**
 * Created by PhpStorm.
 * User: Zero
 * Date: 2020/10/12
 * Time: 9:39
 */

9
namespace Meibuyu\Rpc\Service\Interfaces\Product;
10

王源's avatar
王源 committed
11
use Exception;
12
use Meibuyu\Rpc\Exceptions\RpcException;
王源's avatar
王源 committed
13

14 15 16 17 18 19 20 21
interface ShopifyServiceInterface
{

    /**
     * 拉取一个shopify订单数据
     * @param $orderId
     * @param $shopifySiteId
     * @return array
王源's avatar
王源 committed
22
     * @throws Exception
23 24 25
     */
    public function pullOrder($orderId, $shopifySiteId): array;

26 27 28 29 30 31 32 33 34
    /**
     * 通过id列表获取shopify站点数组
     * @param array $ids shopify站点id数组,默认去重
     * @param array $columns shopify站点表字段,默认['name', 'prefix', 'team_id', 'site_id', 'language_id', 'url', 'currency_id']
     * @return array 默认keyBy('id')
     * @author Zero
     */
    public function getShopifySitesByIds(array $ids, $columns = ['name', 'prefix', 'team_id', 'site_id', 'language_id', 'url', 'currency_id']): array;

35 36 37 38 39
    /**
     * 拉取传入的id之后的shopify订单列表数据,默认50条数据
     * @param int $sinceId 订单id
     * @param int $shopifySiteId shopify站点id
     * @return array
王源's avatar
王源 committed
40
     * @throws Exception
41 42 43 44 45 46 47 48 49 50
     * @author Zero
     */
    public function pullOrderList($sinceId, $shopifySiteId): array;

    /**
     * 更新shopify订单
     * @param int $orderId 订单id
     * @param array $params 更新的数据
     * @param int $shopifySiteId shopify站点id
     * @return mixed
王源's avatar
王源 committed
51 52
     * @throws RpcException
     * @author zero
53 54 55
     */
    public function updateOrder($orderId, $params, $shopifySiteId);

56
    /**
王源's avatar
王源 committed
57
     * 创建shopify订单发货记录
王源's avatar
王源 committed
58 59
     * 参数示例: https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillment#create-2020-07
     * location_id不传会默认拿取系统有的数据,拿不到报错
60 61
     * @param int $orderId
     * @param array $params
62 63
     * @param int $shopifySiteId
     * @return mixed
64 65
     * @throws RpcException
     * @author zero
66 67 68
     */
    public function createOrderFulfillment($orderId, $params, $shopifySiteId);

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
    /**
     * 更新shopify订单发货物流信息
     * 参数示例: https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillment#update_tracking-2020-07
     * [
     *   "notify_customer" => true,
     *   "tracking_info" => [
     *     "number" => "1111",
     *     "url" => "http://www.my-url.com",
     *     "company" => "my-company",
     *    ]
     * ]
     * @param $fulfillmentId
     * @param $params
     * @param $shopifySiteId
     * @return array
     * @throws RpcException
     * @author zero
     */
    public function updateFulfillmentTracking($fulfillmentId, $params, $shopifySiteId);

89 90 91 92 93 94 95 96 97
    /**
     * 通过id数组获取shopify的location数据
     * @param $ids
     * @param string[] $columns
     * @return array 默认keyBy('id')
     * @author zero
     */
    public function getLocationsByIds($ids, $columns = ['*']);

98
}