店铺与购物车草稿
合作商自助维护绑定店铺,并通过购物车草稿走"提交核价 → 员工核价 → 确认下单"流程。身份始终来自令牌解析的会员,店铺范围来自 ChannelPartnerShop 绑定关系;客户端传入的 member_id 不被信任。
认证与通用约定
所有 /channel/api/v1/* 端点由 ChannelPartnerAuthMiddleware 统一鉴权:可携带 request-token,或携带 Authorization: Bearer <token>(用户会话令牌或开发者密令)。
| 请求头 | 必填 | 说明 |
|---|---|---|
request-token | 二选一 | 渠道伙伴应用令牌 |
Authorization | 二选一 | Bearer <token>,用户会话令牌或开发者密令 |
Content-Type | 是 | application/json |
所需能力: 无。shop/* 与 shop/cart-draft/* 路径不在能力映射表中,仅需有效的渠道伙伴身份(见 app/channel/middleware/ChannelPartnerAuthMiddleware.php:39-46)。
通用错误码:
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | 参数或业务校验失败 |
| 404 | 资源不存在或不在当前合作商范围 |
| 500 | 服务端异常 |
已绑定店铺
/channel/api/v1/shop/boundAuth: request-token (channel_partner)
返回当前合作商绑定的店铺(authorize)列表,仅暴露 id、name、brief;密钥等敏感字段不会返回。
所需能力: 无
请求体
无。
响应
{
"code": 200,
"msg": "shop bound succeed",
"data": [
{ "id": 21, "name": "Partner Shop DE", "brief": "Germany distribution" }
]
}| 字段 | 类型 | 说明 |
|---|---|---|
id | integer | 店铺(authorize)ID,即 /shop/product/attach、shop/product/list 的 shop_id |
name | string | 店铺名称 |
brief | string | 简介,可为空 |
说明:未绑定任何店铺时返回空数组,msg 仍为 shop bound succeed。
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 500 | 服务端异常 |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/bound' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json'可授权渠道
/channel/api/v1/shop/grantsAuth: request-token (channel_partner)
返回可用于创建店铺的授权渠道(hottol grants)。本地按 systemGroup.code = shop 过滤,仅保留启用项并按 id 去重。固定请求 pageSize = 200,只取前 200 条,超出部分静默截断。
所需能力: 无
请求体
无。
响应
{
"code": 200,
"msg": "success",
"data": [
{
"id": 12,
"grant_id": 12,
"name": "Shop connector",
"code": "shop_connector",
"oauth": false
}
]
}| 字段 | 类型 | 说明 |
|---|---|---|
id / grant_id | integer | 授权定义 ID(两者相同)。grant_id 用于 shop/grant-fields,id 可作为 shop/create 的 authorization |
name / code | string | 授权渠道名称 / 编码 |
oauth | boolean | 是否为 OAuth 渠道 |
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | 授权渠道接口调用失败(failed to fetch grants) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/grants' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json'授权渠道字段
/channel/api/v1/shop/grant-fieldsAuth: request-token (channel_partner)
返回某个授权渠道的字段定义(sense = authorize),用于动态生成创建店铺表单。仅返回前端需要的字段,不透传含密钥的 grant 嵌套对象。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
grant_id | integer | 是 | 授权定义 ID,取自 shop/grants 的 grant_id |
响应
{
"code": 200,
"msg": "success",
"data": [
{
"id": 301,
"name": "API Key",
"field": "api_key",
"placeHolder": "Enter API key",
"help": "Provided by the shop platform",
"min": 0,
"max": 0,
"minLength": 8,
"maxLength": 64,
"required": true,
"formType": "text",
"rows": 6,
"fixValue": "",
"options": []
}
]
}| 字段 | 类型 | 说明 |
|---|---|---|
id | integer | 字段定义 ID |
name / field | string | 显示名 / 提交字段名 |
placeHolder / help | string | 占位符 / 帮助文本 |
min / max | integer | 数值范围 |
minLength / maxLength | integer | 文本长度范围 |
required | boolean | 是否必填 |
formType | string | 表单类型,如 text / radio / select / checkbox / multiselect |
rows | integer | 文本域行数,默认 6 |
fixValue | string | 固定值;当存在 options 时返回空串 |
options[].key / value | string | 选项显示名 / 提交值;state = false 的选项被过滤 |
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | grant_id 缺失(grant_id is required),或字段接口调用失败(failed to fetch grant fields) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/grant-fields' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"grant_id": 12
}'创建店铺
/channel/api/v1/shop/createAuth: request-token (channel_partner)
自助创建店铺:在同一事务中写入 authorize 行并绑定到当前会员,创建后立即出现在已绑定店铺列表。店铺 type 由授权渠道的 systemGroup.code 推导,客户端传入的 type 不被接受。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 是 | 店铺名称 |
brief | string | 是 | 店铺简介 |
authorization | integer | 是 | 授权定义 ID(hottol grant id) |
property | object | 否 | 动态表单字段值,对应 shop/grant-fields 的定义;存入 authorize.meta.property |
响应
{
"code": 200,
"msg": "shop create succeed",
"data": { "id": 22, "shop_id": 22 }
}| 字段 | 类型 | 说明 |
|---|---|---|
id / shop_id | integer | 新店铺(authorize)ID,两者相同 |
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | name / brief / authorization 缺失;同名且同授权的店铺已存在(the some name of item is exist);授权渠道不存在(the authorization grant is not exist);与主店铺同名且同授权(the primary shop cannot be created);事务异常时返回异常信息 |
| 500 | 授权渠道查询异常(getGrants 调用在事务 try 之外,未被捕获) |
说明:绑定关系幂等,已存在则跳过;同名且同授权的重复校验为全局校验(不限当前会员);主店铺保护同时校验授权与名称,不会阻止复用同一授权创建其他名称的店铺。
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/create' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Partner Shop FR",
"brief": "France distribution",
"authorization": 12,
"property": {
"api_key": "YOUR_SHOP_KEY"
}
}'挂单商品
/channel/api/v1/shop/product/attachAuth: request-token (channel_partner)
把主店铺商品挂单(复制)到合作商自有店铺。每个主商品复制为独立的 t_item + t_variants 快照;重复挂单只刷新描述/物流字段,不覆盖店铺自有价格。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
shop_id | integer | 是 | 目标店铺 ID,必须是当前合作商已绑定且非主店铺 |
item_ids | array | 是 | 主店铺商品 ID 数组;去重后 1–50 个,非数字或非正值忽略 |
说明:挂单时复制描述、图片、物流、分类等字段,并写入挂单时的价格快照;cost / cost_price / shop_sku_id 永不复制。重复挂单以 (shop_id, shop_sku) 识别商品、以 (product_id, shop_sku) 识别变体,仅刷新描述/物流列。单个商品被跳过不会中断整批;非预期异常会回滚整批。
响应
{
"code": 200,
"msg": "attach succeed",
"data": {
"shop_id": 21,
"attached": 1,
"items": [
{
"master_item_id": 501,
"item_id": 1501,
"shop_sku": "E2C-BAT-100",
"action": "created",
"variant_count": 1
}
]
}
}| 字段 | 类型 | 说明 |
|---|---|---|
shop_id | integer | 目标店铺 ID |
attached | integer | 成功挂单(item_id 非空)的商品数 |
items[].master_item_id | integer | 主店铺商品 ID |
items[].item_id | integer | null | 店铺侧商品 ID;跳过时为 null |
items[].shop_sku | string | 店铺侧 SKU;跳过时为空串 |
items[].action | string | created / updated / skipped |
items[].variant_count | integer | 处理(新增或刷新)的变体数;跳过时为 0 |
items[].reason | string | 仅 skipped 时出现:product not found in the master catalog / product has no variant to attach / product has a variant without sku to attach / product has no shop sku to attach |
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | shop_id 缺失(the shop_id is required);店铺未绑定(the shop is not bound to this channel partner);目标为主店铺(the primary shop cannot be attached to);item_ids 为空或超过 50 个(item_ids must be an array of at most 50 unique ids);事务异常时返回异常信息 |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/product/attach' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"shop_id": 21,
"item_ids": [
501,
502
]
}'店铺商品列表
/channel/api/v1/shop/product/listAuth: request-token (channel_partner)
返回合作商某个已绑定店铺的商品分页列表。行结构复用商品目录的快照字段,可直接作为下单明细转发。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
shop_id | integer | 建议 | 店铺 ID;建议显式传入,缺失或非当前合作商绑定店铺时返回 200 空列表 |
page | integer | 否 | 页码,从 1 开始。默认 1 |
pageSize | integer | 否 | 每页条数,最大 100。默认 20 |
keyword | string | 否 | 模糊搜索 title / shop_sku |
in_stock | integer | string | 否 | 按上下架过滤:1 在售、0 下架;不传则不过滤 |
响应
{
"code": 200,
"msg": "",
"data": {
"data": [
{
"id": 1501,
"sku": "E2C-BAT-100",
"name": "10 kWh Battery Module",
"price": 1299.00,
"stock_status": "in_stock",
"vip_price_rule": "Partner Tier A",
"master_item_id": 501,
"sale_price": 1299.00,
"weight": 48.5,
"weight_unit": "kg",
"images": { "id": ["https://cdn.example.com/items/501/1.jpg"] },
"primary_image_key": "id",
"variant": {
"shop_sku": "E2C-BAT-100",
"standard": { "capacity": "10kWh" },
"sale_price": 1299.00,
"weight": 48.5,
"weight_unit": "kg"
}
}
],
"total": 1,
"per_page": 20,
"current_page": 1
}
}| 字段 | 类型 | 说明 |
|---|---|---|
data[].id | integer | 店铺侧商品 ID |
data[].sku | string | 店铺侧 shop_sku(不暴露内部变体 ID) |
data[].name | string | 标题 |
data[].price / sale_price | number | null | 规则引擎最终价 |
data[].stock_status | string | in_stock / out_of_stock |
data[].vip_price_rule | string | 命中规则名称,未命中为空串 |
data[].master_item_id | integer | null | 挂单来源的主商品 ID;非挂单行为 null |
data[].weight / weight_unit | number / string | 重量与单位 |
data[].images | object | 归一化图片映射 |
data[].primary_image_key | string | 主图键 |
data[].variant | object | 首个变体的下单快照(shop_sku / standard / sale_price / weight / weight_unit) |
total | integer | 匹配总数(与 product/list 不同,此接口返回真实总数) |
per_page / current_page | integer | 每页条数 / 当前页 |
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 500 | 服务端异常 |
说明:shop_id 缺失或未绑定到当前合作商时返回 200 与空列表,而不是 403/404。
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/product/list' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"shop_id": 21,
"page": 1,
"pageSize": 20,
"in_stock": 1
}'草稿列表
路径前缀: 以下 7 个端点的实际路径是
/channel/api/v1/shop/cart-draft/*。后端路由app/channel/route/api.php在shop分组内嵌了cart-draft分组。合作商门户当前src/lib/api/endpoints.ts仍在使用旧路径/channel/api/v1/cart-draft/*,请求会命中 404;请以后端路由为准。
/channel/api/v1/shop/cart-draft/listAuth: request-token (channel_partner)
返回当前会员的全部购物车草稿,按 updated_at 倒序。该接口不分页。
所需能力: 无
请求体
无。
响应
{
"code": 200,
"msg": "success",
"data": [
{
"id": 77,
"member_id": 9001,
"label": "Q4 restock",
"shipping_address": "{\"full_name\":\"Anna Schmidt\",\"city\":\"Hamburg\"}",
"billing_address": "{}",
"items": "[{\"variant_id\":4001,\"sku\":\"E2C-BAT-100\",\"name\":\"10 kWh Battery Module\",\"quantity\":2,\"price\":1299}]",
"currency": "EUR",
"subtotal": 2598.00,
"assigned_staff_id": 12,
"status": "draft",
"pricing_request_id": null,
"created_at": "2026-11-11 09:00:00",
"updated_at": "2026-11-11 09:30:00"
}
]
}| 字段 | 类型 | 说明 |
|---|---|---|
id | integer | 草稿 ID |
member_id | integer | 所属会员 |
label | string | 草稿名称,默认 Cart |
shipping_address | string | 收货地址 JSON 字符串 |
billing_address | string | 账单地址 JSON 字符串 |
items | string | 明细 JSON 字符串,元素含 variant_id / sku / name / quantity / price |
currency | string | 币种,默认 EUR |
subtotal | number | string | 小计 = Σ(price × quantity),保留 2 位小数;decimal 列可能以字符串形式返回 |
assigned_staff_id | integer | null | 指定核价员工,<= 0 时为 null |
status | string | draft / pricing / confirmed / submitted |
pricing_request_id | integer | null | 当前核价请求 ID |
created_at / updated_at | string | 创建 / 更新时间 |
说明:接口按数据库行原样返回,JSON 列不会解码;除上述字段外如存在其他列也会一并返回。
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 500 | 服务端异常 |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/list' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json'保存草稿
/channel/api/v1/shop/cart-draft/saveAuth: request-token (channel_partner)
新建或更新购物车草稿。id > 0 为更新,仅 draft / confirmed 状态可更新;id 为 0 或不传时新建。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | integer | 否 | 草稿 ID;0 表示新建。默认 0 |
label | string | 否 | 草稿名称;空串保存为 Cart |
shipping_address | object | 否 | 收货地址,按 JSON 存储 |
billing_address | object | 否 | 账单地址,按 JSON 存储 |
items | array | 否 | 明细数组,按 JSON 存储 |
items[].variant_id | integer | 是 | 变体 ID |
items[].sku | string | 否 | SKU |
items[].name | string | 否 | 商品名称 |
items[].quantity | integer | 是 | 数量,默认 1 |
items[].price | number | 是 | 单价 |
currency | string | 否 | 币种,默认 EUR |
assigned_staff_id | integer | 否 | 指定核价员工;<= 0 时存 null |
响应
{
"code": 200,
"msg": "success",
"data": { "id": 77 }
}| 字段 | 类型 | 说明 |
|---|---|---|
id | integer | 新建或更新的草稿 ID |
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | 草稿不存在或不属于当前会员(cart draft not found);草稿处于 pricing / submitted(cart draft is locked during pricing or after submission) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/save' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 0,
"label": "Q4 restock",
"currency": "EUR",
"shipping_address": {
"full_name": "Anna Schmidt",
"city": "Hamburg",
"country_code": "DE"
},
"items": [
{
"variant_id": 4001,
"sku": "E2C-BAT-100",
"name": "10 kWh Battery Module",
"quantity": 2,
"price": 1299
}
]
}'删除草稿
/channel/api/v1/shop/cart-draft/deleteAuth: request-token (channel_partner)
删除当前会员的购物车草稿,并同时删除关联的核价请求。任何状态都可删除。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | integer | 是 | 草稿 ID |
响应
{
"code": 200,
"msg": "success",
"data": []
}错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | id 缺失或非正(id is required) |
说明:草稿不存在或不属于当前会员时仍返回成功(删除条件按 id + member_id 匹配)。实现现状:关联核价请求按 cart_draft_id 直接删除,未再校验草稿归属;删除不属于自己的草稿 ID 不会删除该草稿,但仍会删除该 ID 下的核价请求。
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/delete' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77
}'提交核价
/channel/api/v1/shop/cart-draft/submit-pricingAuth: request-token (channel_partner)
把 draft 状态的购物车提交核价:创建核价请求(pending),草稿状态变为 pricing。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | integer | 是 | 草稿 ID |
remark | string | 否 | 核价备注 |
说明:核价员工按以下顺序确定:草稿 assigned_staff_id → 会员 bind_manager_id → 系统设置 channel/default_shop_manager/member;都为空时 staff_id = 0。每个明细记录 variant_id / sku / name / quantity / original_price(取草稿 price),adjusted_price 初始为 null。
响应
{
"code": 200,
"msg": "pricing request submitted",
"data": { "pricing_request_id": 301 }
}| 字段 | 类型 | 说明 |
|---|---|---|
pricing_request_id | integer | 新建核价请求 ID,同时写入草稿的 pricing_request_id |
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | 草稿不存在或不属于当前会员(cart draft not found);非 draft 状态(only draft cart can submit for pricing);事务失败(failed to submit pricing request) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/submit-pricing' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77,
"remark": "Please confirm Q4 pricing"
}'取消核价
/channel/api/v1/shop/cart-draft/cancel-pricingAuth: request-token (channel_partner)
合作商取消核价:仅 pricing 状态可取消。核价请求置为 rejected(备注 cancelled by member),草稿退回 draft 并清空 pricing_request_id。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | integer | 是 | 草稿 ID |
响应
{
"code": 200,
"msg": "pricing cancelled, cart returned to draft",
"data": []
}错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | 草稿不存在或不属于当前会员(cart draft not found);非 pricing 状态(only pricing cart can be cancelled);事务失败(failed to cancel pricing) |
说明:confirmed 状态不可取消(价格已确认);如需调整请重新提交核价。
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/cancel-pricing' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77
}'提交订单
/channel/api/v1/shop/cart-draft/submit-orderAuth: request-token (channel_partner)
把 confirmed 或 draft 状态的草稿正式提交为订单,成功后草稿状态变为 submitted。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | integer | 是 | 草稿 ID |
说明:以主店铺 shop_id 显式提交,与 /order/submit 共用 ChannelPartnerOrderService::submitForPartner 提交流程,因此会执行相同的绑定校验与客户经理校验,可能返回 400:the shop is not bound to this channel partner、no account manager assigned, please contact admin to bind a manager first。shop_order_no(此处为 DRAFT-{id}-{timestamp})每次调用重新生成,后端未做重复校验,因此超时重试不具备幂等性;未知 SKU 会整单拒收并回滚,行为与 order-submit 一致。
其余下单约定:shipping_standard = STD、payment_method = bank_transfer;账单地址为空时回退收货地址。税额通过 PlaceOrderRepo::getBossTax 计算,成功后追加一条 fee_code = tax 的费用行,并回填每行 vat_amount / tax_rate;计税失败只记录日志,不阻断下单。draft 状态可跳过核价直接下单。
响应
{
"code": 200,
"msg": "order submitted",
"data": { "order_id": 88123 }
}| 字段 | 类型 | 说明 |
|---|---|---|
order_id | integer | 新订单 ID |
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | 草稿不存在或不属于当前会员(cart draft not found);状态不允许(cart draft must be confirmed or draft before submitting);主店铺未绑定当前合作商(the shop is not bound to this channel partner);未绑定客户经理(no account manager assigned...);未知 SKU 整单拒收;下单失败时返回异常信息 |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/submit-order' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77
}'核价状态
/channel/api/v1/shop/cart-draft/pricing-statusAuth: request-token (channel_partner)
查询草稿与关联核价请求的当前状态,供门户轮询。
所需能力: 无
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | integer | 是 | 草稿 ID |
响应
{
"code": 200,
"msg": "success",
"data": {
"draft_status": "pricing",
"pricing_request": {
"id": 301,
"cart_draft_id": 77,
"member_id": 9001,
"staff_id": 12,
"items": [
{
"variant_id": 4001,
"sku": "E2C-BAT-100",
"name": "10 kWh Battery Module",
"quantity": 2,
"original_price": 1299.00,
"adjusted_price": null,
"remark": ""
}
],
"status": "pending",
"remark": "Please confirm Q4 pricing",
"created_at": "2026-11-11 09:31:00",
"resolved_at": null
}
}
}| 字段 | 类型 | 说明 |
|---|---|---|
draft_status | string | draft / pricing / confirmed / submitted |
pricing_request | object | null | 关联核价请求;草稿无 pricing_request_id 时为 null |
pricing_request.items | array | 已解码的明细数组,含 variant_id / sku / name / quantity / original_price / adjusted_price / remark |
pricing_request.status | string | pending / in_review / approved / rejected |
pricing_request.remark | string | 核价备注;员工审批时会被覆盖 |
pricing_request.resolved_at | string | null | 核价完成时间 |
错误码
| code | 含义 |
|---|---|
| 909 | 令牌缺失/无效,或不属于渠道伙伴 |
| 400 | 草稿不存在或不属于当前会员(cart draft not found) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/pricing-status' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77
}'状态流转
草稿状态机:
| 当前状态 | 操作 | 结果 |
|---|---|---|
draft | submit-pricing | pricing,核价请求创建为 pending |
draft | submit-order | submitted(跳过核价) |
pricing | cancel-pricing | draft,核价请求置 rejected |
pricing | 员工拒绝 | draft,核价请求置 rejected,清空 pricing_request_id |
pricing | 员工批准 | confirmed,明细回写 adjusted_price 并重算小计 |
confirmed | submit-order | submitted |
submitted | — | 终态;save 拒绝更新,delete 仍可删除 |
核价请求状态机:
| 状态 | 触发 |
|---|---|
pending | submit-pricing 创建 |
in_review | 保留状态;当前 /channel 接口不写入 |
approved | 员工审批通过(接受 pending / in_review) |
rejected | 员工拒绝,或合作商 cancel-pricing |
说明:save 在 pricing / submitted 状态被拒绝;cancel-pricing 仅接受 pricing;员工批准/拒绝对应的内部端点不向合作商开放。