feat(client): align account and order foundations
This commit is contained in:
@@ -8,6 +8,8 @@ export type ApiContainerMode = 'FULL_CONTAINER' | 'LCL'
|
||||
export type ApiDestinationType = 'FBA' | 'OVERSEAS' | 'PRIVATE'
|
||||
export type ApiPricingTaxMode = 'TAX_INCLUDED' | 'TAX_EXCLUDED'
|
||||
export type ApiPriceModel = 'FBA_WAREHOUSE_RATE' | 'REGION_WEIGHT_TIER'
|
||||
export type CustomerOrderAddressType = 'PICKUP' | 'PRIVATE_DESTINATION'
|
||||
export type MerchantBatchImportMode = 'ATOMIC' | 'PARTIAL'
|
||||
|
||||
export interface PageResult<T> {
|
||||
records: T[]
|
||||
@@ -91,6 +93,7 @@ export interface FirstLegOrderCargoPayload {
|
||||
declaredValue?: number
|
||||
currency?: string
|
||||
dangerousGoods?: boolean
|
||||
woodenProduct: boolean
|
||||
cargoRemark?: string
|
||||
skuNo?: string
|
||||
upcNo?: string
|
||||
@@ -129,8 +132,8 @@ export interface FirstLegOrderSaveRequest {
|
||||
destinationWarehouseName: string
|
||||
expectedShipDate?: string
|
||||
customerRemark?: string
|
||||
sender?: FirstLegOrderPartyPayload
|
||||
receiver?: FirstLegOrderPartyPayload
|
||||
senderAddressId?: number | string
|
||||
privateDestinationAddressId?: number | string
|
||||
cargoes: FirstLegOrderCargoPayload[]
|
||||
pickupMethod: ApiPickupMethod
|
||||
receivingWarehouseId: number | string
|
||||
@@ -142,13 +145,33 @@ export interface FirstLegOrderSaveRequest {
|
||||
pricingTaxMode: ApiPricingTaxMode
|
||||
taxMode: ApiTaxMode
|
||||
containerMode?: ApiContainerMode
|
||||
customsInspection: boolean
|
||||
customsInspection: boolean | null
|
||||
destinationType: ApiDestinationType
|
||||
amazonWarehouseCode?: string
|
||||
shipmentId?: string
|
||||
referenceId?: string
|
||||
}
|
||||
|
||||
export interface CustomerOrderAddressSaveRequest {
|
||||
addressType: CustomerOrderAddressType
|
||||
addressName: string
|
||||
companyName: string
|
||||
contactName: string
|
||||
phone: string
|
||||
email?: string
|
||||
countryCode: string
|
||||
province?: string
|
||||
city: string
|
||||
district?: string
|
||||
addressLine: string
|
||||
postalCode?: string
|
||||
defaultAddress: boolean
|
||||
}
|
||||
|
||||
export interface CustomerOrderAddress extends CustomerOrderAddressSaveRequest {
|
||||
id: number | string
|
||||
}
|
||||
|
||||
export interface InboundCodePolicy {
|
||||
mode: 'AUTO' | 'LEGACY_MANUAL'
|
||||
manualEntryRequired: boolean
|
||||
@@ -177,6 +200,14 @@ export interface MerchantBatchDraftResponse {
|
||||
items: MerchantBatchDraftResult[]
|
||||
}
|
||||
|
||||
export interface MerchantBatchImportResponse {
|
||||
batchNo: string
|
||||
mode: MerchantBatchImportMode
|
||||
sourceFileId: number | string
|
||||
errorReportFileId: number | string | null
|
||||
result: MerchantBatchDraftResponse
|
||||
}
|
||||
|
||||
export interface MerchantFirstLegOrder {
|
||||
id?: number | string
|
||||
orderId?: number | string
|
||||
@@ -203,7 +234,7 @@ export interface MerchantFirstLegOrder {
|
||||
carrierName?: string | null
|
||||
taxMode: ApiTaxMode
|
||||
containerMode: ApiContainerMode | null
|
||||
customsInspection: boolean
|
||||
customsInspection: boolean | null
|
||||
destinationType: ApiDestinationType
|
||||
amazonWarehouseCode: string | null
|
||||
shipmentId: string | null
|
||||
@@ -453,6 +484,38 @@ export function getMerchantInboundCodePolicy() {
|
||||
return apiRequest<InboundCodePolicy>({ method: 'GET', url: '/merchant/v1/orders/first-leg/inbound-code-policy' })
|
||||
}
|
||||
|
||||
export function getMerchantOrderAddresses(addressType?: CustomerOrderAddressType) {
|
||||
return apiRequest<CustomerOrderAddress[]>({ method: 'GET', url: '/merchant/v1/order-addresses', params: { addressType } })
|
||||
}
|
||||
|
||||
export function createMerchantOrderAddress(payload: CustomerOrderAddressSaveRequest) {
|
||||
return apiRequest<number | string>({ method: 'POST', url: '/merchant/v1/order-addresses', data: payload })
|
||||
}
|
||||
|
||||
export function updateMerchantOrderAddress(id: number | string, payload: CustomerOrderAddressSaveRequest) {
|
||||
return apiRequest<void>({ method: 'PUT', url: `/merchant/v1/order-addresses/${id}`, data: payload })
|
||||
}
|
||||
|
||||
export function disableMerchantOrderAddress(id: number | string) {
|
||||
return apiRequest<void>({ method: 'DELETE', url: `/merchant/v1/order-addresses/${id}` })
|
||||
}
|
||||
|
||||
export function downloadMerchantFirstLegBatchImportTemplate() {
|
||||
return apiBlobRequest({ method: 'GET', url: '/merchant/v1/orders/first-leg/batch-imports/template' })
|
||||
}
|
||||
|
||||
export function importMerchantFirstLegOrders(file: File, mode: MerchantBatchImportMode, idempotencyKey: string) {
|
||||
const data = new FormData()
|
||||
data.append('file', file)
|
||||
return apiRequest<MerchantBatchImportResponse>({
|
||||
method: 'POST',
|
||||
url: '/merchant/v1/orders/first-leg/batch-imports',
|
||||
params: { mode },
|
||||
headers: { 'Idempotency-Key': idempotencyKey },
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export function createMerchantFirstLegOrder(payload: FirstLegOrderSaveRequest) {
|
||||
return apiRequest<number | string>({
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user