This repository has been archived by the owner on Oct 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommercialInvoice.ts
83 lines (83 loc) · 2.25 KB
/
CommercialInvoice.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* Auto-generated file. Do not change.
*/
import { Address } from './Address'
import { CommercialInvoiceLineItem } from './CommercialInvoiceLineItem'
import { CustomsInvolvedParty } from './CustomsInvolvedParty'
import { Metadata } from './Metadata'
import { Money } from './Money'
import { Type } from './Type'
import { Volume } from './Volume'
import { Weight } from './Weight'
import { ApiObjectRef } from '../types/ApiObjectRef'
import { linkObject } from '../links'
import { Option } from 'fp-ts/lib/Option'
import { ResolvableObject } from '../types/Link'
import { TypedApiObject } from '../types/TypedApiObject'
export type CommercialInvoice = {
/**
* Type of the object. Always /commercial_invoice for this object.
*/
readonly _object: Type.CommercialInvoice
/**
* Unique identifier for the commercial invoice.
*
* JSON-schema: string
* @example "abcxyz-23456-def"
*/
readonly id?: string
/**
* Invoice number on the commercial invoice, typically used for display purposes.
*
* JSON-schema: string
* @example "INVOICE-04-05-2020"
*/
readonly invoice_number?: string
/**
* JSON-schema: array
*/
readonly line_items?: CommercialInvoiceLineItem[]
/**
* JSON-schema: array
*/
readonly involved_parties?: CustomsInvolvedParty[]
/**
* Whether there was a related parties transaction as defined by CBP.
*
* JSON-schema: boolean
* @example false
*/
readonly is_related_parties?: boolean
/**
* JSON-schema: array
*/
readonly manufacturer_addresses?: Address[]
readonly metadata?: Metadata
readonly shipment?: ApiObjectRef
/**
* Total units on this commercial invoice.
*
* JSON-schema: string
* @example "123.0"
*/
readonly total_unit_count?: string
readonly total_value?: Money
readonly total_volume?: Volume
readonly total_weight?: Weight
}
export type LiftedCommercialInvoice = TypedApiObject &
Omit<CommercialInvoice, 'shipment'> & {
readonly shipment: Option<ResolvableObject>
}
/**
* Lifts an object return from a Flexport API responses into the SDK domain by augmenting them with higher level properties.
*/
export const liftCommercialInvoice = (
original: CommercialInvoice,
): LiftedCommercialInvoice => {
const { shipment, ...rest } = original
return {
...rest,
shipment: linkObject(shipment),
}
}