增加小程序绑定物流、获取已绑定的物流账号
This commit is contained in:
parent
bb8c63d712
commit
e7a934f13f
|
|
@ -52,14 +52,7 @@ type UploadShippingInfo = {
|
||||||
openid: string;
|
openid: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
type notifyConfirmReceiveData = {
|
import { AddExpressOrderData, CancelExpressOrderData, GetExpressPathData, GetExpressOrderData, NotifyConfirmReceiveData, BindExpressAccountData } from '../../types/Wechat';
|
||||||
transaction_id?: string;
|
|
||||||
merchant_id?: string;
|
|
||||||
sub_merchant_id?: string;
|
|
||||||
merchant_trade_no?: string;
|
|
||||||
received_time: number;
|
|
||||||
};
|
|
||||||
import { AddExpressOrderData, CancelExpressOrderData, getExpressPathData, getExpressOrderData } from '../../types/Wechat';
|
|
||||||
export declare class WechatMpInstance {
|
export declare class WechatMpInstance {
|
||||||
appId: string;
|
appId: string;
|
||||||
appSecret?: string;
|
appSecret?: string;
|
||||||
|
|
@ -207,7 +200,7 @@ export declare class WechatMpInstance {
|
||||||
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getPath.html
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getPath.html
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
getExpressPath(data: getExpressPathData): Promise<{
|
getExpressPath(data: GetExpressPathData): Promise<{
|
||||||
path_item_num: number;
|
path_item_num: number;
|
||||||
path_item_list: Array<{
|
path_item_list: Array<{
|
||||||
action_time: number;
|
action_time: number;
|
||||||
|
|
@ -220,12 +213,23 @@ export declare class WechatMpInstance {
|
||||||
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getOrder.html
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getOrder.html
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
getExpressOrder(data: getExpressOrderData): Promise<any>;
|
getExpressOrder(data: GetExpressOrderData): Promise<any>;
|
||||||
/**
|
/**
|
||||||
* 确认收货提醒
|
* 确认收货提醒
|
||||||
* https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html
|
* https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
notifyConfirmReceive(data: notifyConfirmReceiveData): Promise<void>;
|
notifyConfirmReceive(data: NotifyConfirmReceiveData): Promise<void>;
|
||||||
|
/**
|
||||||
|
* 绑定/解绑物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/bindAccount.html
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
bindExpressAccount(data: BindExpressAccountData): Promise<any>;
|
||||||
|
/**
|
||||||
|
* 获取所有绑定的物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getAllAccount.html
|
||||||
|
*/
|
||||||
|
getExpressAccount(): Promise<any>;
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -462,4 +462,28 @@ export class WechatMpInstance {
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 绑定/解绑物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/bindAccount.html
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
async bindExpressAccount(data) {
|
||||||
|
const token = await this.getAccessToken();
|
||||||
|
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/express/business/account/bind?access_token=${token}`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取所有绑定的物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getAllAccount.html
|
||||||
|
*/
|
||||||
|
async getExpressAccount() {
|
||||||
|
const token = await this.getAccessToken();
|
||||||
|
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/express/business/account/getall?access_token=${token}`, {
|
||||||
|
method: 'GET'
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,12 +110,12 @@ export type CancelExpressOrderData = {
|
||||||
waybill_id: string;
|
waybill_id: string;
|
||||||
order_id: string;
|
order_id: string;
|
||||||
};
|
};
|
||||||
export type getExpressPathData = {
|
export type GetExpressPathData = {
|
||||||
openid?: string;
|
openid?: string;
|
||||||
delivery_id: string;
|
delivery_id: string;
|
||||||
waybill_id: string;
|
waybill_id: string;
|
||||||
};
|
};
|
||||||
export type getExpressOrderData = {
|
export type GetExpressOrderData = {
|
||||||
order_id: string;
|
order_id: string;
|
||||||
openid?: string;
|
openid?: string;
|
||||||
delivery_id: string;
|
delivery_id: string;
|
||||||
|
|
@ -123,4 +123,18 @@ export type getExpressOrderData = {
|
||||||
print_type?: number;
|
print_type?: number;
|
||||||
custom_remark?: string;
|
custom_remark?: string;
|
||||||
};
|
};
|
||||||
|
export type NotifyConfirmReceiveData = {
|
||||||
|
transaction_id?: string;
|
||||||
|
merchant_id?: string;
|
||||||
|
sub_merchant_id?: string;
|
||||||
|
merchant_trade_no?: string;
|
||||||
|
received_time: number;
|
||||||
|
};
|
||||||
|
export type BindExpressAccountData = {
|
||||||
|
type: 'bind' | 'unbind';
|
||||||
|
biz_id: string;
|
||||||
|
delivery_id: string;
|
||||||
|
password?: string;
|
||||||
|
remark_content?: string;
|
||||||
|
};
|
||||||
export {};
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,7 @@ type UploadShippingInfo = {
|
||||||
openid: string;
|
openid: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
type notifyConfirmReceiveData = {
|
import { AddExpressOrderData, CancelExpressOrderData, GetExpressPathData, GetExpressOrderData, NotifyConfirmReceiveData, BindExpressAccountData } from '../../types/Wechat';
|
||||||
transaction_id?: string;
|
|
||||||
merchant_id?: string;
|
|
||||||
sub_merchant_id?: string;
|
|
||||||
merchant_trade_no?: string;
|
|
||||||
received_time: number;
|
|
||||||
};
|
|
||||||
import { AddExpressOrderData, CancelExpressOrderData, getExpressPathData, getExpressOrderData } from '../../types/Wechat';
|
|
||||||
export declare class WechatMpInstance {
|
export declare class WechatMpInstance {
|
||||||
appId: string;
|
appId: string;
|
||||||
appSecret?: string;
|
appSecret?: string;
|
||||||
|
|
@ -207,7 +200,7 @@ export declare class WechatMpInstance {
|
||||||
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getPath.html
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getPath.html
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
getExpressPath(data: getExpressPathData): Promise<{
|
getExpressPath(data: GetExpressPathData): Promise<{
|
||||||
path_item_num: number;
|
path_item_num: number;
|
||||||
path_item_list: Array<{
|
path_item_list: Array<{
|
||||||
action_time: number;
|
action_time: number;
|
||||||
|
|
@ -220,12 +213,23 @@ export declare class WechatMpInstance {
|
||||||
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getOrder.html
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getOrder.html
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
getExpressOrder(data: getExpressOrderData): Promise<any>;
|
getExpressOrder(data: GetExpressOrderData): Promise<any>;
|
||||||
/**
|
/**
|
||||||
* 确认收货提醒
|
* 确认收货提醒
|
||||||
* https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html
|
* https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
notifyConfirmReceive(data: notifyConfirmReceiveData): Promise<void>;
|
notifyConfirmReceive(data: NotifyConfirmReceiveData): Promise<void>;
|
||||||
|
/**
|
||||||
|
* 绑定/解绑物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/bindAccount.html
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
bindExpressAccount(data: BindExpressAccountData): Promise<any>;
|
||||||
|
/**
|
||||||
|
* 获取所有绑定的物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getAllAccount.html
|
||||||
|
*/
|
||||||
|
getExpressAccount(): Promise<any>;
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -466,5 +466,29 @@ class WechatMpInstance {
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 绑定/解绑物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/bindAccount.html
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
async bindExpressAccount(data) {
|
||||||
|
const token = await this.getAccessToken();
|
||||||
|
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/express/business/account/bind?access_token=${token}`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取所有绑定的物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getAllAccount.html
|
||||||
|
*/
|
||||||
|
async getExpressAccount() {
|
||||||
|
const token = await this.getAccessToken();
|
||||||
|
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/express/business/account/getall?access_token=${token}`, {
|
||||||
|
method: 'GET'
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.WechatMpInstance = WechatMpInstance;
|
exports.WechatMpInstance = WechatMpInstance;
|
||||||
|
|
|
||||||
|
|
@ -110,12 +110,12 @@ export type CancelExpressOrderData = {
|
||||||
waybill_id: string;
|
waybill_id: string;
|
||||||
order_id: string;
|
order_id: string;
|
||||||
};
|
};
|
||||||
export type getExpressPathData = {
|
export type GetExpressPathData = {
|
||||||
openid?: string;
|
openid?: string;
|
||||||
delivery_id: string;
|
delivery_id: string;
|
||||||
waybill_id: string;
|
waybill_id: string;
|
||||||
};
|
};
|
||||||
export type getExpressOrderData = {
|
export type GetExpressOrderData = {
|
||||||
order_id: string;
|
order_id: string;
|
||||||
openid?: string;
|
openid?: string;
|
||||||
delivery_id: string;
|
delivery_id: string;
|
||||||
|
|
@ -123,4 +123,18 @@ export type getExpressOrderData = {
|
||||||
print_type?: number;
|
print_type?: number;
|
||||||
custom_remark?: string;
|
custom_remark?: string;
|
||||||
};
|
};
|
||||||
|
export type NotifyConfirmReceiveData = {
|
||||||
|
transaction_id?: string;
|
||||||
|
merchant_id?: string;
|
||||||
|
sub_merchant_id?: string;
|
||||||
|
merchant_trade_no?: string;
|
||||||
|
received_time: number;
|
||||||
|
};
|
||||||
|
export type BindExpressAccountData = {
|
||||||
|
type: 'bind' | 'unbind';
|
||||||
|
biz_id: string;
|
||||||
|
delivery_id: string;
|
||||||
|
password?: string;
|
||||||
|
remark_content?: string;
|
||||||
|
};
|
||||||
export {};
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -71,15 +71,8 @@ type UploadShippingInfo = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type notifyConfirmReceiveData = {
|
|
||||||
transaction_id?: string;
|
|
||||||
merchant_id?: string;
|
|
||||||
sub_merchant_id?: string;
|
|
||||||
merchant_trade_no?: string;
|
|
||||||
received_time: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
import { AddExpressOrderData, CancelExpressOrderData, getExpressPathData, getExpressOrderData } from '../../types/Wechat';
|
import { AddExpressOrderData, CancelExpressOrderData, GetExpressPathData, GetExpressOrderData, NotifyConfirmReceiveData, BindExpressAccountData } from '../../types/Wechat';
|
||||||
|
|
||||||
export class WechatMpInstance {
|
export class WechatMpInstance {
|
||||||
appId: string;
|
appId: string;
|
||||||
|
|
@ -710,7 +703,7 @@ export class WechatMpInstance {
|
||||||
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getPath.html
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getPath.html
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
async getExpressPath(data: getExpressPathData) {
|
async getExpressPath(data: GetExpressPathData) {
|
||||||
const token = await this.getAccessToken();
|
const token = await this.getAccessToken();
|
||||||
const result = await this.access(
|
const result = await this.access(
|
||||||
`https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token=${token}`,
|
`https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token=${token}`,
|
||||||
|
|
@ -738,7 +731,7 @@ export class WechatMpInstance {
|
||||||
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getOrder.html
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getOrder.html
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
async getExpressOrder(data: getExpressOrderData) {
|
async getExpressOrder(data: GetExpressOrderData) {
|
||||||
const token = await this.getAccessToken();
|
const token = await this.getAccessToken();
|
||||||
const result = await this.access(
|
const result = await this.access(
|
||||||
`https://api.weixin.qq.com/cgi-bin/express/business/order/get?access_token=${token}`,
|
`https://api.weixin.qq.com/cgi-bin/express/business/order/get?access_token=${token}`,
|
||||||
|
|
@ -755,7 +748,7 @@ export class WechatMpInstance {
|
||||||
* https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html
|
* https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
async notifyConfirmReceive(data: notifyConfirmReceiveData) {
|
async notifyConfirmReceive(data: NotifyConfirmReceiveData) {
|
||||||
const token = await this.getAccessToken();
|
const token = await this.getAccessToken();
|
||||||
await this.access(
|
await this.access(
|
||||||
`https://api.weixin.qq.com/wxa/sec/order/notify_confirm_receive?access_token=${token}`,
|
`https://api.weixin.qq.com/wxa/sec/order/notify_confirm_receive?access_token=${token}`,
|
||||||
|
|
@ -765,4 +758,36 @@ export class WechatMpInstance {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定/解绑物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/bindAccount.html
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
async bindExpressAccount(data: BindExpressAccountData) {
|
||||||
|
const token = await this.getAccessToken();
|
||||||
|
const result = await this.access(
|
||||||
|
`https://api.weixin.qq.com/cgi-bin/express/business/account/bind?access_token=${token}`,
|
||||||
|
{
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有绑定的物流账号
|
||||||
|
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getAllAccount.html
|
||||||
|
*/
|
||||||
|
async getExpressAccount() {
|
||||||
|
const token = await this.getAccessToken();
|
||||||
|
const result = await this.access(
|
||||||
|
`https://api.weixin.qq.com/cgi-bin/express/business/account/getall?access_token=${token}`,
|
||||||
|
{
|
||||||
|
method: 'GET'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ export type CancelExpressOrderData = {
|
||||||
|
|
||||||
// 查询运单轨迹
|
// 查询运单轨迹
|
||||||
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getPath.html
|
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getPath.html
|
||||||
export type getExpressPathData = {
|
export type GetExpressPathData = {
|
||||||
openid?: string;
|
openid?: string;
|
||||||
delivery_id: string,
|
delivery_id: string,
|
||||||
waybill_id: string,
|
waybill_id: string,
|
||||||
|
|
@ -153,7 +153,7 @@ export type getExpressPathData = {
|
||||||
|
|
||||||
//获取运单数据
|
//获取运单数据
|
||||||
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getOrder.html
|
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getOrder.html
|
||||||
export type getExpressOrderData = {
|
export type GetExpressOrderData = {
|
||||||
order_id: string;
|
order_id: string;
|
||||||
openid?: string;
|
openid?: string;
|
||||||
delivery_id: string;
|
delivery_id: string;
|
||||||
|
|
@ -161,3 +161,23 @@ export type getExpressOrderData = {
|
||||||
print_type?: number;
|
print_type?: number;
|
||||||
custom_remark?: string;
|
custom_remark?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//确认收货提醒
|
||||||
|
//https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html
|
||||||
|
export type NotifyConfirmReceiveData = {
|
||||||
|
transaction_id?: string;
|
||||||
|
merchant_id?: string;
|
||||||
|
sub_merchant_id?: string;
|
||||||
|
merchant_trade_no?: string;
|
||||||
|
received_time: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
//绑定/解绑物流账号
|
||||||
|
//https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/bindAccount.html
|
||||||
|
export type BindExpressAccountData = {
|
||||||
|
type: 'bind' | 'unbind';
|
||||||
|
biz_id: string;
|
||||||
|
delivery_id: string;
|
||||||
|
password?: string;
|
||||||
|
remark_content?: string;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue