@companieshouse/api-sdk-node 2.0.24 → 2.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { ItemOptionsDeliveryTimescaleConfigurable } from "../types";
1
2
  export interface CertificateItemResource {
2
3
  company_name: string;
3
4
  company_number: string;
@@ -120,13 +121,12 @@ export interface ItemCosts {
120
121
  itemCost: string;
121
122
  productType: string;
122
123
  }
123
- export interface ItemOptions {
124
+ export interface ItemOptions extends ItemOptionsDeliveryTimescaleConfigurable {
124
125
  certificateType: string;
125
126
  collectionLocation: string;
126
127
  companyType: string;
127
128
  contactNumber: string;
128
129
  deliveryMethod: string;
129
- deliveryTimescale: string;
130
130
  designatedMemberDetails?: DesignatedMemberDetails;
131
131
  directorDetails?: DirectorOrSecretaryDetails;
132
132
  forename: string;
@@ -1,3 +1,4 @@
1
+ import { ItemOptionsDeliveryTimescaleConfigurable } from "../types";
1
2
  export interface CertifiedCopyItemResource {
2
3
  company_name: string;
3
4
  company_number: string;
@@ -66,14 +67,13 @@ export interface ItemCosts {
66
67
  itemCost: string;
67
68
  productType: string;
68
69
  }
69
- export interface ItemOptions {
70
- collectionLocation?: string;
71
- contactNumber?: string;
72
- deliveryMethod?: string;
73
- deliveryTimescale?: string;
74
- filingHistoryDocuments?: FilingHistoryDocuments[];
75
- forename?: string;
76
- surname?: string;
70
+ export interface ItemOptions extends ItemOptionsDeliveryTimescaleConfigurable {
71
+ collectionLocation: string;
72
+ contactNumber: string;
73
+ deliveryMethod: string;
74
+ filingHistoryDocuments: FilingHistoryDocuments[];
75
+ forename: string;
76
+ surname: string;
77
77
  }
78
78
  export interface Links {
79
79
  self: string;
@@ -88,6 +88,15 @@ export interface FilingHistoryDocuments {
88
88
  }
89
89
  export interface CertifiedCopyItemPatchRequest {
90
90
  customerReference?: string;
91
- itemOptions?: ItemOptions;
91
+ itemOptions?: PatchItemOptions;
92
92
  quantity?: number;
93
93
  }
94
+ export interface PatchItemOptions {
95
+ collectionLocation?: string;
96
+ contactNumber?: string;
97
+ deliveryMethod?: string;
98
+ deliveryTimescale?: string;
99
+ filingHistoryDocuments?: FilingHistoryDocuments[];
100
+ forename?: string;
101
+ surname?: string;
102
+ }
@@ -18,13 +18,13 @@ export interface Checkout {
18
18
  self: string;
19
19
  payment: string;
20
20
  };
21
- paidAt: string;
21
+ paidAt?: string;
22
22
  checkedOutBy: {
23
23
  email: string;
24
24
  id: string;
25
25
  };
26
26
  status: string;
27
- paymentReference: string;
27
+ paymentReference?: string;
28
28
  reference: string;
29
29
  totalOrderCost: string;
30
30
  }
@@ -0,0 +1,9 @@
1
+ import { IHttpClient } from "../../../http";
2
+ import { ApiResult } from "../../../services/resource";
3
+ import { Item } from "../order";
4
+ export default class OrderItemService {
5
+ private readonly client;
6
+ private static readonly EXCLUDED_FIELDS;
7
+ constructor(client: IHttpClient);
8
+ getOrderItem(orderId: string, itemId: string): Promise<ApiResult<Item>>;
9
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const result_1 = require("../../../services/result");
16
+ const mapping_1 = __importDefault(require("../../../mapping/mapping"));
17
+ class OrderItemService {
18
+ constructor(client) {
19
+ this.client = client;
20
+ }
21
+ getOrderItem(orderId, itemId) {
22
+ var _a;
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ const resp = yield this.client.httpGet(`/orders/${orderId}/items/${itemId}`);
25
+ if (resp.error) {
26
+ return result_1.failure({
27
+ httpStatusCode: resp.status,
28
+ errors: ((_a = resp === null || resp === void 0 ? void 0 : resp.error) === null || _a === void 0 ? void 0 : _a.errors) || resp.error
29
+ });
30
+ }
31
+ const body = resp.body;
32
+ const result = mapping_1.default.camelCaseKeys(body, OrderItemService.EXCLUDED_FIELDS);
33
+ return result_1.success(result);
34
+ });
35
+ }
36
+ }
37
+ exports.default = OrderItemService;
38
+ OrderItemService.EXCLUDED_FIELDS = {
39
+ deep: true,
40
+ stopPaths: [
41
+ "description_values",
42
+ "item_options.filing_history_description_values",
43
+ "item_options.filing_history_documents.filing_history_description_values" // certified copies
44
+ ]
45
+ };
46
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../src/services/order/order-item/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,qDAA4D;AAC5D,uEAA+C;AAG/C,MAAqB,gBAAgB;IAUjC,YAA8B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAI,CAAC;IAEzC,YAAY,CAAE,OAAe,EAAE,MAAc;;;YACtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,OAAO,UAAU,MAAM,EAAE,CAAC,CAAC;YAE7E,IAAI,IAAI,CAAC,KAAK,EAAE;gBACZ,OAAO,gBAAO,CAAC;oBACX,cAAc,EAAE,IAAI,CAAC,MAAM;oBAC3B,MAAM,EAAE,OAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,MAAM,KAAI,IAAI,CAAC,KAAK;iBAC5C,CAAC,CAAC;aACN;YAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAoB,CAAC;YAEvC,MAAM,MAAM,GAAS,iBAAO,CAAC,aAAa,CAAC,IAAI,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;YACnF,OAAO,gBAAO,CAAC,MAAM,CAAC,CAAC;;KAC1B;;AA1BL,mCA2BC;AA1B2B,gCAAe,GAAG;IACtC,IAAI,EAAE,IAAI;IACV,SAAS,EAAE;QACP,oBAAoB;QACpB,gDAAgD;QAChD,yEAAyE,CAAC,mBAAmB;KAChG;CACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export interface ItemOptionsDeliveryTimescaleConfigurable {
2
+ deliveryTimescale: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/order/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companieshouse/api-sdk-node",
3
- "version": "2.0.24",
3
+ "version": "2.0.27",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [