@stamhoofd/backend 2.106.1 → 2.107.1

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.
Files changed (30) hide show
  1. package/index.ts +6 -1
  2. package/package.json +17 -11
  3. package/src/boot.ts +28 -22
  4. package/src/endpoints/frontend/FrontendEnvironmentEndpoint.ts +89 -0
  5. package/src/endpoints/global/billing/ActivatePackagesEndpoint.ts +30 -0
  6. package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +3 -2
  7. package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +8 -3
  8. package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +109 -109
  9. package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +7 -0
  10. package/src/endpoints/organization/dashboard/payments/PatchBalanceItemsEndpoint.ts +9 -7
  11. package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +7 -0
  12. package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +9 -2
  13. package/src/excel-loaders/payments.ts +5 -5
  14. package/src/excel-loaders/receivable-balances.ts +7 -7
  15. package/src/helpers/AdminPermissionChecker.ts +20 -0
  16. package/src/helpers/BuckarooHelper.ts +1 -1
  17. package/src/helpers/ServiceFeeHelper.ts +8 -4
  18. package/src/helpers/StripeHelper.ts +20 -35
  19. package/src/seeds/1752848561-groups-registration-periods.ts +35 -0
  20. package/src/services/BalanceItemService.ts +15 -2
  21. package/src/services/PaymentReallocationService.test.ts +298 -128
  22. package/src/services/PaymentReallocationService.ts +46 -16
  23. package/src/services/PaymentService.ts +49 -2
  24. package/src/services/uitpas/getSocialTariffForEvent.ts +2 -2
  25. package/src/services/uitpas/getSocialTariffForUitpasNumbers.ts +2 -2
  26. package/src/services/uitpas/registerTicketSales.ts +2 -2
  27. package/tests/e2e/bundle-discounts.test.ts +415 -391
  28. package/tests/e2e/documents.test.ts +21 -21
  29. package/tests/e2e/register.test.ts +93 -93
  30. package/tests/e2e/stock.test.ts +4 -4
@@ -75,12 +75,12 @@ describe('E2E.Documents', () => {
75
75
 
76
76
  const group = await new GroupFactory({
77
77
  organization,
78
- price: 25_00,
78
+ price: 25_0000,
79
79
  }).create();
80
80
 
81
81
  const group2 = await new GroupFactory({
82
82
  organization,
83
- price: 15_00,
83
+ price: 15_0000,
84
84
  }).create();
85
85
 
86
86
  const documentTemplate = await new DocumentTemplateFactory({
@@ -159,7 +159,7 @@ describe('E2E.Documents', () => {
159
159
  ],
160
160
  }),
161
161
  paymentMethod: PaymentMethod.Bancontact,
162
- totalPrice: 25_00,
162
+ totalPrice: 25_0000,
163
163
  redirectUrl: new URL('https://example.com/redirect'),
164
164
  cancelUrl: new URL('https://example.com/cancel'),
165
165
  });
@@ -175,7 +175,7 @@ describe('E2E.Documents', () => {
175
175
  expect(registrationModel).not.toBeNull();
176
176
  expect(registrationModel?.registeredAt).not.toBeNull();
177
177
 
178
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 25_00 });
178
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 25_0000 });
179
179
  });
180
180
 
181
181
  test('Documents are created for non-paid registrations by default', async () => {
@@ -194,20 +194,20 @@ describe('E2E.Documents', () => {
194
194
  ],
195
195
  }),
196
196
  paymentMethod: PaymentMethod.PointOfSale,
197
- totalPrice: 25_00,
197
+ totalPrice: 25_0000,
198
198
  });
199
199
 
200
200
  const response = await post(checkout1, organization, token);
201
201
  const registration = response.body.registrations[0];
202
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 0 });
202
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 0 });
203
203
 
204
204
  // Mark paid
205
205
  await markPaid({ payment: response.body.payment!, organization });
206
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 25_00 });
206
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 25_0000 });
207
207
 
208
208
  // Mark unpaid
209
209
  await markNotPaid({ payment: response.body.payment!, organization });
210
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 0 });
210
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 0 });
211
211
  });
212
212
 
