turf-common 1.4.2-beta.17 → 1.4.2-beta.19
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/enums/booking-history-operation-type.enum.d.ts +2 -1
- package/build/src/enums/booking-history-operation-type.enum.js +1 -0
- package/build/src/interface/api/update-recurring-booking.interface.d.ts +1 -0
- package/build/src/models/charge-model.js +1 -1
- package/build/tests/unit/charges/extension/basic.spec.js +6 -0
- package/build/tests/unit/pricing-plan/basic-scenario.spec.js +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export declare enum BookingHistoryOperationType {
|
|
|
7
7
|
REFUND = "refund",
|
|
8
8
|
PAYMENT = "payment",
|
|
9
9
|
MERGED = "merged",
|
|
10
|
-
DELETE_SLOT_EVENT = "delete_slot_event"
|
|
10
|
+
DELETE_SLOT_EVENT = "delete_slot_event",
|
|
11
|
+
EXTENSION = "extension"
|
|
11
12
|
}
|
|
12
13
|
export declare const OPERATION_TYPES: BookingHistoryOperationType[];
|
|
@@ -12,6 +12,7 @@ var BookingHistoryOperationType;
|
|
|
12
12
|
BookingHistoryOperationType["PAYMENT"] = "payment";
|
|
13
13
|
BookingHistoryOperationType["MERGED"] = "merged";
|
|
14
14
|
BookingHistoryOperationType["DELETE_SLOT_EVENT"] = "delete_slot_event";
|
|
15
|
+
BookingHistoryOperationType["EXTENSION"] = "extension";
|
|
15
16
|
})(BookingHistoryOperationType || (exports.BookingHistoryOperationType = BookingHistoryOperationType = {}));
|
|
16
17
|
exports.OPERATION_TYPES = [
|
|
17
18
|
BookingHistoryOperationType.DELETE,
|
|
@@ -34,6 +34,7 @@ export interface IUpdateRecurringBookingResponse extends IModifyEntity<IBookingD
|
|
|
34
34
|
discountPolicy?: string;
|
|
35
35
|
delete_slot?: IDeleteBookingByCodesDto;
|
|
36
36
|
update_slot?: IUpdateBookingByCodesDto;
|
|
37
|
+
extension_booking_codes?: string[];
|
|
37
38
|
}
|
|
38
39
|
export interface IUpdateRecurringSlotBookingDetailsRequest {
|
|
39
40
|
customerName?: string;
|
|
@@ -237,7 +237,7 @@ var ChargesModel = /** @class */ (function () {
|
|
|
237
237
|
};
|
|
238
238
|
ChargesModel.getInstance = function (chargeData, discountPolicy) {
|
|
239
239
|
if (discountPolicy === void 0) { discountPolicy = modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL; }
|
|
240
|
-
var chargesModel = new ChargesModel(chargeData.initialBookingGrossAmount, chargeData.amountPaid, chargeData.couponCode, chargeData.totalBookingHours, discountPolicy);
|
|
240
|
+
var chargesModel = new ChargesModel(chargeData.initialBookingGrossAmount, chargeData.amountPaid, chargeData.couponCode, parseFloat(chargeData.totalBookingHours.toString()), discountPolicy);
|
|
241
241
|
Object.assign(chargesModel, chargeData);
|
|
242
242
|
return chargesModel;
|
|
243
243
|
};
|
|
@@ -33,6 +33,7 @@ describe("AppController (e2e)", function () {
|
|
|
33
33
|
var expectedTotalRefundedAmount = 0;
|
|
34
34
|
var expectedCouponCode = "100PHU";
|
|
35
35
|
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
36
|
+
var expectedTotalBookingHours = 3;
|
|
36
37
|
var initialGrossAmount = bookingCodes
|
|
37
38
|
.map(function (bookingCode) { return bookingCode.getCost(); })
|
|
38
39
|
.reduce(function (a, b) { return a + b; }, 0);
|
|
@@ -49,6 +50,7 @@ describe("AppController (e2e)", function () {
|
|
|
49
50
|
expect(chargeModel.totalRefundedAmount).toEqual(expectedTotalRefundedAmount);
|
|
50
51
|
expect(chargeModel.couponCode).toEqual(expectedCouponCode);
|
|
51
52
|
expect(chargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
53
|
+
expect(chargeModel.totalBookingHours).toEqual(expectedTotalBookingHours);
|
|
52
54
|
});
|
|
53
55
|
it("1. modify extend", function () {
|
|
54
56
|
var expectedInitialBookingGrossAmount = 3000;
|
|
@@ -62,6 +64,7 @@ describe("AppController (e2e)", function () {
|
|
|
62
64
|
var expectedTotalRefundedAmount = 0;
|
|
63
65
|
var expectedCouponCode = "100PHU";
|
|
64
66
|
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
67
|
+
var expectedTotalBookingHours = 4;
|
|
65
68
|
if (currentChargeModel)
|
|
66
69
|
currentChargeModel = currentChargeModel.modify({
|
|
67
70
|
oldBookingCode: initialBookingCode2,
|
|
@@ -80,6 +83,7 @@ describe("AppController (e2e)", function () {
|
|
|
80
83
|
expect(currentChargeModel.totalRefundedAmount).toEqual(expectedTotalRefundedAmount);
|
|
81
84
|
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
82
85
|
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
86
|
+
expect(currentChargeModel.totalBookingHours).toEqual(expectedTotalBookingHours);
|
|
83
87
|
}
|
|
84
88
|
});
|
|
85
89
|
it("2. extension", function () {
|
|
@@ -94,6 +98,7 @@ describe("AppController (e2e)", function () {
|
|
|
94
98
|
var expectedTotalRefundedAmount = 0;
|
|
95
99
|
var expectedCouponCode = "100PHU";
|
|
96
100
|
var expectedDiscountPolicy = _enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL;
|
|
101
|
+
var expectedTotalBookingHours = 4.5;
|
|
97
102
|
if (currentChargeModel)
|
|
98
103
|
currentChargeModel = currentChargeModel.extension(modify2ExtensionBookingCode);
|
|
99
104
|
expect(currentChargeModel).not.toBeNull();
|
|
@@ -109,6 +114,7 @@ describe("AppController (e2e)", function () {
|
|
|
109
114
|
expect(currentChargeModel.totalRefundedAmount).toEqual(expectedTotalRefundedAmount);
|
|
110
115
|
expect(currentChargeModel.couponCode).toEqual(expectedCouponCode);
|
|
111
116
|
expect(currentChargeModel.discountPolicy).toEqual(expectedDiscountPolicy);
|
|
117
|
+
expect(currentChargeModel.totalBookingHours).toEqual(expectedTotalBookingHours);
|
|
112
118
|
}
|
|
113
119
|
});
|
|
114
120
|
it("3. modify reduce", function () {
|
|
@@ -153,7 +153,7 @@ describe("AppController (e2e)", function () {
|
|
|
153
153
|
for (var _l = 0, expectedBillingCycleKeys_3 = expectedBillingCycleKeys; _l < expectedBillingCycleKeys_3.length; _l++) {
|
|
154
154
|
var billingCycleKey = expectedBillingCycleKeys_3[_l];
|
|
155
155
|
var subscribedPricingPlanModelV2 = new _model_1.SubscribedPricingPlanModelV2(pricingPlanModelV2, pitchCount, billingCycleKey);
|
|
156
|
-
console.log(
|
|
156
|
+
// console.log(`---- Pitch Count: '${subscribedPricingPlanModelV2.pitchCount}', Billing: '${subscribedPricingPlanModelV2.billingCycle}'`)
|
|
157
157
|
// TODO: Need to check the usability of the below method
|
|
158
158
|
// console.log(`subscribedPricingPlanModelV2.getMonths() : ${subscribedPricingPlanModelV2.getMonths()}`)
|
|
159
159
|
// TODO: Needs to change the name to getBasePriceByPitchSlab for Monthly
|