u
This commit is contained in:
@@ -15,25 +15,25 @@ Creates a shipping (package) for a shipment manifest. The number is allocated fr
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input` | `object` | Shipping input. |
|
||||
| `input.manifestId` | `number` | The shipment manifest id. |
|
||||
| `input.carrierId` | `number` | The carrier id. |
|
||||
| `input.type` | `string` | Shipping type. |
|
||||
| `input.state` | `string` | Shipping state ('shipped' or other). |
|
||||
| `[input.trackingCode]` | `string` | Carrier tracking code. |
|
||||
| `[input.carrier]` | `string` | Carrier name. |
|
||||
| `[input.warehouseId]` | `number` | Optional warehouse ID for stock deduction (defaults to company's first warehouse). |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, manifestId: number, number: string, trackingCode: string|null, carrier: string|null, type: string, state: string}>`
|
||||
`Promise<{id: number, manifestId: number, number: string, trackingCode: string|null, carrierId: number, carrier: string|null, type: string, state: string}>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If manifest is not found, manifest is not a shipment, or input is invalid.
|
||||
`Error` — If manifest is not found, carrier is not found, manifest is not a shipment, or input is invalid.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
await store.shipping.create(googleAuthId, { manifestId: 42, type: 'parcel', state: 'shipped', trackingCode: '1Z999', carrier: 'UPS' });
|
||||
await store.shipping.create(googleAuthId, { manifestId: 42, carrierId: 1, type: 'parcel', state: 'shipped', trackingCode: '1Z999' });
|
||||
```
|
||||
|
||||
## `shipping.delete`
|
||||
|
||||
Reference in New Issue
Block a user