feat(client): expose customs receipt and final files
This commit is contained in:
@@ -32,9 +32,10 @@ export interface MerchantCustomsDocument {
|
||||
inboundIds: string[]
|
||||
inboundCodes: string[]
|
||||
frozen: boolean
|
||||
completion: MerchantCustomsFile | null
|
||||
receipt: MerchantCustomsFile | null
|
||||
receiptStatus: 'PENDING' | 'CONFIRMED' | 'REJECTED' | null
|
||||
receiptRejectReason: string | null
|
||||
finalDocument: MerchantCustomsFile | null
|
||||
}
|
||||
|
||||
export interface MerchantCustomsContainer {
|
||||
@@ -186,10 +187,17 @@ export function downloadMerchantCustomsSource(document: MerchantCustomsDocument)
|
||||
return download(`/merchant/v1/customs/documents/${encodedId(document.documentId)}/download`, document.source.fileName)
|
||||
}
|
||||
|
||||
export function downloadMerchantCustomsCompletion(document: MerchantCustomsDocument) {
|
||||
export function downloadMerchantCustomsReceipt(document: MerchantCustomsDocument) {
|
||||
return download(
|
||||
`/merchant/v1/customs/documents/${encodedId(document.documentId)}/completion/download`,
|
||||
document.completion?.fileName || `customs-completion-${document.documentId}`,
|
||||
`/merchant/v1/customs/documents/${encodedId(document.documentId)}/receipt/download`,
|
||||
document.receipt?.fileName || `customs-receipt-${document.documentId}`,
|
||||
)
|
||||
}
|
||||
|
||||
export function downloadMerchantCustomsFinal(document: MerchantCustomsDocument) {
|
||||
return download(
|
||||
`/merchant/v1/customs/documents/${encodedId(document.documentId)}/final/download`,
|
||||
document.finalDocument?.fileName || `customs-final-${document.documentId}`,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -198,7 +206,7 @@ export function confirmMerchantCustomsReceipt(document: MerchantCustomsDocument)
|
||||
method: 'POST',
|
||||
url: `/merchant/v1/customs/documents/${encodedId(document.documentId)}/receipt/confirm`,
|
||||
headers: { 'Idempotency-Key': createIdempotencyKey(`merchant-customs-receipt-confirm-${document.documentId}`) },
|
||||
data: { expectedVersion: document.completion?.version ?? 0, confirm: true, remark: null },
|
||||
data: { expectedVersion: document.receipt?.version ?? 0, confirm: true, remark: null },
|
||||
})
|
||||
}
|
||||
|
||||
@@ -207,7 +215,7 @@ export function rejectMerchantCustomsReceipt(document: MerchantCustomsDocument,
|
||||
method: 'POST',
|
||||
url: `/merchant/v1/customs/documents/${encodedId(document.documentId)}/receipt/reject`,
|
||||
headers: { 'Idempotency-Key': createIdempotencyKey(`merchant-customs-receipt-reject-${document.documentId}`) },
|
||||
data: { expectedVersion: document.completion?.version ?? 0, confirm: false, remark: reason },
|
||||
data: { expectedVersion: document.receipt?.version ?? 0, confirm: false, remark: reason },
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user