Skip to content

Commit

Permalink
fix!: use parcel_contents over deprecated contents, closes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Gomah committed Mar 25, 2023
1 parent 919088f commit 75bb1aa
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
28 changes: 16 additions & 12 deletions docs/content/en/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,14 @@ const order = await client.orders.create({
},
instructions: 'Give directly to Clark',
},
contents: {
description: 'T-shirt',
value: '20.00',
country_of_origin: 'CN',
hs_code: '610910',
},
parcel_contents: [
{
description: 'T-shirt',
value: '20.00',
country_of_origin: 'CN',
hs_code: '610910',
},
],
});
```

Expand Down Expand Up @@ -259,12 +261,14 @@ You can prevent duplicate orders by using an **Idempotency Key** header with thi
},
"instructions": "Give directly to Clark"
},
"contents": {
"description": "T-shirt",
"value": "20.00",
"country_of_origin": "China",
"hs_code": "610910"
}
"parcel_contents": [
{
"description": "T-shirt",
"value": "20.00",
"country_of_origin": "China",
"hs_code": "610910"
}
]
}
```

Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ export namespace Sendle {
/**
* Description, value & country of origin must be provided when creating an international order.
*/
contents?: {
parcel_contents?: Array<{
/**
* Detailed description of the parcel contents for customs purposes.
* Must be between 3 and 300 characters in length. Examples: Shoes, hat, sunglasses
Expand All @@ -543,7 +543,7 @@ export namespace Sendle {
* Must contain 6–10 digits with separating dots.
*/
hs_code: string;
};
}>;
}

export interface Order {
Expand Down
14 changes: 8 additions & 6 deletions test/orders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,14 @@ describe('Orders', () => {
},
instructions: 'Give directly to Clark',
},
contents: {
description: 'T-shirt',
value: '20.00',
country_of_origin: 'China',
hs_code: '610910',
},
parcel_contents: [
{
description: 'T-shirt',
value: '20.00',
country_of_origin: 'China',
hs_code: '610910',
},
],
});

expect(order).toMatchSnapshot({
Expand Down

0 comments on commit 75bb1aa

Please sign in to comment.