fc-landmark 2.1.3 → 3.0.0
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.
- package/README.md +12 -12
- package/azure-pipelines.yml +45 -45
- package/dist/axios.js +29 -29
- package/dist/core.js +18 -18
- package/dist/globals.js +4 -4
- package/dist/index.js +6 -6
- package/dist/landmark.js +78 -78
- package/dist/shipment.js +212 -201
- package/dist/shipment.js.map +1 -1
- package/dist/tracking.js +92 -92
- package/dist/types.js +2 -2
- package/package.json +42 -31
- package/src/axios.ts +28 -28
- package/src/core.ts +12 -12
- package/src/globals.ts +4 -4
- package/src/index.ts +2 -2
- package/src/landmark.ts +67 -67
- package/src/shipment.spec.ts +179 -0
- package/src/shipment.ts +213 -193
- package/src/tracking.ts +82 -82
- package/src/types.ts +109 -102
- package/tests/shipment.js +456 -456
- package/tests/tracking.js +32 -32
- package/tsconfig.json +14 -12
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# Introduction
|
|
2
|
-
Landmark carrier Integration api
|
|
3
|
-
|
|
4
|
-
# Getting Started
|
|
5
|
-
1. Installation process (npm install fc-landmark)
|
|
6
|
-
2. Software dependencies
|
|
7
|
-
3. Latest releases
|
|
8
|
-
4. API references
|
|
9
|
-
|
|
10
|
-
# Build and Test
|
|
11
|
-
npm run bild and use tests folder
|
|
12
|
-
|
|
1
|
+
# Introduction
|
|
2
|
+
Landmark carrier Integration api
|
|
3
|
+
|
|
4
|
+
# Getting Started
|
|
5
|
+
1. Installation process (npm install fc-landmark)
|
|
6
|
+
2. Software dependencies
|
|
7
|
+
3. Latest releases
|
|
8
|
+
4. API references
|
|
9
|
+
|
|
10
|
+
# Build and Test
|
|
11
|
+
npm run bild and use tests folder
|
|
12
|
+
|
|
13
13
|
# Contribute
|
package/azure-pipelines.yml
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
# Docker
|
|
2
|
-
# Build a Docker image
|
|
3
|
-
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
trigger:
|
|
7
|
-
batch: true
|
|
8
|
-
branches:
|
|
9
|
-
include:
|
|
10
|
-
- ppe
|
|
11
|
-
- feature_*
|
|
12
|
-
- hotfix_*
|
|
13
|
-
|
|
14
|
-
pr:
|
|
15
|
-
autoCancel: true
|
|
16
|
-
branches:
|
|
17
|
-
include:
|
|
18
|
-
- ppe
|
|
19
|
-
- hotfix_*
|
|
20
|
-
- feature_*
|
|
21
|
-
|
|
22
|
-
resources:
|
|
23
|
-
- repo: self
|
|
24
|
-
|
|
25
|
-
variables:
|
|
26
|
-
- group: FC-ECMS
|
|
27
|
-
- name: tag
|
|
28
|
-
value: '$(Build.BuildId)'
|
|
29
|
-
|
|
30
|
-
stages:
|
|
31
|
-
- stage: Publish_npm_package
|
|
32
|
-
displayName: Publish npm package
|
|
33
|
-
jobs:
|
|
34
|
-
- job: Publish
|
|
35
|
-
displayName: Publish package
|
|
36
|
-
timeoutInMinutes: 10
|
|
37
|
-
cancelTimeoutInMinutes: 2
|
|
38
|
-
pool:
|
|
39
|
-
name: flcl-agent-1
|
|
40
|
-
steps:
|
|
41
|
-
- bash: |
|
|
42
|
-
npm install -g npm-cli-login
|
|
43
|
-
npm-cli-login -u $(npm_username) -p $(npm_password) -e $(npm_email) -r http://registry.npmjs.org/
|
|
44
|
-
npm run build
|
|
45
|
-
npm publish
|
|
1
|
+
# Docker
|
|
2
|
+
# Build a Docker image
|
|
3
|
+
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
trigger:
|
|
7
|
+
batch: true
|
|
8
|
+
branches:
|
|
9
|
+
include:
|
|
10
|
+
- ppe
|
|
11
|
+
- feature_*
|
|
12
|
+
- hotfix_*
|
|
13
|
+
|
|
14
|
+
pr:
|
|
15
|
+
autoCancel: true
|
|
16
|
+
branches:
|
|
17
|
+
include:
|
|
18
|
+
- ppe
|
|
19
|
+
- hotfix_*
|
|
20
|
+
- feature_*
|
|
21
|
+
|
|
22
|
+
resources:
|
|
23
|
+
- repo: self
|
|
24
|
+
|
|
25
|
+
variables:
|
|
26
|
+
- group: FC-ECMS
|
|
27
|
+
- name: tag
|
|
28
|
+
value: '$(Build.BuildId)'
|
|
29
|
+
|
|
30
|
+
stages:
|
|
31
|
+
- stage: Publish_npm_package
|
|
32
|
+
displayName: Publish npm package
|
|
33
|
+
jobs:
|
|
34
|
+
- job: Publish
|
|
35
|
+
displayName: Publish package
|
|
36
|
+
timeoutInMinutes: 10
|
|
37
|
+
cancelTimeoutInMinutes: 2
|
|
38
|
+
pool:
|
|
39
|
+
name: flcl-agent-1
|
|
40
|
+
steps:
|
|
41
|
+
- bash: |
|
|
42
|
+
npm install -g npm-cli-login
|
|
43
|
+
npm-cli-login -u $(npm_username) -p $(npm_password) -e $(npm_email) -r http://registry.npmjs.org/
|
|
44
|
+
npm run build
|
|
45
|
+
npm publish
|
package/dist/axios.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const axios_1 = __importDefault(require("axios"));
|
|
7
|
-
const globals_1 = require("./globals");
|
|
8
|
-
const injectRequestId = (data) => {
|
|
9
|
-
if (data) {
|
|
10
|
-
data.requestId = globals_1.MyGlobal.requestId;
|
|
11
|
-
data.rootRequestId = globals_1.MyGlobal.rootRequestId;
|
|
12
|
-
}
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
let axiosMiddleware = {
|
|
16
|
-
get: (urlPath, configs) => {
|
|
17
|
-
return axios_1.default.get(urlPath, configs);
|
|
18
|
-
},
|
|
19
|
-
put: (urlPath, data, configs) => {
|
|
20
|
-
return axios_1.default.put(urlPath, data, configs);
|
|
21
|
-
},
|
|
22
|
-
post: (urlPath, data, configs) => {
|
|
23
|
-
return axios_1.default.post(urlPath, data, configs);
|
|
24
|
-
},
|
|
25
|
-
delete: (urlPath, configs) => {
|
|
26
|
-
return axios_1.default.delete(urlPath, configs);
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
exports.default = axiosMiddleware;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const axios_1 = __importDefault(require("axios"));
|
|
7
|
+
const globals_1 = require("./globals");
|
|
8
|
+
const injectRequestId = (data) => {
|
|
9
|
+
if (data) {
|
|
10
|
+
data.requestId = globals_1.MyGlobal.requestId;
|
|
11
|
+
data.rootRequestId = globals_1.MyGlobal.rootRequestId;
|
|
12
|
+
}
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
let axiosMiddleware = {
|
|
16
|
+
get: (urlPath, configs) => {
|
|
17
|
+
return axios_1.default.get(urlPath, configs);
|
|
18
|
+
},
|
|
19
|
+
put: (urlPath, data, configs) => {
|
|
20
|
+
return axios_1.default.put(urlPath, data, configs);
|
|
21
|
+
},
|
|
22
|
+
post: (urlPath, data, configs) => {
|
|
23
|
+
return axios_1.default.post(urlPath, data, configs);
|
|
24
|
+
},
|
|
25
|
+
delete: (urlPath, configs) => {
|
|
26
|
+
return axios_1.default.delete(urlPath, configs);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
exports.default = axiosMiddleware;
|
|
30
30
|
//# sourceMappingURL=axios.js.map
|
package/dist/core.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setRequredGlobals = void 0;
|
|
7
|
-
const globals_1 = require("./globals");
|
|
8
|
-
const axios_1 = __importDefault(require("./axios"));
|
|
9
|
-
const setRequredGlobals = (logger, flclerror, rootRequestId, requestId) => {
|
|
10
|
-
globals_1.MyGlobal.logger = logger || undefined;
|
|
11
|
-
globals_1.MyGlobal.flclError = flclerror || undefined;
|
|
12
|
-
globals_1.MyGlobal.rootRequestId = rootRequestId || '';
|
|
13
|
-
globals_1.MyGlobal.requestId = requestId || '';
|
|
14
|
-
globals_1.MyGlobal.axios = axios_1.default;
|
|
15
|
-
globals_1.MyGlobal.ship_url = "https://api.landmarkglobal.com/v2/Import.php",
|
|
16
|
-
globals_1.MyGlobal.track_url = "https://api.landmarkglobal.com/v2/Track.php";
|
|
17
|
-
};
|
|
18
|
-
exports.setRequredGlobals = setRequredGlobals;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setRequredGlobals = void 0;
|
|
7
|
+
const globals_1 = require("./globals");
|
|
8
|
+
const axios_1 = __importDefault(require("./axios"));
|
|
9
|
+
const setRequredGlobals = (logger, flclerror, rootRequestId, requestId) => {
|
|
10
|
+
globals_1.MyGlobal.logger = logger || undefined;
|
|
11
|
+
globals_1.MyGlobal.flclError = flclerror || undefined;
|
|
12
|
+
globals_1.MyGlobal.rootRequestId = rootRequestId || '';
|
|
13
|
+
globals_1.MyGlobal.requestId = requestId || '';
|
|
14
|
+
globals_1.MyGlobal.axios = axios_1.default;
|
|
15
|
+
globals_1.MyGlobal.ship_url = "https://api.landmarkglobal.com/v2/Import.php",
|
|
16
|
+
globals_1.MyGlobal.track_url = "https://api.landmarkglobal.com/v2/Track.php";
|
|
17
|
+
};
|
|
18
|
+
exports.setRequredGlobals = setRequredGlobals;
|
|
19
19
|
//# sourceMappingURL=core.js.map
|
package/dist/globals.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MyGlobal = void 0;
|
|
4
|
-
exports.MyGlobal = {};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MyGlobal = void 0;
|
|
4
|
+
exports.MyGlobal = {};
|
|
5
5
|
//# sourceMappingURL=globals.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LandMark = void 0;
|
|
4
|
-
var landmark_1 = require("./landmark");
|
|
5
|
-
Object.defineProperty(exports, "LandMark", { enumerable: true, get: function () { return landmark_1.LandMark; } });
|
|
6
|
-
//export default ECMS;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LandMark = void 0;
|
|
4
|
+
var landmark_1 = require("./landmark");
|
|
5
|
+
Object.defineProperty(exports, "LandMark", { enumerable: true, get: function () { return landmark_1.LandMark; } });
|
|
6
|
+
//export default ECMS;
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/landmark.js
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
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
|
-
exports.LandMark = void 0;
|
|
16
|
-
const shipment_1 = __importDefault(require("./shipment"));
|
|
17
|
-
const tracking_1 = __importDefault(require("./tracking"));
|
|
18
|
-
const core_1 = require("./core");
|
|
19
|
-
const globals_1 = require("./globals");
|
|
20
|
-
class LandMark {
|
|
21
|
-
constructor(username, password, clientId, test, vendorEORINumber, vendorIOSSNumber, logger, flclerror, rootRequestId, requestId) {
|
|
22
|
-
this.username = username;
|
|
23
|
-
this.password = password;
|
|
24
|
-
this.test = test;
|
|
25
|
-
this.clientId = clientId;
|
|
26
|
-
this.vendorEORINumber = vendorEORINumber;
|
|
27
|
-
this.vendorIOSSNumber = vendorIOSSNumber;
|
|
28
|
-
(0, core_1.setRequredGlobals)(logger, flclerror, rootRequestId, requestId);
|
|
29
|
-
}
|
|
30
|
-
createShipmet(args, dangerousGoodsDeatils = "", regionValue = "") {
|
|
31
|
-
var _a, _b, _c, _d, _e;
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
try {
|
|
34
|
-
let shipObj = new shipment_1.default();
|
|
35
|
-
(_a = globals_1.MyGlobal.logger) === null || _a === void 0 ? void 0 : _a.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMarkShipmentInput', propertyValue: args });
|
|
36
|
-
let landmarkShipmentRequest = shipObj.buildShipmentRequest(args, dangerousGoodsDeatils, this.username, this.password, this.test, this.clientId, this.vendorEORINumber, this.vendorIOSSNumber, regionValue);
|
|
37
|
-
(_b = globals_1.MyGlobal.logger) === null || _b === void 0 ? void 0 : _b.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMarkShipmentRequest', propertyValue: landmarkShipmentRequest });
|
|
38
|
-
let landmarkShipmentRes = yield shipObj.createShipment(landmarkShipmentRequest);
|
|
39
|
-
if (landmarkShipmentRes.hasOwnProperty("ImportResponse") && landmarkShipmentRes['ImportResponse']['Errors']) {
|
|
40
|
-
const rawErrors = landmarkShipmentRes['ImportResponse']['Errors']['Error'];
|
|
41
|
-
const errorArray = Array.isArray(rawErrors) ? rawErrors : [rawErrors];
|
|
42
|
-
const messages = errorArray.map((e) => { var _a, _b; return (_b = (_a = e === null || e === void 0 ? void 0 : e['ErrorMessage']) === null || _a === void 0 ? void 0 : _a['_text']) !== null && _b !== void 0 ? _b : 'Unknown Landmark error'; }).join('; ');
|
|
43
|
-
throw new Error(messages);
|
|
44
|
-
}
|
|
45
|
-
let response = shipObj.buildResponse(landmarkShipmentRes, args);
|
|
46
|
-
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'response', propertyValue: response });
|
|
47
|
-
return response;
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
(_d = globals_1.MyGlobal.logger) === null || _d === void 0 ? void 0 : _d.error((_e = globals_1.MyGlobal.flclError) === null || _e === void 0 ? void 0 : _e.create({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMark_ERROR', cause: e, message: 'Exception while creating shipment in Landmark' }));
|
|
51
|
-
throw e;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
getTrackingInfo(args) {
|
|
56
|
-
var _a, _b, _c, _d, _e;
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
try {
|
|
59
|
-
let trackObj = new tracking_1.default();
|
|
60
|
-
(_a = globals_1.MyGlobal.logger) === null || _a === void 0 ? void 0 : _a.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'LandmarkInput', propertyValue: args });
|
|
61
|
-
let landmarkTrackRequest = trackObj.buildTrackingRequest(args, this.username, this.password, this.test, this.clientId);
|
|
62
|
-
(_b = globals_1.MyGlobal.logger) === null || _b === void 0 ? void 0 : _b.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'LandmarkTrackRequest', propertyValue: landmarkTrackRequest });
|
|
63
|
-
let landMarkTrackingRes = yield trackObj.trackInfo(landmarkTrackRequest);
|
|
64
|
-
if (landMarkTrackingRes.hasOwnProperty("TrackResponse") && landMarkTrackingRes['TrackResponse']['Errors']) {
|
|
65
|
-
throw new Error(landMarkTrackingRes['TrackResponse']['Errors']['Error']['ErrorMessage']['_text']);
|
|
66
|
-
}
|
|
67
|
-
let response = trackObj.buildResponse(landMarkTrackingRes, args);
|
|
68
|
-
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'response', propertyValue: response });
|
|
69
|
-
return response;
|
|
70
|
-
}
|
|
71
|
-
catch (e) {
|
|
72
|
-
(_d = globals_1.MyGlobal.logger) === null || _d === void 0 ? void 0 : _d.error((_e = globals_1.MyGlobal.flclError) === null || _e === void 0 ? void 0 : _e.create({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'landMark_ERROR', cause: e, message: 'Exception while get trackinfo in Landmark' }));
|
|
73
|
-
throw e;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.LandMark = LandMark;
|
|
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
|
+
exports.LandMark = void 0;
|
|
16
|
+
const shipment_1 = __importDefault(require("./shipment"));
|
|
17
|
+
const tracking_1 = __importDefault(require("./tracking"));
|
|
18
|
+
const core_1 = require("./core");
|
|
19
|
+
const globals_1 = require("./globals");
|
|
20
|
+
class LandMark {
|
|
21
|
+
constructor(username, password, clientId, test, vendorEORINumber, vendorIOSSNumber, logger, flclerror, rootRequestId, requestId) {
|
|
22
|
+
this.username = username;
|
|
23
|
+
this.password = password;
|
|
24
|
+
this.test = test;
|
|
25
|
+
this.clientId = clientId;
|
|
26
|
+
this.vendorEORINumber = vendorEORINumber;
|
|
27
|
+
this.vendorIOSSNumber = vendorIOSSNumber;
|
|
28
|
+
(0, core_1.setRequredGlobals)(logger, flclerror, rootRequestId, requestId);
|
|
29
|
+
}
|
|
30
|
+
createShipmet(args, dangerousGoodsDeatils = "", regionValue = "") {
|
|
31
|
+
var _a, _b, _c, _d, _e;
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
try {
|
|
34
|
+
let shipObj = new shipment_1.default();
|
|
35
|
+
(_a = globals_1.MyGlobal.logger) === null || _a === void 0 ? void 0 : _a.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMarkShipmentInput', propertyValue: args });
|
|
36
|
+
let landmarkShipmentRequest = shipObj.buildShipmentRequest(args, dangerousGoodsDeatils, this.username, this.password, this.test, this.clientId, this.vendorEORINumber, this.vendorIOSSNumber, regionValue);
|
|
37
|
+
(_b = globals_1.MyGlobal.logger) === null || _b === void 0 ? void 0 : _b.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMarkShipmentRequest', propertyValue: landmarkShipmentRequest });
|
|
38
|
+
let landmarkShipmentRes = yield shipObj.createShipment(landmarkShipmentRequest);
|
|
39
|
+
if (landmarkShipmentRes.hasOwnProperty("ImportResponse") && landmarkShipmentRes['ImportResponse']['Errors']) {
|
|
40
|
+
const rawErrors = landmarkShipmentRes['ImportResponse']['Errors']['Error'];
|
|
41
|
+
const errorArray = Array.isArray(rawErrors) ? rawErrors : [rawErrors];
|
|
42
|
+
const messages = errorArray.map((e) => { var _a, _b; return (_b = (_a = e === null || e === void 0 ? void 0 : e['ErrorMessage']) === null || _a === void 0 ? void 0 : _a['_text']) !== null && _b !== void 0 ? _b : 'Unknown Landmark error'; }).join('; ');
|
|
43
|
+
throw new Error(messages);
|
|
44
|
+
}
|
|
45
|
+
let response = shipObj.buildResponse(landmarkShipmentRes, args);
|
|
46
|
+
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'response', propertyValue: response });
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
(_d = globals_1.MyGlobal.logger) === null || _d === void 0 ? void 0 : _d.error((_e = globals_1.MyGlobal.flclError) === null || _e === void 0 ? void 0 : _e.create({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMark_ERROR', cause: e, message: 'Exception while creating shipment in Landmark' }));
|
|
51
|
+
throw e;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
getTrackingInfo(args) {
|
|
56
|
+
var _a, _b, _c, _d, _e;
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
try {
|
|
59
|
+
let trackObj = new tracking_1.default();
|
|
60
|
+
(_a = globals_1.MyGlobal.logger) === null || _a === void 0 ? void 0 : _a.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'LandmarkInput', propertyValue: args });
|
|
61
|
+
let landmarkTrackRequest = trackObj.buildTrackingRequest(args, this.username, this.password, this.test, this.clientId);
|
|
62
|
+
(_b = globals_1.MyGlobal.logger) === null || _b === void 0 ? void 0 : _b.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'LandmarkTrackRequest', propertyValue: landmarkTrackRequest });
|
|
63
|
+
let landMarkTrackingRes = yield trackObj.trackInfo(landmarkTrackRequest);
|
|
64
|
+
if (landMarkTrackingRes.hasOwnProperty("TrackResponse") && landMarkTrackingRes['TrackResponse']['Errors']) {
|
|
65
|
+
throw new Error(landMarkTrackingRes['TrackResponse']['Errors']['Error']['ErrorMessage']['_text']);
|
|
66
|
+
}
|
|
67
|
+
let response = trackObj.buildResponse(landMarkTrackingRes, args);
|
|
68
|
+
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'response', propertyValue: response });
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
(_d = globals_1.MyGlobal.logger) === null || _d === void 0 ? void 0 : _d.error((_e = globals_1.MyGlobal.flclError) === null || _e === void 0 ? void 0 : _e.create({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'landMark_ERROR', cause: e, message: 'Exception while get trackinfo in Landmark' }));
|
|
73
|
+
throw e;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.LandMark = LandMark;
|
|
79
79
|
//# sourceMappingURL=landmark.js.map
|