@stamhoofd/backend 2.79.6 → 2.79.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamhoofd/backend",
3
- "version": "2.79.6",
3
+ "version": "2.79.7",
4
4
  "main": "./dist/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -38,14 +38,14 @@
38
38
  "@simonbackx/simple-encoding": "2.21.0",
39
39
  "@simonbackx/simple-endpoints": "1.19.1",
40
40
  "@simonbackx/simple-logging": "^1.0.1",
41
- "@stamhoofd/backend-i18n": "2.79.6",
42
- "@stamhoofd/backend-middleware": "2.79.6",
43
- "@stamhoofd/email": "2.79.6",
44
- "@stamhoofd/models": "2.79.6",
45
- "@stamhoofd/queues": "2.79.6",
46
- "@stamhoofd/sql": "2.79.6",
47
- "@stamhoofd/structures": "2.79.6",
48
- "@stamhoofd/utility": "2.79.6",
41
+ "@stamhoofd/backend-i18n": "2.79.7",
42
+ "@stamhoofd/backend-middleware": "2.79.7",
43
+ "@stamhoofd/email": "2.79.7",
44
+ "@stamhoofd/models": "2.79.7",
45
+ "@stamhoofd/queues": "2.79.7",
46
+ "@stamhoofd/sql": "2.79.7",
47
+ "@stamhoofd/structures": "2.79.7",
48
+ "@stamhoofd/utility": "2.79.7",
49
49
  "archiver": "^7.0.1",
50
50
  "aws-sdk": "^2.885.0",
51
51
  "axios": "1.6.8",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "5ed5677f28e62a73283527518b8e7ac0c8b4818e"
68
+ "gitHead": "d8675cbc91c2fcdcc6bbd3b3925ccd8063b15522"
69
69
  }
@@ -457,41 +457,9 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
457
457
  balanceItem.organizationId = organization.id;
458
458
 
459
459
  // Who is responsible for payment?
460
- let balanceItem2: BalanceItem | null = null;
461
460
  if (registration.payingOrganizationId) {
462
- // Create a separate balance item for this meber to pay back the paying organization
463
- // this is not yet associated with a payment but will be added to the outstanding balance of the member
464
-
461
+ // We no longer also charge the member. This has been removed, ref STA-288
465
462
  balanceItem.payingOrganizationId = registration.payingOrganizationId;
466
-
467
- balanceItem2 = new BalanceItem();
468
-
469
- // NOTE: we don't connect the registrationId here
470
- // because otherwise the total price and pricePaid for the registration would be incorrect
471
- // balanceItem2.registrationId = registration.id;
472
-
473
- balanceItem2.unitPrice = unitPrice;
474
- balanceItem2.amount = amount ?? 1;
475
- balanceItem2.description = description;
476
- balanceItem2.relations = relations;
477
- balanceItem2.type = type;
478
-
479
- // Who needs to receive this money?
480
- balanceItem2.organizationId = registration.payingOrganizationId;
481
-
482
- // Who is responsible for payment?
483
- balanceItem2.memberId = registration.memberId;
484
-
485
- if (registration.trialUntil) {
486
- balanceItem2.dueAt = registration.trialUntil;
487
- }
488
-
489
- // If the paying organization hasn't paid yet, this should be hidden and move to pending as soon as the paying organization has paid
490
- balanceItem2.status = BalanceItemStatus.Hidden;
491
- await balanceItem2.save();
492
-
493
- // do not add to createdBalanceItems array because we don't want to add this to the payment if we create a payment
494
- unrelatedCreatedBalanceItems.push(balanceItem2);
495
463
  }
496
464
  else {
497
465
  balanceItem.memberId = registration.memberId;
@@ -501,9 +469,6 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
501
469
  balanceItem.status = BalanceItemStatus.Hidden;
502
470
  balanceItem.pricePaid = 0;
503
471
 
504
- // Connect the 'pay back' balance item to this balance item. As soon as this balance item is paid, we'll mark the other one as pending so the outstanding balance for the member increases
505
- balanceItem.dependingBalanceItemId = balanceItem2?.id ?? null;
506
-
507
472
  if (registration.trialUntil) {
508
473
  balanceItem.dueAt = registration.trialUntil;
509
474
  }
@@ -391,7 +391,7 @@ export class AuthenticatedStructures {
391
391
  const organizations = new Map<string, Organization>();
392
392
 
393
393
  const registrationIds = Formatter.uniqueArray(members.flatMap(m => m.registrations.map(r => r.id)));
394
- const balances = await CachedBalance.getForObjects(registrationIds, Context.organization?.id ?? null);
394
+ const balances = await CachedBalance.getForObjects(registrationIds, null);
395
395
 
396
396
  if (includeUser) {
397
397
  for (const organizationId of includeUser.permissions?.organizationPermissions.keys() ?? []) {