@vergelijkdirect/insurance-transmission-client 1.3.35 → 1.3.36
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/moped.resource.d.ts +1 -0
- package/src/js/resources/moped.resource.js +8 -0
- package/src/js/services/moped.service.d.ts +1 -0
- package/src/js/services/moped.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;
|
|
@@ -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;
|