213
213
  test('A paid-only document is only created when a payment is marked as paid', async () => {
@@ -226,7 +226,7 @@ describe('E2E.Documents', () => {
226
226
  ],
227
227
  }),
228
228
  paymentMethod: PaymentMethod.PointOfSale,
229
- totalPrice: 25_00,
229
+ totalPrice: 25_0000,
230
230
  });
231
231
 
232
232
  const response = await post(checkout1, organization, token);
@@ -234,7 +234,7 @@ describe('E2E.Documents', () => {
234
234
  await assertNoDocument(registration);
235
235
 
236
236
  await markPaid({ payment: response.body.payment!, organization });
237
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 25_00 });
237
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 25_0000 });
238
238
 
239
239
  // Should be deleted again
240
240
  await markNotPaid({ payment: response.body.payment!, organization });
@@ -259,7 +259,7 @@ describe('E2E.Documents', () => {
259
259
  ],
260
260
  }),
261
261
  paymentMethod: PaymentMethod.PointOfSale,
262
- totalPrice: 25_00,
262
+ totalPrice: 25_0000,
263
263
  });
264
264
 
265
265
  const response = await post(checkout1, organization, token);
@@ -279,9 +279,9 @@ describe('E2E.Documents', () => {
279
279
  }),
280
280
  });
281
281
 
282
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 25_00 });
282
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 25_0000 });
283
283
  await markNotPaid({ payment: response.body.payment!, organization });
284
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 0 });
284
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 0 });
285
285
 
286
286
  // Change age again
287
287
  await patchOrganizationMember({
@@ -307,7 +307,7 @@ describe('E2E.Documents', () => {
307
307
  }),
308
308
  }),
309
309
  });
310
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 0 });
310
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 0 });
311
311
  });
312
312
 
313
313
  test('A document is updated when a registration is moved by an admin', async () => {
@@ -327,12 +327,12 @@ describe('E2E.Documents', () => {
327
327
  ],
328
328
  }),
329
329
  paymentMethod: PaymentMethod.PointOfSale,
330
- totalPrice: 25_00,
330
+ totalPrice: 25_0000,
331
331
  });
332
332
 
333
333
  const response = await post(checkout1, organization, token);
334
334
  const registration = response.body.registrations[0];
335
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 0 });
335
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 0 });
336
336
 
337
337
  // Move
338
338
  const checkout2 = IDRegisterCheckout.create({
@@ -349,12 +349,12 @@ describe('E2E.Documents', () => {
349
349
  }),
350
350
  paymentMethod: PaymentMethod.PointOfSale,
351
351
  asOrganizationId: organization.id,
352
- totalPrice: -10_00,
352
+ totalPrice: -10_0000,
353
353
  });
354
354
 
355
355
  const response2 = await post(checkout2, organization, adminToken);
356
356
  const registration2 = response2.body.registrations[0];
357
- await assertDocument({ registration: registration2, organization, member, group: group2, price: 15_00, pricePaid: 0 });
357
+ await assertDocument({ registration: registration2, organization, member, group: group2, price: 15_0000, pricePaid: 0 });
358
358
  await assertNoDocument(registration);
359
359
  });
360
360
 
@@ -375,12 +375,12 @@ describe('E2E.Documents', () => {
375
375
  ],
376
376
  }),
377
377
  paymentMethod: PaymentMethod.PointOfSale,
378
- totalPrice: 25_00,
378
+ totalPrice: 25_0000,
379
379
  });
380
380
 
381
381
  const response = await post(checkout1, organization, token);
382
382
  const registration = response.body.registrations[0];
383
- await assertDocument({ registration, organization, member, group, price: 25_00, pricePaid: 0 });
383
+ await assertDocument({ registration, organization, member, group, price: 25_0000, pricePaid: 0 });
384
384
 
385
385
  // Move
386
386
  const checkout2 = IDRegisterCheckout.create({
@@ -389,7 +389,7 @@ describe('E2E.Documents', () => {
389
389
  }),
390
390
  paymentMethod: PaymentMethod.PointOfSale,
391
391
  asOrganizationId: organization.id,
392
- totalPrice: -25_00,
392
+ totalPrice: -25_0000,
393
393
  });
394
394
 
395
395
  await post(checkout2, organization, adminToken);