diff --git a/packages/santai/package.json b/packages/santai/package.json index 2e7ef6b..e15aa00 100644 --- a/packages/santai/package.json +++ b/packages/santai/package.json @@ -1,6 +1,6 @@ { "name": "@cn-international-express-sdk/santai", - "version": "3.0.1", + "version": "3.0.2", "types": "./dist/types/index.d.ts", "main": "./dist/lib/index.js", "module": "./dist/es/index.js", diff --git a/packages/santai/src/index.ts b/packages/santai/src/index.ts index cdcaa69..c5d4644 100644 --- a/packages/santai/src/index.ts +++ b/packages/santai/src/index.ts @@ -1,4 +1,8 @@ -import { Recordable, promiseSoap } from '@cn-international-express-sdk/utils'; +import { + Recordable, + promiseSoap, + promiseStrongSoap, +} from '@cn-international-express-sdk/utils'; import { SanTaiConfig } from './state'; export * from './state'; @@ -12,6 +16,29 @@ export class SanTai { this.config = config; } + async getRates(sendData: Recordable) { + const { country, state, zip_code } = sendData; + let { weight, length, width, height } = sendData; + width = width || '10'; + height = height || '10'; + length = length || '10'; + weight = weight || 1; + const obj = { + ratesRequestInfo: { + country, + state, + weight, + zip_code, + length, + width, + height, + priceType: '1', + }, + }; + const result = await promiseStrongSoap(this.url, 'getRates', obj); + return result; + } + async genRequest(action: string, sendData: Recordable) { const commonObj = { HeaderRequest: {