fc-landmark 2.0.1 → 2.1.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/dist/axios.js +29 -29
- package/dist/axios.js.map +1 -1
- package/dist/core.js +18 -18
- package/dist/globals.js +4 -4
- package/dist/index.js +6 -6
- package/dist/landmark.js +75 -75
- package/dist/landmark.js.map +1 -1
- package/dist/shipment.js +200 -199
- package/dist/shipment.js.map +1 -1
- package/dist/tracking.js +92 -92
- package/dist/tracking.js.map +1 -1
- package/dist/types.js +2 -2
- package/package.json +1 -1
- package/src/landmark.ts +2 -2
- package/src/shipment.ts +3 -2
- package/tests/shipment.js +6 -13
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/axios.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../src/axios.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,uCAA4C;AAG5C,MAAM,eAAe,GAAG,CAAC,IAAkB,EAAE,EAAE;IAC3C,IAAG,IAAI,EAAE
|
|
1
|
+
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../src/axios.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,uCAA4C;AAG5C,MAAM,eAAe,GAAG,CAAC,IAAkB,EAAE,EAAE;IAC3C,IAAG,IAAI,EAAE;QACL,IAAI,CAAC,SAAS,GAAG,kBAAG,CAAC,SAAS,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,kBAAG,CAAC,aAAa,CAAC;KAC1C;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAA;AAED,IAAI,eAAe,GAAwB;IACvC,GAAG,EAAE,CAAC,OAAe,EAAE,OAAqB,EAAE,EAAE;QAC5C,OAAO,eAAK,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IACD,GAAG,EAAE,CAAC,OAAe,EAAE,IAAkB,EAAE,OAAqB,EAAE,EAAE;QAChE,OAAO,eAAK,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,IAAkB,EAAE,OAAqB,EAAE,EAAE;QACjE,OAAO,eAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IACD,MAAM,EAAE,CAAC,OAAe,EAAE,OAAqB,EAAE,EAAE;QAC/C,OAAO,eAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;CACJ,CAAA;AAED,kBAAe,eAAe,CAAC"}
|
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,76 +1,76 @@
|
|
|
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(
|
|
31
|
-
|
|
32
|
-
|
|
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);
|
|
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
|
-
throw new Error(landmarkShipmentRes['ImportResponse']['Errors']['Error']['ErrorMessage']['_text']);
|
|
41
|
-
}
|
|
42
|
-
let response = shipObj.buildResponse(landmarkShipmentRes, args);
|
|
43
|
-
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'response', propertyValue: response });
|
|
44
|
-
return response;
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
(_d = globals_1.MyGlobal.logger) === null || _d === void 0 ? void 0 : _d.error(globals_1.MyGlobal.flclError.create({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMark_ERROR', cause: e, message: 'Exception while creating shipment in Landmark' }));
|
|
48
|
-
throw e;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
getTrackingInfo(args) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
let trackObj = new tracking_1.default();
|
|
57
|
-
(_a = globals_1.MyGlobal.logger) === null || _a === void 0 ? void 0 : _a.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'LandmarkInput', propertyValue: args });
|
|
58
|
-
let landmarkTrackRequest = trackObj.buildTrackingRequest(args, this.username, this.password, this.test, this.clientId);
|
|
59
|
-
(_b = globals_1.MyGlobal.logger) === null || _b === void 0 ? void 0 : _b.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'LandmarkTrackRequest', propertyValue: landmarkTrackRequest });
|
|
60
|
-
let landMarkTrackingRes = yield trackObj.trackInfo(landmarkTrackRequest);
|
|
61
|
-
if (landMarkTrackingRes.hasOwnProperty("TrackResponse") && landMarkTrackingRes['TrackResponse']['Errors']) {
|
|
62
|
-
throw new Error(landMarkTrackingRes['TrackResponse']['Errors']['Error']['ErrorMessage']['_text']);
|
|
63
|
-
}
|
|
64
|
-
let response = trackObj.buildResponse(landMarkTrackingRes, args);
|
|
65
|
-
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'response', propertyValue: response });
|
|
66
|
-
return response;
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
(_d = globals_1.MyGlobal.logger) === null || _d === void 0 ? void 0 : _d.error(globals_1.MyGlobal.flclError.create({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'landMark_ERROR', cause: e, message: 'Exception while get trackinfo in Landmark' }));
|
|
70
|
-
throw e;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
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;
|
|
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
|
+
throw new Error(landmarkShipmentRes['ImportResponse']['Errors']['Error']['ErrorMessage']['_text']);
|
|
41
|
+
}
|
|
42
|
+
let response = shipObj.buildResponse(landmarkShipmentRes, args);
|
|
43
|
+
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'response', propertyValue: response });
|
|
44
|
+
return response;
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
(_d = globals_1.MyGlobal.logger) === null || _d === void 0 ? void 0 : _d.error(globals_1.MyGlobal.flclError.create({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMark_ERROR', cause: e, message: 'Exception while creating shipment in Landmark' }));
|
|
48
|
+
throw e;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
getTrackingInfo(args) {
|
|
53
|
+
var _a, _b, _c, _d;
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
try {
|
|
56
|
+
let trackObj = new tracking_1.default();
|
|
57
|
+
(_a = globals_1.MyGlobal.logger) === null || _a === void 0 ? void 0 : _a.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'LandmarkInput', propertyValue: args });
|
|
58
|
+
let landmarkTrackRequest = trackObj.buildTrackingRequest(args, this.username, this.password, this.test, this.clientId);
|
|
59
|
+
(_b = globals_1.MyGlobal.logger) === null || _b === void 0 ? void 0 : _b.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'LandmarkTrackRequest', propertyValue: landmarkTrackRequest });
|
|
60
|
+
let landMarkTrackingRes = yield trackObj.trackInfo(landmarkTrackRequest);
|
|
61
|
+
if (landMarkTrackingRes.hasOwnProperty("TrackResponse") && landMarkTrackingRes['TrackResponse']['Errors']) {
|
|
62
|
+
throw new Error(landMarkTrackingRes['TrackResponse']['Errors']['Error']['ErrorMessage']['_text']);
|
|
63
|
+
}
|
|
64
|
+
let response = trackObj.buildResponse(landMarkTrackingRes, args);
|
|
65
|
+
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'response', propertyValue: response });
|
|
66
|
+
return response;
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
(_d = globals_1.MyGlobal.logger) === null || _d === void 0 ? void 0 : _d.error(globals_1.MyGlobal.flclError.create({ npm: 'fc-landmark', className: 'Landmark', methodName: 'getTrackingInfo', propertyName: 'landMark_ERROR', cause: e, message: 'Exception while get trackinfo in Landmark' }));
|
|
70
|
+
throw e;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.LandMark = LandMark;
|
|
76
76
|
//# sourceMappingURL=landmark.js.map
|
package/dist/landmark.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landmark.js","sourceRoot":"","sources":["../src/landmark.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAkC;AAClC,0DAAkC;AAClC,iCAA2C;AAC3C,uCAA4C;AAG5C,MAAa,QAAQ;IAOjB,YAAY,QAAe,EAAC,QAAe,EAAC,QAAe,EAAC,IAAY,EAAC,gBAAuB,EAAC,gBAAuB,EAAE,MAAmB,EAAE,SAAqB,EAAE,aAAsB,EAAE,SAAkB;QAC5M,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAA,wBAAiB,EAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IACnE,CAAC;IAEK,aAAa
|
|
1
|
+
{"version":3,"file":"landmark.js","sourceRoot":"","sources":["../src/landmark.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAkC;AAClC,0DAAkC;AAClC,iCAA2C;AAC3C,uCAA4C;AAG5C,MAAa,QAAQ;IAOjB,YAA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,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,2CAA2C,EAAC,CAAC,CAAC,CAAC;gBACrN,MAAM,CAAC,CAAC;aACX;;KACJ;CACJ;AAxDD,4BAwDC"}
|
package/dist/shipment.js
CHANGED
|
@@ -1,200 +1,201 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const globals_1 = require("./globals");
|
|
13
|
-
const xml_js_1 = require("xml-js");
|
|
14
|
-
class Shipment {
|
|
15
|
-
constructor() {
|
|
16
|
-
}
|
|
17
|
-
getConsignee(shipto_address, targetToCountry) {
|
|
18
|
-
const combinedAddress = shipto_address.address_line_1 + shipto_address.address_line_2 + shipto_address.address_line_3;
|
|
19
|
-
let consignee = {
|
|
20
|
-
"Name": shipto_address.name.slice(0, 50),
|
|
21
|
-
"Attention": shipto_address.attention_name.slice(0, 50),
|
|
22
|
-
"Address1": combinedAddress.substring(0, 60),
|
|
23
|
-
"Address2": combinedAddress.substring(61, 120),
|
|
24
|
-
"Address3": combinedAddress.substring(121, 180),
|
|
25
|
-
"City": shipto_address.city,
|
|
26
|
-
"State": shipto_address.state,
|
|
27
|
-
"PostalCode": shipto_address.zip,
|
|
28
|
-
"Country": targetToCountry ? targetToCountry : shipto_address.country,
|
|
29
|
-
"Phone": shipto_address.phone.toString(),
|
|
30
|
-
"Email": shipto_address.email,
|
|
31
|
-
"ConsigneeTaxID": shipto_address.federal_tax_id ? shipto_address.federal_tax_id : ""
|
|
32
|
-
};
|
|
33
|
-
return consignee;
|
|
34
|
-
}
|
|
35
|
-
getShipperInfo(shipfrom_address, targetFromCountry) {
|
|
36
|
-
const combinedAddress = shipfrom_address.address_line_1 + shipfrom_address.address_line_2 + shipfrom_address.address_line_3;
|
|
37
|
-
let shipper = {
|
|
38
|
-
"Name": shipfrom_address.name.slice(0, 50),
|
|
39
|
-
"Attention": shipfrom_address.attention_name.slice(0, 50),
|
|
40
|
-
"Address1": combinedAddress.substring(0, 60),
|
|
41
|
-
"Address2": combinedAddress.substring(61, 120),
|
|
42
|
-
"Address3": combinedAddress.substring(121, 180),
|
|
43
|
-
"City": shipfrom_address.city,
|
|
44
|
-
"State": shipfrom_address.state,
|
|
45
|
-
"PostalCode": shipfrom_address.zip,
|
|
46
|
-
"Country": targetFromCountry ? targetFromCountry : shipfrom_address.country,
|
|
47
|
-
"Phone": shipfrom_address.phone.toString(),
|
|
48
|
-
"Email": shipfrom_address.email
|
|
49
|
-
};
|
|
50
|
-
return shipper;
|
|
51
|
-
}
|
|
52
|
-
getVendorInfo(shipfrom_address, targetFromCountry, eroiNumber, iossNumber) {
|
|
53
|
-
const combinedAddress = shipfrom_address.address_line_1 + shipfrom_address.address_line_2 + shipfrom_address.address_line_3;
|
|
54
|
-
let shipper = {
|
|
55
|
-
"VendorName": shipfrom_address.name.slice(0, 50),
|
|
56
|
-
"Attention": shipfrom_address.attention_name.slice(0, 50),
|
|
57
|
-
"VendorAddress1": combinedAddress.substring(0, 60),
|
|
58
|
-
"VendorAddress2": combinedAddress.substring(61, 120),
|
|
59
|
-
"VendorAddress3": combinedAddress.substring(121, 180),
|
|
60
|
-
"VendorCity": shipfrom_address.city,
|
|
61
|
-
"VendorState": shipfrom_address.state,
|
|
62
|
-
"VendorPostalCode": shipfrom_address.zip,
|
|
63
|
-
"VendorCountry": targetFromCountry ? targetFromCountry : shipfrom_address.country,
|
|
64
|
-
"VendorPhone": shipfrom_address.phone.toString(),
|
|
65
|
-
"VendorEmail": shipfrom_address.email,
|
|
66
|
-
"VendorBusinessNumber": "",
|
|
67
|
-
"VendorRGRNumber": "",
|
|
68
|
-
"VendorIOSSNumber": iossNumber,
|
|
69
|
-
"VendorEORINumber": eroiNumber
|
|
70
|
-
};
|
|
71
|
-
return shipper;
|
|
72
|
-
}
|
|
73
|
-
buildShipmentRequest(args, dangerousGoodsDeatils = "", username, password, test, clientId, vendorEORINumber, vendorIOSSNumber) {
|
|
74
|
-
try {
|
|
75
|
-
const EUCountries = ["BE", "BG", "CZ", "DK", "DE", "EE", "IE", "EL", "ES", "FR", "HR", "IT", "CY", "LV", "LT", "LU", "HU", "MT", "NL", "AT", "PL", "PT", "RO", "SI", "SK", "FI", "SE"];
|
|
76
|
-
let iossNumber = "";
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
// "
|
|
121
|
-
// "
|
|
122
|
-
// "
|
|
123
|
-
// "
|
|
124
|
-
// "
|
|
125
|
-
//
|
|
126
|
-
// }
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const globals_1 = require("./globals");
|
|
13
|
+
const xml_js_1 = require("xml-js");
|
|
14
|
+
class Shipment {
|
|
15
|
+
constructor() {
|
|
16
|
+
}
|
|
17
|
+
getConsignee(shipto_address, targetToCountry) {
|
|
18
|
+
const combinedAddress = shipto_address.address_line_1 + shipto_address.address_line_2 + shipto_address.address_line_3;
|
|
19
|
+
let consignee = {
|
|
20
|
+
"Name": shipto_address.name.slice(0, 50),
|
|
21
|
+
"Attention": shipto_address.attention_name.slice(0, 50),
|
|
22
|
+
"Address1": combinedAddress.substring(0, 60),
|
|
23
|
+
"Address2": combinedAddress.substring(61, 120),
|
|
24
|
+
"Address3": combinedAddress.substring(121, 180),
|
|
25
|
+
"City": shipto_address.city,
|
|
26
|
+
"State": shipto_address.state,
|
|
27
|
+
"PostalCode": shipto_address.zip,
|
|
28
|
+
"Country": targetToCountry ? targetToCountry : shipto_address.country,
|
|
29
|
+
"Phone": shipto_address.phone.toString(),
|
|
30
|
+
"Email": shipto_address.email,
|
|
31
|
+
"ConsigneeTaxID": shipto_address.federal_tax_id ? shipto_address.federal_tax_id : ""
|
|
32
|
+
};
|
|
33
|
+
return consignee;
|
|
34
|
+
}
|
|
35
|
+
getShipperInfo(shipfrom_address, targetFromCountry) {
|
|
36
|
+
const combinedAddress = shipfrom_address.address_line_1 + shipfrom_address.address_line_2 + shipfrom_address.address_line_3;
|
|
37
|
+
let shipper = {
|
|
38
|
+
"Name": shipfrom_address.name.slice(0, 50),
|
|
39
|
+
"Attention": shipfrom_address.attention_name.slice(0, 50),
|
|
40
|
+
"Address1": combinedAddress.substring(0, 60),
|
|
41
|
+
"Address2": combinedAddress.substring(61, 120),
|
|
42
|
+
"Address3": combinedAddress.substring(121, 180),
|
|
43
|
+
"City": shipfrom_address.city,
|
|
44
|
+
"State": shipfrom_address.state,
|
|
45
|
+
"PostalCode": shipfrom_address.zip,
|
|
46
|
+
"Country": targetFromCountry ? targetFromCountry : shipfrom_address.country,
|
|
47
|
+
"Phone": shipfrom_address.phone.toString(),
|
|
48
|
+
"Email": shipfrom_address.email
|
|
49
|
+
};
|
|
50
|
+
return shipper;
|
|
51
|
+
}
|
|
52
|
+
getVendorInfo(shipfrom_address, targetFromCountry, eroiNumber, iossNumber) {
|
|
53
|
+
const combinedAddress = shipfrom_address.address_line_1 + shipfrom_address.address_line_2 + shipfrom_address.address_line_3;
|
|
54
|
+
let shipper = {
|
|
55
|
+
"VendorName": shipfrom_address.name.slice(0, 50),
|
|
56
|
+
"Attention": shipfrom_address.attention_name.slice(0, 50),
|
|
57
|
+
"VendorAddress1": combinedAddress.substring(0, 60),
|
|
58
|
+
"VendorAddress2": combinedAddress.substring(61, 120),
|
|
59
|
+
"VendorAddress3": combinedAddress.substring(121, 180),
|
|
60
|
+
"VendorCity": shipfrom_address.city,
|
|
61
|
+
"VendorState": shipfrom_address.state,
|
|
62
|
+
"VendorPostalCode": shipfrom_address.zip,
|
|
63
|
+
"VendorCountry": targetFromCountry ? targetFromCountry : shipfrom_address.country,
|
|
64
|
+
"VendorPhone": shipfrom_address.phone.toString(),
|
|
65
|
+
"VendorEmail": shipfrom_address.email,
|
|
66
|
+
"VendorBusinessNumber": "",
|
|
67
|
+
"VendorRGRNumber": "",
|
|
68
|
+
"VendorIOSSNumber": iossNumber,
|
|
69
|
+
"VendorEORINumber": eroiNumber
|
|
70
|
+
};
|
|
71
|
+
return shipper;
|
|
72
|
+
}
|
|
73
|
+
buildShipmentRequest(args, dangerousGoodsDeatils = "", username, password, test, clientId, vendorEORINumber, vendorIOSSNumber, reqRegionValue) {
|
|
74
|
+
try {
|
|
75
|
+
const EUCountries = ["BE", "BG", "CZ", "DK", "DE", "EE", "IE", "EL", "ES", "FR", "HR", "IT", "CY", "LV", "LT", "LU", "HU", "MT", "NL", "AT", "PL", "PT", "RO", "SI", "SK", "FI", "SE"];
|
|
76
|
+
let iossNumber = "";
|
|
77
|
+
let regionValue = (reqRegionValue && reqRegionValue != "") ? reqRegionValue : "Landmark BUF";
|
|
78
|
+
if (EUCountries.indexOf(args.shipto_address.country.toUpperCase()) != -1 || EUCountries.indexOf(args.targetToCountry.toUpperCase()) != -1) {
|
|
79
|
+
iossNumber = vendorIOSSNumber;
|
|
80
|
+
}
|
|
81
|
+
let eroiNumber = "";
|
|
82
|
+
if (args.shipto_address.country.toUpperCase() == "GB" || args.shipto_address.country.toUpperCase() == "UK") {
|
|
83
|
+
eroiNumber = vendorEORINumber;
|
|
84
|
+
}
|
|
85
|
+
let importRequest = {
|
|
86
|
+
"Login": {
|
|
87
|
+
"Username": username,
|
|
88
|
+
"Password": password
|
|
89
|
+
},
|
|
90
|
+
"Test": test,
|
|
91
|
+
"ClientID": clientId,
|
|
92
|
+
"Reference": args.reference,
|
|
93
|
+
"ShipTo": this.getConsignee(args.shipto_address, args.targetToCountry),
|
|
94
|
+
"ShippingLane": {
|
|
95
|
+
"Region": regionValue
|
|
96
|
+
},
|
|
97
|
+
"ShipMethod": args._carrierRateObj.servicecode,
|
|
98
|
+
"OrderTotal": args.shipment_total_usd,
|
|
99
|
+
"ItemsCurrency": args.currency,
|
|
100
|
+
"ProduceLabel": true,
|
|
101
|
+
"LabelFormat": args.label_format,
|
|
102
|
+
"LabelEncoding": args.label_format.toLowerCase() == "zpl" ? "ZPL" : "LINKS",
|
|
103
|
+
"Packages": {
|
|
104
|
+
"Package": {
|
|
105
|
+
"WeightUnit": args.weight_unit,
|
|
106
|
+
"Weight": args.package.weight,
|
|
107
|
+
"DimensionsUnit": args.dimension_unit,
|
|
108
|
+
"Length": args.package.length,
|
|
109
|
+
"Width": args.package.width,
|
|
110
|
+
"Height": args.package.height,
|
|
111
|
+
"PackageReference": args.reference
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"SendReturnToAddress": this.getShipperInfo(args.shipfrom_address, args.targetFromCountry),
|
|
115
|
+
"VendorInformation": this.getVendorInfo(args.shipfrom_address, args.targetFromCountry, eroiNumber, iossNumber),
|
|
116
|
+
"IsCommercialShipment": args.b2b ? 1 : 0,
|
|
117
|
+
};
|
|
118
|
+
// let items = args.pieces.map((item:any)=>{
|
|
119
|
+
// return {"Item":{
|
|
120
|
+
// "Sku": item.sku || 12345,
|
|
121
|
+
// "Description": item.description.substr(0,100),
|
|
122
|
+
// "Quantity": item.quantity,
|
|
123
|
+
// "UnitPrice": (item.sale_price == 0) ? 0.01 : item.sale_price,
|
|
124
|
+
// "HSCode": item.hs_code,
|
|
125
|
+
// "CountryOfOrigin": item.origin_country_code
|
|
126
|
+
// }
|
|
127
|
+
// }
|
|
128
|
+
// })
|
|
129
|
+
let items = args.pieces.map((item) => {
|
|
130
|
+
let itemObj = {
|
|
131
|
+
"Sku": item.sku || 12345,
|
|
132
|
+
"Description": item.description.substr(0, 100),
|
|
133
|
+
"Quantity": item.quantity,
|
|
134
|
+
"UnitPrice": (item.sale_price == 0) ? 0.01 : item.sale_price,
|
|
135
|
+
"HSCode": item.hs_code,
|
|
136
|
+
"CountryOfOrigin": item.origin_country_code
|
|
137
|
+
};
|
|
138
|
+
if (dangerousGoodsDeatils && dangerousGoodsDeatils[item.sku] && dangerousGoodsDeatils[item.sku]['UNCode']) {
|
|
139
|
+
let dangerousGoodInformation = {
|
|
140
|
+
"ContainsDangerousGoods": 1,
|
|
141
|
+
"UNCode": dangerousGoodsDeatils[item.sku]['UNCode'] || "",
|
|
142
|
+
"PackingGroup": dangerousGoodsDeatils[item.sku]['CategoryCode'] || "",
|
|
143
|
+
"PackingInstructions": dangerousGoodsDeatils[item.sku]['PackingInstructions'] || "",
|
|
144
|
+
"ItemWeight": item.weight,
|
|
145
|
+
"ItemWeightUnit": args.weight_unit
|
|
146
|
+
};
|
|
147
|
+
itemObj["DangerousGoodsInformation"] = dangerousGoodInformation;
|
|
148
|
+
}
|
|
149
|
+
return itemObj;
|
|
150
|
+
});
|
|
151
|
+
importRequest["Items"] = { "Item": items };
|
|
152
|
+
let request = {
|
|
153
|
+
"ImportRequest": importRequest
|
|
154
|
+
};
|
|
155
|
+
const xmlData = (0, xml_js_1.js2xml)(request, { compact: true, ignoreComment: true, spaces: 4 });
|
|
156
|
+
return xmlData;
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
throw globals_1.MyGlobal.FlclError.create({ className: 'Shipment', methodName: '_buildRequest', message: 'Exception while building the LandMark shipment request', cause: e, appendChildMsg: true });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
createShipment(ShipmentRequest) {
|
|
163
|
+
var _a, _b, _c;
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
try {
|
|
166
|
+
let configs = {
|
|
167
|
+
headers: {
|
|
168
|
+
'Content-Type': 'application/xml'
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
let resp = yield globals_1.MyGlobal.axios.post(globals_1.MyGlobal.ship_url, ShipmentRequest, configs);
|
|
172
|
+
console.log(resp.data);
|
|
173
|
+
(_a = globals_1.MyGlobal.logger) === null || _a === void 0 ? void 0 : _a.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'Landmark-RAW-RESPOSNE', propertyValue: resp.data });
|
|
174
|
+
let responsejson = (0, xml_js_1.xml2json)(resp.data, { compact: true, spaces: 4 });
|
|
175
|
+
return JSON.parse(responsejson);
|
|
176
|
+
}
|
|
177
|
+
catch (e) {
|
|
178
|
+
(_b = globals_1.MyGlobal.logger) === null || _b === void 0 ? void 0 : _b.info({ npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'Landmark-RAW-RESPOSNE', data: { error: e } });
|
|
179
|
+
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.error(globals_1.MyGlobal.flclError.create({ npm: 'fc-landmark', className: 'Shipment', methodName: 'createShipment', propertyName: 'CREDITS_ERROR', cause: e }));
|
|
180
|
+
throw e;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
buildResponse(resp, args) {
|
|
185
|
+
let response = {
|
|
186
|
+
provider_name: 'Landmark',
|
|
187
|
+
shipping_provider: 'Landmark',
|
|
188
|
+
carrier: 'Landmark',
|
|
189
|
+
tracking_number: resp['ImportResponse']['Result']['Packages']['Package']['TrackingNumber']['_text'],
|
|
190
|
+
provider_tracking_number: resp['ImportResponse']['Result']['Packages']['Package']['TrackingNumber']['_text'],
|
|
191
|
+
shipping_label: args.label_format.toLowerCase() == "zpl" ? resp['ImportResponse']['Result']['Packages']['Package']['LabelImages']['LabelImage']['_text'] : resp['ImportResponse']['Result']['ShipmentLabelLink']['_text'],
|
|
192
|
+
label_type: args.label_format.toLowerCase() == "zpl" ? "zplenc" : "url",
|
|
193
|
+
gross_weight: args.total_weight,
|
|
194
|
+
gross_weight_unit: args.weight_unit,
|
|
195
|
+
submitted_electronically: true
|
|
196
|
+
};
|
|
197
|
+
return response;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
exports.default = Shipment;
|
|
200
201
|
//# sourceMappingURL=shipment.js.map
|
package/dist/shipment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shipment.js","sourceRoot":"","sources":["../src/shipment.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,uCAA4C;AAC5C,mCAA0C;AAE1C,MAAqB,QAAQ;IACzB;IAEA,CAAC;IACD,YAAY,CAAC,cAAmB,EAAC,eAAmB;QAEhD,MAAM,eAAe,GAAG,cAAc,CAAC,cAAc,GAAG,cAAc,CAAC,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC;QACtH,IAAI,SAAS,GAAQ;YACjB,MAAM,EAAE,cAAc,CAAC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CAAC;QACF,OAAO,QAAQ,CAAC;IACpB,CAAC;CAEJ;AA5LD,2BA4LC"}
|
package/dist/tracking.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const globals_1 = require("./globals");
|
|
13
|
-
const xml_js_1 = require("xml-js");
|
|
14
|
-
class Tracking {
|
|
15
|
-
constructor() {
|
|
16
|
-
}
|
|
17
|
-
buildTrackingRequest(args, username, password, test, clientId) {
|
|
18
|
-
try {
|
|
19
|
-
let trackRequest = {
|
|
20
|
-
"Login": {
|
|
21
|
-
"Username": username,
|
|
22
|
-
"Password": password
|
|
23
|
-
},
|
|
24
|
-
"Test": test,
|
|
25
|
-
"ClientID": clientId,
|
|
26
|
-
"TrackingNumber": args.tracking_number,
|
|
27
|
-
"RetrievalType": "Historical"
|
|
28
|
-
};
|
|
29
|
-
let request = {
|
|
30
|
-
"TrackRequest": trackRequest
|
|
31
|
-
};
|
|
32
|
-
const xmlData = (0, xml_js_1.js2xml)(request, { compact: true, ignoreComment: true, spaces: 4 });
|
|
33
|
-
return xmlData;
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
throw globals_1.MyGlobal.FlclError.create({ className: 'Tracking', methodName: '_buildRequest', message: 'Exception while building the LandMark Tracking request', cause: e, appendChildMsg: true });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
trackInfo(ShipmentRequest) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
let configs = {
|
|
44
|
-
headers: {
|
|
45
|
-
'Content-Type': 'application/xml'
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
let resp = yield globals_1.MyGlobal.axios.post(globals_1.MyGlobal.track_url, ShipmentRequest, configs);
|
|
49
|
-
(_a = globals_1.MyGlobal.logger) === null || _a === void 0 ? void 0 : _a.info({ npm: 'fc-landmark', className: 'Tracking', methodName: 'trackInfo', propertyName: 'landmark-RAW-RESPOSNE', propertyValue: resp.data });
|
|
50
|
-
let responsejson = (0, xml_js_1.xml2json)(resp.data, { compact: true, spaces: 4 });
|
|
51
|
-
return JSON.parse(responsejson);
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
(_b = globals_1.MyGlobal.logger) === null || _b === void 0 ? void 0 : _b.info({ npm: 'fc-landmark', className: 'Tracking', methodName: 'trackInfo', propertyName: 'landmar-RAW-RESPOSNE', data: { error: e } });
|
|
55
|
-
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.error(globals_1.MyGlobal.flclError.create({ npm: 'fc-landmark', className: 'Tracking', methodName: 'trackInfo', propertyName: 'CREDITS_ERROR', cause: e }));
|
|
56
|
-
throw e;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
buildResponse(resp, args) {
|
|
61
|
-
let response = {
|
|
62
|
-
reference: args.reference,
|
|
63
|
-
tracking_number: args.tracking_number,
|
|
64
|
-
tracking_history: []
|
|
65
|
-
};
|
|
66
|
-
if (!Array.isArray(resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'])) {
|
|
67
|
-
resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'] = [resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event']];
|
|
68
|
-
}
|
|
69
|
-
for (let i = 0; i < resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'].length; i++) {
|
|
70
|
-
let history = {};
|
|
71
|
-
let code = resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'][i]['EventCode']['_text'];
|
|
72
|
-
if (code == '50' || code == '60') {
|
|
73
|
-
history.status = "In Progress";
|
|
74
|
-
}
|
|
75
|
-
else if (code == '500') {
|
|
76
|
-
history.status = "Delivered";
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
history.status = "In Transit";
|
|
80
|
-
}
|
|
81
|
-
history.status_date = resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'][i]['DateTime']['_text'];
|
|
82
|
-
let dateofevent = new Date(history.status_date);
|
|
83
|
-
history.event_date = dateofevent.getTime();
|
|
84
|
-
history.status_detail = resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'][i]['Status']['_text'] || "";
|
|
85
|
-
history.location = resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'][i]['Location']['_text'] || '';
|
|
86
|
-
history.country = '';
|
|
87
|
-
response.tracking_history.push(history);
|
|
88
|
-
}
|
|
89
|
-
return response;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.default = Tracking;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const globals_1 = require("./globals");
|
|
13
|
+
const xml_js_1 = require("xml-js");
|
|
14
|
+
class Tracking {
|
|
15
|
+
constructor() {
|
|
16
|
+
}
|
|
17
|
+
buildTrackingRequest(args, username, password, test, clientId) {
|
|
18
|
+
try {
|
|
19
|
+
let trackRequest = {
|
|
20
|
+
"Login": {
|
|
21
|
+
"Username": username,
|
|
22
|
+
"Password": password
|
|
23
|
+
},
|
|
24
|
+
"Test": test,
|
|
25
|
+
"ClientID": clientId,
|
|
26
|
+
"TrackingNumber": args.tracking_number,
|
|
27
|
+
"RetrievalType": "Historical"
|
|
28
|
+
};
|
|
29
|
+
let request = {
|
|
30
|
+
"TrackRequest": trackRequest
|
|
31
|
+
};
|
|
32
|
+
const xmlData = (0, xml_js_1.js2xml)(request, { compact: true, ignoreComment: true, spaces: 4 });
|
|
33
|
+
return xmlData;
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
throw globals_1.MyGlobal.FlclError.create({ className: 'Tracking', methodName: '_buildRequest', message: 'Exception while building the LandMark Tracking request', cause: e, appendChildMsg: true });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
trackInfo(ShipmentRequest) {
|
|
40
|
+
var _a, _b, _c;
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
let configs = {
|
|
44
|
+
headers: {
|
|
45
|
+
'Content-Type': 'application/xml'
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
let resp = yield globals_1.MyGlobal.axios.post(globals_1.MyGlobal.track_url, ShipmentRequest, configs);
|
|
49
|
+
(_a = globals_1.MyGlobal.logger) === null || _a === void 0 ? void 0 : _a.info({ npm: 'fc-landmark', className: 'Tracking', methodName: 'trackInfo', propertyName: 'landmark-RAW-RESPOSNE', propertyValue: resp.data });
|
|
50
|
+
let responsejson = (0, xml_js_1.xml2json)(resp.data, { compact: true, spaces: 4 });
|
|
51
|
+
return JSON.parse(responsejson);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
(_b = globals_1.MyGlobal.logger) === null || _b === void 0 ? void 0 : _b.info({ npm: 'fc-landmark', className: 'Tracking', methodName: 'trackInfo', propertyName: 'landmar-RAW-RESPOSNE', data: { error: e } });
|
|
55
|
+
(_c = globals_1.MyGlobal.logger) === null || _c === void 0 ? void 0 : _c.error(globals_1.MyGlobal.flclError.create({ npm: 'fc-landmark', className: 'Tracking', methodName: 'trackInfo', propertyName: 'CREDITS_ERROR', cause: e }));
|
|
56
|
+
throw e;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
buildResponse(resp, args) {
|
|
61
|
+
let response = {
|
|
62
|
+
reference: args.reference,
|
|
63
|
+
tracking_number: args.tracking_number,
|
|
64
|
+
tracking_history: []
|
|
65
|
+
};
|
|
66
|
+
if (!Array.isArray(resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'])) {
|
|
67
|
+
resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'] = [resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event']];
|
|
68
|
+
}
|
|
69
|
+
for (let i = 0; i < resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'].length; i++) {
|
|
70
|
+
let history = {};
|
|
71
|
+
let code = resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'][i]['EventCode']['_text'];
|
|
72
|
+
if (code == '50' || code == '60') {
|
|
73
|
+
history.status = "In Progress";
|
|
74
|
+
}
|
|
75
|
+
else if (code == '500') {
|
|
76
|
+
history.status = "Delivered";
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
history.status = "In Transit";
|
|
80
|
+
}
|
|
81
|
+
history.status_date = resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'][i]['DateTime']['_text'];
|
|
82
|
+
let dateofevent = new Date(history.status_date);
|
|
83
|
+
history.event_date = dateofevent.getTime();
|
|
84
|
+
history.status_detail = resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'][i]['Status']['_text'] || "";
|
|
85
|
+
history.location = resp['TrackResponse']['Result']['Packages']['Package']['Events']['Event'][i]['Location']['_text'] || '';
|
|
86
|
+
history.country = '';
|
|
87
|
+
response.tracking_history.push(history);
|
|
88
|
+
}
|
|
89
|
+
return response;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.default = Tracking;
|
|
93
93
|
//# sourceMappingURL=tracking.js.map
|
package/dist/tracking.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../src/tracking.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,uCAA4C;AAC5C,mCAA0C;AAE1C,MAAqB,QAAQ;IACzB;IAEA,CAAC;IAED,oBAAoB,CAAC,IAAS,EAAC,QAAgB,EAAC,QAAgB,EAAE,IAAY,EAAC,QAAe;QAC1F,IAAI
|
|
1
|
+
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../src/tracking.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,uCAA4C;AAC5C,mCAA0C;AAE1C,MAAqB,QAAQ;IACzB;IAEA,CAAC;IAED,oBAAoB,CAAC,IAAS,EAAC,QAAgB,EAAC,QAAgB,EAAE,IAAY,EAAC,QAAe;QAC1F,IAAI;YACA,IAAI,YAAY,GAAQ;gBACpB,OAAO,EAAE;oBACL,UAAU,EAAE,QAAQ;oBACpB,UAAU,EAAE,QAAQ;iBACvB;gBACD,MAAM,EAAE,IAAI;gBACZ,UAAU,EAAE,QAAQ;gBACpB,gBAAgB,EAAE,IAAI,CAAC,eAAe;gBACtC,eAAe,EAAC,YAAY;aAE/B,CAAC;YACF,IAAI,OAAO,GAAQ;gBACf,cAAc,EAAE,YAAY;aAC/B,CAAA;YACD,MAAM,OAAO,GAAG,IAAA,eAAM,EAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,E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;CACJ;AA9ED,2BA8EC"}
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
package/src/landmark.ts
CHANGED
|
@@ -21,12 +21,12 @@ export class LandMark {
|
|
|
21
21
|
setRequredGlobals(logger, flclerror, rootRequestId, requestId);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async createShipmet(args: any, dangerousGoodsDeatils: any = "") {
|
|
24
|
+
async createShipmet(args: any, dangerousGoodsDeatils: any = "", regionValue: string = "") {
|
|
25
25
|
try {
|
|
26
26
|
|
|
27
27
|
let shipObj = new Shipment();
|
|
28
28
|
app.logger?.info({npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMarkShipmentInput', propertyValue: args});
|
|
29
|
-
let landmarkShipmentRequest: string = shipObj.buildShipmentRequest(args, dangerousGoodsDeatils, this.username,this.password,this.test,this.clientId,this.vendorEORINumber,this.vendorIOSSNumber);
|
|
29
|
+
let landmarkShipmentRequest: string = shipObj.buildShipmentRequest(args, dangerousGoodsDeatils, this.username,this.password,this.test,this.clientId,this.vendorEORINumber,this.vendorIOSSNumber, regionValue);
|
|
30
30
|
app.logger?.info({npm: 'fc-landmark', className: 'Landmark', methodName: 'createShipmet', propertyName: 'landMarkShipmentRequest', propertyValue: landmarkShipmentRequest});
|
|
31
31
|
let landmarkShipmentRes: any = await shipObj.createShipment(landmarkShipmentRequest);
|
|
32
32
|
if(landmarkShipmentRes.hasOwnProperty("ImportResponse") && landmarkShipmentRes['ImportResponse']['Errors']){
|
package/src/shipment.ts
CHANGED
|
@@ -66,10 +66,11 @@ export default class Shipment {
|
|
|
66
66
|
return shipper;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
buildShipmentRequest(args: any, dangerousGoodsDeatils: any = "", username:string,password:string,test:boolean,clientId:number,vendorEORINumber:any,vendorIOSSNumber:any): string{
|
|
69
|
+
buildShipmentRequest(args: any, dangerousGoodsDeatils: any = "", username:string,password:string,test:boolean,clientId:number,vendorEORINumber:any,vendorIOSSNumber:any,reqRegionValue:string): string{
|
|
70
70
|
try {
|
|
71
71
|
const EUCountries = ["BE", "BG", "CZ", "DK", "DE", "EE", "IE", "EL", "ES", "FR", "HR", "IT", "CY", "LV", "LT", "LU", "HU", "MT", "NL", "AT", "PL", "PT", "RO", "SI", "SK", "FI", "SE"];
|
|
72
72
|
let iossNumber=""
|
|
73
|
+
let regionValue = (reqRegionValue && reqRegionValue != "") ? reqRegionValue : "Landmark BUF"
|
|
73
74
|
if( EUCountries.indexOf(args.shipto_address.country.toUpperCase()) != -1 || EUCountries.indexOf(args.targetToCountry.toUpperCase()) != -1 ){
|
|
74
75
|
iossNumber = vendorIOSSNumber
|
|
75
76
|
}
|
|
@@ -87,7 +88,7 @@ export default class Shipment {
|
|
|
87
88
|
"Reference": args.reference,
|
|
88
89
|
"ShipTo": this.getConsignee(args.shipto_address,args.targetToCountry),
|
|
89
90
|
"ShippingLane": {
|
|
90
|
-
"Region" :
|
|
91
|
+
"Region" : regionValue
|
|
91
92
|
},
|
|
92
93
|
"ShipMethod": args._carrierRateObj.servicecode,
|
|
93
94
|
"OrderTotal": args.shipment_total_usd,
|
package/tests/shipment.js
CHANGED
|
@@ -59,7 +59,7 @@ let request = {
|
|
|
59
59
|
"origin_country_code": "US",
|
|
60
60
|
"material": "wellbel glamlab Single International",
|
|
61
61
|
"description": "wellbel glamlab Single International",
|
|
62
|
-
"sku": "
|
|
62
|
+
"sku": "SKU",
|
|
63
63
|
"category": [
|
|
64
64
|
"wellbel glamlab - Single - International"
|
|
65
65
|
],
|
|
@@ -83,7 +83,7 @@ let request = {
|
|
|
83
83
|
"origin_country_code": "US",
|
|
84
84
|
"material": "wellbel glamlab Single International",
|
|
85
85
|
"description": "wellbel glamlab Single International",
|
|
86
|
-
"sku": "
|
|
86
|
+
"sku": "SKU",
|
|
87
87
|
"category": [
|
|
88
88
|
"wellbel glamlab - Single - International"
|
|
89
89
|
],
|
|
@@ -403,7 +403,7 @@ let request = {
|
|
|
403
403
|
"providerrateid": 9437685,
|
|
404
404
|
"hashkey": "ZpPGix",
|
|
405
405
|
"carrier": "landmark",
|
|
406
|
-
"servicecode": "
|
|
406
|
+
"servicecode": "APC.PRIUDC",
|
|
407
407
|
"flclservicecode": "standard",
|
|
408
408
|
"termsoftrade": "DDU",
|
|
409
409
|
"easypostreferenceid": "",
|
|
@@ -432,16 +432,9 @@ let request = {
|
|
|
432
432
|
async function create(){
|
|
433
433
|
try{
|
|
434
434
|
console.log('sampel gift');
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
"UNCode": "UN3481",
|
|
439
|
-
"CategoryCode": "II",
|
|
440
|
-
"PackingInstructions": "PS967S1"
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
let landmark = new LandMark("flavorcloudapi","FCL@ndmark123", "2056", false,'','','','');
|
|
444
|
-
let res = await landmark.createShipmet(request, dangerousGoodDEtails);
|
|
435
|
+
|
|
436
|
+
let landmark = new LandMark("demoapi","demo123",false,'','','','');
|
|
437
|
+
let res = await landmark.createShipmet(request);
|
|
445
438
|
console.log(res);
|
|
446
439
|
return res;
|
|
447
440
|
|