Skip to content

Commit

Permalink
Merge pull request #18 from Print-one/main
Browse files Browse the repository at this point in the history
Main -> Next
  • Loading branch information
SophiaH67 authored May 16, 2024
2 parents 6d0dade + 9f08b1c commit 44a084a
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 47 deletions.
42 changes: 21 additions & 21 deletions docs/CsvOrder.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ 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. |
| 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

Expand Down
35 changes: 19 additions & 16 deletions docs/PrintOne.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ Create a new csv order.

**Parameters**

| Name | Type | Description |
| ------ | -------- | ---------------------------------------------------------------------------------------- |
| Name | Type | Description |
| ------ | -------- | ------------------------------------------------------------------------------------------------- |
| `data` | `object` | The data to create the order with. See [`CsvOrder`](./CsvOrder#createcsvorderdata) for more info. |

**Returns: [`Promise<CsvOrder>`](./CsvOrder)**
Expand All @@ -262,21 +262,21 @@ Create a new csv order.

```js
const order = await client.createCsvOrder({
mapping: {
recipient: {
city: "{{City}}",
name: "{{FirstName}} {{LastName}}",
address: "{{Street}} {{HouseNr}}",
country: "{{Country}}",
postalCode: "{{ZIP}}",
},
mergeVariables: {
name: "{{FirstName}}",
coupon: "{{Coupon}}",
},
mapping: {
recipient: {
city: "{{City}}",
name: "{{FirstName}} {{LastName}}",
address: "{{Street}} {{HouseNr}}",
country: "{{Country}}",
postalCode: "{{ZIP}}",
},
template: template,
file: file,
mergeVariables: {
name: "{{FirstName}}",
coupon: "{{Coupon}}",
},
},
template: template,
file: file,
});
```

Expand All @@ -299,4 +299,7 @@ Get a csv order by its ID.
```js
const csvOrder = await client.getCsvOrder("example-order-id");
```

```
```
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"lint": "bsm",
"prepublishOnly": "bsm build",
"semantic-release": "semantic-release",
"test": "bsm test.coverage",
"setup": "bsm build"
"setup": "bsm build",
"test": "bsm test.coverage"
},
"types": "lib/index.d.ts",
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/PrintOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { ICsvOrder } from "./models/_interfaces/ICsvOrder";
import { Batch, CreateBatch } from "./models/Batch";
import { IBatch } from "./models/_interfaces/IBatch";
import { BatchStatus } from "./enums/BatchStatus";
import { stringify } from "ts-jest";

export type RequestHandler = new (
token: string,
Expand Down
2 changes: 1 addition & 1 deletion src/models/Order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,6 @@ export class Order {
}

protected get urlPrefix(): string {
return this.batchId ? `batches/${this.batchId}/` : "";;
return this.batchId ? `batches/${this.batchId}/` : "";
}
}
12 changes: 6 additions & 6 deletions test/Batch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ describe("getOrders", function () {
});
});

describe('BatchOrder', function () {
it('should be able to cancel Order', async function() {
describe("BatchOrder", function () {
it("should be able to cancel Order", async function () {
// arrange
const order = await batch.createOrder({
recipient: {
Expand All @@ -423,10 +423,10 @@ describe('BatchOrder', function () {
await order.cancel();

// assert
expect(order.status).toEqual('order_cancelled');
})
expect(order.status).toEqual("order_cancelled");
});

it('should be able to refresh Order', async function () {
it("should be able to refresh Order", async function () {
// arrange
const order = await batch.createOrder({
recipient: {
Expand All @@ -447,4 +447,4 @@ describe('BatchOrder', function () {
// assert
expect(order.status).not.toEqual("order_created");
}, 30000);
})
});

0 comments on commit 44a084a

Please sign in to comment.