Skip to content

Commit

Permalink
chore(santai): add get rates func
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjue666 committed Jun 4, 2024
1 parent 2e0bdbf commit d0b0d90
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/santai/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
29 changes: 28 additions & 1 deletion packages/santai/src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<T>(action: string, sendData: Recordable) {
const commonObj = {
HeaderRequest: {
Expand Down

0 comments on commit d0b0d90

Please sign in to comment.