@stamhoofd/backend 2.106.1 → 2.107.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/index.ts +6 -1
- package/package.json +17 -11
- package/src/boot.ts +28 -22
- package/src/endpoints/frontend/FrontendEnvironmentEndpoint.ts +89 -0
- package/src/endpoints/global/billing/ActivatePackagesEndpoint.ts +30 -0
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +3 -2
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +8 -3
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +109 -109
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +7 -0
- package/src/endpoints/organization/dashboard/payments/PatchBalanceItemsEndpoint.ts +9 -7
- package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +7 -0
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +9 -2
- package/src/excel-loaders/payments.ts +5 -5
- package/src/excel-loaders/receivable-balances.ts +7 -7
- package/src/helpers/AdminPermissionChecker.ts +20 -0
- package/src/helpers/BuckarooHelper.ts +1 -1
- package/src/helpers/ServiceFeeHelper.ts +8 -4
- package/src/helpers/StripeHelper.ts +20 -35
- package/src/seeds/1752848561-groups-registration-periods.ts +35 -0
- package/src/services/BalanceItemService.ts +15 -2
- package/src/services/PaymentReallocationService.test.ts +298 -128
- package/src/services/PaymentReallocationService.ts +46 -16
- package/src/services/PaymentService.ts +49 -2
- package/src/services/uitpas/getSocialTariffForEvent.ts +2 -2
- package/src/services/uitpas/getSocialTariffForUitpasNumbers.ts +2 -2
- package/src/services/uitpas/registerTicketSales.ts +2 -2
- package/tests/e2e/bundle-discounts.test.ts +415 -391
- package/tests/e2e/documents.test.ts +21 -21
- package/tests/e2e/register.test.ts +93 -93
- package/tests/e2e/stock.test.ts +4 -4
|
@@ -88,7 +88,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
88
88
|
|
|
89
89
|
const group = await new GroupFactory({
|
|
90
90
|
organization,
|
|
91
|
-
price:
|
|
91
|
+
price: 25_0000,
|
|
92
92
|
bundleDiscount,
|
|
93
93
|
})
|
|
94
94
|
.create();
|
|
@@ -108,7 +108,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
108
108
|
],
|
|
109
109
|
}),
|
|
110
110
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
111
|
-
totalPrice:
|
|
111
|
+
totalPrice: 25_0000,
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
const response1 = await post(checkout1, organization, token);
|
|
@@ -123,10 +123,10 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
123
123
|
{
|
|
124
124
|
type: BalanceItemType.Registration,
|
|
125
125
|
amount: 1,
|
|
126
|
-
price:
|
|
126
|
+
price: 25_0000,
|
|
127
127
|
status: BalanceItemStatus.Due,
|
|
128
128
|
priceOpen: 0,
|
|
129
|
-
pricePending:
|
|
129
|
+
pricePending: 25_0000,
|
|
130
130
|
},
|
|
131
131
|
]);
|
|
132
132
|
});
|
|
@@ -144,14 +144,14 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
144
144
|
|
|
145
145
|
const group = await new GroupFactory({
|
|
146
146
|
organization,
|
|
147
|
-
price:
|
|
147
|
+
price: 25_0000,
|
|
148
148
|
}).create();
|
|
149
149
|
|
|
150
150
|
const groupPrice = group.settings.prices[0];
|
|
151
151
|
|
|
152
152
|
const group2 = await new GroupFactory({
|
|
153
153
|
organization,
|
|
154
|
-
price:
|
|
154
|
+
price: 35_0000,
|
|
155
155
|
bundleDiscount,
|
|
156
156
|
}).create();
|
|
157
157
|
|
|
@@ -170,7 +170,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
170
170
|
],
|
|
171
171
|
}),
|
|
172
172
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
173
|
-
totalPrice:
|
|
173
|
+
totalPrice: 25_0000,
|
|
174
174
|
});
|
|
175
175
|
|
|
176
176
|
const response1 = await post(checkout1, organization, token);
|
|
@@ -191,7 +191,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
191
191
|
],
|
|
192
192
|
}),
|
|
193
193
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
194
|
-
totalPrice:
|
|
194
|
+
totalPrice: 35_0000,
|
|
195
195
|
});
|
|
196
196
|
const response2 = await post(checkout2, organization, token);
|
|
197
197
|
expect(response2.body.registrations.length).toBe(1);
|
|
@@ -209,19 +209,19 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
209
209
|
type: BalanceItemType.Registration,
|
|
210
210
|
registrationId: registration1.id,
|
|
211
211
|
amount: 1,
|
|
212
|
-
price:
|
|
212
|
+
price: 25_0000,
|
|
213
213
|
status: BalanceItemStatus.Due,
|
|
214
214
|
priceOpen: 0,
|
|
215
|
-
pricePending:
|
|
215
|
+
pricePending: 25_0000,
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
218
|
type: BalanceItemType.Registration,
|
|
219
219
|
registrationId: registration2.id,
|
|
220
220
|
amount: 1,
|
|
221
|
-
price:
|
|
221
|
+
price: 35_0000,
|
|
222
222
|
status: BalanceItemStatus.Due,
|
|
223
223
|
priceOpen: 0,
|
|
224
|
-
pricePending:
|
|
224
|
+
pricePending: 35_0000,
|
|
225
225
|
},
|
|
226
226
|
]);
|
|
227
227
|
});
|
|
@@ -239,7 +239,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
239
239
|
|
|
240
240
|
const group = await new GroupFactory({
|
|
241
241
|
organization,
|
|
242
|
-
price:
|
|
242
|
+
price: 25_0000,
|
|
243
243
|
bundleDiscount,
|
|
244
244
|
}).create();
|
|
245
245
|
|
|
@@ -247,7 +247,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
247
247
|
|
|
248
248
|
const group2 = await new GroupFactory({
|
|
249
249
|
organization,
|
|
250
|
-
price:
|
|
250
|
+
price: 15_0000, // Lower price so discount is applied preferably on the first group
|
|
251
251
|
bundleDiscount,
|
|
252
252
|
}).create();
|
|
253
253
|
|
|
@@ -287,7 +287,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
287
287
|
],
|
|
288
288
|
}),
|
|
289
289
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
290
|
-
totalPrice:
|
|
290
|
+
totalPrice: 15_0000 - 5_0000, // 20% discount on first group
|
|
291
291
|
});
|
|
292
292
|
const response2 = await post(checkout2, organization, token);
|
|
293
293
|
expect(response2.body.registrations.length).toBe(1);
|
|
@@ -302,7 +302,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
302
302
|
expect(updatedRegistration1.discounts).toMatchMap(new Map([
|
|
303
303
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
304
304
|
name: bundleDiscount.name,
|
|
305
|
-
amount:
|
|
305
|
+
amount: 5_0000,
|
|
306
306
|
})],
|
|
307
307
|
]));
|
|
308
308
|
|
|
@@ -311,28 +311,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
311
311
|
type: BalanceItemType.Registration,
|
|
312
312
|
registrationId: registration1.id,
|
|
313
313
|
amount: 1,
|
|
314
|
-
price:
|
|
314
|
+
price: 25_0000,
|
|
315
315
|
status: BalanceItemStatus.Due,
|
|
316
316
|
priceOpen: 0,
|
|
317
|
-
pricePending:
|
|
317
|
+
pricePending: 25_0000,
|
|
318
318
|
},
|
|
319
319
|
{
|
|
320
320
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
321
321
|
registrationId: registration1.id,
|
|
322
322
|
amount: 1,
|
|
323
|
-
price: -
|
|
323
|
+
price: -5_0000,
|
|
324
324
|
status: BalanceItemStatus.Due,
|
|
325
325
|
priceOpen: 0,
|
|
326
|
-
pricePending: -
|
|
326
|
+
pricePending: -5_0000,
|
|
327
327
|
},
|
|
328
328
|
{
|
|
329
329
|
type: BalanceItemType.Registration,
|
|
330
330
|
registrationId: registration2.id,
|
|
331
331
|
amount: 1,
|
|
332
|
-
price:
|
|
332
|
+
price: 15_0000,
|
|
333
333
|
status: BalanceItemStatus.Due,
|
|
334
334
|
priceOpen: 0,
|
|
335
|
-
pricePending:
|
|
335
|
+
pricePending: 15_0000,
|
|
336
336
|
},
|
|
337
337
|
]);
|
|
338
338
|
});
|
|
@@ -350,7 +350,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
350
350
|
|
|
351
351
|
const group = await new GroupFactory({
|
|
352
352
|
organization,
|
|
353
|
-
price:
|
|
353
|
+
price: 25_0000,
|
|
354
354
|
bundleDiscount,
|
|
355
355
|
})
|
|
356
356
|
.create();
|
|
@@ -359,7 +359,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
359
359
|
|
|
360
360
|
const group2 = await new GroupFactory({
|
|
361
361
|
organization,
|
|
362
|
-
price:
|
|
362
|
+
price: 35_0000, // Higher price so discount is applied preferably here
|
|
363
363
|
bundleDiscount,
|
|
364
364
|
}).create();
|
|
365
365
|
|
|
@@ -378,7 +378,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
378
378
|
],
|
|
379
379
|
}),
|
|
380
380
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
381
|
-
totalPrice:
|
|
381
|
+
totalPrice: 25_0000,
|
|
382
382
|
});
|
|
383
383
|
|
|
384
384
|
const response1 = await post(checkout1, organization, token);
|
|
@@ -399,7 +399,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
399
399
|
],
|
|
400
400
|
}),
|
|
401
401
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
402
|
-
totalPrice:
|
|
402
|
+
totalPrice: 35_0000 - 7_0000, // 20% discount on 35_00 = 7_00
|
|
403
403
|
});
|
|
404
404
|
const response2 = await post(checkout2, organization, token);
|
|
405
405
|
expect(response2.body.registrations.length).toBe(1);
|
|
@@ -411,7 +411,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
411
411
|
bundleDiscount.id,
|
|
412
412
|
AppliedRegistrationDiscount.create({
|
|
413
413
|
name: bundleDiscount.name,
|
|
414
|
-
amount:
|
|
414
|
+
amount: 7_0000,
|
|
415
415
|
}),
|
|
416
416
|
],
|
|
417
417
|
]));
|
|
@@ -426,28 +426,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
426
426
|
type: BalanceItemType.Registration,
|
|
427
427
|
registrationId: registration1.id,
|
|
428
428
|
amount: 1,
|
|
429
|
-
price:
|
|
429
|
+
price: 25_0000,
|
|
430
430
|
status: BalanceItemStatus.Due,
|
|
431
431
|
priceOpen: 0,
|
|
432
|
-
pricePending:
|
|
432
|
+
pricePending: 25_0000,
|
|
433
433
|
},
|
|
434
434
|
{
|
|
435
435
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
436
436
|
registrationId: registration2.id,
|
|
437
437
|
amount: 1,
|
|
438
|
-
price: -
|
|
438
|
+
price: -7_0000,
|
|
439
439
|
status: BalanceItemStatus.Due,
|
|
440
440
|
priceOpen: 0,
|
|
441
|
-
pricePending: -
|
|
441
|
+
pricePending: -7_0000,
|
|
442
442
|
},
|
|
443
443
|
{
|
|
444
444
|
type: BalanceItemType.Registration,
|
|
445
445
|
registrationId: registration2.id,
|
|
446
446
|
amount: 1,
|
|
447
|
-
price:
|
|
447
|
+
price: 35_0000,
|
|
448
448
|
status: BalanceItemStatus.Due,
|
|
449
449
|
priceOpen: 0,
|
|
450
|
-
pricePending:
|
|
450
|
+
pricePending: 35_0000,
|
|
451
451
|
},
|
|
452
452
|
]);
|
|
453
453
|
});
|
|
@@ -467,17 +467,17 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
467
467
|
const groups = [
|
|
468
468
|
await new GroupFactory({
|
|
469
469
|
organization,
|
|
470
|
-
price:
|
|
470
|
+
price: 35_0000,
|
|
471
471
|
bundleDiscount,
|
|
472
472
|
}).create(),
|
|
473
473
|
await new GroupFactory({
|
|
474
474
|
organization,
|
|
475
|
-
price:
|
|
475
|
+
price: 25_0000,
|
|
476
476
|
bundleDiscount,
|
|
477
477
|
}).create(),
|
|
478
478
|
await new GroupFactory({
|
|
479
479
|
organization,
|
|
480
|
-
price:
|
|
480
|
+
price: 45_0000,
|
|
481
481
|
bundleDiscount,
|
|
482
482
|
}).create(),
|
|
483
483
|
];
|
|
@@ -497,7 +497,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
497
497
|
registrationId: registration1.id,
|
|
498
498
|
type: BalanceItemType.Registration,
|
|
499
499
|
amount: 1,
|
|
500
|
-
unitPrice:
|
|
500
|
+
unitPrice: 35_0000,
|
|
501
501
|
status: BalanceItemStatus.Due,
|
|
502
502
|
}).create();
|
|
503
503
|
|
|
@@ -524,7 +524,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
524
524
|
administrationFee: 0,
|
|
525
525
|
freeContribution: 0,
|
|
526
526
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
527
|
-
totalPrice:
|
|
527
|
+
totalPrice: 25_0000 + 45_0000 - 7_0000 - 18_0000, // 20% off 35_00 = 7_00, 40% off 45_00 = 18_00
|
|
528
528
|
});
|
|
529
529
|
const response = await post(checkout, organization, token);
|
|
530
530
|
expect(response.body.registrations.length).toBe(2);
|
|
@@ -543,7 +543,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
543
543
|
bundleDiscount.id,
|
|
544
544
|
AppliedRegistrationDiscount.create({
|
|
545
545
|
name: bundleDiscount.name,
|
|
546
|
-
amount:
|
|
546
|
+
amount: 18_0000,
|
|
547
547
|
}),
|
|
548
548
|
],
|
|
549
549
|
]),
|
|
@@ -552,39 +552,39 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
552
552
|
await assertBalances({ user }, [
|
|
553
553
|
{
|
|
554
554
|
registrationId: registration1.id,
|
|
555
|
-
unitPrice:
|
|
555
|
+
unitPrice: 35_0000,
|
|
556
556
|
amount: 1,
|
|
557
557
|
type: BalanceItemType.Registration,
|
|
558
|
-
priceOpen:
|
|
558
|
+
priceOpen: 35_0000,
|
|
559
559
|
},
|
|
560
560
|
{
|
|
561
561
|
registrationId: registration2.id,
|
|
562
|
-
unitPrice:
|
|
562
|
+
unitPrice: 25_0000,
|
|
563
563
|
amount: 1,
|
|
564
564
|
type: BalanceItemType.Registration,
|
|
565
|
-
pricePending:
|
|
565
|
+
pricePending: 25_0000,
|
|
566
566
|
},
|
|
567
567
|
{
|
|
568
568
|
registrationId: registration3.id,
|
|
569
|
-
unitPrice:
|
|
569
|
+
unitPrice: 45_0000,
|
|
570
570
|
amount: 1,
|
|
571
571
|
type: BalanceItemType.Registration,
|
|
572
|
-
pricePending:
|
|
572
|
+
pricePending: 45_0000,
|
|
573
573
|
},
|
|
574
574
|
// Discounts
|
|
575
575
|
{
|
|
576
576
|
registrationId: registration1.id,
|
|
577
|
-
unitPrice: -
|
|
577
|
+
unitPrice: -7_0000,
|
|
578
578
|
amount: 1,
|
|
579
579
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
580
|
-
pricePending: -
|
|
580
|
+
pricePending: -7_0000,
|
|
581
581
|
},
|
|
582
582
|
{
|
|
583
583
|
registrationId: registration3.id,
|
|
584
|
-
unitPrice: -
|
|
584
|
+
unitPrice: -18_0000,
|
|
585
585
|
amount: 1,
|
|
586
586
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
587
|
-
pricePending: -
|
|
587
|
+
pricePending: -18_0000,
|
|
588
588
|
},
|
|
589
589
|
]);
|
|
590
590
|
});
|
|
@@ -608,12 +608,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
608
608
|
const groups = [
|
|
609
609
|
await new GroupFactory({
|
|
610
610
|
organization,
|
|
611
|
-
price:
|
|
611
|
+
price: 35_0000,
|
|
612
612
|
bundleDiscount,
|
|
613
613
|
}).create(),
|
|
614
614
|
await new GroupFactory({
|
|
615
615
|
organization,
|
|
616
|
-
price:
|
|
616
|
+
price: 25_0000,
|
|
617
617
|
bundleDiscount,
|
|
618
618
|
}).create(),
|
|
619
619
|
];
|
|
@@ -625,7 +625,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
625
625
|
group: groups[0],
|
|
626
626
|
groupPrice: groups[0].settings.prices[0].patch({
|
|
627
627
|
price: ReduceablePrice.create({
|
|
628
|
-
price:
|
|
628
|
+
price: 30_0000, // This has changed, the group normally 'costs' 35_00
|
|
629
629
|
}),
|
|
630
630
|
}),
|
|
631
631
|
}).create();
|
|
@@ -638,7 +638,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
638
638
|
registrationId: registration1.id,
|
|
639
639
|
type: BalanceItemType.Registration,
|
|
640
640
|
amount: 1,
|
|
641
|
-
unitPrice:
|
|
641
|
+
unitPrice: 30_0000, // This has changed, the group normally 'costs' 35_00
|
|
642
642
|
status: BalanceItemStatus.Due,
|
|
643
643
|
}).create();
|
|
644
644
|
|
|
@@ -658,7 +658,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
658
658
|
administrationFee: 0,
|
|
659
659
|
freeContribution: 0,
|
|
660
660
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
661
|
-
totalPrice:
|
|
661
|
+
totalPrice: 25_0000 - 6_0000, // 20% of 30_00 = 6_00
|
|
662
662
|
});
|
|
663
663
|
const response = await post(checkout, organization, token);
|
|
664
664
|
expect(response.body.registrations.length).toBe(1);
|
|
@@ -672,25 +672,25 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
672
672
|
await assertBalances({ user }, [
|
|
673
673
|
{
|
|
674
674
|
registrationId: registration1.id,
|
|
675
|
-
unitPrice:
|
|
675
|
+
unitPrice: 30_0000,
|
|
676
676
|
amount: 1,
|
|
677
677
|
type: BalanceItemType.Registration,
|
|
678
|
-
priceOpen:
|
|
678
|
+
priceOpen: 30_0000,
|
|
679
679
|
},
|
|
680
680
|
{
|
|
681
681
|
registrationId: registration2.id,
|
|
682
|
-
unitPrice:
|
|
682
|
+
unitPrice: 25_0000,
|
|
683
683
|
amount: 1,
|
|
684
684
|
type: BalanceItemType.Registration,
|
|
685
|
-
pricePending:
|
|
685
|
+
pricePending: 25_0000,
|
|
686
686
|
},
|
|
687
687
|
// Discounts
|
|
688
688
|
{
|
|
689
689
|
registrationId: registration1.id,
|
|
690
|
-
unitPrice: -
|
|
690
|
+
unitPrice: -6_0000,
|
|
691
691
|
amount: 1,
|
|
692
692
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
693
|
-
pricePending: -
|
|
693
|
+
pricePending: -6_0000,
|
|
694
694
|
},
|
|
695
695
|
]);
|
|
696
696
|
});
|
|
@@ -714,19 +714,19 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
714
714
|
const groups = [
|
|
715
715
|
await new GroupFactory({
|
|
716
716
|
organization,
|
|
717
|
-
price:
|
|
717
|
+
price: 25_0000,
|
|
718
718
|
bundleDiscount,
|
|
719
719
|
}).create(),
|
|
720
720
|
|
|
721
721
|
await new GroupFactory({
|
|
722
722
|
organization,
|
|
723
|
-
price:
|
|
723
|
+
price: 15_0000,
|
|
724
724
|
bundleDiscount,
|
|
725
725
|
}).create(),
|
|
726
726
|
|
|
727
727
|
await new GroupFactory({
|
|
728
728
|
organization,
|
|
729
|
-
price:
|
|
729
|
+
price: 35_0000,
|
|
730
730
|
bundleDiscount,
|
|
731
731
|
}).create(),
|
|
732
732
|
];
|
|
@@ -753,7 +753,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
753
753
|
registrationId: registrations[0].id,
|
|
754
754
|
type: BalanceItemType.Registration,
|
|
755
755
|
amount: 1,
|
|
756
|
-
unitPrice:
|
|
756
|
+
unitPrice: 25_0000,
|
|
757
757
|
status: BalanceItemStatus.Due, // Still due, because we had a 100% cancellation fee
|
|
758
758
|
}).create();
|
|
759
759
|
|
|
@@ -765,7 +765,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
765
765
|
registrationId: registrations[0].id,
|
|
766
766
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
767
767
|
amount: 1,
|
|
768
|
-
unitPrice: -
|
|
768
|
+
unitPrice: -5_0000,
|
|
769
769
|
status: BalanceItemStatus.Due, // Still due, because we had a 100% cancellation fee
|
|
770
770
|
relations: new Map([
|
|
771
771
|
[
|
|
@@ -786,7 +786,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
786
786
|
registrationId: registrations[1].id,
|
|
787
787
|
type: BalanceItemType.Registration,
|
|
788
788
|
amount: 1,
|
|
789
|
-
unitPrice:
|
|
789
|
+
unitPrice: 15_0000,
|
|
790
790
|
status: BalanceItemStatus.Due,
|
|
791
791
|
}).create();
|
|
792
792
|
|
|
@@ -806,7 +806,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
806
806
|
administrationFee: 0,
|
|
807
807
|
freeContribution: 0,
|
|
808
808
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
809
|
-
totalPrice:
|
|
809
|
+
totalPrice: 35_0000 - 7_0000, // 20% of 35 = 7_00
|
|
810
810
|
});
|
|
811
811
|
const response = await post(checkout, organization, token);
|
|
812
812
|
const registration3 = response.body.registrations[0];
|
|
@@ -819,7 +819,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
819
819
|
discounts: new Map([
|
|
820
820
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
821
821
|
name: bundleDiscount.name,
|
|
822
|
-
amount:
|
|
822
|
+
amount: 7_0000,
|
|
823
823
|
})],
|
|
824
824
|
]),
|
|
825
825
|
});
|
|
@@ -829,7 +829,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
829
829
|
expect(registrations[0].discounts).toMatchMap(new Map([
|
|
830
830
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
831
831
|
name: bundleDiscount.name,
|
|
832
|
-
amount:
|
|
832
|
+
amount: 5_0000,
|
|
833
833
|
})],
|
|
834
834
|
]));
|
|
835
835
|
|
|
@@ -839,46 +839,46 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
839
839
|
type: BalanceItemType.Registration,
|
|
840
840
|
registrationId: registrations[0].id,
|
|
841
841
|
amount: 1,
|
|
842
|
-
price:
|
|
842
|
+
price: 25_0000,
|
|
843
843
|
status: BalanceItemStatus.Due,
|
|
844
|
-
priceOpen:
|
|
844
|
+
priceOpen: 25_0000,
|
|
845
845
|
pricePending: 0,
|
|
846
846
|
},
|
|
847
847
|
{
|
|
848
848
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
849
849
|
registrationId: registrations[0].id,
|
|
850
850
|
amount: 1,
|
|
851
|
-
price: -
|
|
851
|
+
price: -5_0000,
|
|
852
852
|
status: BalanceItemStatus.Due,
|
|
853
|
-
priceOpen: -
|
|
853
|
+
priceOpen: -5_0000,
|
|
854
854
|
pricePending: 0,
|
|
855
855
|
},
|
|
856
856
|
{
|
|
857
857
|
type: BalanceItemType.Registration,
|
|
858
858
|
registrationId: registrations[1].id,
|
|
859
859
|
amount: 1,
|
|
860
|
-
price:
|
|
860
|
+
price: 15_0000,
|
|
861
861
|
status: BalanceItemStatus.Due,
|
|
862
|
-
priceOpen:
|
|
862
|
+
priceOpen: 15_0000,
|
|
863
863
|
pricePending: 0,
|
|
864
864
|
},
|
|
865
865
|
{
|
|
866
866
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
867
867
|
registrationId: registration3.id,
|
|
868
868
|
amount: 1,
|
|
869
|
-
price: -
|
|
869
|
+
price: -7_0000,
|
|
870
870
|
status: BalanceItemStatus.Due,
|
|
871
871
|
priceOpen: 0,
|
|
872
|
-
pricePending: -
|
|
872
|
+
pricePending: -7_0000,
|
|
873
873
|
},
|
|
874
874
|
{
|
|
875
875
|
type: BalanceItemType.Registration,
|
|
876
876
|
registrationId: registration3.id,
|
|
877
877
|
amount: 1,
|
|
878
|
-
price:
|
|
878
|
+
price: 35_0000,
|
|
879
879
|
status: BalanceItemStatus.Due,
|
|
880
880
|
priceOpen: 0,
|
|
881
|
-
pricePending:
|
|
881
|
+
pricePending: 35_0000,
|
|
882
882
|
},
|
|
883
883
|
]);
|
|
884
884
|
});
|
|
@@ -898,13 +898,13 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
898
898
|
const groups = [
|
|
899
899
|
await new GroupFactory({
|
|
900
900
|
organization,
|
|
901
|
-
price:
|
|
901
|
+
price: 25_0000,
|
|
902
902
|
bundleDiscount,
|
|
903
903
|
}).create(),
|
|
904
904
|
|
|
905
905
|
await new GroupFactory({
|
|
906
906
|
organization,
|
|
907
|
-
price:
|
|
907
|
+
price: 35_0000,
|
|
908
908
|
bundleDiscount,
|
|
909
909
|
}).create(),
|
|
910
910
|
];
|
|
@@ -927,7 +927,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
927
927
|
registrationId: registrations[0].id,
|
|
928
928
|
type: BalanceItemType.Registration,
|
|
929
929
|
amount: 1,
|
|
930
|
-
unitPrice:
|
|
930
|
+
unitPrice: 25_0000,
|
|
931
931
|
status: BalanceItemStatus.Due,
|
|
932
932
|
}).create();
|
|
933
933
|
|
|
@@ -939,7 +939,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
939
939
|
registrationId: registrations[0].id,
|
|
940
940
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
941
941
|
amount: 1,
|
|
942
|
-
unitPrice: -
|
|
942
|
+
unitPrice: -15_0000, // not correct, this is what we'll correct
|
|
943
943
|
status: BalanceItemStatus.Due,
|
|
944
944
|
relations: new Map([
|
|
945
945
|
[
|
|
@@ -969,7 +969,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
969
969
|
administrationFee: 0,
|
|
970
970
|
freeContribution: 0,
|
|
971
971
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
972
|
-
totalPrice:
|
|
972
|
+
totalPrice: 35_0000 - 7_0000 + 15_0000, // - normal discount + wrong discount
|
|
973
973
|
});
|
|
974
974
|
const response = await post(checkout, organization, token);
|
|
975
975
|
const registration2 = response.body.registrations[0];
|
|
@@ -979,7 +979,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
979
979
|
discounts: new Map([
|
|
980
980
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
981
981
|
name: bundleDiscount.name,
|
|
982
|
-
amount:
|
|
982
|
+
amount: 7_0000,
|
|
983
983
|
})],
|
|
984
984
|
]),
|
|
985
985
|
});
|
|
@@ -994,47 +994,47 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
994
994
|
type: BalanceItemType.Registration,
|
|
995
995
|
registrationId: registrations[0].id,
|
|
996
996
|
amount: 1,
|
|
997
|
-
price:
|
|
997
|
+
price: 25_0000,
|
|
998
998
|
status: BalanceItemStatus.Due,
|
|
999
|
-
priceOpen:
|
|
999
|
+
priceOpen: 25_0000,
|
|
1000
1000
|
pricePending: 0,
|
|
1001
1001
|
},
|
|
1002
1002
|
{
|
|
1003
1003
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1004
1004
|
registrationId: registrations[0].id,
|
|
1005
1005
|
amount: 1,
|
|
1006
|
-
price: -
|
|
1006
|
+
price: -15_0000,
|
|
1007
1007
|
status: BalanceItemStatus.Due,
|
|
1008
|
-
priceOpen: -
|
|
1008
|
+
priceOpen: -15_0000,
|
|
1009
1009
|
pricePending: 0,
|
|
1010
1010
|
},
|
|
1011
1011
|
{
|
|
1012
1012
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1013
1013
|
registrationId: registration2.id,
|
|
1014
1014
|
amount: 1,
|
|
1015
|
-
price: -
|
|
1015
|
+
price: -7_0000,
|
|
1016
1016
|
status: BalanceItemStatus.Due,
|
|
1017
1017
|
priceOpen: 0,
|
|
1018
|
-
pricePending: -
|
|
1018
|
+
pricePending: -7_0000,
|
|
1019
1019
|
},
|
|
1020
1020
|
{
|
|
1021
1021
|
type: BalanceItemType.Registration,
|
|
1022
1022
|
registrationId: registration2.id,
|
|
1023
1023
|
amount: 1,
|
|
1024
|
-
price:
|
|
1024
|
+
price: 35_0000,
|
|
1025
1025
|
status: BalanceItemStatus.Due,
|
|
1026
1026
|
priceOpen: 0,
|
|
1027
|
-
pricePending:
|
|
1027
|
+
pricePending: 35_0000,
|
|
1028
1028
|
},
|
|
1029
1029
|
// Corrected discount:
|
|
1030
1030
|
{
|
|
1031
1031
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1032
1032
|
registrationId: registrations[0].id,
|
|
1033
1033
|
amount: 1,
|
|
1034
|
-
price:
|
|
1034
|
+
price: 15_0000,
|
|
1035
1035
|
status: BalanceItemStatus.Due,
|
|
1036
1036
|
priceOpen: 0,
|
|
1037
|
-
pricePending:
|
|
1037
|
+
pricePending: 15_0000,
|
|
1038
1038
|
},
|
|
1039
1039
|
]);
|
|
1040
1040
|
});
|
|
@@ -1054,13 +1054,13 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1054
1054
|
const groups = [
|
|
1055
1055
|
await new GroupFactory({
|
|
1056
1056
|
organization,
|
|
1057
|
-
price:
|
|
1057
|
+
price: 25_0000,
|
|
1058
1058
|
bundleDiscount,
|
|
1059
1059
|
}).create(),
|
|
1060
1060
|
|
|
1061
1061
|
await new GroupFactory({
|
|
1062
1062
|
organization,
|
|
1063
|
-
price:
|
|
1063
|
+
price: 35_0000,
|
|
1064
1064
|
}).create(),
|
|
1065
1065
|
];
|
|
1066
1066
|
|
|
@@ -1082,7 +1082,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1082
1082
|
registrationId: registrations[0].id,
|
|
1083
1083
|
type: BalanceItemType.Registration,
|
|
1084
1084
|
amount: 1,
|
|
1085
|
-
unitPrice:
|
|
1085
|
+
unitPrice: 25_0000,
|
|
1086
1086
|
status: BalanceItemStatus.Due,
|
|
1087
1087
|
}).create();
|
|
1088
1088
|
|
|
@@ -1094,7 +1094,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1094
1094
|
registrationId: registrations[0].id,
|
|
1095
1095
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1096
1096
|
amount: 1,
|
|
1097
|
-
unitPrice: -
|
|
1097
|
+
unitPrice: -15_0000, // not correct, this is what we'll correct
|
|
1098
1098
|
status: BalanceItemStatus.Due,
|
|
1099
1099
|
relations: new Map([
|
|
1100
1100
|
[
|
|
@@ -1124,7 +1124,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1124
1124
|
administrationFee: 0,
|
|
1125
1125
|
freeContribution: 0,
|
|
1126
1126
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
1127
|
-
totalPrice:
|
|
1127
|
+
totalPrice: 35_0000,
|
|
1128
1128
|
});
|
|
1129
1129
|
const response = await post(checkout, organization, token);
|
|
1130
1130
|
const registration2 = response.body.registrations[0];
|
|
@@ -1139,7 +1139,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1139
1139
|
expect(registrations[0].discounts).toMatchMap(new Map([
|
|
1140
1140
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
1141
1141
|
name: bundleDiscount.name,
|
|
1142
|
-
amount:
|
|
1142
|
+
amount: 15_0000,
|
|
1143
1143
|
})],
|
|
1144
1144
|
]));
|
|
1145
1145
|
|
|
@@ -1149,28 +1149,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1149
1149
|
type: BalanceItemType.Registration,
|
|
1150
1150
|
registrationId: registrations[0].id,
|
|
1151
1151
|
amount: 1,
|
|
1152
|
-
price:
|
|
1152
|
+
price: 25_0000,
|
|
1153
1153
|
status: BalanceItemStatus.Due,
|
|
1154
|
-
priceOpen:
|
|
1154
|
+
priceOpen: 25_0000,
|
|
1155
1155
|
pricePending: 0,
|
|
1156
1156
|
},
|
|
1157
1157
|
{
|
|
1158
1158
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1159
1159
|
registrationId: registrations[0].id,
|
|
1160
1160
|
amount: 1,
|
|
1161
|
-
price: -
|
|
1161
|
+
price: -15_0000,
|
|
1162
1162
|
status: BalanceItemStatus.Due,
|
|
1163
|
-
priceOpen: -
|
|
1163
|
+
priceOpen: -15_0000,
|
|
1164
1164
|
pricePending: 0,
|
|
1165
1165
|
},
|
|
1166
1166
|
{
|
|
1167
1167
|
type: BalanceItemType.Registration,
|
|
1168
1168
|
registrationId: registration2.id,
|
|
1169
1169
|
amount: 1,
|
|
1170
|
-
price:
|
|
1170
|
+
price: 35_0000,
|
|
1171
1171
|
status: BalanceItemStatus.Due,
|
|
1172
1172
|
priceOpen: 0,
|
|
1173
|
-
pricePending:
|
|
1173
|
+
pricePending: 35_0000,
|
|
1174
1174
|
},
|
|
1175
1175
|
]);
|
|
1176
1176
|
});
|
|
@@ -1189,12 +1189,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1189
1189
|
const groups = [
|
|
1190
1190
|
await new GroupFactory({
|
|
1191
1191
|
organization,
|
|
1192
|
-
price:
|
|
1192
|
+
price: 25_0000,
|
|
1193
1193
|
bundleDiscount,
|
|
1194
1194
|
}).create(),
|
|
1195
1195
|
await new GroupFactory({
|
|
1196
1196
|
organization,
|
|
1197
|
-
price:
|
|
1197
|
+
price: 15_0000,
|
|
1198
1198
|
bundleDiscount,
|
|
1199
1199
|
}).create(),
|
|
1200
1200
|
];
|
|
@@ -1222,7 +1222,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1222
1222
|
administrationFee: 0,
|
|
1223
1223
|
freeContribution: 0,
|
|
1224
1224
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
1225
|
-
totalPrice:
|
|
1225
|
+
totalPrice: 25_0000 + 15_0000 - 5_0000, // 20% discount on highest price (25_00 * 0.2 = 5_00)
|
|
1226
1226
|
});
|
|
1227
1227
|
|
|
1228
1228
|
const response1 = await post(checkout, organization, token);
|
|
@@ -1235,7 +1235,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1235
1235
|
discounts: new Map([
|
|
1236
1236
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
1237
1237
|
name: bundleDiscount.name,
|
|
1238
|
-
amount:
|
|
1238
|
+
amount: 5_0000,
|
|
1239
1239
|
})],
|
|
1240
1240
|
]),
|
|
1241
1241
|
}),
|
|
@@ -1251,28 +1251,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1251
1251
|
type: BalanceItemType.Registration,
|
|
1252
1252
|
registrationId: expect.any(String),
|
|
1253
1253
|
amount: 1,
|
|
1254
|
-
price:
|
|
1254
|
+
price: 25_0000,
|
|
1255
1255
|
status: BalanceItemStatus.Due,
|
|
1256
1256
|
priceOpen: 0,
|
|
1257
|
-
pricePending:
|
|
1257
|
+
pricePending: 25_0000,
|
|
1258
1258
|
},
|
|
1259
1259
|
{
|
|
1260
1260
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1261
1261
|
registrationId: expect.any(String),
|
|
1262
1262
|
amount: 1,
|
|
1263
|
-
price: -
|
|
1263
|
+
price: -5_0000,
|
|
1264
1264
|
status: BalanceItemStatus.Due,
|
|
1265
1265
|
priceOpen: 0,
|
|
1266
|
-
pricePending: -
|
|
1266
|
+
pricePending: -5_0000,
|
|
1267
1267
|
},
|
|
1268
1268
|
{
|
|
1269
1269
|
type: BalanceItemType.Registration,
|
|
1270
1270
|
registrationId: expect.any(String),
|
|
1271
1271
|
amount: 1,
|
|
1272
|
-
price:
|
|
1272
|
+
price: 15_0000,
|
|
1273
1273
|
status: BalanceItemStatus.Due,
|
|
1274
1274
|
priceOpen: 0,
|
|
1275
|
-
pricePending:
|
|
1275
|
+
pricePending: 15_0000,
|
|
1276
1276
|
},
|
|
1277
1277
|
]);
|
|
1278
1278
|
});
|
|
@@ -1292,7 +1292,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1292
1292
|
|
|
1293
1293
|
const group = await new GroupFactory({
|
|
1294
1294
|
organization,
|
|
1295
|
-
price:
|
|
1295
|
+
price: 25_0000,
|
|
1296
1296
|
stock: 500,
|
|
1297
1297
|
bundleDiscount,
|
|
1298
1298
|
})
|
|
@@ -1301,7 +1301,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1301
1301
|
|
|
1302
1302
|
const group2 = await new GroupFactory({
|
|
1303
1303
|
organization,
|
|
1304
|
-
price:
|
|
1304
|
+
price: 15_0000, // Lower price so discount is applied preferably on the first group
|
|
1305
1305
|
bundleDiscount,
|
|
1306
1306
|
}).create();
|
|
1307
1307
|
|
|
@@ -1340,10 +1340,10 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1340
1340
|
type: BalanceItemType.Registration,
|
|
1341
1341
|
registrationId: registration1.id,
|
|
1342
1342
|
amount: 1,
|
|
1343
|
-
unitPrice:
|
|
1343
|
+
unitPrice: 25_0000,
|
|
1344
1344
|
status: BalanceItemStatus.Hidden,
|
|
1345
|
-
priceOpen: -
|
|
1346
|
-
pricePending:
|
|
1345
|
+
priceOpen: -25_0000, // hidden, so no payment expected yet
|
|
1346
|
+
pricePending: 25_0000,
|
|
1347
1347
|
pricePaid: 0,
|
|
1348
1348
|
},
|
|
1349
1349
|
]);
|
|
@@ -1361,10 +1361,10 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1361
1361
|
type: BalanceItemType.Registration,
|
|
1362
1362
|
registrationId: registration1.id,
|
|
1363
1363
|
amount: 1,
|
|
1364
|
-
unitPrice:
|
|
1364
|
+
unitPrice: 25_0000,
|
|
1365
1365
|
status: BalanceItemStatus.Due,
|
|
1366
1366
|
priceOpen: 0,
|
|
1367
|
-
pricePaid:
|
|
1367
|
+
pricePaid: 25_0000,
|
|
1368
1368
|
pricePending: 0,
|
|
1369
1369
|
paidAt: expect.any(Date),
|
|
1370
1370
|
},
|
|
@@ -1387,7 +1387,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1387
1387
|
administrationFee: 0,
|
|
1388
1388
|
freeContribution: 0,
|
|
1389
1389
|
paymentMethod: PaymentMethod.Bancontact,
|
|
1390
|
-
totalPrice:
|
|
1390
|
+
totalPrice: 15_0000 - 5_0000, // 20% discount on first group
|
|
1391
1391
|
redirectUrl: new URL('https://www.example.com/success'),
|
|
1392
1392
|
cancelUrl: new URL('https://www.example.com/cancel'),
|
|
1393
1393
|
});
|
|
@@ -1409,20 +1409,20 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1409
1409
|
type: BalanceItemType.Registration,
|
|
1410
1410
|
registrationId: registration2.id,
|
|
1411
1411
|
amount: 1,
|
|
1412
|
-
unitPrice:
|
|
1412
|
+
unitPrice: 15_0000,
|
|
1413
1413
|
status: BalanceItemStatus.Hidden, // Pending
|
|
1414
|
-
priceOpen: -
|
|
1415
|
-
pricePending:
|
|
1414
|
+
priceOpen: -15_0000, // hidden, so no payment expected yet
|
|
1415
|
+
pricePending: 15_0000,
|
|
1416
1416
|
pricePaid: 0,
|
|
1417
1417
|
},
|
|
1418
1418
|
{
|
|
1419
1419
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1420
1420
|
registrationId: registration1.id,
|
|
1421
1421
|
amount: 1,
|
|
1422
|
-
unitPrice: -
|
|
1422
|
+
unitPrice: -5_0000,
|
|
1423
1423
|
status: BalanceItemStatus.Hidden, // Pending
|
|
1424
|
-
priceOpen:
|
|
1425
|
-
pricePending: -
|
|
1424
|
+
priceOpen: 5_0000,
|
|
1425
|
+
pricePending: -5_0000,
|
|
1426
1426
|
pricePaid: 0,
|
|
1427
1427
|
},
|
|
1428
1428
|
]);
|
|
@@ -1436,7 +1436,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1436
1436
|
type: BalanceItemType.Registration,
|
|
1437
1437
|
registrationId: registration2.id,
|
|
1438
1438
|
amount: 1,
|
|
1439
|
-
unitPrice:
|
|
1439
|
+
unitPrice: 15_0000,
|
|
1440
1440
|
status: BalanceItemStatus.Hidden,
|
|
1441
1441
|
priceOpen: 0,
|
|
1442
1442
|
pricePending: 0,
|
|
@@ -1447,7 +1447,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1447
1447
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1448
1448
|
registrationId: registration1.id,
|
|
1449
1449
|
amount: 1,
|
|
1450
|
-
unitPrice: -
|
|
1450
|
+
unitPrice: -5_0000,
|
|
1451
1451
|
status: BalanceItemStatus.Hidden,
|
|
1452
1452
|
priceOpen: 0,
|
|
1453
1453
|
pricePending: 0,
|
|
@@ -1477,10 +1477,10 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1477
1477
|
type: BalanceItemType.Registration,
|
|
1478
1478
|
registrationId: registration3.id,
|
|
1479
1479
|
amount: 1,
|
|
1480
|
-
unitPrice:
|
|
1480
|
+
unitPrice: 15_0000,
|
|
1481
1481
|
status: BalanceItemStatus.Hidden, // Pending
|
|
1482
|
-
priceOpen: -
|
|
1483
|
-
pricePending:
|
|
1482
|
+
priceOpen: -15_0000, // hidden, so no payment expected yet
|
|
1483
|
+
pricePending: 15_0000,
|
|
1484
1484
|
pricePaid: 0,
|
|
1485
1485
|
paidAt: null,
|
|
1486
1486
|
},
|
|
@@ -1488,10 +1488,10 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1488
1488
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1489
1489
|
registrationId: registration1.id,
|
|
1490
1490
|
amount: 1,
|
|
1491
|
-
unitPrice: -
|
|
1491
|
+
unitPrice: -5_0000,
|
|
1492
1492
|
status: BalanceItemStatus.Hidden, // Pending
|
|
1493
|
-
priceOpen:
|
|
1494
|
-
pricePending: -
|
|
1493
|
+
priceOpen: 5_0000,
|
|
1494
|
+
pricePending: -5_0000,
|
|
1495
1495
|
pricePaid: 0,
|
|
1496
1496
|
paidAt: null,
|
|
1497
1497
|
},
|
|
@@ -1511,7 +1511,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1511
1511
|
expect(updatedRegistration1.discounts).toMatchMap(new Map([
|
|
1512
1512
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
1513
1513
|
name: bundleDiscount.name,
|
|
1514
|
-
amount:
|
|
1514
|
+
amount: 5_0000,
|
|
1515
1515
|
})],
|
|
1516
1516
|
]));
|
|
1517
1517
|
|
|
@@ -1521,22 +1521,22 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1521
1521
|
type: BalanceItemType.Registration,
|
|
1522
1522
|
registrationId: registration3.id,
|
|
1523
1523
|
amount: 1,
|
|
1524
|
-
unitPrice:
|
|
1524
|
+
unitPrice: 15_0000,
|
|
1525
1525
|
status: BalanceItemStatus.Due,
|
|
1526
1526
|
priceOpen: 0,
|
|
1527
1527
|
pricePending: 0,
|
|
1528
|
-
pricePaid:
|
|
1528
|
+
pricePaid: 15_0000,
|
|
1529
1529
|
paidAt: expect.any(Date),
|
|
1530
1530
|
},
|
|
1531
1531
|
{
|
|
1532
1532
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1533
1533
|
registrationId: registration1.id,
|
|
1534
1534
|
amount: 1,
|
|
1535
|
-
unitPrice: -
|
|
1535
|
+
unitPrice: -5_0000,
|
|
1536
1536
|
status: BalanceItemStatus.Due,
|
|
1537
1537
|
priceOpen: 0,
|
|
1538
1538
|
pricePending: 0,
|
|
1539
|
-
pricePaid: -
|
|
1539
|
+
pricePaid: -5_0000,
|
|
1540
1540
|
paidAt: expect.any(Date),
|
|
1541
1541
|
},
|
|
1542
1542
|
);
|
|
@@ -1561,8 +1561,8 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1561
1561
|
organizationRegistrationPeriod,
|
|
1562
1562
|
discount: {
|
|
1563
1563
|
discounts: [
|
|
1564
|
-
{ value:
|
|
1565
|
-
{ value:
|
|
1564
|
+
{ value: 5000, type: GroupPriceDiscountType.Fixed },
|
|
1565
|
+
{ value: 5_0000, type: GroupPriceDiscountType.Fixed },
|
|
1566
1566
|
],
|
|
1567
1567
|
},
|
|
1568
1568
|
}),
|
|
@@ -1571,17 +1571,17 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1571
1571
|
const groups = [
|
|
1572
1572
|
await new GroupFactory({
|
|
1573
1573
|
organization,
|
|
1574
|
-
price:
|
|
1574
|
+
price: 35_0000,
|
|
1575
1575
|
bundleDiscounts,
|
|
1576
1576
|
}).create(),
|
|
1577
1577
|
await new GroupFactory({
|
|
1578
1578
|
organization,
|
|
1579
|
-
price:
|
|
1579
|
+
price: 25_0000,
|
|
1580
1580
|
bundleDiscounts,
|
|
1581
1581
|
}).create(),
|
|
1582
1582
|
await new GroupFactory({
|
|
1583
1583
|
organization,
|
|
1584
|
-
price:
|
|
1584
|
+
price: 45_0000,
|
|
1585
1585
|
bundleDiscounts,
|
|
1586
1586
|
}).create(),
|
|
1587
1587
|
];
|
|
@@ -1601,7 +1601,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1601
1601
|
registrationId: registration1.id,
|
|
1602
1602
|
type: BalanceItemType.Registration,
|
|
1603
1603
|
amount: 1,
|
|
1604
|
-
unitPrice:
|
|
1604
|
+
unitPrice: 35_0000,
|
|
1605
1605
|
status: BalanceItemStatus.Due,
|
|
1606
1606
|
}).create();
|
|
1607
1607
|
|
|
@@ -1624,7 +1624,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1624
1624
|
],
|
|
1625
1625
|
}),
|
|
1626
1626
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
1627
|
-
totalPrice:
|
|
1627
|
+
totalPrice: 25_0000 + 45_0000 - 7_0000 - 18_0000 - 5000 - 5_0000,
|
|
1628
1628
|
});
|
|
1629
1629
|
const response = await post(checkout, organization, token);
|
|
1630
1630
|
expect(response.body.registrations.length).toBe(2);
|
|
@@ -1638,7 +1638,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1638
1638
|
bundleDiscounts[1].id,
|
|
1639
1639
|
AppliedRegistrationDiscount.create({
|
|
1640
1640
|
name: bundleDiscounts[1].name,
|
|
1641
|
-
amount:
|
|
1641
|
+
amount: 5000,
|
|
1642
1642
|
}),
|
|
1643
1643
|
],
|
|
1644
1644
|
]),
|
|
@@ -1651,14 +1651,14 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1651
1651
|
bundleDiscounts[0].id,
|
|
1652
1652
|
AppliedRegistrationDiscount.create({
|
|
1653
1653
|
name: bundleDiscounts[0].name,
|
|
1654
|
-
amount:
|
|
1654
|
+
amount: 18_0000,
|
|
1655
1655
|
}),
|
|
1656
1656
|
],
|
|
1657
1657
|
[
|
|
1658
1658
|
bundleDiscounts[1].id,
|
|
1659
1659
|
AppliedRegistrationDiscount.create({
|
|
1660
1660
|
name: bundleDiscounts[1].name,
|
|
1661
|
-
amount:
|
|
1661
|
+
amount: 5_0000,
|
|
1662
1662
|
}),
|
|
1663
1663
|
],
|
|
1664
1664
|
]),
|
|
@@ -1669,28 +1669,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1669
1669
|
type: BalanceItemType.Registration,
|
|
1670
1670
|
registrationId: registration1.id,
|
|
1671
1671
|
amount: 1,
|
|
1672
|
-
unitPrice:
|
|
1672
|
+
unitPrice: 35_0000,
|
|
1673
1673
|
status: BalanceItemStatus.Due,
|
|
1674
|
-
priceOpen:
|
|
1674
|
+
priceOpen: 35_0000,
|
|
1675
1675
|
pricePending: 0,
|
|
1676
1676
|
},
|
|
1677
1677
|
{
|
|
1678
1678
|
type: BalanceItemType.Registration,
|
|
1679
1679
|
registrationId: registration2.id,
|
|
1680
1680
|
amount: 1,
|
|
1681
|
-
unitPrice:
|
|
1681
|
+
unitPrice: 25_0000,
|
|
1682
1682
|
status: BalanceItemStatus.Due,
|
|
1683
1683
|
priceOpen: 0,
|
|
1684
|
-
pricePending:
|
|
1684
|
+
pricePending: 25_0000,
|
|
1685
1685
|
},
|
|
1686
1686
|
{
|
|
1687
1687
|
type: BalanceItemType.Registration,
|
|
1688
1688
|
registrationId: registration3.id,
|
|
1689
1689
|
amount: 1,
|
|
1690
|
-
unitPrice:
|
|
1690
|
+
unitPrice: 45_0000,
|
|
1691
1691
|
status: BalanceItemStatus.Due,
|
|
1692
1692
|
priceOpen: 0,
|
|
1693
|
-
pricePending:
|
|
1693
|
+
pricePending: 45_0000,
|
|
1694
1694
|
},
|
|
1695
1695
|
|
|
1696
1696
|
// Discounts (4)
|
|
@@ -1698,37 +1698,37 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1698
1698
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1699
1699
|
registrationId: registration2.id,
|
|
1700
1700
|
amount: 1,
|
|
1701
|
-
unitPrice: -
|
|
1701
|
+
unitPrice: -5000,
|
|
1702
1702
|
status: BalanceItemStatus.Due,
|
|
1703
1703
|
priceOpen: 0,
|
|
1704
|
-
pricePending: -
|
|
1704
|
+
pricePending: -5000,
|
|
1705
1705
|
},
|
|
1706
1706
|
{
|
|
1707
1707
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1708
1708
|
registrationId: registration3.id,
|
|
1709
1709
|
amount: 1,
|
|
1710
|
-
unitPrice: -
|
|
1710
|
+
unitPrice: -18_0000,
|
|
1711
1711
|
status: BalanceItemStatus.Due,
|
|
1712
1712
|
priceOpen: 0,
|
|
1713
|
-
pricePending: -
|
|
1713
|
+
pricePending: -18_0000,
|
|
1714
1714
|
},
|
|
1715
1715
|
{
|
|
1716
1716
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1717
1717
|
registrationId: registration3.id,
|
|
1718
1718
|
amount: 1,
|
|
1719
|
-
unitPrice: -
|
|
1719
|
+
unitPrice: -5_0000,
|
|
1720
1720
|
status: BalanceItemStatus.Due,
|
|
1721
1721
|
priceOpen: 0,
|
|
1722
|
-
pricePending: -
|
|
1722
|
+
pricePending: -5_0000,
|
|
1723
1723
|
},
|
|
1724
1724
|
{
|
|
1725
1725
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1726
1726
|
registrationId: registration1.id,
|
|
1727
1727
|
amount: 1,
|
|
1728
|
-
unitPrice: -
|
|
1728
|
+
unitPrice: -7_0000,
|
|
1729
1729
|
status: BalanceItemStatus.Due,
|
|
1730
1730
|
priceOpen: 0,
|
|
1731
|
-
pricePending: -
|
|
1731
|
+
pricePending: -7_0000,
|
|
1732
1732
|
},
|
|
1733
1733
|
]);
|
|
1734
1734
|
});
|
|
@@ -1750,17 +1750,17 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1750
1750
|
const groups = [
|
|
1751
1751
|
await new GroupFactory({
|
|
1752
1752
|
organization,
|
|
1753
|
-
price:
|
|
1753
|
+
price: 25_0000, // 20% discount = 5_00
|
|
1754
1754
|
bundleDiscount,
|
|
1755
1755
|
}).create(),
|
|
1756
1756
|
await new GroupFactory({
|
|
1757
1757
|
organization,
|
|
1758
|
-
price:
|
|
1758
|
+
price: 25_0000, // 20% discount = 5_00 (same as group 1)
|
|
1759
1759
|
bundleDiscount,
|
|
1760
1760
|
}).create(),
|
|
1761
1761
|
await new GroupFactory({
|
|
1762
1762
|
organization,
|
|
1763
|
-
price:
|
|
1763
|
+
price: 25_0000, // 20% discount = 5_00 (same as groups 1 & 2)
|
|
1764
1764
|
bundleDiscount,
|
|
1765
1765
|
}).create(),
|
|
1766
1766
|
];
|
|
@@ -1786,7 +1786,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1786
1786
|
registrationId: registration1.id,
|
|
1787
1787
|
type: BalanceItemType.Registration,
|
|
1788
1788
|
amount: 1,
|
|
1789
|
-
unitPrice:
|
|
1789
|
+
unitPrice: 25_0000,
|
|
1790
1790
|
status: BalanceItemStatus.Due,
|
|
1791
1791
|
}).create();
|
|
1792
1792
|
|
|
@@ -1797,7 +1797,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1797
1797
|
registrationId: registration1.id,
|
|
1798
1798
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1799
1799
|
amount: 1,
|
|
1800
|
-
unitPrice: -
|
|
1800
|
+
unitPrice: -5_0000,
|
|
1801
1801
|
status: BalanceItemStatus.Due,
|
|
1802
1802
|
relations: new Map([
|
|
1803
1803
|
[
|
|
@@ -1817,7 +1817,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1817
1817
|
registrationId: registration2.id,
|
|
1818
1818
|
type: BalanceItemType.Registration,
|
|
1819
1819
|
amount: 1,
|
|
1820
|
-
unitPrice:
|
|
1820
|
+
unitPrice: 25_0000,
|
|
1821
1821
|
status: BalanceItemStatus.Due,
|
|
1822
1822
|
}).create();
|
|
1823
1823
|
|
|
@@ -1832,7 +1832,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1832
1832
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
1833
1833
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
1834
1834
|
name: bundleDiscount.name,
|
|
1835
|
-
amount:
|
|
1835
|
+
amount: 5_0000,
|
|
1836
1836
|
})],
|
|
1837
1837
|
]));
|
|
1838
1838
|
|
|
@@ -1849,7 +1849,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1849
1849
|
],
|
|
1850
1850
|
}),
|
|
1851
1851
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
1852
|
-
totalPrice:
|
|
1852
|
+
totalPrice: 25_0000 - 5_0000, // 20% discount on new registration
|
|
1853
1853
|
});
|
|
1854
1854
|
|
|
1855
1855
|
const response = await post(checkout, organization, token);
|
|
@@ -1861,7 +1861,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1861
1861
|
discounts: new Map([
|
|
1862
1862
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
1863
1863
|
name: bundleDiscount.name,
|
|
1864
|
-
amount:
|
|
1864
|
+
amount: 5_0000,
|
|
1865
1865
|
})],
|
|
1866
1866
|
]),
|
|
1867
1867
|
});
|
|
@@ -1874,7 +1874,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1874
1874
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
1875
1875
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
1876
1876
|
name: bundleDiscount.name,
|
|
1877
|
-
amount:
|
|
1877
|
+
amount: 5_0000,
|
|
1878
1878
|
})],
|
|
1879
1879
|
]));
|
|
1880
1880
|
|
|
@@ -1883,46 +1883,46 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1883
1883
|
type: BalanceItemType.Registration,
|
|
1884
1884
|
registrationId: registration1.id,
|
|
1885
1885
|
amount: 1,
|
|
1886
|
-
price:
|
|
1886
|
+
price: 25_0000,
|
|
1887
1887
|
status: BalanceItemStatus.Due,
|
|
1888
|
-
priceOpen:
|
|
1888
|
+
priceOpen: 25_0000,
|
|
1889
1889
|
pricePending: 0,
|
|
1890
1890
|
},
|
|
1891
1891
|
{
|
|
1892
1892
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1893
1893
|
registrationId: registration1.id,
|
|
1894
1894
|
amount: 1,
|
|
1895
|
-
price: -
|
|
1895
|
+
price: -5_0000,
|
|
1896
1896
|
status: BalanceItemStatus.Due,
|
|
1897
|
-
priceOpen: -
|
|
1897
|
+
priceOpen: -5_0000,
|
|
1898
1898
|
pricePending: 0,
|
|
1899
1899
|
},
|
|
1900
1900
|
{
|
|
1901
1901
|
type: BalanceItemType.Registration,
|
|
1902
1902
|
registrationId: registration2.id,
|
|
1903
1903
|
amount: 1,
|
|
1904
|
-
price:
|
|
1904
|
+
price: 25_0000,
|
|
1905
1905
|
status: BalanceItemStatus.Due,
|
|
1906
|
-
priceOpen:
|
|
1906
|
+
priceOpen: 25_0000,
|
|
1907
1907
|
pricePending: 0,
|
|
1908
1908
|
},
|
|
1909
1909
|
{
|
|
1910
1910
|
type: BalanceItemType.Registration,
|
|
1911
1911
|
registrationId: registration3.id,
|
|
1912
1912
|
amount: 1,
|
|
1913
|
-
price:
|
|
1913
|
+
price: 25_0000,
|
|
1914
1914
|
status: BalanceItemStatus.Due,
|
|
1915
1915
|
priceOpen: 0,
|
|
1916
|
-
pricePending:
|
|
1916
|
+
pricePending: 25_0000,
|
|
1917
1917
|
},
|
|
1918
1918
|
{
|
|
1919
1919
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1920
1920
|
registrationId: registration3.id,
|
|
1921
1921
|
amount: 1,
|
|
1922
|
-
price: -
|
|
1922
|
+
price: -5_0000,
|
|
1923
1923
|
status: BalanceItemStatus.Due,
|
|
1924
1924
|
priceOpen: 0,
|
|
1925
|
-
pricePending: -
|
|
1925
|
+
pricePending: -5_0000,
|
|
1926
1926
|
},
|
|
1927
1927
|
]);
|
|
1928
1928
|
});
|
|
@@ -1941,14 +1941,14 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1941
1941
|
const groups = [
|
|
1942
1942
|
await new GroupFactory({
|
|
1943
1943
|
organization,
|
|
1944
|
-
price:
|
|
1944
|
+
price: 25_0000, // 20% discount = 5_00
|
|
1945
1945
|
bundleDiscount,
|
|
1946
1946
|
}).create(),
|
|
1947
1947
|
|
|
1948
1948
|
// Does not have discount:
|
|
1949
1949
|
await new GroupFactory({
|
|
1950
1950
|
organization,
|
|
1951
|
-
price:
|
|
1951
|
+
price: 25_0000,
|
|
1952
1952
|
}).create(),
|
|
1953
1953
|
];
|
|
1954
1954
|
|
|
@@ -1967,7 +1967,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1967
1967
|
registrationId: registration1.id,
|
|
1968
1968
|
type: BalanceItemType.Registration,
|
|
1969
1969
|
amount: 1,
|
|
1970
|
-
unitPrice:
|
|
1970
|
+
unitPrice: 25_0000,
|
|
1971
1971
|
status: BalanceItemStatus.Due,
|
|
1972
1972
|
}).create();
|
|
1973
1973
|
|
|
@@ -1982,7 +1982,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
1982
1982
|
registrationId: registration1.id,
|
|
1983
1983
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
1984
1984
|
amount: 1,
|
|
1985
|
-
unitPrice: -
|
|
1985
|
+
unitPrice: -5_0000,
|
|
1986
1986
|
status: BalanceItemStatus.Due,
|
|
1987
1987
|
relations: new Map([
|
|
1988
1988
|
[
|
|
@@ -2004,7 +2004,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2004
2004
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
2005
2005
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
2006
2006
|
name: bundleDiscount.name,
|
|
2007
|
-
amount:
|
|
2007
|
+
amount: 5_0000,
|
|
2008
2008
|
})],
|
|
2009
2009
|
]));
|
|
2010
2010
|
|
|
@@ -2021,7 +2021,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2021
2021
|
],
|
|
2022
2022
|
}),
|
|
2023
2023
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
2024
|
-
totalPrice:
|
|
2024
|
+
totalPrice: 25_0000,
|
|
2025
2025
|
});
|
|
2026
2026
|
|
|
2027
2027
|
const response = await post(checkout, organization, token);
|
|
@@ -2038,7 +2038,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2038
2038
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
2039
2039
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
2040
2040
|
name: bundleDiscount.name,
|
|
2041
|
-
amount:
|
|
2041
|
+
amount: 5_0000,
|
|
2042
2042
|
})],
|
|
2043
2043
|
]));
|
|
2044
2044
|
|
|
@@ -2047,28 +2047,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2047
2047
|
type: BalanceItemType.Registration,
|
|
2048
2048
|
registrationId: registration1.id,
|
|
2049
2049
|
amount: 1,
|
|
2050
|
-
price:
|
|
2050
|
+
price: 25_0000,
|
|
2051
2051
|
status: BalanceItemStatus.Due,
|
|
2052
|
-
priceOpen:
|
|
2052
|
+
priceOpen: 25_0000,
|
|
2053
2053
|
pricePending: 0,
|
|
2054
2054
|
},
|
|
2055
2055
|
{
|
|
2056
2056
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
2057
2057
|
registrationId: registration1.id,
|
|
2058
2058
|
amount: 1,
|
|
2059
|
-
price: -
|
|
2059
|
+
price: -5_0000,
|
|
2060
2060
|
status: BalanceItemStatus.Due,
|
|
2061
|
-
priceOpen: -
|
|
2061
|
+
priceOpen: -5_0000,
|
|
2062
2062
|
pricePending: 0,
|
|
2063
2063
|
},
|
|
2064
2064
|
{
|
|
2065
2065
|
type: BalanceItemType.Registration,
|
|
2066
2066
|
registrationId: registration2.id,
|
|
2067
2067
|
amount: 1,
|
|
2068
|
-
price:
|
|
2068
|
+
price: 25_0000,
|
|
2069
2069
|
status: BalanceItemStatus.Due,
|
|
2070
2070
|
priceOpen: 0,
|
|
2071
|
-
pricePending:
|
|
2071
|
+
pricePending: 25_0000,
|
|
2072
2072
|
},
|
|
2073
2073
|
]);
|
|
2074
2074
|
});
|
|
@@ -2088,12 +2088,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2088
2088
|
const groups = [
|
|
2089
2089
|
await new GroupFactory({
|
|
2090
2090
|
organization,
|
|
2091
|
-
price:
|
|
2091
|
+
price: 25_0000, // 20% discount = 5_00
|
|
2092
2092
|
bundleDiscount,
|
|
2093
2093
|
}).create(),
|
|
2094
2094
|
await new GroupFactory({
|
|
2095
2095
|
organization,
|
|
2096
|
-
price:
|
|
2096
|
+
price: 25_0000, // 20% discount = 5_00 (same as group 1)
|
|
2097
2097
|
bundleDiscount,
|
|
2098
2098
|
}).create(),
|
|
2099
2099
|
];
|
|
@@ -2113,7 +2113,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2113
2113
|
registrationId: registration1.id,
|
|
2114
2114
|
type: BalanceItemType.Registration,
|
|
2115
2115
|
amount: 1,
|
|
2116
|
-
unitPrice:
|
|
2116
|
+
unitPrice: 25_0000,
|
|
2117
2117
|
status: BalanceItemStatus.Due,
|
|
2118
2118
|
}).create();
|
|
2119
2119
|
|
|
@@ -2137,7 +2137,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2137
2137
|
],
|
|
2138
2138
|
}),
|
|
2139
2139
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
2140
|
-
totalPrice:
|
|
2140
|
+
totalPrice: 25_0000 - 5_0000, // 20% discount on new registration
|
|
2141
2141
|
});
|
|
2142
2142
|
|
|
2143
2143
|
const response = await post(checkout, organization, token);
|
|
@@ -2149,7 +2149,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2149
2149
|
discounts: new Map([
|
|
2150
2150
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
2151
2151
|
name: bundleDiscount.name,
|
|
2152
|
-
amount:
|
|
2152
|
+
amount: 5_0000,
|
|
2153
2153
|
})],
|
|
2154
2154
|
]),
|
|
2155
2155
|
});
|
|
@@ -2163,28 +2163,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2163
2163
|
type: BalanceItemType.Registration,
|
|
2164
2164
|
registrationId: registration1.id,
|
|
2165
2165
|
amount: 1,
|
|
2166
|
-
price:
|
|
2166
|
+
price: 25_0000,
|
|
2167
2167
|
status: BalanceItemStatus.Due,
|
|
2168
|
-
priceOpen:
|
|
2168
|
+
priceOpen: 25_0000,
|
|
2169
2169
|
pricePending: 0,
|
|
2170
2170
|
},
|
|
2171
2171
|
{
|
|
2172
2172
|
type: BalanceItemType.Registration,
|
|
2173
2173
|
registrationId: registration2.id,
|
|
2174
2174
|
amount: 1,
|
|
2175
|
-
price:
|
|
2175
|
+
price: 25_0000,
|
|
2176
2176
|
status: BalanceItemStatus.Due,
|
|
2177
2177
|
priceOpen: 0,
|
|
2178
|
-
pricePending:
|
|
2178
|
+
pricePending: 25_0000,
|
|
2179
2179
|
},
|
|
2180
2180
|
{
|
|
2181
2181
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
2182
2182
|
registrationId: registration2.id,
|
|
2183
2183
|
amount: 1,
|
|
2184
|
-
price: -
|
|
2184
|
+
price: -5_0000,
|
|
2185
2185
|
status: BalanceItemStatus.Due,
|
|
2186
2186
|
priceOpen: 0,
|
|
2187
|
-
pricePending: -
|
|
2187
|
+
pricePending: -5_0000,
|
|
2188
2188
|
},
|
|
2189
2189
|
]);
|
|
2190
2190
|
});
|
|
@@ -2215,12 +2215,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2215
2215
|
const groups = [
|
|
2216
2216
|
await new GroupFactory({
|
|
2217
2217
|
organization,
|
|
2218
|
-
price:
|
|
2218
|
+
price: 25_0000,
|
|
2219
2219
|
bundleDiscounts,
|
|
2220
2220
|
}).create(),
|
|
2221
2221
|
await new GroupFactory({
|
|
2222
2222
|
organization,
|
|
2223
|
-
price:
|
|
2223
|
+
price: 35_0000, // Higher price so discount is applied preferably here
|
|
2224
2224
|
bundleDiscounts,
|
|
2225
2225
|
}).create(),
|
|
2226
2226
|
];
|
|
@@ -2240,7 +2240,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2240
2240
|
registrationId: registration1.id,
|
|
2241
2241
|
type: BalanceItemType.Registration,
|
|
2242
2242
|
amount: 1,
|
|
2243
|
-
unitPrice:
|
|
2243
|
+
unitPrice: 25_0000,
|
|
2244
2244
|
status: BalanceItemStatus.Due,
|
|
2245
2245
|
}).create();
|
|
2246
2246
|
|
|
@@ -2256,7 +2256,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2256
2256
|
],
|
|
2257
2257
|
}),
|
|
2258
2258
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
2259
|
-
totalPrice:
|
|
2259
|
+
totalPrice: 35_0000 - 42_0000, // 120% discount on 35_00
|
|
2260
2260
|
});
|
|
2261
2261
|
await expect(post(checkout, organization, token)).rejects
|
|
2262
2262
|
.toThrow(STExpect.simpleError({
|
|
@@ -2269,9 +2269,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2269
2269
|
type: BalanceItemType.Registration,
|
|
2270
2270
|
registrationId: registration1.id,
|
|
2271
2271
|
amount: 1,
|
|
2272
|
-
unitPrice:
|
|
2272
|
+
unitPrice: 25_0000,
|
|
2273
2273
|
status: BalanceItemStatus.Due,
|
|
2274
|
-
priceOpen:
|
|
2274
|
+
priceOpen: 25_0000,
|
|
2275
2275
|
pricePending: 0,
|
|
2276
2276
|
},
|
|
2277
2277
|
]);
|
|
@@ -2298,14 +2298,14 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2298
2298
|
const groups = [
|
|
2299
2299
|
await new GroupFactory({
|
|
2300
2300
|
organization,
|
|
2301
|
-
price:
|
|
2302
|
-
reducedPrice:
|
|
2301
|
+
price: 25_0000,
|
|
2302
|
+
reducedPrice: 20_0000,
|
|
2303
2303
|
bundleDiscount,
|
|
2304
2304
|
}).create(),
|
|
2305
2305
|
await new GroupFactory({
|
|
2306
2306
|
organization,
|
|
2307
|
-
price:
|
|
2308
|
-
reducedPrice:
|
|
2307
|
+
price: 15_0000,
|
|
2308
|
+
reducedPrice: 10_0000,
|
|
2309
2309
|
bundleDiscount,
|
|
2310
2310
|
}).create(),
|
|
2311
2311
|
];
|
|
@@ -2323,7 +2323,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2323
2323
|
organizationId: organization.id,
|
|
2324
2324
|
type: BalanceItemType.Registration,
|
|
2325
2325
|
amount: 1,
|
|
2326
|
-
unitPrice:
|
|
2326
|
+
unitPrice: 20_0000, // Reduced price
|
|
2327
2327
|
status: BalanceItemStatus.Due,
|
|
2328
2328
|
registrationId: registration1.id,
|
|
2329
2329
|
}).create();
|
|
@@ -2340,7 +2340,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2340
2340
|
],
|
|
2341
2341
|
}),
|
|
2342
2342
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
2343
|
-
totalPrice:
|
|
2343
|
+
totalPrice: 10_0000 - 2_0000, // 10% discount on first group
|
|
2344
2344
|
});
|
|
2345
2345
|
|
|
2346
2346
|
const response2 = await post(checkout, organization, token);
|
|
@@ -2355,7 +2355,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2355
2355
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
2356
2356
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
2357
2357
|
name: bundleDiscount.name,
|
|
2358
|
-
amount:
|
|
2358
|
+
amount: 2_0000,
|
|
2359
2359
|
})],
|
|
2360
2360
|
]));
|
|
2361
2361
|
|
|
@@ -2364,28 +2364,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2364
2364
|
type: BalanceItemType.Registration,
|
|
2365
2365
|
registrationId: registration1.id,
|
|
2366
2366
|
amount: 1,
|
|
2367
|
-
price:
|
|
2367
|
+
price: 20_0000,
|
|
2368
2368
|
status: BalanceItemStatus.Due,
|
|
2369
|
-
priceOpen:
|
|
2369
|
+
priceOpen: 20_0000,
|
|
2370
2370
|
pricePending: 0,
|
|
2371
2371
|
},
|
|
2372
2372
|
{
|
|
2373
2373
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
2374
2374
|
registrationId: registration1.id,
|
|
2375
2375
|
amount: 1,
|
|
2376
|
-
price: -
|
|
2376
|
+
price: -2_0000,
|
|
2377
2377
|
status: BalanceItemStatus.Due,
|
|
2378
2378
|
priceOpen: 0,
|
|
2379
|
-
pricePending: -
|
|
2379
|
+
pricePending: -2_0000,
|
|
2380
2380
|
},
|
|
2381
2381
|
{
|
|
2382
2382
|
type: BalanceItemType.Registration,
|
|
2383
2383
|
registrationId: registration2.id,
|
|
2384
2384
|
amount: 1,
|
|
2385
|
-
price:
|
|
2385
|
+
price: 10_0000,
|
|
2386
2386
|
status: BalanceItemStatus.Due,
|
|
2387
2387
|
priceOpen: 0,
|
|
2388
|
-
pricePending:
|
|
2388
|
+
pricePending: 10_0000,
|
|
2389
2389
|
},
|
|
2390
2390
|
]);
|
|
2391
2391
|
});
|
|
@@ -2410,12 +2410,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2410
2410
|
const groups = [
|
|
2411
2411
|
await new GroupFactory({
|
|
2412
2412
|
organization,
|
|
2413
|
-
price:
|
|
2413
|
+
price: 25_0000,
|
|
2414
2414
|
bundleDiscount,
|
|
2415
2415
|
}).create(),
|
|
2416
2416
|
await new GroupFactory({
|
|
2417
2417
|
organization,
|
|
2418
|
-
price:
|
|
2418
|
+
price: 15_0000,
|
|
2419
2419
|
bundleDiscounts: new Map([
|
|
2420
2420
|
[
|
|
2421
2421
|
bundleDiscount,
|
|
@@ -2443,7 +2443,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2443
2443
|
organizationId: organization.id,
|
|
2444
2444
|
type: BalanceItemType.Registration,
|
|
2445
2445
|
amount: 1,
|
|
2446
|
-
unitPrice:
|
|
2446
|
+
unitPrice: 25_0000,
|
|
2447
2447
|
status: BalanceItemStatus.Due,
|
|
2448
2448
|
registrationId: registration1.id,
|
|
2449
2449
|
}).create();
|
|
@@ -2460,7 +2460,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2460
2460
|
],
|
|
2461
2461
|
}),
|
|
2462
2462
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
2463
|
-
totalPrice:
|
|
2463
|
+
totalPrice: 15_0000 - 7_5000, // 50% discount on last group
|
|
2464
2464
|
});
|
|
2465
2465
|
|
|
2466
2466
|
const response2 = await post(checkout, organization, token);
|
|
@@ -2471,7 +2471,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2471
2471
|
expect(registration2.discounts).toMatchMap(new Map([
|
|
2472
2472
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
2473
2473
|
name: bundleDiscount.name,
|
|
2474
|
-
amount:
|
|
2474
|
+
amount: 7_5000,
|
|
2475
2475
|
})],
|
|
2476
2476
|
]));
|
|
2477
2477
|
|
|
@@ -2484,28 +2484,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2484
2484
|
type: BalanceItemType.Registration,
|
|
2485
2485
|
registrationId: registration1.id,
|
|
2486
2486
|
amount: 1,
|
|
2487
|
-
price:
|
|
2487
|
+
price: 25_0000,
|
|
2488
2488
|
status: BalanceItemStatus.Due,
|
|
2489
|
-
priceOpen:
|
|
2489
|
+
priceOpen: 25_0000,
|
|
2490
2490
|
pricePending: 0,
|
|
2491
2491
|
},
|
|
2492
2492
|
{
|
|
2493
2493
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
2494
2494
|
registrationId: registration2.id,
|
|
2495
2495
|
amount: 1,
|
|
2496
|
-
price: -
|
|
2496
|
+
price: -7_5000,
|
|
2497
2497
|
status: BalanceItemStatus.Due,
|
|
2498
2498
|
priceOpen: 0,
|
|
2499
|
-
pricePending: -
|
|
2499
|
+
pricePending: -7_5000,
|
|
2500
2500
|
},
|
|
2501
2501
|
{
|
|
2502
2502
|
type: BalanceItemType.Registration,
|
|
2503
2503
|
registrationId: registration2.id,
|
|
2504
2504
|
amount: 1,
|
|
2505
|
-
price:
|
|
2505
|
+
price: 15_0000,
|
|
2506
2506
|
status: BalanceItemStatus.Due,
|
|
2507
2507
|
priceOpen: 0,
|
|
2508
|
-
pricePending:
|
|
2508
|
+
pricePending: 15_0000,
|
|
2509
2509
|
},
|
|
2510
2510
|
]);
|
|
2511
2511
|
});
|
|
@@ -2534,12 +2534,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2534
2534
|
const groups = [
|
|
2535
2535
|
await new GroupFactory({
|
|
2536
2536
|
organization,
|
|
2537
|
-
price:
|
|
2537
|
+
price: 25_0000,
|
|
2538
2538
|
bundleDiscount,
|
|
2539
2539
|
}).create(),
|
|
2540
2540
|
await new GroupFactory({
|
|
2541
2541
|
organization,
|
|
2542
|
-
price:
|
|
2542
|
+
price: 15_0000,
|
|
2543
2543
|
bundleDiscount,
|
|
2544
2544
|
}).create(),
|
|
2545
2545
|
];
|
|
@@ -2557,7 +2557,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2557
2557
|
organizationId: organization.id,
|
|
2558
2558
|
type: BalanceItemType.Registration,
|
|
2559
2559
|
amount: 1,
|
|
2560
|
-
unitPrice:
|
|
2560
|
+
unitPrice: 25_0000,
|
|
2561
2561
|
status: BalanceItemStatus.Due,
|
|
2562
2562
|
registrationId: registration1.id,
|
|
2563
2563
|
}).create();
|
|
@@ -2574,7 +2574,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2574
2574
|
],
|
|
2575
2575
|
}),
|
|
2576
2576
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
2577
|
-
totalPrice:
|
|
2577
|
+
totalPrice: 15_0000 - 5_0000, // 20% discount on first group
|
|
2578
2578
|
});
|
|
2579
2579
|
|
|
2580
2580
|
const response2 = await post(checkout, organization, token);
|
|
@@ -2589,7 +2589,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2589
2589
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
2590
2590
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
2591
2591
|
name: bundleDiscount.name,
|
|
2592
|
-
amount:
|
|
2592
|
+
amount: 5_0000,
|
|
2593
2593
|
})],
|
|
2594
2594
|
]));
|
|
2595
2595
|
|
|
@@ -2598,28 +2598,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2598
2598
|
type: BalanceItemType.Registration,
|
|
2599
2599
|
registrationId: registration1.id,
|
|
2600
2600
|
amount: 1,
|
|
2601
|
-
price:
|
|
2601
|
+
price: 25_0000,
|
|
2602
2602
|
status: BalanceItemStatus.Due,
|
|
2603
|
-
priceOpen:
|
|
2603
|
+
priceOpen: 25_0000,
|
|
2604
2604
|
pricePending: 0,
|
|
2605
2605
|
},
|
|
2606
2606
|
{
|
|
2607
2607
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
2608
2608
|
registrationId: registration1.id,
|
|
2609
2609
|
amount: 1,
|
|
2610
|
-
price: -
|
|
2610
|
+
price: -5_0000,
|
|
2611
2611
|
status: BalanceItemStatus.Due,
|
|
2612
2612
|
priceOpen: 0,
|
|
2613
|
-
pricePending: -
|
|
2613
|
+
pricePending: -5_0000,
|
|
2614
2614
|
},
|
|
2615
2615
|
{
|
|
2616
2616
|
type: BalanceItemType.Registration,
|
|
2617
2617
|
registrationId: registration2.id,
|
|
2618
2618
|
amount: 1,
|
|
2619
|
-
price:
|
|
2619
|
+
price: 15_0000,
|
|
2620
2620
|
status: BalanceItemStatus.Due,
|
|
2621
2621
|
priceOpen: 0,
|
|
2622
|
-
pricePending:
|
|
2622
|
+
pricePending: 15_0000,
|
|
2623
2623
|
},
|
|
2624
2624
|
]);
|
|
2625
2625
|
});
|
|
@@ -2648,12 +2648,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2648
2648
|
const groups = [
|
|
2649
2649
|
await new GroupFactory({
|
|
2650
2650
|
organization,
|
|
2651
|
-
price:
|
|
2651
|
+
price: 25_0000,
|
|
2652
2652
|
bundleDiscount,
|
|
2653
2653
|
}).create(),
|
|
2654
2654
|
await new GroupFactory({
|
|
2655
2655
|
organization,
|
|
2656
|
-
price:
|
|
2656
|
+
price: 15_0000,
|
|
2657
2657
|
bundleDiscount,
|
|
2658
2658
|
}).create(),
|
|
2659
2659
|
];
|
|
@@ -2671,7 +2671,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2671
2671
|
organizationId: organization.id,
|
|
2672
2672
|
type: BalanceItemType.Registration,
|
|
2673
2673
|
amount: 1,
|
|
2674
|
-
unitPrice:
|
|
2674
|
+
unitPrice: 25_0000,
|
|
2675
2675
|
status: BalanceItemStatus.Due,
|
|
2676
2676
|
registrationId: registration1.id,
|
|
2677
2677
|
}).create();
|
|
@@ -2688,7 +2688,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2688
2688
|
],
|
|
2689
2689
|
}),
|
|
2690
2690
|
paymentMethod: PaymentMethod.PointOfSale,
|
|
2691
|
-
totalPrice:
|
|
2691
|
+
totalPrice: 15_0000,
|
|
2692
2692
|
});
|
|
2693
2693
|
|
|
2694
2694
|
const response2 = await post(checkout, organization, token);
|
|
@@ -2706,19 +2706,19 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2706
2706
|
type: BalanceItemType.Registration,
|
|
2707
2707
|
registrationId: registration1.id,
|
|
2708
2708
|
amount: 1,
|
|
2709
|
-
price:
|
|
2709
|
+
price: 25_0000,
|
|
2710
2710
|
status: BalanceItemStatus.Due,
|
|
2711
|
-
priceOpen:
|
|
2711
|
+
priceOpen: 25_0000,
|
|
2712
2712
|
pricePending: 0,
|
|
2713
2713
|
},
|
|
2714
2714
|
{
|
|
2715
2715
|
type: BalanceItemType.Registration,
|
|
2716
2716
|
registrationId: registration2.id,
|
|
2717
2717
|
amount: 1,
|
|
2718
|
-
price:
|
|
2718
|
+
price: 15_0000,
|
|
2719
2719
|
status: BalanceItemStatus.Due,
|
|
2720
2720
|
priceOpen: 0,
|
|
2721
|
-
pricePending:
|
|
2721
|
+
pricePending: 15_0000,
|
|
2722
2722
|
},
|
|
2723
2723
|
]);
|
|
2724
2724
|
});
|
|
@@ -2740,17 +2740,17 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2740
2740
|
const groups = [
|
|
2741
2741
|
await new GroupFactory({
|
|
2742
2742
|
organization,
|
|
2743
|
-
price:
|
|
2743
|
+
price: 25_0000,
|
|
2744
2744
|
bundleDiscount,
|
|
2745
2745
|
}).create(),
|
|
2746
2746
|
await new GroupFactory({
|
|
2747
2747
|
organization,
|
|
2748
|
-
price:
|
|
2748
|
+
price: 15_0000,
|
|
2749
2749
|
bundleDiscount,
|
|
2750
2750
|
}).create(),
|
|
2751
2751
|
await new GroupFactory({
|
|
2752
2752
|
organization,
|
|
2753
|
-
price:
|
|
2753
|
+
price: 40_0000,
|
|
2754
2754
|
bundleDiscount,
|
|
2755
2755
|
}).create(),
|
|
2756
2756
|
];
|
|
@@ -2775,7 +2775,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2775
2775
|
registrationId: registration1.id,
|
|
2776
2776
|
type: BalanceItemType.Registration,
|
|
2777
2777
|
amount: 1,
|
|
2778
|
-
unitPrice:
|
|
2778
|
+
unitPrice: 25_0000,
|
|
2779
2779
|
status: BalanceItemStatus.Due,
|
|
2780
2780
|
}).create();
|
|
2781
2781
|
|
|
@@ -2786,7 +2786,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2786
2786
|
registrationId: registration1.id,
|
|
2787
2787
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
2788
2788
|
amount: 1,
|
|
2789
|
-
unitPrice: -
|
|
2789
|
+
unitPrice: -5_0000,
|
|
2790
2790
|
status: BalanceItemStatus.Due,
|
|
2791
2791
|
relations: new Map([
|
|
2792
2792
|
[
|
|
@@ -2806,7 +2806,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2806
2806
|
registrationId: registration2.id,
|
|
2807
2807
|
type: BalanceItemType.Registration,
|
|
2808
2808
|
amount: 1,
|
|
2809
|
-
unitPrice:
|
|
2809
|
+
unitPrice: 15_0000,
|
|
2810
2810
|
status: BalanceItemStatus.Due,
|
|
2811
2811
|
}).create();
|
|
2812
2812
|
|
|
@@ -2819,7 +2819,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2819
2819
|
discounts: new Map([
|
|
2820
2820
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
2821
2821
|
name: bundleDiscount.name,
|
|
2822
|
-
amount:
|
|
2822
|
+
amount: 5_0000,
|
|
2823
2823
|
})],
|
|
2824
2824
|
]),
|
|
2825
2825
|
});
|
|
@@ -2857,7 +2857,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2857
2857
|
],
|
|
2858
2858
|
}),
|
|
2859
2859
|
asOrganizationId: organization.id,
|
|
2860
|
-
totalPrice:
|
|
2860
|
+
totalPrice: 40_0000 - 15_0000 + 5_0000 - 8_0000, // group 3 - group 2 + reverted discount - new discount
|
|
2861
2861
|
});
|
|
2862
2862
|
|
|
2863
2863
|
const response = await post(checkout, organization, adminToken);
|
|
@@ -2870,7 +2870,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2870
2870
|
discounts: new Map([
|
|
2871
2871
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
2872
2872
|
name: bundleDiscount.name,
|
|
2873
|
-
amount:
|
|
2873
|
+
amount: 8_0000,
|
|
2874
2874
|
})],
|
|
2875
2875
|
]),
|
|
2876
2876
|
});
|
|
@@ -2888,25 +2888,29 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2888
2888
|
type: BalanceItemType.Registration,
|
|
2889
2889
|
registrationId: registration1.id,
|
|
2890
2890
|
amount: 1,
|
|
2891
|
-
unitPrice:
|
|
2891
|
+
unitPrice: 25_0000,
|
|
2892
2892
|
status: BalanceItemStatus.Due,
|
|
2893
|
-
priceOpen:
|
|
2893
|
+
priceOpen: 25_0000,
|
|
2894
2894
|
pricePending: 0,
|
|
2895
2895
|
},
|
|
2896
2896
|
{
|
|
2897
2897
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
2898
2898
|
registrationId: registration1.id,
|
|
2899
2899
|
amount: 1,
|
|
2900
|
-
unitPrice: -
|
|
2900
|
+
unitPrice: -5_0000,
|
|
2901
2901
|
status: BalanceItemStatus.Due,
|
|
2902
2902
|
pricePending: 0,
|
|
2903
|
-
|
|
2903
|
+
priceTotal: -5_0000,
|
|
2904
|
+
|
|
2905
|
+
// Payment reallocation
|
|
2906
|
+
pricePaid: -5_0000,
|
|
2907
|
+
priceOpen: 0,
|
|
2904
2908
|
},
|
|
2905
2909
|
{
|
|
2906
2910
|
type: BalanceItemType.Registration,
|
|
2907
2911
|
registrationId: registration2.id,
|
|
2908
2912
|
amount: 1,
|
|
2909
|
-
unitPrice:
|
|
2913
|
+
unitPrice: 15_0000,
|
|
2910
2914
|
status: BalanceItemStatus.Canceled,
|
|
2911
2915
|
pricePending: 0,
|
|
2912
2916
|
priceOpen: 0,
|
|
@@ -2917,9 +2921,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2917
2921
|
memberId: member.id,
|
|
2918
2922
|
registrationId: registration3.id,
|
|
2919
2923
|
amount: 1,
|
|
2920
|
-
unitPrice:
|
|
2924
|
+
unitPrice: 40_0000,
|
|
2921
2925
|
status: BalanceItemStatus.Due,
|
|
2922
|
-
priceOpen:
|
|
2926
|
+
priceOpen: 40_0000,
|
|
2923
2927
|
|
|
2924
2928
|
// Not pending because created by admin
|
|
2925
2929
|
pricePending: 0,
|
|
@@ -2931,12 +2935,16 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2931
2935
|
memberId: member.id,
|
|
2932
2936
|
registrationId: registration1.id,
|
|
2933
2937
|
amount: 1,
|
|
2934
|
-
unitPrice:
|
|
2938
|
+
unitPrice: 5_0000,
|
|
2935
2939
|
status: BalanceItemStatus.Due,
|
|
2936
|
-
|
|
2940
|
+
priceTotal: 5_0000,
|
|
2937
2941
|
|
|
2938
2942
|
// Not pending because created by admin
|
|
2939
2943
|
pricePending: 0,
|
|
2944
|
+
|
|
2945
|
+
// Payment reallocation
|
|
2946
|
+
pricePaid: 5_0000,
|
|
2947
|
+
priceOpen: 0,
|
|
2940
2948
|
},
|
|
2941
2949
|
// Add new discount
|
|
2942
2950
|
{
|
|
@@ -2945,9 +2953,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2945
2953
|
memberId: member.id,
|
|
2946
2954
|
registrationId: registration3.id,
|
|
2947
2955
|
amount: 1,
|
|
2948
|
-
unitPrice: -
|
|
2956
|
+
unitPrice: -8_0000,
|
|
2949
2957
|
status: BalanceItemStatus.Due,
|
|
2950
|
-
priceOpen: -
|
|
2958
|
+
priceOpen: -8_0000,
|
|
2951
2959
|
|
|
2952
2960
|
// Not pending because created by admin
|
|
2953
2961
|
pricePending: 0,
|
|
@@ -2973,7 +2981,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2973
2981
|
],
|
|
2974
2982
|
}),
|
|
2975
2983
|
asOrganizationId: organization.id,
|
|
2976
|
-
totalPrice:
|
|
2984
|
+
totalPrice: 40_0000 - 25_0000 + 5_0000 - 8_0000, // group 3 - group 1 + reverted discount - new discount
|
|
2977
2985
|
});
|
|
2978
2986
|
|
|
2979
2987
|
const response = await post(checkout, organization, adminToken);
|
|
@@ -2986,7 +2994,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
2986
2994
|
discounts: new Map([
|
|
2987
2995
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
2988
2996
|
name: bundleDiscount.name,
|
|
2989
|
-
amount:
|
|
2997
|
+
amount: 8_0000,
|
|
2990
2998
|
})],
|
|
2991
2999
|
]),
|
|
2992
3000
|
});
|
|
@@ -3004,7 +3012,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3004
3012
|
type: BalanceItemType.Registration,
|
|
3005
3013
|
registrationId: registration1.id,
|
|
3006
3014
|
amount: 1,
|
|
3007
|
-
unitPrice:
|
|
3015
|
+
unitPrice: 25_0000,
|
|
3008
3016
|
status: BalanceItemStatus.Canceled, // has been cancelled
|
|
3009
3017
|
priceOpen: 0,
|
|
3010
3018
|
pricePending: 0,
|
|
@@ -3013,7 +3021,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3013
3021
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3014
3022
|
registrationId: registration1.id,
|
|
3015
3023
|
amount: 1,
|
|
3016
|
-
unitPrice: -
|
|
3024
|
+
unitPrice: -5_0000,
|
|
3017
3025
|
status: BalanceItemStatus.Canceled, // has been cancelled
|
|
3018
3026
|
pricePending: 0,
|
|
3019
3027
|
priceOpen: 0,
|
|
@@ -3022,10 +3030,10 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3022
3030
|
type: BalanceItemType.Registration,
|
|
3023
3031
|
registrationId: registration2.id,
|
|
3024
3032
|
amount: 1,
|
|
3025
|
-
unitPrice:
|
|
3033
|
+
unitPrice: 15_0000,
|
|
3026
3034
|
status: BalanceItemStatus.Due,
|
|
3027
3035
|
pricePending: 0,
|
|
3028
|
-
priceOpen:
|
|
3036
|
+
priceOpen: 15_0000,
|
|
3029
3037
|
},
|
|
3030
3038
|
{
|
|
3031
3039
|
type: BalanceItemType.Registration,
|
|
@@ -3033,9 +3041,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3033
3041
|
memberId: member.id,
|
|
3034
3042
|
registrationId: registration3.id,
|
|
3035
3043
|
amount: 1,
|
|
3036
|
-
unitPrice:
|
|
3044
|
+
unitPrice: 40_0000,
|
|
3037
3045
|
status: BalanceItemStatus.Due,
|
|
3038
|
-
priceOpen:
|
|
3046
|
+
priceOpen: 40_0000,
|
|
3039
3047
|
|
|
3040
3048
|
// Not pending because created by admin
|
|
3041
3049
|
pricePending: 0,
|
|
@@ -3047,9 +3055,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3047
3055
|
memberId: member.id,
|
|
3048
3056
|
registrationId: registration3.id,
|
|
3049
3057
|
amount: 1,
|
|
3050
|
-
unitPrice: -
|
|
3058
|
+
unitPrice: -8_0000,
|
|
3051
3059
|
status: BalanceItemStatus.Due,
|
|
3052
|
-
priceOpen: -
|
|
3060
|
+
priceOpen: -8_0000,
|
|
3053
3061
|
|
|
3054
3062
|
// Not pending because created by admin
|
|
3055
3063
|
pricePending: 0,
|
|
@@ -3067,7 +3075,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3067
3075
|
deleteRegistrationIds: [registration1.id],
|
|
3068
3076
|
}),
|
|
3069
3077
|
asOrganizationId: organization.id,
|
|
3070
|
-
totalPrice: -
|
|
3078
|
+
totalPrice: -25_0000 + 5_0000,
|
|
3071
3079
|
cancellationFeePercentage: 0,
|
|
3072
3080
|
});
|
|
3073
3081
|
|
|
@@ -3086,7 +3094,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3086
3094
|
type: BalanceItemType.Registration,
|
|
3087
3095
|
registrationId: registration1.id,
|
|
3088
3096
|
amount: 1,
|
|
3089
|
-
unitPrice:
|
|
3097
|
+
unitPrice: 25_0000,
|
|
3090
3098
|
status: BalanceItemStatus.Canceled, // has been cancelled
|
|
3091
3099
|
priceOpen: 0,
|
|
3092
3100
|
pricePending: 0,
|
|
@@ -3095,7 +3103,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3095
3103
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3096
3104
|
registrationId: registration1.id,
|
|
3097
3105
|
amount: 1,
|
|
3098
|
-
unitPrice: -
|
|
3106
|
+
unitPrice: -5_0000,
|
|
3099
3107
|
status: BalanceItemStatus.Canceled, // has been cancelled
|
|
3100
3108
|
pricePending: 0,
|
|
3101
3109
|
priceOpen: 0,
|
|
@@ -3104,10 +3112,10 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3104
3112
|
type: BalanceItemType.Registration,
|
|
3105
3113
|
registrationId: registration2.id,
|
|
3106
3114
|
amount: 1,
|
|
3107
|
-
unitPrice:
|
|
3115
|
+
unitPrice: 15_0000,
|
|
3108
3116
|
status: BalanceItemStatus.Due,
|
|
3109
3117
|
pricePending: 0,
|
|
3110
|
-
priceOpen:
|
|
3118
|
+
priceOpen: 15_0000,
|
|
3111
3119
|
},
|
|
3112
3120
|
]);
|
|
3113
3121
|
});
|
|
@@ -3135,7 +3143,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3135
3143
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
3136
3144
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
3137
3145
|
name: bundleDiscount.name,
|
|
3138
|
-
amount:
|
|
3146
|
+
amount: 5_0000,
|
|
3139
3147
|
})],
|
|
3140
3148
|
]));
|
|
3141
3149
|
expect(registration1.deactivatedAt).not.toBeNull(); // should be cancelled
|
|
@@ -3146,28 +3154,28 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3146
3154
|
type: BalanceItemType.Registration,
|
|
3147
3155
|
registrationId: registration1.id,
|
|
3148
3156
|
amount: 1,
|
|
3149
|
-
unitPrice:
|
|
3157
|
+
unitPrice: 25_0000,
|
|
3150
3158
|
status: BalanceItemStatus.Due, // NOT cancelled, because we charge a cancellation fee
|
|
3151
|
-
priceOpen:
|
|
3159
|
+
priceOpen: 25_0000, // cancellation fee
|
|
3152
3160
|
pricePending: 0,
|
|
3153
3161
|
},
|
|
3154
3162
|
{
|
|
3155
3163
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3156
3164
|
registrationId: registration1.id,
|
|
3157
3165
|
amount: 1,
|
|
3158
|
-
unitPrice: -
|
|
3166
|
+
unitPrice: -5_0000,
|
|
3159
3167
|
status: BalanceItemStatus.Due, // NOT cancelled, because we charge a cancellation fee
|
|
3160
|
-
priceOpen: -
|
|
3168
|
+
priceOpen: -5_0000,
|
|
3161
3169
|
pricePending: 0,
|
|
3162
3170
|
},
|
|
3163
3171
|
{
|
|
3164
3172
|
type: BalanceItemType.Registration,
|
|
3165
3173
|
registrationId: registration2.id,
|
|
3166
3174
|
amount: 1,
|
|
3167
|
-
unitPrice:
|
|
3175
|
+
unitPrice: 15_0000,
|
|
3168
3176
|
status: BalanceItemStatus.Due,
|
|
3169
3177
|
pricePending: 0,
|
|
3170
|
-
priceOpen:
|
|
3178
|
+
priceOpen: 15_0000,
|
|
3171
3179
|
},
|
|
3172
3180
|
]);
|
|
3173
3181
|
});
|
|
@@ -3182,7 +3190,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3182
3190
|
deleteRegistrationIds: [registration2.id],
|
|
3183
3191
|
}),
|
|
3184
3192
|
asOrganizationId: organization.id,
|
|
3185
|
-
totalPrice: -
|
|
3193
|
+
totalPrice: -15_0000 + 5_0000, // -15 back, but also lose discount on registration 1, so add 5
|
|
3186
3194
|
cancellationFeePercentage: 0,
|
|
3187
3195
|
});
|
|
3188
3196
|
|
|
@@ -3203,25 +3211,29 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3203
3211
|
type: BalanceItemType.Registration,
|
|
3204
3212
|
registrationId: registration1.id,
|
|
3205
3213
|
amount: 1,
|
|
3206
|
-
unitPrice:
|
|
3214
|
+
unitPrice: 25_0000,
|
|
3207
3215
|
status: BalanceItemStatus.Due,
|
|
3208
|
-
priceOpen:
|
|
3216
|
+
priceOpen: 25_0000,
|
|
3209
3217
|
pricePending: 0,
|
|
3210
3218
|
},
|
|
3211
3219
|
{
|
|
3212
3220
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3213
3221
|
registrationId: registration1.id,
|
|
3214
3222
|
amount: 1,
|
|
3215
|
-
unitPrice: -
|
|
3223
|
+
unitPrice: -5_0000,
|
|
3216
3224
|
status: BalanceItemStatus.Due, // has NOT been cancelled
|
|
3217
3225
|
pricePending: 0,
|
|
3218
|
-
|
|
3226
|
+
priceTotal: -5_0000,
|
|
3227
|
+
|
|
3228
|
+
// Payment reallocation
|
|
3229
|
+
priceOpen: 0,
|
|
3230
|
+
pricePaid: -5_0000,
|
|
3219
3231
|
},
|
|
3220
3232
|
{
|
|
3221
3233
|
type: BalanceItemType.Registration,
|
|
3222
3234
|
registrationId: registration2.id,
|
|
3223
3235
|
amount: 1,
|
|
3224
|
-
unitPrice:
|
|
3236
|
+
unitPrice: 15_0000,
|
|
3225
3237
|
status: BalanceItemStatus.Canceled,
|
|
3226
3238
|
pricePending: 0,
|
|
3227
3239
|
priceOpen: 0,
|
|
@@ -3231,10 +3243,14 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3231
3243
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3232
3244
|
registrationId: registration1.id,
|
|
3233
3245
|
amount: 1,
|
|
3234
|
-
unitPrice:
|
|
3246
|
+
unitPrice: 5_0000,
|
|
3235
3247
|
status: BalanceItemStatus.Due,
|
|
3236
3248
|
pricePending: 0,
|
|
3237
|
-
|
|
3249
|
+
priceTotal: 5_0000,
|
|
3250
|
+
|
|
3251
|
+
// Payment reallocation
|
|
3252
|
+
priceOpen: 0,
|
|
3253
|
+
pricePaid: 5_0000,
|
|
3238
3254
|
},
|
|
3239
3255
|
]);
|
|
3240
3256
|
});
|
|
@@ -3249,7 +3265,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3249
3265
|
deleteRegistrationIds: [registration2.id],
|
|
3250
3266
|
}),
|
|
3251
3267
|
asOrganizationId: organization.id,
|
|
3252
|
-
totalPrice:
|
|
3268
|
+
totalPrice: 5_0000, // Positive 5 because we lose the discount on registration 1
|
|
3253
3269
|
cancellationFeePercentage: 100_00, // we charge a cancellation fee
|
|
3254
3270
|
});
|
|
3255
3271
|
|
|
@@ -3270,38 +3286,46 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3270
3286
|
type: BalanceItemType.Registration,
|
|
3271
3287
|
registrationId: registration1.id,
|
|
3272
3288
|
amount: 1,
|
|
3273
|
-
unitPrice:
|
|
3289
|
+
unitPrice: 25_0000,
|
|
3274
3290
|
status: BalanceItemStatus.Due,
|
|
3275
|
-
priceOpen:
|
|
3291
|
+
priceOpen: 25_0000,
|
|
3276
3292
|
pricePending: 0,
|
|
3277
3293
|
},
|
|
3278
3294
|
{
|
|
3279
3295
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3280
3296
|
registrationId: registration1.id,
|
|
3281
3297
|
amount: 1,
|
|
3282
|
-
unitPrice: -
|
|
3298
|
+
unitPrice: -5_0000,
|
|
3283
3299
|
status: BalanceItemStatus.Due, // has NOT been cancelled
|
|
3284
3300
|
pricePending: 0,
|
|
3285
|
-
|
|
3301
|
+
priceTotal: -5_0000,
|
|
3302
|
+
|
|
3303
|
+
// Payment reallocation
|
|
3304
|
+
priceOpen: 0,
|
|
3305
|
+
pricePaid: -5_0000,
|
|
3286
3306
|
},
|
|
3287
3307
|
{
|
|
3288
3308
|
type: BalanceItemType.Registration,
|
|
3289
3309
|
registrationId: registration2.id,
|
|
3290
3310
|
amount: 1,
|
|
3291
|
-
unitPrice:
|
|
3311
|
+
unitPrice: 15_0000,
|
|
3292
3312
|
status: BalanceItemStatus.Due, // still due because of cancellation fee
|
|
3293
3313
|
pricePending: 0,
|
|
3294
|
-
priceOpen:
|
|
3314
|
+
priceOpen: 15_0000,
|
|
3295
3315
|
},
|
|
3296
3316
|
// A new bundle discount balance item has been created to offset the difference
|
|
3297
3317
|
{
|
|
3298
3318
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3299
3319
|
registrationId: registration1.id,
|
|
3300
3320
|
amount: 1,
|
|
3301
|
-
unitPrice:
|
|
3321
|
+
unitPrice: 5_0000,
|
|
3302
3322
|
status: BalanceItemStatus.Due,
|
|
3303
3323
|
pricePending: 0,
|
|
3304
|
-
|
|
3324
|
+
priceTotal: 5_0000,
|
|
3325
|
+
|
|
3326
|
+
// Payment reallocation
|
|
3327
|
+
priceOpen: 0,
|
|
3328
|
+
pricePaid: 5_0000,
|
|
3305
3329
|
},
|
|
3306
3330
|
]);
|
|
3307
3331
|
});
|
|
@@ -3343,12 +3367,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3343
3367
|
const groups = [
|
|
3344
3368
|
await new GroupFactory({
|
|
3345
3369
|
organization,
|
|
3346
|
-
price:
|
|
3370
|
+
price: 25_0000,
|
|
3347
3371
|
bundleDiscount,
|
|
3348
3372
|
}).create(),
|
|
3349
3373
|
await new GroupFactory({
|
|
3350
3374
|
organization,
|
|
3351
|
-
price:
|
|
3375
|
+
price: 15_0000,
|
|
3352
3376
|
bundleDiscount,
|
|
3353
3377
|
}).create(),
|
|
3354
3378
|
];
|
|
@@ -3366,7 +3390,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3366
3390
|
organizationId: organization.id,
|
|
3367
3391
|
type: BalanceItemType.Registration,
|
|
3368
3392
|
amount: 1,
|
|
3369
|
-
unitPrice:
|
|
3393
|
+
unitPrice: 25_0000,
|
|
3370
3394
|
status: BalanceItemStatus.Due,
|
|
3371
3395
|
registrationId: registration1.id,
|
|
3372
3396
|
}).create();
|
|
@@ -3382,7 +3406,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3382
3406
|
}),
|
|
3383
3407
|
],
|
|
3384
3408
|
}),
|
|
3385
|
-
totalPrice:
|
|
3409
|
+
totalPrice: 15_0000 - 5_0000, // 20% discount on first group
|
|
3386
3410
|
asOrganizationId: organization.id,
|
|
3387
3411
|
});
|
|
3388
3412
|
|
|
@@ -3402,7 +3426,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3402
3426
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
3403
3427
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
3404
3428
|
name: bundleDiscount.name,
|
|
3405
|
-
amount:
|
|
3429
|
+
amount: 5_0000,
|
|
3406
3430
|
})],
|
|
3407
3431
|
]));
|
|
3408
3432
|
|
|
@@ -3411,9 +3435,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3411
3435
|
type: BalanceItemType.Registration,
|
|
3412
3436
|
registrationId: registration1.id,
|
|
3413
3437
|
amount: 1,
|
|
3414
|
-
price:
|
|
3438
|
+
price: 25_0000,
|
|
3415
3439
|
status: BalanceItemStatus.Due,
|
|
3416
|
-
priceOpen:
|
|
3440
|
+
priceOpen: 25_0000,
|
|
3417
3441
|
pricePending: 0,
|
|
3418
3442
|
userId: user.id,
|
|
3419
3443
|
},
|
|
@@ -3421,9 +3445,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3421
3445
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3422
3446
|
registrationId: registration1.id,
|
|
3423
3447
|
amount: 1,
|
|
3424
|
-
price: -
|
|
3448
|
+
price: -5_0000,
|
|
3425
3449
|
status: BalanceItemStatus.Due,
|
|
3426
|
-
priceOpen: -
|
|
3450
|
+
priceOpen: -5_0000,
|
|
3427
3451
|
pricePending: 0,
|
|
3428
3452
|
userId: null,
|
|
3429
3453
|
},
|
|
@@ -3434,9 +3458,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3434
3458
|
type: BalanceItemType.Registration,
|
|
3435
3459
|
registrationId: registration2.id,
|
|
3436
3460
|
amount: 1,
|
|
3437
|
-
price:
|
|
3461
|
+
price: 15_0000,
|
|
3438
3462
|
status: BalanceItemStatus.Due,
|
|
3439
|
-
priceOpen:
|
|
3463
|
+
priceOpen: 15_0000,
|
|
3440
3464
|
pricePending: 0,
|
|
3441
3465
|
userId: null,
|
|
3442
3466
|
},
|
|
@@ -3461,12 +3485,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3461
3485
|
const groups = [
|
|
3462
3486
|
await new GroupFactory({
|
|
3463
3487
|
organization,
|
|
3464
|
-
price:
|
|
3488
|
+
price: 25_0000,
|
|
3465
3489
|
bundleDiscount,
|
|
3466
3490
|
}).create(),
|
|
3467
3491
|
await new GroupFactory({
|
|
3468
3492
|
organization,
|
|
3469
|
-
price:
|
|
3493
|
+
price: 15_0000,
|
|
3470
3494
|
bundleDiscount,
|
|
3471
3495
|
}).create(),
|
|
3472
3496
|
];
|
|
@@ -3531,7 +3555,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3531
3555
|
organizationId: organization.id,
|
|
3532
3556
|
type: BalanceItemType.Registration,
|
|
3533
3557
|
amount: 1,
|
|
3534
|
-
unitPrice:
|
|
3558
|
+
unitPrice: 25_0000,
|
|
3535
3559
|
status: BalanceItemStatus.Due,
|
|
3536
3560
|
registrationId: registration1.id,
|
|
3537
3561
|
}).create();
|
|
@@ -3547,7 +3571,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3547
3571
|
}),
|
|
3548
3572
|
],
|
|
3549
3573
|
}),
|
|
3550
|
-
totalPrice:
|
|
3574
|
+
totalPrice: 15_0000, // Admin does not know there should be discount
|
|
3551
3575
|
asOrganizationId: organization.id,
|
|
3552
3576
|
});
|
|
3553
3577
|
|
|
@@ -3567,7 +3591,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3567
3591
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
3568
3592
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
3569
3593
|
name: bundleDiscount.name,
|
|
3570
|
-
amount:
|
|
3594
|
+
amount: 5_0000,
|
|
3571
3595
|
})],
|
|
3572
3596
|
]));
|
|
3573
3597
|
|
|
@@ -3576,9 +3600,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3576
3600
|
type: BalanceItemType.Registration,
|
|
3577
3601
|
registrationId: registration1.id,
|
|
3578
3602
|
amount: 1,
|
|
3579
|
-
price:
|
|
3603
|
+
price: 25_0000,
|
|
3580
3604
|
status: BalanceItemStatus.Due,
|
|
3581
|
-
priceOpen:
|
|
3605
|
+
priceOpen: 25_0000,
|
|
3582
3606
|
pricePending: 0,
|
|
3583
3607
|
userId: user.id,
|
|
3584
3608
|
},
|
|
@@ -3586,9 +3610,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3586
3610
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3587
3611
|
registrationId: registration1.id,
|
|
3588
3612
|
amount: 1,
|
|
3589
|
-
price: -
|
|
3613
|
+
price: -5_0000,
|
|
3590
3614
|
status: BalanceItemStatus.Due,
|
|
3591
|
-
priceOpen: -
|
|
3615
|
+
priceOpen: -5_0000,
|
|
3592
3616
|
pricePending: 0,
|
|
3593
3617
|
userId: null,
|
|
3594
3618
|
},
|
|
@@ -3599,9 +3623,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3599
3623
|
type: BalanceItemType.Registration,
|
|
3600
3624
|
registrationId: registration2.id,
|
|
3601
3625
|
amount: 1,
|
|
3602
|
-
price:
|
|
3626
|
+
price: 15_0000,
|
|
3603
3627
|
status: BalanceItemStatus.Due,
|
|
3604
|
-
priceOpen:
|
|
3628
|
+
priceOpen: 15_0000,
|
|
3605
3629
|
pricePending: 0,
|
|
3606
3630
|
userId: null,
|
|
3607
3631
|
},
|
|
@@ -3626,12 +3650,12 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3626
3650
|
const groups = [
|
|
3627
3651
|
await new GroupFactory({
|
|
3628
3652
|
organization,
|
|
3629
|
-
price:
|
|
3653
|
+
price: 25_0000,
|
|
3630
3654
|
bundleDiscount,
|
|
3631
3655
|
}).create(),
|
|
3632
3656
|
await new GroupFactory({
|
|
3633
3657
|
organization,
|
|
3634
|
-
price:
|
|
3658
|
+
price: 15_0000,
|
|
3635
3659
|
bundleDiscount,
|
|
3636
3660
|
}).create(),
|
|
3637
3661
|
];
|
|
@@ -3687,7 +3711,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3687
3711
|
organizationId: organization.id,
|
|
3688
3712
|
type: BalanceItemType.Registration,
|
|
3689
3713
|
amount: 1,
|
|
3690
|
-
unitPrice:
|
|
3714
|
+
unitPrice: 25_0000,
|
|
3691
3715
|
status: BalanceItemStatus.Due,
|
|
3692
3716
|
registrationId: registration1.id,
|
|
3693
3717
|
}).create();
|
|
@@ -3703,7 +3727,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3703
3727
|
}),
|
|
3704
3728
|
],
|
|
3705
3729
|
}),
|
|
3706
|
-
totalPrice:
|
|
3730
|
+
totalPrice: 15_0000, // Admin does not know there should be discount
|
|
3707
3731
|
asOrganizationId: organization.id,
|
|
3708
3732
|
});
|
|
3709
3733
|
|
|
@@ -3723,7 +3747,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3723
3747
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
3724
3748
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
3725
3749
|
name: bundleDiscount.name,
|
|
3726
|
-
amount:
|
|
3750
|
+
amount: 5_0000,
|
|
3727
3751
|
})],
|
|
3728
3752
|
]));
|
|
3729
3753
|
|
|
@@ -3732,9 +3756,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3732
3756
|
type: BalanceItemType.Registration,
|
|
3733
3757
|
registrationId: registration1.id,
|
|
3734
3758
|
amount: 1,
|
|
3735
|
-
price:
|
|
3759
|
+
price: 25_0000,
|
|
3736
3760
|
status: BalanceItemStatus.Due,
|
|
3737
|
-
priceOpen:
|
|
3761
|
+
priceOpen: 25_0000,
|
|
3738
3762
|
pricePending: 0,
|
|
3739
3763
|
userId: user.id,
|
|
3740
3764
|
},
|
|
@@ -3742,9 +3766,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3742
3766
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3743
3767
|
registrationId: registration1.id,
|
|
3744
3768
|
amount: 1,
|
|
3745
|
-
price: -
|
|
3769
|
+
price: -5_0000,
|
|
3746
3770
|
status: BalanceItemStatus.Due,
|
|
3747
|
-
priceOpen: -
|
|
3771
|
+
priceOpen: -5_0000,
|
|
3748
3772
|
pricePending: 0,
|
|
3749
3773
|
userId: null,
|
|
3750
3774
|
},
|
|
@@ -3755,9 +3779,9 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3755
3779
|
type: BalanceItemType.Registration,
|
|
3756
3780
|
registrationId: registration2.id,
|
|
3757
3781
|
amount: 1,
|
|
3758
|
-
price:
|
|
3782
|
+
price: 15_0000,
|
|
3759
3783
|
status: BalanceItemStatus.Due,
|
|
3760
|
-
priceOpen:
|
|
3784
|
+
priceOpen: 15_0000,
|
|
3761
3785
|
pricePending: 0,
|
|
3762
3786
|
userId: null,
|
|
3763
3787
|
},
|
|
@@ -3784,17 +3808,17 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3784
3808
|
const groups = [
|
|
3785
3809
|
await new GroupFactory({
|
|
3786
3810
|
organization,
|
|
3787
|
-
price:
|
|
3811
|
+
price: 25_0000, // 20% discount = 5_00
|
|
3788
3812
|
bundleDiscount,
|
|
3789
3813
|
}).create(),
|
|
3790
3814
|
await new GroupFactory({
|
|
3791
3815
|
organization,
|
|
3792
|
-
price:
|
|
3816
|
+
price: 25_0000, // 20% discount = 5_00 (same as group 1)
|
|
3793
3817
|
bundleDiscount,
|
|
3794
3818
|
}).create(),
|
|
3795
3819
|
await new GroupFactory({
|
|
3796
3820
|
organization,
|
|
3797
|
-
price:
|
|
3821
|
+
price: 25_0000, // 20% discount = 5_00 (same as groups 1 & 2)
|
|
3798
3822
|
bundleDiscount,
|
|
3799
3823
|
}).create(),
|
|
3800
3824
|
];
|
|
@@ -3826,7 +3850,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3826
3850
|
registrationId: registration1.id,
|
|
3827
3851
|
type: BalanceItemType.Registration,
|
|
3828
3852
|
amount: 1,
|
|
3829
|
-
unitPrice:
|
|
3853
|
+
unitPrice: 25_0000,
|
|
3830
3854
|
status: BalanceItemStatus.Due,
|
|
3831
3855
|
}).create();
|
|
3832
3856
|
|
|
@@ -3837,7 +3861,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3837
3861
|
registrationId: registration1.id,
|
|
3838
3862
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3839
3863
|
amount: 1,
|
|
3840
|
-
unitPrice: -
|
|
3864
|
+
unitPrice: -5_0000,
|
|
3841
3865
|
status: BalanceItemStatus.Due,
|
|
3842
3866
|
relations: new Map([
|
|
3843
3867
|
[
|
|
@@ -3857,7 +3881,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3857
3881
|
registrationId: registration2.id,
|
|
3858
3882
|
type: BalanceItemType.Registration,
|
|
3859
3883
|
amount: 1,
|
|
3860
|
-
unitPrice:
|
|
3884
|
+
unitPrice: 25_0000,
|
|
3861
3885
|
status: BalanceItemStatus.Due,
|
|
3862
3886
|
}).create();
|
|
3863
3887
|
|
|
@@ -3871,7 +3895,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3871
3895
|
registrationId: registration3.id,
|
|
3872
3896
|
type: BalanceItemType.Registration,
|
|
3873
3897
|
amount: 1,
|
|
3874
|
-
unitPrice:
|
|
3898
|
+
unitPrice: 25_0000,
|
|
3875
3899
|
status: BalanceItemStatus.Due,
|
|
3876
3900
|
}).create();
|
|
3877
3901
|
|
|
@@ -3882,7 +3906,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3882
3906
|
registrationId: registration3.id,
|
|
3883
3907
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
3884
3908
|
amount: 1,
|
|
3885
|
-
unitPrice: -
|
|
3909
|
+
unitPrice: -5_0000,
|
|
3886
3910
|
status: BalanceItemStatus.Due,
|
|
3887
3911
|
relations: new Map([
|
|
3888
3912
|
[
|
|
@@ -3905,13 +3929,13 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3905
3929
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
3906
3930
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
3907
3931
|
name: bundleDiscount.name,
|
|
3908
|
-
amount:
|
|
3932
|
+
amount: 5_0000,
|
|
3909
3933
|
})],
|
|
3910
3934
|
]));
|
|
3911
3935
|
expect(registration3.discounts).toMatchMap(new Map([
|
|
3912
3936
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
3913
3937
|
name: bundleDiscount.name,
|
|
3914
|
-
amount:
|
|
3938
|
+
amount: 5_0000,
|
|
3915
3939
|
})],
|
|
3916
3940
|
]));
|
|
3917
3941
|
|
|
@@ -3951,13 +3975,13 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3951
3975
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
3952
3976
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
3953
3977
|
name: bundleDiscount.name,
|
|
3954
|
-
amount:
|
|
3978
|
+
amount: 5_0000,
|
|
3955
3979
|
})],
|
|
3956
3980
|
]));
|
|
3957
3981
|
expect(registration3.discounts).toMatchMap(new Map([
|
|
3958
3982
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
3959
3983
|
name: bundleDiscount.name,
|
|
3960
|
-
amount:
|
|
3984
|
+
amount: 5_0000,
|
|
3961
3985
|
})],
|
|
3962
3986
|
]));
|
|
3963
3987
|
});
|
|
@@ -3982,17 +4006,17 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
3982
4006
|
const groups = [
|
|
3983
4007
|
await new GroupFactory({
|
|
3984
4008
|
organization,
|
|
3985
|
-
price:
|
|
4009
|
+
price: 25_0000, // 20% discount = 5_00
|
|
3986
4010
|
bundleDiscount,
|
|
3987
4011
|
}).create(),
|
|
3988
4012
|
await new GroupFactory({
|
|
3989
4013
|
organization,
|
|
3990
|
-
price:
|
|
4014
|
+
price: 25_0000, // 20% discount = 5_00 (same as group 1)
|
|
3991
4015
|
bundleDiscount,
|
|
3992
4016
|
}).create(),
|
|
3993
4017
|
await new GroupFactory({
|
|
3994
4018
|
organization,
|
|
3995
|
-
price:
|
|
4019
|
+
price: 25_0000, // 20% discount = 5_00 (same as groups 1 & 2)
|
|
3996
4020
|
bundleDiscount,
|
|
3997
4021
|
}).create(),
|
|
3998
4022
|
];
|
|
@@ -4024,7 +4048,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4024
4048
|
registrationId: registration1.id,
|
|
4025
4049
|
type: BalanceItemType.Registration,
|
|
4026
4050
|
amount: 1,
|
|
4027
|
-
unitPrice:
|
|
4051
|
+
unitPrice: 25_0000,
|
|
4028
4052
|
status: BalanceItemStatus.Due,
|
|
4029
4053
|
}).create();
|
|
4030
4054
|
|
|
@@ -4035,7 +4059,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4035
4059
|
registrationId: registration1.id,
|
|
4036
4060
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
4037
4061
|
amount: 1,
|
|
4038
|
-
unitPrice: -
|
|
4062
|
+
unitPrice: -5_0000,
|
|
4039
4063
|
status: BalanceItemStatus.Due,
|
|
4040
4064
|
relations: new Map([
|
|
4041
4065
|
[
|
|
@@ -4055,7 +4079,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4055
4079
|
registrationId: registration2.id,
|
|
4056
4080
|
type: BalanceItemType.Registration,
|
|
4057
4081
|
amount: 1,
|
|
4058
|
-
unitPrice:
|
|
4082
|
+
unitPrice: 25_0000,
|
|
4059
4083
|
status: BalanceItemStatus.Due,
|
|
4060
4084
|
}).create();
|
|
4061
4085
|
|
|
@@ -4069,7 +4093,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4069
4093
|
registrationId: registration3.id,
|
|
4070
4094
|
type: BalanceItemType.Registration,
|
|
4071
4095
|
amount: 1,
|
|
4072
|
-
unitPrice:
|
|
4096
|
+
unitPrice: 25_0000,
|
|
4073
4097
|
status: BalanceItemStatus.Due,
|
|
4074
4098
|
}).create();
|
|
4075
4099
|
|
|
@@ -4080,7 +4104,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4080
4104
|
registrationId: registration3.id,
|
|
4081
4105
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
4082
4106
|
amount: 1,
|
|
4083
|
-
unitPrice: -
|
|
4107
|
+
unitPrice: -5_0000,
|
|
4084
4108
|
status: BalanceItemStatus.Due,
|
|
4085
4109
|
relations: new Map([
|
|
4086
4110
|
[
|
|
@@ -4103,13 +4127,13 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4103
4127
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
4104
4128
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4105
4129
|
name: bundleDiscount.name,
|
|
4106
|
-
amount:
|
|
4130
|
+
amount: 5_0000,
|
|
4107
4131
|
})],
|
|
4108
4132
|
]));
|
|
4109
4133
|
expect(registration3.discounts).toMatchMap(new Map([
|
|
4110
4134
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4111
4135
|
name: bundleDiscount.name,
|
|
4112
|
-
amount:
|
|
4136
|
+
amount: 5_0000,
|
|
4113
4137
|
})],
|
|
4114
4138
|
]));
|
|
4115
4139
|
|
|
@@ -4140,7 +4164,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4140
4164
|
discounts: new Map([
|
|
4141
4165
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4142
4166
|
name: bundleDiscount.name,
|
|
4143
|
-
amount:
|
|
4167
|
+
amount: 5_0000,
|
|
4144
4168
|
})],
|
|
4145
4169
|
]),
|
|
4146
4170
|
});
|
|
@@ -4154,13 +4178,13 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4154
4178
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
4155
4179
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4156
4180
|
name: bundleDiscount.name,
|
|
4157
|
-
amount:
|
|
4181
|
+
amount: 5_0000,
|
|
4158
4182
|
})],
|
|
4159
4183
|
]));
|
|
4160
4184
|
expect(registration3.discounts).toMatchMap(new Map([
|
|
4161
4185
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4162
4186
|
name: bundleDiscount.name,
|
|
4163
|
-
amount:
|
|
4187
|
+
amount: 5_0000,
|
|
4164
4188
|
})],
|
|
4165
4189
|
]));
|
|
4166
4190
|
});
|
|
@@ -4185,17 +4209,17 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4185
4209
|
const groups = [
|
|
4186
4210
|
await new GroupFactory({
|
|
4187
4211
|
organization,
|
|
4188
|
-
price:
|
|
4212
|
+
price: 25_0000, // 20% discount = 5_00
|
|
4189
4213
|
bundleDiscount,
|
|
4190
4214
|
}).create(),
|
|
4191
4215
|
await new GroupFactory({
|
|
4192
4216
|
organization,
|
|
4193
|
-
price:
|
|
4217
|
+
price: 25_0000, // 20% discount = 5_00 (same as group 1)
|
|
4194
4218
|
bundleDiscount,
|
|
4195
4219
|
}).create(),
|
|
4196
4220
|
await new GroupFactory({
|
|
4197
4221
|
organization,
|
|
4198
|
-
price:
|
|
4222
|
+
price: 25_0000, // 20% discount = 5_00 (same as groups 1 & 2)
|
|
4199
4223
|
bundleDiscount,
|
|
4200
4224
|
}).create(),
|
|
4201
4225
|
];
|
|
@@ -4227,7 +4251,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4227
4251
|
registrationId: registration1.id,
|
|
4228
4252
|
type: BalanceItemType.Registration,
|
|
4229
4253
|
amount: 1,
|
|
4230
|
-
unitPrice:
|
|
4254
|
+
unitPrice: 25_0000,
|
|
4231
4255
|
status: BalanceItemStatus.Due,
|
|
4232
4256
|
}).create();
|
|
4233
4257
|
|
|
@@ -4238,7 +4262,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4238
4262
|
registrationId: registration1.id,
|
|
4239
4263
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
4240
4264
|
amount: 1,
|
|
4241
|
-
unitPrice: -
|
|
4265
|
+
unitPrice: -5_0000,
|
|
4242
4266
|
status: BalanceItemStatus.Due,
|
|
4243
4267
|
relations: new Map([
|
|
4244
4268
|
[
|
|
@@ -4258,7 +4282,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4258
4282
|
registrationId: registration2.id,
|
|
4259
4283
|
type: BalanceItemType.Registration,
|
|
4260
4284
|
amount: 1,
|
|
4261
|
-
unitPrice:
|
|
4285
|
+
unitPrice: 25_0000,
|
|
4262
4286
|
status: BalanceItemStatus.Due,
|
|
4263
4287
|
}).create();
|
|
4264
4288
|
|
|
@@ -4272,7 +4296,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4272
4296
|
registrationId: registration3.id,
|
|
4273
4297
|
type: BalanceItemType.Registration,
|
|
4274
4298
|
amount: 1,
|
|
4275
|
-
unitPrice:
|
|
4299
|
+
unitPrice: 25_0000,
|
|
4276
4300
|
status: BalanceItemStatus.Due,
|
|
4277
4301
|
}).create();
|
|
4278
4302
|
|
|
@@ -4283,7 +4307,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4283
4307
|
registrationId: registration3.id,
|
|
4284
4308
|
type: BalanceItemType.RegistrationBundleDiscount,
|
|
4285
4309
|
amount: 1,
|
|
4286
|
-
unitPrice: -
|
|
4310
|
+
unitPrice: -5_0000,
|
|
4287
4311
|
status: BalanceItemStatus.Due,
|
|
4288
4312
|
relations: new Map([
|
|
4289
4313
|
[
|
|
@@ -4306,13 +4330,13 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4306
4330
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
4307
4331
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4308
4332
|
name: bundleDiscount.name,
|
|
4309
|
-
amount:
|
|
4333
|
+
amount: 5_0000,
|
|
4310
4334
|
})],
|
|
4311
4335
|
]));
|
|
4312
4336
|
expect(registration3.discounts).toMatchMap(new Map([
|
|
4313
4337
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4314
4338
|
name: bundleDiscount.name,
|
|
4315
|
-
amount:
|
|
4339
|
+
amount: 5_0000,
|
|
4316
4340
|
})],
|
|
4317
4341
|
]));
|
|
4318
4342
|
|
|
@@ -4352,7 +4376,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4352
4376
|
discounts: new Map([
|
|
4353
4377
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4354
4378
|
name: bundleDiscount.name,
|
|
4355
|
-
amount:
|
|
4379
|
+
amount: 5_0000,
|
|
4356
4380
|
})],
|
|
4357
4381
|
]),
|
|
4358
4382
|
}),
|
|
@@ -4372,13 +4396,13 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
4372
4396
|
expect(registration1.discounts).toMatchMap(new Map([
|
|
4373
4397
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4374
4398
|
name: bundleDiscount.name,
|
|
4375
|
-
amount:
|
|
4399
|
+
amount: 5_0000,
|
|
4376
4400
|
})],
|
|
4377
4401
|
]));
|
|
4378
4402
|
expect(registration3.discounts).toMatchMap(new Map([
|
|
4379
4403
|
[bundleDiscount.id, AppliedRegistrationDiscount.create({
|
|
4380
4404
|
name: bundleDiscount.name,
|
|
4381
|
-
amount:
|
|
4405
|
+
amount: 5_0000,
|
|
4382
4406
|
})],
|
|
4383
4407
|
]));
|
|
4384
4408
|
});
|