@companieshouse/api-sdk-node 2.0.31 → 2.0.32
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.
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IHttpClient } from "../../../http";
|
|
2
|
+
import { Result } from "../../../services/result";
|
|
3
|
+
import { Item } from "../order";
|
|
4
|
+
export declare type CheckoutItemErrorResponse = {
|
|
5
|
+
httpStatusCode?: number;
|
|
6
|
+
error?: string;
|
|
7
|
+
};
|
|
8
|
+
export default class CheckoutItemService {
|
|
9
|
+
private readonly client;
|
|
10
|
+
private static readonly EXCLUDED_FIELDS;
|
|
11
|
+
constructor(client: IHttpClient);
|
|
12
|
+
getCheckoutItem(orderId: string, itemId: string): Promise<Result<Item, CheckoutItemErrorResponse>>;
|
|
13
|
+
}
|
|
@@ -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 CheckoutItemService {
|
|
18
|
+
constructor(client) {
|
|
19
|
+
this.client = client;
|
|
20
|
+
}
|
|
21
|
+
getCheckoutItem(orderId, itemId) {
|
|
22
|
+
var _a;
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const resp = yield this.client.httpGet(`/checkouts/${orderId}/items/${itemId}`);
|
|
25
|
+
if (resp.error) {
|
|
26
|
+
return result_1.failure({
|
|
27
|
+
httpStatusCode: resp.status,
|
|
28
|
+
error: (_a = resp.error) === null || _a === void 0 ? void 0 : _a.error
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const body = resp.body;
|
|
32
|
+
const result = mapping_1.default.camelCaseKeys(body, CheckoutItemService.EXCLUDED_FIELDS);
|
|
33
|
+
return result_1.success(result);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = CheckoutItemService;
|
|
38
|
+
CheckoutItemService.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/checkout-item/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qDAAoE;AACpE,uEAA+C;AAQ/C,MAAqB,mBAAmB;IAUpC,YAA8B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAI,CAAC;IAEzC,eAAe,CAAE,OAAe,EAAE,MAAc;;;YACzD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,OAAO,UAAU,MAAM,EAAE,CAAC,CAAC;YAEhF,IAAI,IAAI,CAAC,KAAK,EAAE;gBACZ,OAAO,gBAAO,CAAC;oBACX,cAAc,EAAE,IAAI,CAAC,MAAM;oBAC3B,KAAK,QAAE,IAAI,CAAC,KAAK,0CAAE,KAAK;iBAC3B,CAAC,CAAC;aACN;YAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAoB,CAAC;YAEvC,MAAM,MAAM,GAAS,iBAAO,CAAC,aAAa,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;YACtF,OAAO,gBAAO,CAAC,MAAM,CAAC,CAAC;;KAC1B;;AA1BL,sCA2BC;AA1B2B,mCAAe,GAAG;IACtC,IAAI,EAAE,IAAI;IACV,SAAS,EAAE;QACP,oBAAoB;QACpB,gDAAgD;QAChD,yEAAyE,CAAC,mBAAmB;KAChG;CACJ,CAAC"}
|