turf-common 1.3.1 → 1.4.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/build/src/tests/unit/charges/across-dates/across-dates-booking-TURF-476.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/across-dates/across-dates-booking-TURF-476.spec.js +114 -0
- package/build/src/tests/unit/charges/across-dates/across-dates-booking-without-discount-TURF-476.e2e-spec.d.ts +1 -0
- package/build/src/tests/unit/charges/across-dates/across-dates-booking-without-discount-TURF-476.e2e-spec.js +114 -0
- package/build/src/tests/unit/charges/across-dates/across-dates-discount-TURF-476.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/across-dates/across-dates-discount-TURF-476.spec.js +114 -0
- package/build/src/tests/unit/charges/across-dates/across-dates-extend-remove-TURF-476.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/across-dates/across-dates-extend-remove-TURF-476.spec.js +114 -0
- package/build/src/tests/unit/charges/discount-conditional/basic-amount-half-amount-paid.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/discount-conditional/basic-amount-half-amount-paid.spec.js +221 -0
- package/build/src/tests/unit/charges/discount-conditional/basic-amount-paid-refund-amount-paid-cancellation-not-present.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/discount-conditional/basic-amount-paid-refund-amount-paid-cancellation-not-present.spec.js +518 -0
- package/build/src/tests/unit/charges/discount-conditional/basic-amount-paid-refund-amount-paid.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/discount-conditional/basic-amount-paid-refund-amount-paid.spec.js +470 -0
- package/build/src/tests/unit/charges/discount-conditional/basic-amount-paid.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/discount-conditional/basic-amount-paid.spec.js +263 -0
- package/build/src/tests/unit/charges/discount-conditional/basic.-amount-not-paid.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/discount-conditional/basic.-amount-not-paid.spec.js +223 -0
- package/build/src/tests/unit/charges/discount-conditional/decimal-discount.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/discount-conditional/decimal-discount.spec.js +509 -0
- package/build/src/tests/unit/charges/per-hour-unit/phu-basic-amount-not-paid-TURF-486.spec.d.ts +1 -0
- package/build/src/tests/unit/charges/per-hour-unit/phu-basic-amount-not-paid-TURF-486.spec.js +148 -0
- package/build/src/tests/utils/models/booking-entity-test.d.ts +9 -0
- package/build/src/tests/utils/models/booking-entity-test.js +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,509 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var _enum_1 = require("../../../../@enum");
|
|
40
|
+
var _model_1 = require("../../../../@model");
|
|
41
|
+
var booking_entity_test_1 = require("../../../utils/models/booking-entity-test");
|
|
42
|
+
describe("AppController (e2e)", function () {
|
|
43
|
+
var bookingCodes = [
|
|
44
|
+
new booking_entity_test_1.BookingEntityTest("00012308131000120001", "250,250,250,250").getBookingCode(),
|
|
45
|
+
new booking_entity_test_1.BookingEntityTest("00012308141000120001", "250,250,250,250").getBookingCode(),
|
|
46
|
+
new booking_entity_test_1.BookingEntityTest("00012308151000120001", "250,250,250,250").getBookingCode(),
|
|
47
|
+
];
|
|
48
|
+
var initialGrossAmount = bookingCodes
|
|
49
|
+
.map(function (bookingCode) { return bookingCode.getCost(); })
|
|
50
|
+
.reduce(function (a, b) { return a + b; }, 0);
|
|
51
|
+
var totalBookingHours = booking_entity_test_1.BookingEntityTest.getTotalHours(bookingCodes);
|
|
52
|
+
var chargeModel = new _model_1.ChargesModel(initialGrossAmount, 0, "10.5P", totalBookingHours, _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL);
|
|
53
|
+
var currentChargeModel = chargeModel;
|
|
54
|
+
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
55
|
+
return [2 /*return*/];
|
|
56
|
+
}); }); });
|
|
57
|
+
it("1 create", function () {
|
|
58
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
59
|
+
var expectedAdditionalBookingGrossAmount = 0;
|
|
60
|
+
var expectCancelledBookingGrossAmount = 0;
|
|
61
|
+
var expectTotalCancellationCharges = 0;
|
|
62
|
+
var expectRefundPayable = 0;
|
|
63
|
+
var expectNetTotal = 2685;
|
|
64
|
+
var expectAmountPaid = 2685;
|
|
65
|
+
var expectAmountPayable = 0;
|
|
66
|
+
var expectTotalRefundedAmount = 0;
|
|
67
|
+
var expectedCouponCode = "10.5P";
|
|
68
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
69
|
+
var initialGrossAmount = bookingCodes
|
|
70
|
+
.map(function (bookingCode) { return bookingCode.getCost(); })
|
|
71
|
+
.reduce(function (a, b) { return a + b; }, 0);
|
|
72
|
+
chargeModel = new _model_1.ChargesModel(initialGrossAmount, 2685, "10.5P", totalBookingHours, _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL);
|
|
73
|
+
currentChargeModel = chargeModel;
|
|
74
|
+
expect(chargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
75
|
+
expect(chargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
76
|
+
expect(chargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
77
|
+
expect(chargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
78
|
+
expect(chargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
79
|
+
expect(chargeModel.netTotal).toEqual(expectNetTotal);
|
|
80
|
+
expect(chargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
81
|
+
expect(chargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
82
|
+
expect(chargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
83
|
+
expect(chargeModel.couponCode).toEqual(expectedCouponCode);
|
|
84
|
+
expect(chargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
85
|
+
});
|
|
86
|
+
it("2 extend", function () {
|
|
87
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
88
|
+
var expectedAdditionalBookingGrossAmount = 500;
|
|
89
|
+
var expectCancelledBookingGrossAmount = 0;
|
|
90
|
+
var expectTotalCancellationCharges = 0;
|
|
91
|
+
var expectRefundPayable = 0;
|
|
92
|
+
var expectNetTotal = 3132;
|
|
93
|
+
var expectAmountPaid = 2685;
|
|
94
|
+
var expectAmountPayable = 447;
|
|
95
|
+
var expectTotalRefundedAmount = 0;
|
|
96
|
+
var expectedCouponCode = "10.5P";
|
|
97
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
98
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000120001", "250,250,250,250").getBookingCode();
|
|
99
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000130001", "250,250,250,250,250,250").getBookingCode();
|
|
100
|
+
if (currentChargeModel)
|
|
101
|
+
currentChargeModel = currentChargeModel.modify({
|
|
102
|
+
oldBookingCode: oldBookingCode,
|
|
103
|
+
newBookingCode: newBookingCode,
|
|
104
|
+
cancellationUnit: "3.5P",
|
|
105
|
+
});
|
|
106
|
+
expect(currentChargeModel).not.toBeNull();
|
|
107
|
+
if (currentChargeModel) {
|
|
108
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
109
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
110
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
111
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
112
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
113
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
114
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
115
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
116
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
117
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
118
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
it("3 reduce", function () {
|
|
122
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
123
|
+
var expectedAdditionalBookingGrossAmount = 500;
|
|
124
|
+
var expectCancelledBookingGrossAmount = 500;
|
|
125
|
+
var expectTotalCancellationCharges = 18;
|
|
126
|
+
var expectRefundPayable = 0;
|
|
127
|
+
var expectNetTotal = 3000;
|
|
128
|
+
var expectAmountPaid = 2685;
|
|
129
|
+
var expectAmountPayable = 333;
|
|
130
|
+
var expectTotalRefundedAmount = 0;
|
|
131
|
+
var expectedCouponCode = "";
|
|
132
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
133
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308141000120001", "250,250,250,250").getBookingCode();
|
|
134
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308141000110001", "250,250").getBookingCode();
|
|
135
|
+
if (currentChargeModel)
|
|
136
|
+
currentChargeModel = currentChargeModel.modify({
|
|
137
|
+
oldBookingCode: oldBookingCode,
|
|
138
|
+
newBookingCode: newBookingCode,
|
|
139
|
+
cancellationUnit: "3.5P",
|
|
140
|
+
});
|
|
141
|
+
expect(currentChargeModel).not.toBeNull();
|
|
142
|
+
if (currentChargeModel) {
|
|
143
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
144
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
145
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
146
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
147
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
148
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
149
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
150
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
151
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
152
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
153
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
it("4 move", function () {
|
|
157
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
158
|
+
var expectedAdditionalBookingGrossAmount = 500;
|
|
159
|
+
var expectCancelledBookingGrossAmount = 500;
|
|
160
|
+
var expectTotalCancellationCharges = 18;
|
|
161
|
+
var expectRefundPayable = 0;
|
|
162
|
+
var expectNetTotal = 3000;
|
|
163
|
+
var expectAmountPaid = 2685;
|
|
164
|
+
var expectAmountPayable = 333;
|
|
165
|
+
var expectTotalRefundedAmount = 0;
|
|
166
|
+
var expectedCouponCode = "";
|
|
167
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
168
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308141000110001", "250,250").getBookingCode();
|
|
169
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308141100120001", "250,250").getBookingCode();
|
|
170
|
+
if (currentChargeModel)
|
|
171
|
+
currentChargeModel = currentChargeModel.modify({
|
|
172
|
+
oldBookingCode: oldBookingCode,
|
|
173
|
+
newBookingCode: newBookingCode,
|
|
174
|
+
cancellationUnit: "3.5P",
|
|
175
|
+
});
|
|
176
|
+
expect(currentChargeModel).not.toBeNull();
|
|
177
|
+
if (currentChargeModel) {
|
|
178
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
179
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
180
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
181
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
182
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
183
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
184
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
185
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
186
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
187
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
188
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
it("5 delete", function () {
|
|
192
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
193
|
+
var expectedAdditionalBookingGrossAmount = 500;
|
|
194
|
+
var expectCancelledBookingGrossAmount = 1500;
|
|
195
|
+
var expectTotalCancellationCharges = 53;
|
|
196
|
+
var expectRefundPayable = 632;
|
|
197
|
+
var expectNetTotal = 2000;
|
|
198
|
+
var expectAmountPaid = 2685;
|
|
199
|
+
var expectAmountPayable = 0;
|
|
200
|
+
var expectTotalRefundedAmount = 0;
|
|
201
|
+
var expectedCouponCode = "";
|
|
202
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
203
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308131000120001", "250,250,250,250").getBookingCode();
|
|
204
|
+
if (currentChargeModel)
|
|
205
|
+
currentChargeModel = currentChargeModel.modify({
|
|
206
|
+
oldBookingCode: oldBookingCode,
|
|
207
|
+
cancellationUnit: "3.5P",
|
|
208
|
+
});
|
|
209
|
+
expect(currentChargeModel).not.toBeNull();
|
|
210
|
+
if (currentChargeModel) {
|
|
211
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
212
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
213
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
214
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
215
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
216
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
217
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
218
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
219
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
220
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
221
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
it("6 refund amount paid", function () {
|
|
225
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
226
|
+
var expectedAdditionalBookingGrossAmount = 500;
|
|
227
|
+
var expectCancelledBookingGrossAmount = 1500;
|
|
228
|
+
var expectTotalCancellationCharges = 53;
|
|
229
|
+
var expectRefundPayable = 0;
|
|
230
|
+
var expectNetTotal = 2000;
|
|
231
|
+
var expectAmountPaid = 2685;
|
|
232
|
+
var expectAmountPayable = 0;
|
|
233
|
+
var expectTotalRefundedAmount = 632;
|
|
234
|
+
var expectedCouponCode = "";
|
|
235
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
236
|
+
if (currentChargeModel)
|
|
237
|
+
currentChargeModel = currentChargeModel.setValues({
|
|
238
|
+
totalRefundedAmount: 632,
|
|
239
|
+
});
|
|
240
|
+
expect(currentChargeModel).not.toBeNull();
|
|
241
|
+
if (currentChargeModel) {
|
|
242
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
243
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
244
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
245
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
246
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
247
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
248
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
249
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
250
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
251
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
252
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
it("7 reduce", function () {
|
|
256
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
257
|
+
var expectedAdditionalBookingGrossAmount = 500;
|
|
258
|
+
var expectCancelledBookingGrossAmount = 2500;
|
|
259
|
+
var expectNetTotal = 1000;
|
|
260
|
+
var expectTotalCancellationCharges = 88;
|
|
261
|
+
var expectAmountPaid = 2685;
|
|
262
|
+
var expectRefundPayable = 965;
|
|
263
|
+
var expectAmountPayable = 0;
|
|
264
|
+
var expectTotalRefundedAmount = 632;
|
|
265
|
+
var expectedCouponCode = "";
|
|
266
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
267
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000130001", "250,250,250,250,250,250").getBookingCode();
|
|
268
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000110001", "250,250").getBookingCode();
|
|
269
|
+
if (currentChargeModel) {
|
|
270
|
+
currentChargeModel = currentChargeModel.modify({
|
|
271
|
+
oldBookingCode: oldBookingCode,
|
|
272
|
+
newBookingCode: newBookingCode,
|
|
273
|
+
cancellationUnit: "3.5P",
|
|
274
|
+
});
|
|
275
|
+
// currentChargeModel!.totalRefundAmount = 0;
|
|
276
|
+
}
|
|
277
|
+
expect(currentChargeModel).not.toBeNull();
|
|
278
|
+
if (currentChargeModel) {
|
|
279
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
280
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
281
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
282
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
283
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
284
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
285
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
286
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
287
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
288
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
289
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
it("8 extend", function () {
|
|
293
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
294
|
+
var expectedAdditionalBookingGrossAmount = 3000;
|
|
295
|
+
var expectCancelledBookingGrossAmount = 2500;
|
|
296
|
+
var expectNetTotal = 3500;
|
|
297
|
+
var expectTotalCancellationCharges = 88;
|
|
298
|
+
var expectAmountPaid = 2685;
|
|
299
|
+
var expectRefundPayable = 0;
|
|
300
|
+
var expectAmountPayable = 1535;
|
|
301
|
+
var expectTotalRefundedAmount = 632;
|
|
302
|
+
var expectedCouponCode = "";
|
|
303
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
304
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000110001", "250,250").getBookingCode();
|
|
305
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000160001", "250,250,250,250,250,250,250,250,250,250,250,250").getBookingCode();
|
|
306
|
+
if (currentChargeModel) {
|
|
307
|
+
currentChargeModel = currentChargeModel.modify({
|
|
308
|
+
oldBookingCode: oldBookingCode,
|
|
309
|
+
newBookingCode: newBookingCode,
|
|
310
|
+
cancellationUnit: "3.5P",
|
|
311
|
+
});
|
|
312
|
+
// currentChargeModel!.totalRefundAmount = 0;
|
|
313
|
+
}
|
|
314
|
+
expect(currentChargeModel).not.toBeNull();
|
|
315
|
+
if (currentChargeModel) {
|
|
316
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
317
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
318
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
319
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
320
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
321
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
322
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
323
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
324
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
325
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
326
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
it("9 extend", function () {
|
|
330
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
331
|
+
var expectedAdditionalBookingGrossAmount = 4000;
|
|
332
|
+
var expectCancelledBookingGrossAmount = 2500;
|
|
333
|
+
var expectNetTotal = 4500;
|
|
334
|
+
var expectTotalCancellationCharges = 88;
|
|
335
|
+
var expectAmountPaid = 2685;
|
|
336
|
+
var expectRefundPayable = 0;
|
|
337
|
+
var expectAmountPayable = 2535;
|
|
338
|
+
var expectTotalRefundedAmount = 632;
|
|
339
|
+
var expectedCouponCode = "";
|
|
340
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
341
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000160001", "250,250,250,250,250,250,250,250,250,250,250,250").getBookingCode();
|
|
342
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000180001", "250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250").getBookingCode();
|
|
343
|
+
if (currentChargeModel) {
|
|
344
|
+
currentChargeModel = currentChargeModel.modify({
|
|
345
|
+
oldBookingCode: oldBookingCode,
|
|
346
|
+
newBookingCode: newBookingCode,
|
|
347
|
+
cancellationUnit: "3.5P",
|
|
348
|
+
});
|
|
349
|
+
// currentChargeModel!.totalRefundAmount = 0;
|
|
350
|
+
}
|
|
351
|
+
expect(currentChargeModel).not.toBeNull();
|
|
352
|
+
if (currentChargeModel) {
|
|
353
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
354
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
355
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
356
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
357
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
358
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
359
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
360
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
361
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
362
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
363
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
it("10 pay amount", function () {
|
|
367
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
368
|
+
var expectedAdditionalBookingGrossAmount = 4000;
|
|
369
|
+
var expectCancelledBookingGrossAmount = 2500;
|
|
370
|
+
var expectNetTotal = 4500;
|
|
371
|
+
var expectTotalCancellationCharges = 88;
|
|
372
|
+
var expectAmountPaid = 5220;
|
|
373
|
+
var expectRefundPayable = 0;
|
|
374
|
+
var expectAmountPayable = 0;
|
|
375
|
+
var expectTotalRefundedAmount = 632;
|
|
376
|
+
var expectedCouponCode = "";
|
|
377
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
378
|
+
if (currentChargeModel) {
|
|
379
|
+
currentChargeModel = currentChargeModel.setValues({
|
|
380
|
+
amountPaid: 2535,
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
expect(currentChargeModel).not.toBeNull();
|
|
384
|
+
if (currentChargeModel) {
|
|
385
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
386
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
387
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
388
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
389
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
390
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
391
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
392
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
393
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
394
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
395
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
it("11 reduce", function () {
|
|
399
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
400
|
+
var expectedAdditionalBookingGrossAmount = 4000;
|
|
401
|
+
var expectCancelledBookingGrossAmount = 4500;
|
|
402
|
+
var expectNetTotal = 2500;
|
|
403
|
+
var expectTotalCancellationCharges = 158;
|
|
404
|
+
var expectAmountPaid = 5220;
|
|
405
|
+
var expectRefundPayable = 1930;
|
|
406
|
+
var expectAmountPayable = 0;
|
|
407
|
+
var expectTotalRefundedAmount = 632;
|
|
408
|
+
var expectedCouponCode = "";
|
|
409
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
410
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000180001", "250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250").getBookingCode();
|
|
411
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000140001", "250,250,250,250,250,250,250,250").getBookingCode();
|
|
412
|
+
if (currentChargeModel) {
|
|
413
|
+
currentChargeModel = currentChargeModel.modify({
|
|
414
|
+
oldBookingCode: oldBookingCode,
|
|
415
|
+
newBookingCode: newBookingCode,
|
|
416
|
+
cancellationUnit: "3.5P",
|
|
417
|
+
});
|
|
418
|
+
// currentChargeModel!.totalRefundAmount = 0;
|
|
419
|
+
}
|
|
420
|
+
expect(currentChargeModel).not.toBeNull();
|
|
421
|
+
if (currentChargeModel) {
|
|
422
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
423
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
424
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
425
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
426
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
427
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
428
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
429
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
430
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
431
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
432
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
it("12 extend", function () {
|
|
436
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
437
|
+
var expectedAdditionalBookingGrossAmount = 4100;
|
|
438
|
+
var expectCancelledBookingGrossAmount = 4500;
|
|
439
|
+
var expectNetTotal = 2600;
|
|
440
|
+
var expectTotalCancellationCharges = 158;
|
|
441
|
+
var expectAmountPaid = 5220;
|
|
442
|
+
var expectRefundPayable = 1830;
|
|
443
|
+
var expectAmountPayable = 0;
|
|
444
|
+
var expectTotalRefundedAmount = 632;
|
|
445
|
+
var expectedCouponCode = "";
|
|
446
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
447
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151000140001", "250,250,250,250,250,250,250,250").getBookingCode();
|
|
448
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151100150001", "250,250,250,250,250,250,300,300").getBookingCode();
|
|
449
|
+
if (currentChargeModel) {
|
|
450
|
+
currentChargeModel = currentChargeModel.modify({
|
|
451
|
+
oldBookingCode: oldBookingCode,
|
|
452
|
+
newBookingCode: newBookingCode,
|
|
453
|
+
cancellationUnit: "3.5P",
|
|
454
|
+
});
|
|
455
|
+
// currentChargeModel!.totalRefundAmount = 0;
|
|
456
|
+
}
|
|
457
|
+
expect(currentChargeModel).not.toBeNull();
|
|
458
|
+
if (currentChargeModel) {
|
|
459
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
460
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
461
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
462
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
463
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
464
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
465
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
466
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
467
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
468
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
469
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
it("13 reduce", function () {
|
|
473
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
474
|
+
var expectedAdditionalBookingGrossAmount = 4100;
|
|
475
|
+
var expectCancelledBookingGrossAmount = 4700;
|
|
476
|
+
var expectNetTotal = 2400;
|
|
477
|
+
var expectTotalCancellationCharges = 165;
|
|
478
|
+
var expectAmountPaid = 5220;
|
|
479
|
+
var expectRefundPayable = 2023;
|
|
480
|
+
var expectAmountPayable = 0;
|
|
481
|
+
var expectTotalRefundedAmount = 632;
|
|
482
|
+
var expectedCouponCode = "";
|
|
483
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
484
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151100150001", "250,250,250,250,250,250,300,300").getBookingCode();
|
|
485
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308151200160001", "250,250,250,250,300,300,150,150").getBookingCode();
|
|
486
|
+
if (currentChargeModel) {
|
|
487
|
+
currentChargeModel = currentChargeModel.modify({
|
|
488
|
+
oldBookingCode: oldBookingCode,
|
|
489
|
+
newBookingCode: newBookingCode,
|
|
490
|
+
cancellationUnit: "3.5P",
|
|
491
|
+
});
|
|
492
|
+
// currentChargeModel!.totalRefundAmount = 0;
|
|
493
|
+
}
|
|
494
|
+
expect(currentChargeModel).not.toBeNull();
|
|
495
|
+
if (currentChargeModel) {
|
|
496
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
497
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
498
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectCancelledBookingGrossAmount);
|
|
499
|
+
expect(currentChargeModel.netTotal).toEqual(expectNetTotal);
|
|
500
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectTotalCancellationCharges);
|
|
501
|
+
expect(currentChargeModel.amountPaid).toEqual(expectAmountPaid);
|
|
502
|
+
expect(currentChargeModel.refundPayable).toEqual(expectRefundPayable);
|
|
503
|
+
expect(currentChargeModel.amountPayable).toEqual(expectAmountPayable);
|
|
504
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectTotalRefundedAmount);
|
|
505
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
506
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
});
|
package/build/src/tests/unit/charges/per-hour-unit/phu-basic-amount-not-paid-TURF-486.spec.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var _enum_1 = require("../../../../@enum");
|
|
4
|
+
var _model_1 = require("../../../../@model");
|
|
5
|
+
var booking_entity_test_1 = require("../../../utils/models/booking-entity-test");
|
|
6
|
+
describe("AppController (e2e)", function () {
|
|
7
|
+
var bookingCodes = [
|
|
8
|
+
new booking_entity_test_1.BookingEntityTest("00012308131000120001", "500,500,500,500").getBookingCode(),
|
|
9
|
+
new booking_entity_test_1.BookingEntityTest("00012308141000110001", "500,500").getBookingCode(),
|
|
10
|
+
];
|
|
11
|
+
var initialGrossAmount = bookingCodes
|
|
12
|
+
.map(function (bookingCode) { return bookingCode.getCost(); })
|
|
13
|
+
.reduce(function (a, b) { return a + b; }, 0);
|
|
14
|
+
var totalBookingHours = booking_entity_test_1.BookingEntityTest.getTotalHours(bookingCodes);
|
|
15
|
+
var chargeModel = new _model_1.ChargesModel(initialGrossAmount, 0, "", totalBookingHours, _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL);
|
|
16
|
+
var currentChargeModel = chargeModel;
|
|
17
|
+
it("create", function () {
|
|
18
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
19
|
+
var expectedAdditionalBookingGrossAmount = 0;
|
|
20
|
+
var expectedCancellationGrossAmount = 0;
|
|
21
|
+
var expectedTotalCancellationCharges = 0;
|
|
22
|
+
var expectedRefundPayable = 0;
|
|
23
|
+
var expectedNetTotal = 2700;
|
|
24
|
+
var expectedAmountPaid = 0;
|
|
25
|
+
var expectedAmountPayable = 2700;
|
|
26
|
+
var expectedTotalRefundedAmount = 0;
|
|
27
|
+
var expectedCouponCode = "100PHU";
|
|
28
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
29
|
+
var initialGrossAmount = bookingCodes
|
|
30
|
+
.map(function (bookingCode) { return bookingCode.getCost(); })
|
|
31
|
+
.reduce(function (a, b) { return a + b; }, 0);
|
|
32
|
+
chargeModel = new _model_1.ChargesModel(initialGrossAmount, 0, "100PHU", totalBookingHours, _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL);
|
|
33
|
+
currentChargeModel = chargeModel;
|
|
34
|
+
expect(chargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
35
|
+
expect(chargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
36
|
+
expect(chargeModel.cancelledBookingGrossAmount).toEqual(expectedCancellationGrossAmount);
|
|
37
|
+
expect(chargeModel.totalCancellationCharges).toEqual(expectedTotalCancellationCharges);
|
|
38
|
+
expect(chargeModel.refundPayable).toEqual(expectedRefundPayable);
|
|
39
|
+
expect(chargeModel.netTotal).toEqual(expectedNetTotal);
|
|
40
|
+
expect(chargeModel.amountPaid).toEqual(expectedAmountPaid);
|
|
41
|
+
expect(chargeModel.amountPayable).toEqual(expectedAmountPayable);
|
|
42
|
+
expect(chargeModel.totalRefundedAmount).toEqual(expectedTotalRefundedAmount);
|
|
43
|
+
expect(chargeModel.couponCode).toEqual(expectedCouponCode);
|
|
44
|
+
expect(chargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
45
|
+
});
|
|
46
|
+
it("extend", function () {
|
|
47
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
48
|
+
var expectedAdditionalBookingGrossAmount = 1000;
|
|
49
|
+
var expectedCancellationGrossAmount = 0;
|
|
50
|
+
var expectedTotalCancellationCharges = 0;
|
|
51
|
+
var expectedRefundPayable = 0;
|
|
52
|
+
var expectedNetTotal = 3600;
|
|
53
|
+
var expectedAmountPaid = 0;
|
|
54
|
+
var expectedAmountPayable = 3600;
|
|
55
|
+
var expectedTotalRefundedAmount = 0;
|
|
56
|
+
var expectedCouponCode = "100PHU";
|
|
57
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
58
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308141000110001", "500,500").getBookingCode();
|
|
59
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308141000120001", "500,500,500,500").getBookingCode();
|
|
60
|
+
if (currentChargeModel)
|
|
61
|
+
currentChargeModel = currentChargeModel.modify({
|
|
62
|
+
oldBookingCode: oldBookingCode,
|
|
63
|
+
newBookingCode: newBookingCode,
|
|
64
|
+
});
|
|
65
|
+
expect(currentChargeModel).not.toBeNull();
|
|
66
|
+
if (currentChargeModel) {
|
|
67
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
68
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
69
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectedCancellationGrossAmount);
|
|
70
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectedTotalCancellationCharges);
|
|
71
|
+
expect(currentChargeModel.refundPayable).toEqual(expectedRefundPayable);
|
|
72
|
+
expect(currentChargeModel.netTotal).toEqual(expectedNetTotal);
|
|
73
|
+
expect(currentChargeModel.amountPaid).toEqual(expectedAmountPaid);
|
|
74
|
+
expect(currentChargeModel.amountPayable).toEqual(expectedAmountPayable);
|
|
75
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectedTotalRefundedAmount);
|
|
76
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
77
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
it("reduce", function () {
|
|
81
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
82
|
+
var expectedAdditionalBookingGrossAmount = 1000;
|
|
83
|
+
var expectedCancellationGrossAmount = 1000;
|
|
84
|
+
var expectedTotalCancellationCharges = 100;
|
|
85
|
+
var expectedRefundPayable = 0;
|
|
86
|
+
var expectedNetTotal = 3000;
|
|
87
|
+
var expectedAmountPaid = 0;
|
|
88
|
+
var expectedAmountPayable = 3100;
|
|
89
|
+
var expectedTotalRefundedAmount = 0;
|
|
90
|
+
var expectedCouponCode = "";
|
|
91
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
92
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308141000120001", "500,500,500,500").getBookingCode();
|
|
93
|
+
var newBookingCode = new booking_entity_test_1.BookingEntityTest("00012308141000110001", "500,500").getBookingCode();
|
|
94
|
+
if (currentChargeModel)
|
|
95
|
+
currentChargeModel = currentChargeModel.modify({
|
|
96
|
+
oldBookingCode: oldBookingCode,
|
|
97
|
+
newBookingCode: newBookingCode,
|
|
98
|
+
cancellationUnit: "100U",
|
|
99
|
+
});
|
|
100
|
+
expect(currentChargeModel).not.toBeNull();
|
|
101
|
+
if (currentChargeModel) {
|
|
102
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
103
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
104
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectedCancellationGrossAmount);
|
|
105
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectedTotalCancellationCharges);
|
|
106
|
+
expect(currentChargeModel.refundPayable).toEqual(expectedRefundPayable);
|
|
107
|
+
expect(currentChargeModel.netTotal).toEqual(expectedNetTotal);
|
|
108
|
+
expect(currentChargeModel.amountPaid).toEqual(expectedAmountPaid);
|
|
109
|
+
expect(currentChargeModel.amountPayable).toEqual(expectedAmountPayable);
|
|
110
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectedTotalRefundedAmount);
|
|
111
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
112
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
it("delete", function () {
|
|
116
|
+
var expectedInitialBookingGrossAmount = 3000;
|
|
117
|
+
var expectedAdditionalBookingGrossAmount = 1000;
|
|
118
|
+
var expectedCancellationGrossAmount = 2000;
|
|
119
|
+
var expectedTotalCancellationCharges = 200;
|
|
120
|
+
var expectedRefundPayable = 0;
|
|
121
|
+
var expectedNetTotal = 2000;
|
|
122
|
+
var expectedAmountPaid = 0;
|
|
123
|
+
var expectedAmountPayable = 2200;
|
|
124
|
+
var expectedTotalRefundedAmount = 0;
|
|
125
|
+
var expectedCouponCode = "";
|
|
126
|
+
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
127
|
+
var oldBookingCode = new booking_entity_test_1.BookingEntityTest("00012308141000110001", "500,500").getBookingCode();
|
|
128
|
+
if (currentChargeModel)
|
|
129
|
+
currentChargeModel = currentChargeModel.modify({
|
|
130
|
+
oldBookingCode: oldBookingCode,
|
|
131
|
+
cancellationUnit: "100U",
|
|
132
|
+
});
|
|
133
|
+
expect(currentChargeModel).not.toBeNull();
|
|
134
|
+
if (currentChargeModel) {
|
|
135
|
+
expect(currentChargeModel.initialBookingGrossAmount).toEqual(expectedInitialBookingGrossAmount);
|
|
136
|
+
expect(currentChargeModel.additionalBookingGrossAmount).toEqual(expectedAdditionalBookingGrossAmount);
|
|
137
|
+
expect(currentChargeModel.cancelledBookingGrossAmount).toEqual(expectedCancellationGrossAmount);
|
|
138
|
+
expect(currentChargeModel.totalCancellationCharges).toEqual(expectedTotalCancellationCharges);
|
|
139
|
+
expect(currentChargeModel.refundPayable).toEqual(expectedRefundPayable);
|
|
140
|
+
expect(currentChargeModel.netTotal).toEqual(expectedNetTotal);
|
|
141
|
+
expect(currentChargeModel.amountPaid).toEqual(expectedAmountPaid);
|
|
142
|
+
expect(currentChargeModel.amountPayable).toEqual(expectedAmountPayable);
|
|
143
|
+
expect(currentChargeModel.totalRefundedAmount).toEqual(expectedTotalRefundedAmount);
|
|
144
|
+
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
145
|
+
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|