增加小程序绑定物流、获取已绑定的物流账号
This commit is contained in:
parent
bb8c63d712
commit
e7a934f13f
|
|
@ -52,14 +52,7 @@ type UploadShippingInfo = {
|
|||
openid: string;
|
||||
};
|
||||
};
|
||||
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 declare class WechatMpInstance {
|
||||
appId: 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
|
||||
* @param data
|
||||
*/
|
||||
getExpressPath(data: getExpressPathData): Promise<{
|
||||
getExpressPath(data: GetExpressPathData): Promise<{
|
||||
path_item_num: number;
|
||||
path_item_list: Array<{
|
||||
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
|
||||
* @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
|
||||
* @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 {};
|
||||
|
|
|
|||
|
|
@ -462,4 +462,28 @@ export class WechatMpInstance {
|
|||
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;
|
||||
order_id: string;
|
||||
};
|
||||
export type getExpressPathData = {
|
||||
export type GetExpressPathData = {
|
||||
openid?: string;
|
||||
delivery_id: string;
|
||||
waybill_id: string;
|
||||
};
|
||||
export type getExpressOrderData = {
|
||||
export type GetExpressOrderData = {
|
||||
order_id: string;
|
||||
openid?: string;
|
||||
delivery_id: string;
|
||||
|
|
@ -123,4 +123,18 @@ export type getExpressOrderData = {
|
|||
print_type?: number;
|
||||
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 {};
|
||||
|
|
|
|||
|
|
@ -52,14 +52,7 @@ type UploadShippingInfo = {
|
|||
openid: string;
|
||||
};
|
||||
};
|
||||
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 declare class WechatMpInstance {
|
||||
appId: 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
|
||||
* @param data
|
||||
*/
|
||||
getExpressPath(data: getExpressPathData): Promise<{
|
||||
getExpressPath(data: GetExpressPathData): Promise<{
|
||||
path_item_num: number;
|
||||
path_item_list: Array<{
|
||||
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
|
||||
* @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
|
||||
* @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 {};
|
||||
|
|
|
|||
|
|
@ -466,5 +466,29 @@ class WechatMpInstance {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -110,12 +110,12 @@ export type CancelExpressOrderData = {
|
|||
waybill_id: string;
|
||||
order_id: string;
|
||||
};
|
||||
export type getExpressPathData = {
|
||||
export type GetExpressPathData = {
|
||||
openid?: string;
|
||||
delivery_id: string;
|
||||
waybill_id: string;
|
||||
};
|
||||
export type getExpressOrderData = {
|
||||
export type GetExpressOrderData = {
|
||||
order_id: string;
|
||||
openid?: string;
|
||||
delivery_id: string;
|
||||
|
|
@ -123,4 +123,18 @@ export type getExpressOrderData = {
|
|||
print_type?: number;
|
||||
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 {};
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
appId: string;
|
||||
|
|
@ -710,7 +703,7 @@ export class WechatMpInstance {
|
|||
* https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getPath.html
|
||||
* @param data
|
||||
*/
|
||||
async getExpressPath(data: getExpressPathData) {
|
||||
async getExpressPath(data: GetExpressPathData) {
|
||||
const token = await this.getAccessToken();
|
||||
const result = await this.access(
|
||||
`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
|
||||
* @param data
|
||||
*/
|
||||
async getExpressOrder(data: getExpressOrderData) {
|
||||
async getExpressOrder(data: GetExpressOrderData) {
|
||||
const token = await this.getAccessToken();
|
||||
const result = await this.access(
|
||||
`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
|
||||
* @param data
|
||||
*/
|
||||
async notifyConfirmReceive(data: notifyConfirmReceiveData) {
|
||||
async notifyConfirmReceive(data: NotifyConfirmReceiveData) {
|
||||
const token = await this.getAccessToken();
|
||||
await this.access(
|
||||
`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
|
||||
export type getExpressPathData = {
|
||||
export type GetExpressPathData = {
|
||||
openid?: string;
|
||||
delivery_id: string,
|
||||
waybill_id: string,
|
||||
|
|
@ -153,11 +153,31 @@ export type getExpressPathData = {
|
|||
|
||||
//获取运单数据
|
||||
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/express/express-by-business/getOrder.html
|
||||
export type getExpressOrderData = {
|
||||
export type GetExpressOrderData = {
|
||||
order_id: string;
|
||||
openid?: string;
|
||||
delivery_id: string;
|
||||
waybill_id?: string;
|
||||
print_type?: number;
|
||||
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