@vergelijkdirect/insurance-transmission-client 1.3.62 → 1.3.63
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 +1 -1
- package/src/js/clients/shopping-card.client.d.ts +27 -0
- package/src/js/clients/shopping-card.client.js +96 -0
- package/src/js/interfaces/abstract-rate.interface.d.ts +8 -0
- package/src/js/interfaces/abstract-rate.interface.js +2 -0
- package/src/js/maps/nl-insurance.map.d.ts +1 -0
- package/src/js/maps/nl-insurance.map.js +18 -0
- package/src/js/resources/caravan.resource.d.ts +2 -1
- package/src/js/resources/caravan.resource.js +7 -0
- package/src/js/services/caravan.service.d.ts +2 -1
- package/src/js/services/caravan.service.js +7 -0
package/package.json
CHANGED
|
@@ -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;
|
|
@@ -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;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { NextableInterface } from "../interfaces";
|
|
1
|
+
import { AdditionalCoveragesRequestInterface, NextableInterface } from "../interfaces";
|
|
2
2
|
import CategoryResource from "./categories.resource";
|
|
3
3
|
declare class CaravanResource extends CategoryResource {
|
|
4
4
|
protected getCategory(): string;
|
|
5
5
|
protected getAvailableServices(): string[];
|
|
6
6
|
getCaravanBrands(data: any): Promise<NextableInterface>;
|
|
7
|
+
getRiskAdditionalCoverages(data: AdditionalCoveragesRequestInterface): Promise<any>;
|
|
7
8
|
getCaravanVDBrands(data: any): Promise<NextableInterface>;
|
|
8
9
|
getCaravanModels(data: any): Promise<NextableInterface>;
|
|
9
10
|
getCaravanTypes(data: any): Promise<NextableInterface>;
|
|
@@ -35,6 +35,13 @@ var CaravanResource = /** @class */ (function (_super) {
|
|
|
35
35
|
url: '/brands?' + new URLSearchParams(data),
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
+
CaravanResource.prototype.getRiskAdditionalCoverages = function (data) {
|
|
39
|
+
return this.http({
|
|
40
|
+
method: 'post',
|
|
41
|
+
url: '/risk/additional_coverages',
|
|
42
|
+
data: data,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
38
45
|
CaravanResource.prototype.getCaravanVDBrands = function (data) {
|
|
39
46
|
return this.http({
|
|
40
47
|
method: 'get',
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { RateCollection } from "../models";
|
|
2
|
-
import { CalculateRatesInterface } from "../interfaces";
|
|
2
|
+
import { AdditionalCoverageInterface, CalculateRatesInterface } from "../interfaces";
|
|
3
3
|
import { RateService } from "./index";
|
|
4
4
|
declare class CaravanService extends RateService implements CalculateRatesInterface {
|
|
5
5
|
private client;
|
|
6
6
|
constructor();
|
|
7
7
|
getRates(data: any): Promise<RateCollection>;
|
|
8
8
|
getCoverageRateComparison(data: any): Promise<RateCollection>;
|
|
9
|
+
getRiskAdditionalCoverages(data: any): Promise<AdditionalCoverageInterface[] | []>;
|
|
9
10
|
getCaravanBrands(data: any): Promise<any>;
|
|
10
11
|
getCaravanVDBrands(data: any): Promise<any>;
|
|
11
12
|
getCaravanModels(data: any): Promise<any>;
|
|
@@ -90,6 +90,13 @@ var CaravanService = /** @class */ (function (_super) {
|
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
+
CaravanService.prototype.getRiskAdditionalCoverages = function (data) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
return [2 /*return*/, this.client.getRiskAdditionalCoverages(data)];
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
};
|
|
93
100
|
CaravanService.prototype.getCaravanBrands = function (data) {
|
|
94
101
|
return __awaiter(this, void 0, void 0, function () {
|
|
95
102
|
return __generator(this, function (_a) {
|