/** * @author songxiwen * @date 2020/12/14 15:40 */ import { TowifyClient } from './towify.client'; import { ExpressResponseType, ExpressTraceRequestType, GettingUsableApiKeyErrorType } from './type'; export enum ThirdPartyMicroserviceFunction { SendSMSCode = 'ThirdPartySMSService:sendSMSCode', GetCurrentExpressInfo = 'ThirdPartySMSService:getCurrentExpressInfo' } export class ThirdPartyMicroserviceHandler { public static async sendSMSCode(requestBody: { applicationSmsConfigId: string; phone: string; }) { await TowifyClient.getInstance().sendMessage< void, { applicationSmsConfigId: string; phone: string; } >(ThirdPartyMicroserviceFunction.SendSMSCode, requestBody); } public static async getCurrentExpressInfo( requestBody: ExpressTraceRequestType ): Promise< | { code: number; data: ExpressResponseType; } | GettingUsableApiKeyErrorType > { const result = await TowifyClient.getInstance().sendMessage< | { code: number; data: ExpressResponseType; } | GettingUsableApiKeyErrorType, { OrderCode?: string; ShipperCode: string; LogisticCode: string; } >(ThirdPartyMicroserviceFunction.GetCurrentExpressInfo, requestBody); return result; } }