@vergelijkdirect/insurance-transmission-client 1.3.35 → 1.3.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vergelijkdirect/insurance-transmission-client",
3
- "version": "1.3.35",
3
+ "version": "1.3.38",
4
4
  "description": "",
5
5
  "main": "./src/js/index.js",
6
6
  "scripts": {
@@ -0,0 +1,27 @@
1
+ import { EnvironmentInterface, RateInterface, StorageInterface } from "../interfaces";
2
+ declare class ShoppingCardClient {
3
+ private products;
4
+ private packageService;
5
+ private totalPrice;
6
+ private totalDiscount;
7
+ private subTotal;
8
+ private totalCosts;
9
+ private storageManager;
10
+ onCalculating: boolean;
11
+ constructor(storageManager: StorageInterface, env: EnvironmentInterface);
12
+ configure(config: EnvironmentInterface): this;
13
+ addProduct(rate: RateInterface): this;
14
+ setProducts(products: any): this;
15
+ getTotalCosts(): number;
16
+ getTotalPrice(): number;
17
+ getTotalDiscount(): number;
18
+ getSubTotal(): number;
19
+ getProducts(): any;
20
+ setCalculations(calculations: any): this;
21
+ initFromStore(): void;
22
+ resetCard(): void;
23
+ productsCount(): any;
24
+ private commit;
25
+ private calculatePackage;
26
+ }
27
+ export default ShoppingCardClient;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var core_1 = require("../core");
4
+ var package_service_1 = require("../services/package.service");
5
+ var ShoppingCardClient = /** @class */ (function () {
6
+ function ShoppingCardClient(storageManager, env) {
7
+ this.products = [];
8
+ this.totalPrice = 0;
9
+ this.totalDiscount = 0;
10
+ this.subTotal = 0;
11
+ this.totalCosts = 0;
12
+ this.onCalculating = false;
13
+ this.storageManager = storageManager;
14
+ this.configure(env);
15
+ this.packageService = new package_service_1.default();
16
+ }
17
+ ShoppingCardClient.prototype.configure = function (config) {
18
+ var injector = core_1.Injector.instance;
19
+ injector.constant('environment', config);
20
+ return this;
21
+ };
22
+ ShoppingCardClient.prototype.addProduct = function (rate) {
23
+ var rateData = rate.getData();
24
+ this.products.push(rateData);
25
+ this.calculatePackage();
26
+ return this;
27
+ };
28
+ ShoppingCardClient.prototype.setProducts = function (products) {
29
+ this.products = products;
30
+ this.calculatePackage();
31
+ return this;
32
+ };
33
+ ShoppingCardClient.prototype.getTotalCosts = function () {
34
+ return this.totalCosts;
35
+ };
36
+ ShoppingCardClient.prototype.getTotalPrice = function () {
37
+ return this.totalPrice;
38
+ };
39
+ ShoppingCardClient.prototype.getTotalDiscount = function () {
40
+ return this.totalDiscount;
41
+ };
42
+ ShoppingCardClient.prototype.getSubTotal = function () {
43
+ return this.subTotal;
44
+ };
45
+ ShoppingCardClient.prototype.getProducts = function () {
46
+ return this.products;
47
+ };
48
+ ShoppingCardClient.prototype.setCalculations = function (calculations) {
49
+ this.subTotal = calculations.NettoPremium;
50
+ this.totalPrice = calculations.Premium;
51
+ this.totalDiscount = calculations.PackageDiscount;
52
+ this.totalCosts = calculations.TotalCosts;
53
+ this.commit();
54
+ return this;
55
+ };
56
+ ShoppingCardClient.prototype.initFromStore = function () {
57
+ this.products = this.storageManager.get('products');
58
+ this.totalPrice = this.storageManager.get('totalPrice');
59
+ this.totalDiscount = this.storageManager.get('totalDiscount');
60
+ this.subTotal = this.storageManager.get('subTotal');
61
+ this.totalCosts = this.storageManager.get('totalCosts');
62
+ };
63
+ ShoppingCardClient.prototype.resetCard = function () {
64
+ this.products = [];
65
+ this.totalPrice = 0;
66
+ this.totalDiscount = 0;
67
+ this.subTotal = 0;
68
+ this.commit();
69
+ };
70
+ ShoppingCardClient.prototype.productsCount = function () {
71
+ return this.products.length;
72
+ };
73
+ ShoppingCardClient.prototype.commit = function () {
74
+ this.storageManager.put('products', this.products);
75
+ this.storageManager.put('totalPrice', this.totalPrice);
76
+ this.storageManager.put('totalDiscount', this.totalDiscount);
77
+ this.storageManager.put('subTotal', this.subTotal);
78
+ this.storageManager.put('totalCosts', this.totalCosts);
79
+ return this;
80
+ };
81
+ ShoppingCardClient.prototype.calculatePackage = function () {
82
+ var _this = this;
83
+ this.onCalculating = true;
84
+ this.packageService.calculatePackage(this.getProducts())
85
+ .then(function (calculations) {
86
+ _this.setCalculations(calculations);
87
+ _this.onCalculating = false;
88
+ })
89
+ .catch(function (error) {
90
+ console.error(error);
91
+ _this.onCalculating = false;
92
+ });
93
+ };
94
+ return ShoppingCardClient;
95
+ }());
96
+ exports.default = ShoppingCardClient;
@@ -83,6 +83,9 @@ var RateFactory = /** @class */ (function () {
83
83
  else if (rate['Service'] === 'DKM') {
84
84
  return new models_1.DkmRate(comparison, rate);
85
85
  }
86
+ else if (rate['Service'] === 'Unigarant') {
87
+ return new models_1.UnigarantRate(comparison, rate);
88
+ }
86
89
  else {
87
90
  return new models_1.UndefinedRate();
88
91
  }
@@ -0,0 +1,8 @@
1
+ interface AbstractRateInterface {
2
+ Price: number;
3
+ CompanyName: string;
4
+ CompanyLogoUrl: string;
5
+ Identifier: string;
6
+ Coverage: any;
7
+ }
8
+ export default AbstractRateInterface;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export default function (insuranceCategory: string): any;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function default_1(insuranceCategory) {
4
+ var map = {
5
+ 'moped': 'brommer',
6
+ 'pet': 'dieren',
7
+ 'motor': 'motor',
8
+ 'home': 'woon',
9
+ 'household': 'woon',
10
+ 'liability': 'woon',
11
+ 'legal-assistance': 'rechtsbijstand',
12
+ 'caravan': 'caravan',
13
+ 'bike': 'fiets',
14
+ 'car': 'car',
15
+ };
16
+ return map[insuranceCategory];
17
+ }
18
+ exports.default = default_1;
@@ -8,6 +8,7 @@ export { default as EnraRate } from "./enra-model";
8
8
  export { default as MoneyviewRate } from "./moneyview-rate.model";
9
9
  export { default as VergelijkdirectRate } from "./vergelijkdirect-rate.model";
10
10
  export { default as DkmRate } from "./dkm-rate.model";
11
+ export { default as UnigarantRate } from "./unigarant-rate.model";
11
12
  export { default as UndefinedRate } from "./undefined-rate.model";
12
13
  export { default as RateCollection } from "./rate-collection.model";
13
14
  export { default as User } from "./user.model";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.User = exports.RateCollection = exports.UndefinedRate = exports.DkmRate = exports.VergelijkdirectRate = exports.MoneyviewRate = exports.EnraRate = exports.RollsRate = exports.RiskRate = exports.LakaRate = exports.PackageRate = exports.Rate = exports.DocumentsModel = void 0;
17
+ exports.User = exports.RateCollection = exports.UndefinedRate = exports.UnigarantRate = exports.DkmRate = exports.VergelijkdirectRate = exports.MoneyviewRate = exports.EnraRate = exports.RollsRate = exports.RiskRate = exports.LakaRate = exports.PackageRate = exports.Rate = exports.DocumentsModel = void 0;
18
18
  var documents_model_1 = require("./documents.model");
19
19
  Object.defineProperty(exports, "DocumentsModel", { enumerable: true, get: function () { return documents_model_1.default; } });
20
20
  var rate_model_1 = require("./rate.model");
@@ -35,6 +35,8 @@ var vergelijkdirect_rate_model_1 = require("./vergelijkdirect-rate.model");
35
35
  Object.defineProperty(exports, "VergelijkdirectRate", { enumerable: true, get: function () { return vergelijkdirect_rate_model_1.default; } });
36
36
  var dkm_rate_model_1 = require("./dkm-rate.model");
37
37
  Object.defineProperty(exports, "DkmRate", { enumerable: true, get: function () { return dkm_rate_model_1.default; } });
38
+ var unigarant_rate_model_1 = require("./unigarant-rate.model");
39
+ Object.defineProperty(exports, "UnigarantRate", { enumerable: true, get: function () { return unigarant_rate_model_1.default; } });
38
40
  var undefined_rate_model_1 = require("./undefined-rate.model");
39
41
  Object.defineProperty(exports, "UndefinedRate", { enumerable: true, get: function () { return undefined_rate_model_1.default; } });
40
42
  var rate_collection_model_1 = require("./rate-collection.model");
@@ -0,0 +1,6 @@
1
+ import { RateInterface } from "../interfaces";
2
+ import { Rate } from "./";
3
+ declare class UnigarantRate extends Rate implements RateInterface {
4
+ getAdditionalCoverages(data: any): Promise<any>;
5
+ }
6
+ export default UnigarantRate;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ var _1 = require("./");
19
+ var factories_1 = require("../factories");
20
+ var UnigarantRate = /** @class */ (function (_super) {
21
+ __extends(UnigarantRate, _super);
22
+ function UnigarantRate() {
23
+ return _super !== null && _super.apply(this, arguments) || this;
24
+ }
25
+ UnigarantRate.prototype.getAdditionalCoverages = function (data) {
26
+ return factories_1.ApiServiceFactory.get(this.insuranceCategory).getUnigarantAdditionalCoverages(data);
27
+ };
28
+ return UnigarantRate;
29
+ }(_1.Rate));
30
+ exports.default = UnigarantRate;
@@ -9,5 +9,6 @@ declare class MopedResource extends CategoryResource {
9
9
  getMoneyviewAdditionalCoverages(data: AdditionalCoveragesRequestInterface): Promise<any>;
10
10
  getVergelijkdirectAdditionalCoverages(data: AdditionalCoveragesRequestInterface): Promise<any>;
11
11
  getEnraAdditionalCoverages(data: AdditionalCoveragesRequestInterface): Promise<any>;
12
+ getUnigarantAdditionalCoverages(data: AdditionalCoveragesRequestInterface): Promise<any>;
12
13
  }
13
14
  export default MopedResource;
@@ -30,6 +30,7 @@ var MopedResource = /** @class */ (function (_super) {
30
30
  'moneyview',
31
31
  'vergelijkdirect',
32
32
  'enra',
33
+ 'unigarant',
33
34
  ];
34
35
  };
35
36
  MopedResource.prototype.findMoped = function (licensePlate) {
@@ -73,6 +74,13 @@ var MopedResource = /** @class */ (function (_super) {
73
74
  data: data
74
75
  });
75
76
  };
77
+ MopedResource.prototype.getUnigarantAdditionalCoverages = function (data) {
78
+ return this.http({
79
+ method: 'post',
80
+ url: '/unigarant/additional_coverages',
81
+ data: data
82
+ });
83
+ };
76
84
  return MopedResource;
77
85
  }(categories_resource_1.default));
78
86
  exports.default = MopedResource;
@@ -12,5 +12,6 @@ declare class MopedService extends RateService implements CalculateRatesInterfac
12
12
  getVergelijkdirectAdditionalCoverages(data: any): Promise<AdditionalCoverageInterface[] | []>;
13
13
  getEnraAdditionalCoverages(data: any): Promise<AdditionalCoverageInterface[] | []>;
14
14
  getMoneyviewAdditionalCoverages(data: any): Promise<AdditionalCoverageInterface[] | []>;
15
+ getUnigarantAdditionalCoverages(data: any): Promise<AdditionalCoverageInterface[] | []>;
15
16
  }
16
17
  export default MopedService;
@@ -124,6 +124,13 @@ var MopedService = /** @class */ (function (_super) {
124
124
  });
125
125
  });
126
126
  };
127
+ MopedService.prototype.getUnigarantAdditionalCoverages = function (data) {
128
+ return __awaiter(this, void 0, void 0, function () {
129
+ return __generator(this, function (_a) {
130
+ return [2 /*return*/, this.client.getUnigarantAdditionalCoverages(data)];
131
+ });
132
+ });
133
+ };
127
134
  return MopedService;
128
135
  }(index_1.RateService));
129
136
  exports.default = MopedService;