From 9e041416bdc09a3f34d6f2da72bde6788770e39b Mon Sep 17 00:00:00 2001 From: Paul Rill <55083975+PaulRill00@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:39:48 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20added=20CsvOrder=20model=20?= =?UTF-8?q?+=20endpoints=20(#7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: :sparkles: added CsvOrder model + endpoints * docs: :memo: updated docs about CsvOrder * fix: PR feedback * chore: type error --------- Co-authored-by: Koen van Staveren --- docs/CsvOrder.md | 98 ++++++++++++++++++ docs/PrintOne.md | 36 +++++++ src/PrintOne.ts | 72 ++++++++++--- src/enums/CsvStatus.ts | 29 ++++++ src/index.ts | 2 + src/models/CsvOrder.ts | 142 ++++++++++++++++++++++++++ src/models/_interfaces/ICsvOrder.ts | 24 +++++ test/CsvOrder.spec.ts | 112 +++++++++++++++++++++ test/PrintOne.spec.ts | 151 +++++++++++++++++++++++++++- test/assets/test.csv | 3 + 10 files changed, 652 insertions(+), 17 deletions(-) create mode 100644 docs/CsvOrder.md create mode 100644 src/enums/CsvStatus.ts create mode 100644 src/models/CsvOrder.ts create mode 100644 src/models/_interfaces/ICsvOrder.ts create mode 100644 test/CsvOrder.spec.ts create mode 100644 test/assets/test.csv diff --git a/docs/CsvOrder.md b/docs/CsvOrder.md new file mode 100644 index 0000000..abe07eb --- /dev/null +++ b/docs/CsvOrder.md @@ -0,0 +1,98 @@ +Contains all information about a given CsvOrder + +# Fields + +| Name | Type | Description | +| --------------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | `string` | The ID of the order. | +| `templateId` | `string` | The ID of the template the order is based on. | +| `finish` | `string` | The finish of the order. Can be `GLOSSY` or `MATT`. | +| `format` | `string` | The format of the order. Can be `POSTCARD_A5`, `POSTCARD_A6`, `POSTCARD_SQ14` or `GREETINGCARD_SQ15`. | +| `mergeVariableMapping` | `object` | The merge variables of the order. Keys are the merge variable names. | +| `sender` | [`Address`](#Address) \| `undefined` | The sender of the order. | +| `recipientMapping` | [`Address`](#Address) | The mapping of the recipient. | +| `definitiveCountryId` | `string` | The ID of the definitive country of the order. | +| `billingId` | `string` \| `undefined` | The ID assigned to the csv order by the customer. | +| `isBillable` | `boolean` | Whether the csv order is billable. True when an live API key is used, false when a test API key is used. | +| `status` | `string` | The status of the csv order. Can be `order_created` or `order_processed` | +| `friendlyStatus` | `string` | The friendly status of the csv order. Can be `Processing` or `Success` | +| `estimatedOrderCount` | `number` | The amount of initial orders in the CSV +| `failedOrderCount` | `number` | The amount of orders which have failed to be processed +| `processedOrderCount` | `number` | The amount of orders which have successfully been processed +| `totalOrderCount` | `number` | The total amount of orders failed or processed +| `sendDate` | `Date` | The date the order will be sent on. | +| `createdAt` | `Date` | The date and time the order was created. | +| `updatedAt` | `Date` | The date and time the order was last updated. | + +# Methods + +## `.getTemplate()` + +Get the template the order is based on. Uses [`PrintOne.getTemplate()`](./PrintOne#gettemplateid). + +**Returns: [`Promise