@stamhoofd/backend 2.82.0 → 2.83.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.
- package/package.json +10 -10
- package/src/audit-logs/GroupLogger.ts +3 -3
- package/src/audit-logs/MemberResponsibilityRecordLogger.ts +1 -1
- package/src/audit-logs/OrderLogger.ts +1 -1
- package/src/audit-logs/RegistrationLogger.ts +1 -1
- package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +4 -4
- package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +1 -1
- package/src/endpoints/admin/organizations/ChargeOrganizationsEndpoint.ts +5 -5
- package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +1 -1
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +8 -8
- package/src/endpoints/auth/CreateAdminEndpoint.ts +2 -2
- package/src/endpoints/auth/CreateTokenEndpoint.ts +10 -10
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +2 -2
- package/src/endpoints/auth/PatchUserEndpoint.ts +9 -9
- package/src/endpoints/auth/SignupEndpoint.ts +2 -2
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +3 -3
- package/src/endpoints/global/audit-logs/GetAuditLogsEndpoint.ts +1 -1
- package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +1 -1
- package/src/endpoints/global/email/GetEmailEndpoint.ts +1 -1
- package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +1 -1
- package/src/endpoints/global/email/PatchEmailEndpoint.ts +4 -4
- package/src/endpoints/global/events/GetEventNotificationsEndpoint.ts +1 -1
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.ts +1 -1
- package/src/endpoints/global/events/PatchEventsEndpoint.ts +22 -16
- package/src/endpoints/global/files/ExportToExcelEndpoint.ts +1 -1
- package/src/endpoints/global/files/UploadFile.ts +14 -2
- package/src/endpoints/global/files/UploadImage.ts +2 -2
- package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +2 -2
- package/src/endpoints/global/members/GetMembersEndpoint.ts +1 -1
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +11 -11
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +34 -34
- package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +1 -1
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +5 -5
- package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +1 -1
- package/src/endpoints/global/registration/GetPaymentRegistrations.ts +2 -2
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.test.ts +10 -10
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +4 -4
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +37 -37
- package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +1 -1
- package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +5 -5
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplateEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +1218 -3
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +136 -12
- package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/payments/PatchBalanceItemsEndpoint.ts +11 -11
- package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +13 -13
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +16 -16
- package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/users/PatchApiUserEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +4 -4
- package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +8 -8
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +1 -1
- package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +1 -1
- package/src/endpoints/organization/shared/GetDocumentHtml.ts +2 -2
- package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +1 -1
- package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +1 -1
- package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +2 -2
- package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +1 -1
- package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +3 -3
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +1 -1
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +10 -8
- package/src/excel-loaders/event-notifications.ts +11 -11
- package/src/excel-loaders/members.ts +34 -34
- package/src/excel-loaders/organizations.ts +23 -23
- package/src/excel-loaders/payments.ts +39 -39
- package/src/excel-loaders/receivable-balances.ts +21 -21
- package/src/helpers/AddressValidator.ts +6 -6
- package/src/helpers/AdminPermissionChecker.ts +29 -5
- package/src/helpers/AuthenticatedStructures.ts +8 -8
- package/src/helpers/BuckarooHelper.ts +1 -1
- package/src/helpers/Context.ts +3 -3
- package/src/helpers/FileCache.ts +7 -7
- package/src/helpers/ForwardHandler.ts +1 -1
- package/src/helpers/GlobalHelper.ts +6 -4
- package/src/helpers/MembershipCharger.ts +2 -2
- package/src/helpers/SetupStepUpdater.ts +1 -1
- package/src/helpers/StripeHelper.ts +7 -7
- package/src/helpers/XlsxTransformerColumnHelper.ts +18 -18
- package/src/services/DocumentService.ts +1 -1
- package/src/services/EventNotificationService.ts +1 -1
- package/src/services/MemberNumberService.ts +3 -3
- package/src/services/SSOService.ts +5 -5
- package/src/sql-filters/members.ts +1 -1
- package/tests/e2e/private-files.test.ts +3 -3
|
@@ -31,7 +31,7 @@ export class CreateOrganizationEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
31
31
|
throw new SimpleError({
|
|
32
32
|
code: 'invalid_field',
|
|
33
33
|
message: 'Not allowed',
|
|
34
|
-
human:
|
|
34
|
+
human: $t(`a010c110-bf4e-4c12-a324-6b84c992e728`),
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -40,7 +40,7 @@ export class CreateOrganizationEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
40
40
|
throw new SimpleError({
|
|
41
41
|
code: 'invalid_field',
|
|
42
42
|
message: 'Should not be empty',
|
|
43
|
-
human:
|
|
43
|
+
human: $t(`3f37782a-c07f-457d-994f-f1cc075cff44`),
|
|
44
44
|
field: 'organization.name',
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -48,7 +48,7 @@ export class CreateOrganizationEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
48
48
|
throw new SimpleError({
|
|
49
49
|
code: 'invalid_field',
|
|
50
50
|
message: 'Field is too short',
|
|
51
|
-
human:
|
|
51
|
+
human: $t(`0e82abec-5467-45d8-ba89-9b9fd10c085d`),
|
|
52
52
|
field: 'organization.name',
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -59,7 +59,7 @@ export class CreateOrganizationEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
59
59
|
throw new SimpleError({
|
|
60
60
|
code: 'invalid_field',
|
|
61
61
|
message: 'Field is too long',
|
|
62
|
-
human:
|
|
62
|
+
human: $t(`c4d225ea-8e41-4829-bf0c-bc04755492de`),
|
|
63
63
|
field: 'organization.name',
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -69,7 +69,7 @@ export class CreateOrganizationEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
69
69
|
throw new SimpleError({
|
|
70
70
|
code: 'name_taken',
|
|
71
71
|
message: 'An organization with the same name already exists',
|
|
72
|
-
human:
|
|
72
|
+
human: $t(`19e5262f-9dc1-40d9-b905-bda8462b6046`),
|
|
73
73
|
field: 'name',
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -161,7 +161,7 @@ export class PatchPlatformEndpoint extends Endpoint<
|
|
|
161
161
|
throw new SimpleError({
|
|
162
162
|
code: 'cannot_set_locked_period',
|
|
163
163
|
message: 'Platform period cannot be set to a locked period',
|
|
164
|
-
human:
|
|
164
|
+
human: $t(`fdd15119-b950-4282-9413-fd6973afde07`),
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
platform.periodId = period.id;
|
|
@@ -33,7 +33,7 @@ export class GetPaymentRegistrations extends Endpoint<Params, Query, Body, Respo
|
|
|
33
33
|
if (!payment) {
|
|
34
34
|
throw new SimpleError({
|
|
35
35
|
code: '',
|
|
36
|
-
message:
|
|
36
|
+
message: $t(`35b369bd-5766-41d1-8da3-3d362e316c1a`),
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
const registrations = await Member.getRegistrationWithMembersForPayment(payment.id);
|
|
@@ -45,7 +45,7 @@ export class GetPaymentRegistrations extends Endpoint<Params, Query, Body, Respo
|
|
|
45
45
|
if (!authorizedMembers.includes(registration.member.id)) {
|
|
46
46
|
throw new SimpleError({
|
|
47
47
|
code: '',
|
|
48
|
-
message:
|
|
48
|
+
message: $t(`35b369bd-5766-41d1-8da3-3d362e316c1a`),
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PatchableArray, PatchMap } from '@simonbackx/simple-encoding';
|
|
2
2
|
import { Endpoint, Request } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import { GroupFactory, MemberFactory, OrganizationFactory, Platform, RegistrationFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
4
|
-
import { MemberDetails, MemberWithRegistrationsBlob, OrganizationMetaData, OrganizationRecordsConfiguration, Parent, PatchAnswers, PermissionLevel, RecordCategory, RecordSettings, RecordTextAnswer } from '@stamhoofd/structures';
|
|
4
|
+
import { MemberDetails, MemberWithRegistrationsBlob, OrganizationMetaData, OrganizationRecordsConfiguration, Parent, PatchAnswers, PermissionLevel, RecordCategory, RecordSettings, RecordTextAnswer, TranslatedString } from '@stamhoofd/structures';
|
|
5
5
|
import { testServer } from '../../../../tests/helpers/TestServer';
|
|
6
6
|
import { PatchUserMembersEndpoint } from './PatchUserMembersEndpoint';
|
|
7
7
|
import { Database } from '@simonbackx/simple-database';
|
|
@@ -170,11 +170,11 @@ describe('Endpoint.PatchUserMembersEndpoint', () => {
|
|
|
170
170
|
describe('Record answers', () => {
|
|
171
171
|
test('A user can save answers of records of an organization it has not yet registered for', async () => {
|
|
172
172
|
const commentsRecord = RecordSettings.create({
|
|
173
|
-
name: 'Opmerkingen',
|
|
173
|
+
name: TranslatedString.create('Opmerkingen'),
|
|
174
174
|
});
|
|
175
175
|
|
|
176
176
|
const recordCategory = RecordCategory.create({
|
|
177
|
-
name: 'Medische fiche',
|
|
177
|
+
name: TranslatedString.create('Medische fiche'),
|
|
178
178
|
records: [
|
|
179
179
|
commentsRecord,
|
|
180
180
|
],
|
|
@@ -230,12 +230,12 @@ describe('Endpoint.PatchUserMembersEndpoint', () => {
|
|
|
230
230
|
|
|
231
231
|
test('A user cannot save answers to organization read-only records', async () => {
|
|
232
232
|
const commentsRecord = RecordSettings.create({
|
|
233
|
-
name: 'Opmerkingen',
|
|
233
|
+
name: TranslatedString.create('Opmerkingen'),
|
|
234
234
|
externalPermissionLevel: PermissionLevel.Read,
|
|
235
235
|
});
|
|
236
236
|
|
|
237
237
|
const recordCategory = RecordCategory.create({
|
|
238
|
-
name: 'Medische fiche',
|
|
238
|
+
name: TranslatedString.create('Medische fiche'),
|
|
239
239
|
records: [
|
|
240
240
|
commentsRecord,
|
|
241
241
|
],
|
|
@@ -283,11 +283,11 @@ describe('Endpoint.PatchUserMembersEndpoint', () => {
|
|
|
283
283
|
|
|
284
284
|
test('A user can save answers of records of the platform', async () => {
|
|
285
285
|
const commentsRecord = RecordSettings.create({
|
|
286
|
-
name: 'Opmerkingen',
|
|
286
|
+
name: TranslatedString.create('Opmerkingen'),
|
|
287
287
|
});
|
|
288
288
|
|
|
289
289
|
const recordCategory = RecordCategory.create({
|
|
290
|
-
name: 'Medische fiche',
|
|
290
|
+
name: TranslatedString.create('Medische fiche'),
|
|
291
291
|
records: [
|
|
292
292
|
commentsRecord,
|
|
293
293
|
],
|
|
@@ -342,12 +342,12 @@ describe('Endpoint.PatchUserMembersEndpoint', () => {
|
|
|
342
342
|
|
|
343
343
|
test('A user cannot save answers to platform read-only records', async () => {
|
|
344
344
|
const commentsRecord = RecordSettings.create({
|
|
345
|
-
name: 'Opmerkingen',
|
|
345
|
+
name: TranslatedString.create('Opmerkingen'),
|
|
346
346
|
externalPermissionLevel: PermissionLevel.Read,
|
|
347
347
|
});
|
|
348
348
|
|
|
349
349
|
const recordCategory = RecordCategory.create({
|
|
350
|
-
name: 'Medische fiche',
|
|
350
|
+
name: TranslatedString.create('Medische fiche'),
|
|
351
351
|
records: [
|
|
352
352
|
commentsRecord,
|
|
353
353
|
],
|
|
@@ -394,7 +394,7 @@ describe('Endpoint.PatchUserMembersEndpoint', () => {
|
|
|
394
394
|
|
|
395
395
|
test('A user can not save anwers to inexisting records', async () => {
|
|
396
396
|
const commentsRecord = RecordSettings.create({
|
|
397
|
-
name: 'Opmerkingen',
|
|
397
|
+
name: TranslatedString.create('Opmerkingen'),
|
|
398
398
|
});
|
|
399
399
|
|
|
400
400
|
const organization = await new OrganizationFactory({
|
|
@@ -90,7 +90,7 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
90
90
|
throw new SimpleError({
|
|
91
91
|
code: 'not_allowed',
|
|
92
92
|
message: 'Cannot override details',
|
|
93
|
-
human:
|
|
93
|
+
human: $t(`b66ef4c3-9931-4fc3-9da1-c023857684fa`),
|
|
94
94
|
field: 'details',
|
|
95
95
|
});
|
|
96
96
|
}
|
|
@@ -106,7 +106,7 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
106
106
|
throw new SimpleError({
|
|
107
107
|
code: 'invalid_data',
|
|
108
108
|
message: 'No details provided',
|
|
109
|
-
human:
|
|
109
|
+
human: $t(`c43b9970-bcf2-472d-ac3a-65f3be5765c5`),
|
|
110
110
|
field: 'details',
|
|
111
111
|
});
|
|
112
112
|
}
|
|
@@ -170,7 +170,7 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
170
170
|
if (details.firstName.length < 2) {
|
|
171
171
|
throw new SimpleError({
|
|
172
172
|
code: 'invalid_field',
|
|
173
|
-
message:
|
|
173
|
+
message: $t(`cdd2e8bd-ebda-4c85-acc3-dbe1a5cfeff5`),
|
|
174
174
|
field: 'firstName',
|
|
175
175
|
});
|
|
176
176
|
}
|
|
@@ -178,7 +178,7 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
178
178
|
if (details.lastName.length < 2) {
|
|
179
179
|
throw new SimpleError({
|
|
180
180
|
code: 'invalid_field',
|
|
181
|
-
message:
|
|
181
|
+
message: $t(`ca519528-c0cb-4e4f-94c7-f0f160312fb8`),
|
|
182
182
|
field: 'lastName',
|
|
183
183
|
});
|
|
184
184
|
}
|
|
@@ -54,7 +54,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
54
54
|
throw new SimpleError({
|
|
55
55
|
code: 'not_supported',
|
|
56
56
|
message: 'This version is no longer supported',
|
|
57
|
-
human:
|
|
57
|
+
human: $t(`47f56c92-fcfb-4ef4-8d0b-fb0c959fb624`),
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
return [true, params as Params];
|
|
@@ -71,7 +71,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
71
71
|
throw new SimpleError({
|
|
72
72
|
code: 'forbidden',
|
|
73
73
|
message: 'No permission to register as this organization for a different organization',
|
|
74
|
-
human:
|
|
74
|
+
human: $t(`62fe6e39-f6b0-4836-b0f7-dc84d22a81e3`),
|
|
75
75
|
statusCode: 403,
|
|
76
76
|
});
|
|
77
77
|
}
|
|
@@ -93,7 +93,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
93
93
|
throw new SimpleError({
|
|
94
94
|
code: 'too_many_emails_period',
|
|
95
95
|
message: 'Too many e-mails limited',
|
|
96
|
-
human:
|
|
96
|
+
human: $t(`28fb7a27-9b8e-44e0-833b-44c72ab61306`),
|
|
97
97
|
field: 'recipients',
|
|
98
98
|
});
|
|
99
99
|
}
|
|
@@ -111,7 +111,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
111
111
|
if (balanceItemsModels.length !== balanceItemIds.length) {
|
|
112
112
|
throw new SimpleError({
|
|
113
113
|
code: 'invalid_data',
|
|
114
|
-
message:
|
|
114
|
+
message: $t(`3e10f812-8871-458c-ae03-c508abfd3ca5`),
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
memberBalanceItemsStructs = balanceItemsModels.map(i => i.getStructure());
|
|
@@ -128,7 +128,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
128
128
|
if (group.organizationId !== organization.id) {
|
|
129
129
|
throw new SimpleError({
|
|
130
130
|
code: 'invalid_data',
|
|
131
|
-
message:
|
|
131
|
+
message: $t(`57d57c76-4e76-4b0e-93b5-57ef8025f5ec`),
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -138,7 +138,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
138
138
|
throw new SimpleError({
|
|
139
139
|
code: 'forbidden',
|
|
140
140
|
message: 'No permission to register this member',
|
|
141
|
-
human:
|
|
141
|
+
human: $t(`7b7c4b2b-f30c-4cad-ba13-caad591bafde`),
|
|
142
142
|
statusCode: 403,
|
|
143
143
|
});
|
|
144
144
|
}
|
|
@@ -183,7 +183,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
183
183
|
if (checkout.cart.isEmpty) {
|
|
184
184
|
throw new SimpleError({
|
|
185
185
|
code: 'empty_data',
|
|
186
|
-
message:
|
|
186
|
+
message: $t(`29d8bd5c-da83-49b9-a822-c44db58edd1a`),
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -198,14 +198,14 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
198
198
|
if (totalPrice !== request.body.totalPrice) {
|
|
199
199
|
throw new SimpleError({
|
|
200
200
|
code: 'changed_price',
|
|
201
|
-
message:
|
|
201
|
+
message: $t(`e424d549-2bb8-4103-9a14-ac4063d7d454`, { total: Formatter.price(totalPrice) }),
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
if (totalPrice < 0) {
|
|
206
206
|
throw new SimpleError({
|
|
207
207
|
code: 'empty_data',
|
|
208
|
-
message:
|
|
208
|
+
message: $t(`725715e5-b0ac-43c1-adef-dd42b8907327`),
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
|
|
@@ -229,7 +229,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
229
229
|
if (!member) {
|
|
230
230
|
throw new SimpleError({
|
|
231
231
|
code: 'invalid_member',
|
|
232
|
-
message:
|
|
232
|
+
message: $t(`bded79ec-0c69-47b1-9944-b9f3821b566e`),
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
|
|
@@ -237,7 +237,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
237
237
|
if (!group) {
|
|
238
238
|
throw new SimpleError({
|
|
239
239
|
code: 'invalid_member',
|
|
240
|
-
message:
|
|
240
|
+
message: $t(`c4896202-dd3b-4445-a530-3fed231259c2`),
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
|
|
@@ -247,7 +247,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
247
247
|
throw new SimpleError({
|
|
248
248
|
code: 'forbidden',
|
|
249
249
|
message: 'No permission to register in this group',
|
|
250
|
-
human: $t('36e8f895-91df-4c88-88e7-d4f0e9d1b5bf', { group: group.settings.name }),
|
|
250
|
+
human: $t('36e8f895-91df-4c88-88e7-d4f0e9d1b5bf', { group: group.settings.name.toString() }),
|
|
251
251
|
statusCode: 403,
|
|
252
252
|
});
|
|
253
253
|
}
|
|
@@ -270,7 +270,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
270
270
|
if (existingRegistration.registeredAt !== null && existingRegistration.deactivatedAt === null) {
|
|
271
271
|
throw new SimpleError({
|
|
272
272
|
code: 'already_registered',
|
|
273
|
-
message:
|
|
273
|
+
message: $t(`04d77a26-25c2-4a3e-a268-98bea9df45a2`, { member: member.firstName, group: group.settings.name }),
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
}
|
|
@@ -351,7 +351,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
351
351
|
if (!checkout.paymentMethod || !allowedPaymentMethods.includes(checkout.paymentMethod)) {
|
|
352
352
|
throw new SimpleError({
|
|
353
353
|
code: 'invalid_payment_method',
|
|
354
|
-
message:
|
|
354
|
+
message: $t(`2b1ca6a0-662e-4326-ada1-10239b6ddc6f`),
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
357
|
|
|
@@ -359,7 +359,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
359
359
|
throw new SimpleError({
|
|
360
360
|
code: 'missing_fields',
|
|
361
361
|
message: 'redirectUrl or cancelUrl is missing and is required for non-zero online payments',
|
|
362
|
-
human:
|
|
362
|
+
human: $t(`ebe54b63-2de6-4f22-a5ed-d3fe65194562`),
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
}
|
|
@@ -384,7 +384,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
384
384
|
throw new SimpleError({
|
|
385
385
|
code: 'forbidden',
|
|
386
386
|
message: 'Permission denied: you are not allowed to delete registrations',
|
|
387
|
-
human:
|
|
387
|
+
human: $t(`d47bdfdd-5940-4818-a664-1cd072294a26`),
|
|
388
388
|
statusCode: 403,
|
|
389
389
|
});
|
|
390
390
|
}
|
|
@@ -393,7 +393,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
393
393
|
if (!existingRegistration || existingRegistration.organizationId !== organization.id) {
|
|
394
394
|
throw new SimpleError({
|
|
395
395
|
code: 'invalid_data',
|
|
396
|
-
message:
|
|
396
|
+
message: $t(`282a7491-d129-4e43-9a14-e55c72ef5c5d`),
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
|
|
@@ -401,7 +401,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
401
401
|
throw new SimpleError({
|
|
402
402
|
code: 'forbidden',
|
|
403
403
|
message: 'No permission to delete this registration',
|
|
404
|
-
human:
|
|
404
|
+
human: $t(`9b772fd5-a36e-4997-85fa-251bb3a97a0a`),
|
|
405
405
|
statusCode: 403,
|
|
406
406
|
});
|
|
407
407
|
}
|
|
@@ -410,7 +410,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
410
410
|
throw new SimpleError({
|
|
411
411
|
code: 'invalid_data',
|
|
412
412
|
message: 'Cannot delete inactive registration',
|
|
413
|
-
human:
|
|
413
|
+
human: $t(`a0f43131-c880-4a8e-98e3-bf78df27336c`),
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
|
|
@@ -508,7 +508,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
508
508
|
BalanceItemRelationType.Group,
|
|
509
509
|
BalanceItemRelation.create({
|
|
510
510
|
id: item.group.id,
|
|
511
|
-
name: item.group.settings.name,
|
|
511
|
+
name: item.group.settings.name.toString(),
|
|
512
512
|
}),
|
|
513
513
|
],
|
|
514
514
|
];
|
|
@@ -518,7 +518,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
518
518
|
BalanceItemRelationType.GroupPrice,
|
|
519
519
|
BalanceItemRelation.create({
|
|
520
520
|
id: item.groupPrice.id,
|
|
521
|
-
name: item.groupPrice.name,
|
|
521
|
+
name: item.groupPrice.name.toString(),
|
|
522
522
|
}),
|
|
523
523
|
]);
|
|
524
524
|
}
|
|
@@ -529,7 +529,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
529
529
|
unitPrice: item.groupPrice.price.forMember(item.member),
|
|
530
530
|
type: BalanceItemType.Registration,
|
|
531
531
|
skipZero: false, // Always create at least one balance item for each registration - even when the price is zero
|
|
532
|
-
description: `${item.member.patchedMember.name} bij ${item.group.settings.name}`,
|
|
532
|
+
description: `${item.member.patchedMember.name} bij ${item.group.settings.name.toString()}`,
|
|
533
533
|
relations: new Map([
|
|
534
534
|
...sharedRelations,
|
|
535
535
|
]),
|
|
@@ -716,14 +716,14 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
716
716
|
if (price > 0 && price > Math.max(balanceItem.priceOpen, balanceItem.price - balanceItem.pricePaid)) {
|
|
717
717
|
throw new SimpleError({
|
|
718
718
|
code: 'invalid_data',
|
|
719
|
-
message:
|
|
719
|
+
message: $t(`38ddccb2-7cf6-4b47-aa71-d11ad73386d8`),
|
|
720
720
|
});
|
|
721
721
|
}
|
|
722
722
|
|
|
723
723
|
if (price < 0 && price < Math.min(balanceItem.priceOpen, balanceItem.price - balanceItem.pricePaid)) {
|
|
724
724
|
throw new SimpleError({
|
|
725
725
|
code: 'invalid_data',
|
|
726
|
-
message:
|
|
726
|
+
message: $t(`dd14a1d9-c569-4d5e-bb26-569ecede4c52`),
|
|
727
727
|
});
|
|
728
728
|
}
|
|
729
729
|
|
|
@@ -738,7 +738,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
738
738
|
if (!member) {
|
|
739
739
|
throw new SimpleError({
|
|
740
740
|
code: 'invalid_data',
|
|
741
|
-
message:
|
|
741
|
+
message: $t(`e64b8269-1cda-434d-8d6f-35be23a9d6e9`),
|
|
742
742
|
});
|
|
743
743
|
}
|
|
744
744
|
payMembers.push(member);
|
|
@@ -749,7 +749,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
749
749
|
// todo: try to make it non-negative by reducing some balance items
|
|
750
750
|
throw new SimpleError({
|
|
751
751
|
code: 'empty_data',
|
|
752
|
-
message:
|
|
752
|
+
message: $t(`725715e5-b0ac-43c1-adef-dd42b8907327`),
|
|
753
753
|
});
|
|
754
754
|
}
|
|
755
755
|
const payment = new Payment();
|
|
@@ -769,7 +769,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
769
769
|
else if (payment.method === PaymentMethod.Unknown) {
|
|
770
770
|
throw new SimpleError({
|
|
771
771
|
code: 'invalid_data',
|
|
772
|
-
message:
|
|
772
|
+
message: $t(`86c7b6f7-3ec9-4af3-a5e6-b5de6de80d73`),
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
|
|
@@ -795,7 +795,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
795
795
|
throw new SimpleError({
|
|
796
796
|
code: 'missing_fields',
|
|
797
797
|
message: 'customer is required when paying as an organization',
|
|
798
|
-
human:
|
|
798
|
+
human: $t(`d483aa9a-289c-4c59-955f-d2f99ec533ab`),
|
|
799
799
|
});
|
|
800
800
|
}
|
|
801
801
|
|
|
@@ -803,7 +803,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
803
803
|
throw new SimpleError({
|
|
804
804
|
code: 'missing_fields',
|
|
805
805
|
message: 'customer.company is required when paying as an organization',
|
|
806
|
-
human:
|
|
806
|
+
human: $t(`bc89861d-a799-4100-b06c-29d6808ba8d2`),
|
|
807
807
|
});
|
|
808
808
|
}
|
|
809
809
|
|
|
@@ -811,7 +811,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
811
811
|
if (!payingOrganization) {
|
|
812
812
|
throw new SimpleError({
|
|
813
813
|
code: 'invalid_data',
|
|
814
|
-
message:
|
|
814
|
+
message: $t(`492117ce-4d5f-4cff-8f3f-8fa56bbb0fee`),
|
|
815
815
|
});
|
|
816
816
|
}
|
|
817
817
|
|
|
@@ -823,7 +823,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
823
823
|
if (!foundCompany) {
|
|
824
824
|
throw new SimpleError({
|
|
825
825
|
code: 'invalid_data',
|
|
826
|
-
message:
|
|
826
|
+
message: $t(`0ab71307-8f4f-4701-b120-b552a1b6bdd0`),
|
|
827
827
|
});
|
|
828
828
|
}
|
|
829
829
|
|
|
@@ -853,7 +853,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
853
853
|
throw new SimpleError({
|
|
854
854
|
code: 'no_iban',
|
|
855
855
|
message: 'No IBAN',
|
|
856
|
-
human:
|
|
856
|
+
human: $t(`cc8b5066-a7e4-4eae-b556-f56de5d3502c`),
|
|
857
857
|
});
|
|
858
858
|
}
|
|
859
859
|
|
|
@@ -893,7 +893,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
893
893
|
balanceItemPayments.push(balanceItemPayment.setRelation(BalanceItemPayment.balanceItem, balanceItem));
|
|
894
894
|
}
|
|
895
895
|
|
|
896
|
-
const description = '
|
|
896
|
+
const description = $t(`33a926ea-9bc7-444e-becc-c0f2f70e1f0e`) + ' ' + organization.name;
|
|
897
897
|
|
|
898
898
|
let paymentUrl: string | null = null;
|
|
899
899
|
|
|
@@ -943,7 +943,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
943
943
|
lineItems: balanceItemPayments,
|
|
944
944
|
organization,
|
|
945
945
|
customer: {
|
|
946
|
-
name: user.name ?? payMembers[0]?.details.name ??
|
|
946
|
+
name: user.name ?? payMembers[0]?.details.name ?? $t(`bd1e59c8-3d4c-4097-ab35-0ce7b20d0e50`),
|
|
947
947
|
email: user.email,
|
|
948
948
|
},
|
|
949
949
|
});
|
|
@@ -955,14 +955,14 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
955
955
|
if (!token) {
|
|
956
956
|
throw new SimpleError({
|
|
957
957
|
code: '',
|
|
958
|
-
message:
|
|
958
|
+
message: $t(`b77e1f68-8928-42a2-802b-059fa73bedc3`, { method: PaymentMethodHelper.getName(payment.method) }),
|
|
959
959
|
});
|
|
960
960
|
}
|
|
961
961
|
const profileId = organization.privateMeta.mollieProfile?.id ?? await token.getProfileId(organization.getHost());
|
|
962
962
|
if (!profileId) {
|
|
963
963
|
throw new SimpleError({
|
|
964
964
|
code: '',
|
|
965
|
-
message:
|
|
965
|
+
message: $t(`5574469f-8eee-47fe-9fb6-1b097142ac75`, { method: PaymentMethodHelper.getName(payment.method) }),
|
|
966
966
|
});
|
|
967
967
|
}
|
|
968
968
|
const mollieClient = createMollieClient({ accessToken: await token.getAccessToken() });
|
|
@@ -1006,7 +1006,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
1006
1006
|
if ((payment.status as any) === PaymentStatus.Failed) {
|
|
1007
1007
|
throw new SimpleError({
|
|
1008
1008
|
code: 'payment_failed',
|
|
1009
|
-
message:
|
|
1009
|
+
message: $t(`b77e1f68-8928-42a2-802b-059fa73bedc3`, { method: PaymentMethodHelper.getName(payment.method) }),
|
|
1010
1010
|
});
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
@@ -87,7 +87,7 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
87
87
|
throw new SimpleError({
|
|
88
88
|
code: 'cannot_lock_current_period',
|
|
89
89
|
message: 'Current registration period cannot be locked',
|
|
90
|
-
human:
|
|
90
|
+
human: $t(`1401fb57-4172-4211-acdb-0afbc87af86e`),
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -117,7 +117,7 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
117
117
|
throw new SimpleError({
|
|
118
118
|
code: 'cannot_lock_current_period',
|
|
119
119
|
message: 'Current registration period cannot be locked',
|
|
120
|
-
human:
|
|
120
|
+
human: $t(`1401fb57-4172-4211-acdb-0afbc87af86e`),
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -37,7 +37,7 @@ export class GetDocumentTemplateXMLEndpoint extends Endpoint<Params, Query, Body
|
|
|
37
37
|
|
|
38
38
|
const template = await DocumentTemplate.getByID(request.params.id);
|
|
39
39
|
if (!template || !await Context.auth.canAccessDocumentTemplate(template)) {
|
|
40
|
-
throw Context.auth.notFoundOrNoAccess(
|
|
40
|
+
throw Context.auth.notFoundOrNoAccess($t(`a9860203-6a6d-4612-b4d4-7851e47d4dad`));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// Update documents
|
|
@@ -40,7 +40,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
40
40
|
for (const patch of request.body.getPatches()) {
|
|
41
41
|
const document = await Document.getByID(patch.id);
|
|
42
42
|
if (!document || !(await Context.auth.canAccessDocument(document, PermissionLevel.Write))) {
|
|
43
|
-
throw Context.auth.notFoundOrNoAccess(
|
|
43
|
+
throw Context.auth.notFoundOrNoAccess($t(`a9860203-6a6d-4612-b4d4-7851e47d4dad`));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (patch.data) {
|
|
@@ -57,7 +57,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
57
57
|
throw new SimpleError({
|
|
58
58
|
code: 'not_found',
|
|
59
59
|
message: 'Document not found',
|
|
60
|
-
human:
|
|
60
|
+
human: $t(`b6ffe33d-566e-4c9a-85b2-82930d653548`),
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -78,7 +78,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
78
78
|
throw new SimpleError({
|
|
79
79
|
code: 'not_found',
|
|
80
80
|
message: 'Document template not found',
|
|
81
|
-
human:
|
|
81
|
+
human: $t(`f428c3d5-9b0f-485b-971e-b7e5d76533d4`),
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
const document = new Document();
|
|
@@ -97,7 +97,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
97
97
|
throw new SimpleError({
|
|
98
98
|
code: 'not_found',
|
|
99
99
|
message: 'Registration not found',
|
|
100
|
-
human:
|
|
100
|
+
human: $t(`5756fd57-7f2b-4ce4-8be1-ba0dd4313c75`),
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
document.registrationId = put.registrationId;
|
|
@@ -109,7 +109,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
109
109
|
throw new SimpleError({
|
|
110
110
|
code: 'not_found',
|
|
111
111
|
message: 'Member not found',
|
|
112
|
-
human:
|
|
112
|
+
human: $t(`9cfa48c7-980c-4cd5-85ed-2656db040b4c`),
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
document.memberId = put.memberId;
|
|
@@ -62,7 +62,7 @@ export class PatchDocumentTemplateEndpoint extends Endpoint<Params, Query, Body,
|
|
|
62
62
|
for (const patch of request.body.getPatches()) {
|
|
63
63
|
const template = await DocumentTemplate.getByID(patch.id);
|
|
64
64
|
if (!template || !await Context.auth.canAccessDocumentTemplate(template, PermissionLevel.Full)) {
|
|
65
|
-
throw Context.auth.notFoundOrNoAccess(
|
|
65
|
+
throw Context.auth.notFoundOrNoAccess($t(`148bfab7-ca0e-4fac-8a0a-302ca7855fc8`));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
if (patch.privateSettings) {
|
|
@@ -100,7 +100,7 @@ export class PatchDocumentTemplateEndpoint extends Endpoint<Params, Query, Body,
|
|
|
100
100
|
throw new SimpleError({
|
|
101
101
|
code: 'not_found',
|
|
102
102
|
message: 'Template not found',
|
|
103
|
-
human:
|
|
103
|
+
human: $t(`10aa55e6-5ad6-4ac1-8e7f-3a414e26e22e`),
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -39,7 +39,7 @@ export class CheckEmailBouncesEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
39
39
|
throw new SimpleError({
|
|
40
40
|
code: 'too_many_recipients',
|
|
41
41
|
message: 'Too many recipients',
|
|
42
|
-
human:
|
|
42
|
+
human: $t(`0a406ba7-037a-405b-93f8-de308a66f3e3`),
|
|
43
43
|
field: 'recipients',
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -49,7 +49,7 @@ export class PatchEmailTemplatesEndpoint extends Endpoint<Params, Query, Body, R
|
|
|
49
49
|
for (const patch of request.body.getPatches()) {
|
|
50
50
|
const template = await EmailTemplate.getByID(patch.id);
|
|
51
51
|
if (!template || !(await Context.auth.canAccessEmailTemplate(template, PermissionLevel.Write))) {
|
|
52
|
-
throw Context.auth.notFoundOrNoAccess(
|
|
52
|
+
throw Context.auth.notFoundOrNoAccess($t(`ca80fb17-1557-491f-9e9d-554d842a74d7`));
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
template.html = patch.html ?? template.html;
|
|
@@ -104,7 +104,7 @@ export class PatchEmailTemplatesEndpoint extends Endpoint<Params, Query, Body, R
|
|
|
104
104
|
|
|
105
105
|
// Check if valid + write permissions
|
|
106
106
|
if (!(await Context.auth.canAccessEmailTemplate(template, PermissionLevel.Write))) {
|
|
107
|
-
throw Context.auth.error(
|
|
107
|
+
throw Context.auth.error($t(`a2afb95e-1dc5-452d-a919-70720fd4e8a6`));
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
await template.save();
|
|
@@ -115,7 +115,7 @@ export class PatchEmailTemplatesEndpoint extends Endpoint<Params, Query, Body, R
|
|
|
115
115
|
for (const id of request.body.getDeletes()) {
|
|
116
116
|
const template = await EmailTemplate.getByID(id);
|
|
117
117
|
if (!template || !(await Context.auth.canAccessEmailTemplate(template, PermissionLevel.Write))) {
|
|
118
|
-
throw Context.auth.notFoundOrNoAccess(
|
|
118
|
+
throw Context.auth.notFoundOrNoAccess($t(`54599fe6-d0a3-471d-bbe4-b41c367f9aa2`));
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
await template.delete();
|