@stamhoofd/backend 2.121.0 → 2.122.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/output-2.txt +1 -0
- package/output.txt +1 -0
- package/package.json +69 -52
- package/src/audit-logs/EventNotificationLogger.ts +40 -0
- package/src/audit-logs/ModelLogger.ts +19 -15
- package/src/audit-logs/OrganizationLogger.ts +1 -1
- package/src/audit-logs/RegistrationInvitationLogger.ts +24 -24
- package/src/audit-logs/init.ts +8 -2
- package/src/boot.ts +19 -18
- package/src/crons/amazon-ses.ts +13 -26
- package/src/crons/balance-emails.ts +3 -5
- package/src/crons/clearExcelCache.test.ts +1 -1
- package/src/crons/clearExcelCache.ts +1 -2
- package/src/crons/drip-emails.ts +42 -0
- package/src/crons/endFunctionsOfUsersWithoutRegistration.ts +4 -0
- package/src/crons/helpers/isOutside.ts +11 -0
- package/src/crons/helpers/useSavedIterator.ts +32 -0
- package/src/crons/index.ts +5 -0
- package/src/crons/invoices.ts +32 -38
- package/src/crons/members-fees.ts +50 -0
- package/src/crons/mollie-chargebacks.ts +14 -15
- package/src/crons/service-fees.ts +152 -0
- package/src/crons/stripe-invoices.ts +48 -0
- package/src/crons/transfer-fees.ts +176 -0
- package/src/crons/update-cached-balances.ts +4 -4
- package/src/crons.ts +7 -64
- package/src/debug.ts +4 -2
- package/src/email-recipient-loaders/documents.ts +1 -1
- package/src/email-recipient-loaders/members.ts +1 -1
- package/src/email-recipient-loaders/payments.ts +4 -6
- package/src/email-recipient-loaders/registrations.ts +1 -1
- package/src/email-replacements/getEmailReplacementsForPayment.ts +5 -9
- package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +1 -1
- package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +1 -1
- package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +3 -5
- package/src/endpoints/admin/organizations/ChargeOrganizationsEndpoint.ts +1 -1
- package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +1 -1
- package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +13 -7
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +4 -6
- package/src/endpoints/admin/organizations/PatchPackagesEndpoint.test.ts +10 -6
- package/src/endpoints/admin/organizations/PatchPackagesEndpoint.ts +39 -21
- package/src/endpoints/admin/registrations/ChargeRegistrationsEndpoint.ts +1 -1
- package/src/endpoints/auth/CreateAdminEndpoint.ts +23 -5
- package/src/endpoints/auth/CreateTokenEndpoint.ts +2 -2
- package/src/endpoints/auth/DeleteTokenEndpoint.ts +1 -1
- package/src/endpoints/auth/DeleteUserEndpoint.ts +3 -3
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +1 -1
- package/src/endpoints/auth/GetOtherUserEndpoint.ts +1 -1
- package/src/endpoints/auth/GetUserEndpoint.ts +1 -1
- package/src/endpoints/auth/OpenIDConnectAuthTokenEndpoint.ts +1 -1
- package/src/endpoints/auth/OpenIDConnectStartEndpoint.ts +1 -1
- package/src/endpoints/auth/PatchUserEndpoint.ts +5 -8
- package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +1 -1
- package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +1 -1
- package/src/endpoints/auth/SignupEndpoint.ts +2 -3
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +20 -3
- package/src/endpoints/frontend/FrontendEnvironmentEndpoint.ts +2 -1
- package/src/endpoints/global/addresses/SearchRegionsEndpoint.ts +2 -4
- package/src/endpoints/global/addresses/ValidateAddressEndpoint.ts +1 -1
- package/src/endpoints/global/audit-logs/GetAuditLogsEndpoint.ts +5 -7
- package/src/endpoints/global/caddy/CheckDomainCertEndpoint.ts +2 -2
- package/src/endpoints/global/email/CreateEmailEndpoint.ts +3 -4
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.test.ts +1 -1
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.ts +1 -2
- package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +4 -6
- package/src/endpoints/global/email/GetEmailEndpoint.ts +1 -1
- package/src/endpoints/global/email/GetUserEmailsEndpoint.test.ts +1 -1
- package/src/endpoints/global/email/GetUserEmailsEndpoint.ts +1 -1
- package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +6 -10
- package/src/endpoints/global/email/PatchEmailEndpoint.test.ts +4 -7
- package/src/endpoints/global/email/PatchEmailEndpoint.ts +6 -9
- package/src/endpoints/global/email-recipients/GetEmailRecipientsCountEndpoint.ts +1 -1
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.test.ts +1 -1
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.ts +1 -1
- package/src/endpoints/global/email-recipients/RetryEmailRecipientEndpoint.ts +2 -2
- package/src/endpoints/global/events/GetEventNotificationsCountEndpoint.ts +1 -1
- package/src/endpoints/global/events/GetEventNotificationsEndpoint.ts +3 -3
- package/src/endpoints/global/events/GetEventsEndpoint.ts +3 -3
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.test.ts +49 -4
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.ts +5 -8
- package/src/endpoints/global/events/PatchEventsEndpoint.test.ts +12 -44
- package/src/endpoints/global/events/PatchEventsEndpoint.ts +128 -127
- package/src/endpoints/global/files/ExportToExcelEndpoint.ts +9 -9
- package/src/endpoints/global/files/GetFileCache.ts +3 -4
- package/src/endpoints/global/files/UploadFile.ts +3 -4
- package/src/endpoints/global/files/UploadImage.ts +3 -4
- package/src/endpoints/global/groups/GetGroupsCountEndpoint.ts +1 -1
- package/src/endpoints/global/groups/GetGroupsEndpoint.test.ts +1 -1
- package/src/endpoints/global/groups/GetGroupsEndpoint.ts +4 -2
- package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +2 -3
- package/src/endpoints/global/members/GetMembersCountEndpoint.ts +1 -1
- package/src/endpoints/global/members/GetMembersEndpoint.test.ts +2 -2
- package/src/endpoints/global/members/GetMembersEndpoint.ts +10 -12
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +195 -12
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +16 -22
- package/src/endpoints/global/members/helpers/validateGroupFilter.ts +6 -30
- package/src/endpoints/global/members/shouldCheckIfMemberIsDuplicate.ts +1 -1
- package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +1 -1
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +40 -8
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.ts +2 -2
- package/src/endpoints/global/organizations/GetOrganizationFromUriEndpoint.ts +2 -2
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.test.ts +4 -1
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.ts +4 -5
- package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +9 -16
- package/src/endpoints/global/platform/GetPlatformAdminsEndpoint.ts +1 -1
- package/src/endpoints/global/platform/GetPlatformEndpoint.ts +1 -1
- package/src/endpoints/global/platform/PatchPlatformEnpoint.test.ts +1 -1
- package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +11 -11
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsCountEndpoint.ts +31 -31
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsEndpoint.ts +18 -20
- package/src/endpoints/global/registration/GetRegistrationsCountEndpoint.ts +1 -1
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.test.ts +1 -1
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.ts +6 -10
- package/src/endpoints/global/registration/GetUserDetailedPayableBalanceEndpoint.ts +35 -6
- package/src/endpoints/global/registration/GetUserDocumentsEndpoint.ts +2 -2
- package/src/endpoints/global/registration/GetUserMembersEndpoint.ts +1 -1
- package/src/endpoints/global/registration/GetUserPayableBalanceEndpoint.ts +1 -1
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.test.ts +2 -2
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +3 -3
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +90 -6
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +35 -34
- package/src/endpoints/global/registration-invitations/GetRegistrationInvitationsCountEndpoint.ts +1 -1
- package/src/endpoints/global/registration-invitations/GetRegistrationInvitationsEndpoint.test.ts +62 -63
- package/src/endpoints/global/registration-invitations/GetRegistrationInvitationsEndpoint.ts +6 -9
- package/src/endpoints/global/registration-invitations/PatchRegistrationInvitationsEndpoint.test.ts +51 -52
- package/src/endpoints/global/registration-invitations/PatchRegistrationInvitationsEndpoint.ts +6 -7
- package/src/endpoints/global/registration-periods/GetRegistrationPeriodsCountEndpoint.ts +43 -0
- package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +1 -1
- package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +13 -5
- package/src/endpoints/global/sso/GetSSOEndpoint.ts +2 -3
- package/src/endpoints/global/sso/SetSSOEndpoint.ts +1 -1
- package/src/endpoints/global/webshops/GetWebshopFromDomainEndpoint.ts +2 -2
- package/src/endpoints/global/webshops/GetWebshopsEndpoint.test.ts +1 -2
- package/src/endpoints/global/webshops/GetWebshopsEndpoint.ts +2 -4
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsCountEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsEndpoint.ts +3 -4
- package/src/endpoints/organization/dashboard/balance-items/PatchBalanceItemsEndpoint.ts +7 -9
- package/src/endpoints/organization/dashboard/billing/ApplyRegisterCodeEndpoint.test.ts +73 -0
- package/src/endpoints/organization/dashboard/billing/ApplyRegisterCodeEndpoint.ts +89 -0
- package/src/endpoints/organization/dashboard/billing/DeactivatePackageEndpoint.ts +1 -5
- package/src/endpoints/organization/dashboard/billing/DeleteOrganizationMandateEndpoint.ts +11 -11
- package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedPayableBalanceCollectionEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedPayableBalanceEndpoint.ts +8 -8
- package/src/endpoints/organization/dashboard/billing/GetOrganizationMandatesEndpoint.ts +9 -9
- package/src/endpoints/organization/dashboard/billing/GetOrganizationPayableBalanceEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/billing/GetOrganizationPayableInvoicesEndpoint.ts +68 -0
- package/src/endpoints/organization/dashboard/billing/GetPackagesEndpoint.ts +4 -4
- package/src/endpoints/organization/dashboard/billing/GetRegisterCodeEndpoint.ts +66 -0
- package/src/endpoints/organization/dashboard/billing/OrganizationCheckoutEndpoint.test.ts +949 -0
- package/src/endpoints/organization/dashboard/billing/OrganizationCheckoutEndpoint.ts +60 -57
- package/src/endpoints/organization/dashboard/billing/PatchOrganizationMandatesEndpoint.ts +20 -20
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +1 -1
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesCountEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/documents/GetDocumentsCountEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/documents/GetDocumentsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +10 -2
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.test.ts +2 -2
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.test.ts +1 -1
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.ts +10 -8
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.test.ts +1 -1
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +5 -6
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesCountEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesEndpoint.ts +10 -6
- package/src/endpoints/organization/dashboard/invoices/PatchInvoicesEndpoint.ts +11 -2
- package/src/endpoints/organization/dashboard/mollie/CheckMollieEndpoint.ts +4 -5
- package/src/endpoints/organization/dashboard/mollie/ConnectMollieEndpoint.ts +5 -5
- package/src/endpoints/organization/dashboard/mollie/DisconnectMollieEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/mollie/GetMollieDashboardEndpoint.ts +7 -7
- package/src/endpoints/organization/dashboard/nolt/CreateNoltTokenEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/organization/GetOrganizationArchivedGroups.ts +2 -2
- package/src/endpoints/organization/dashboard/organization/GetOrganizationDeletedGroups.ts +1 -1
- package/src/endpoints/organization/dashboard/organization/GetUitpasClientIdEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +2 -2
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +50 -12
- package/src/endpoints/organization/dashboard/organization/SearchUitpasOrganizersEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +5 -10
- package/src/endpoints/organization/dashboard/organization/SetUitpasClientCredentialsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/payments/GetPaymentsCountEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +3 -4
- package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +21 -14
- package/src/endpoints/organization/dashboard/receivable-balances/ChargeReceivableBalancesEndpoint.ts +35 -28
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint.ts +2 -3
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesCountEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.test.ts +1 -1
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.ts +2 -3
- package/src/endpoints/organization/dashboard/registration-periods/MoveRegistrationPeriods.test.ts +1 -1
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.test.ts +1 -1
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +19 -18
- package/src/endpoints/organization/dashboard/registration-periods/SetupStepReviewEndpoint.ts +4 -5
- package/src/endpoints/organization/dashboard/stripe/ConnectStripeEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +2 -3
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +2 -2
- 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 +1 -1
- package/src/endpoints/organization/dashboard/users/GetApiUsersEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/users/GetOrganizationAdminsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/users/PatchApiUserEndpoint.ts +4 -6
- package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +10 -15
- package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/GetDiscountCodesEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersCountEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/GetWebshopTicketsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/GetWebshopUriAvailabilityEndpoint.ts +11 -2
- package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +4 -6
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +22 -7
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +20 -27
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/SearchUitpasEventsEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +2 -3
- package/src/endpoints/organization/dashboard/webshops/WebshopReservedPathSegments.test.ts +95 -0
- package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +2 -2
- package/src/endpoints/organization/shared/GetDocumentHtml.ts +1 -1
- package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +1 -1
- package/src/endpoints/organization/shared/GetUitpasNumberDetailsEndpoint.ts +3 -5
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.ts +1 -1
- package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +4 -1
- package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +14 -3
- package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +14 -2
- package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +37 -16
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.test.ts +34 -2
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +4 -2
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +74 -3
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +16 -33
- package/src/endpoints/organization/webshops/RetrieveUitpasSocialTariffPriceEndpoint.ts +3 -5
- package/src/endpoints/organization/webshops/WebshopAuthHelper.ts +36 -0
- package/src/endpoints/system/HealthEndpoint.ts +1 -1
- package/src/excel-loaders/balance-items.ts +1 -1
- package/src/excel-loaders/event-notifications.ts +1 -1
- package/src/excel-loaders/members.ts +1 -1
- package/src/excel-loaders/organizations.ts +3 -3
- package/src/excel-loaders/payments.ts +31 -1
- package/src/excel-loaders/platform-memberships.ts +13 -14
- package/src/excel-loaders/receivable-balances.ts +2 -2
- package/src/excel-loaders/registrations.ts +2 -3
- package/src/helpers/AddressValidator.ts +7 -14
- package/src/helpers/AdminPermissionChecker.ts +50 -63
- package/src/helpers/AuthenticatedStructures.ts +69 -55
- package/src/helpers/BalanceItemRelationsBackfiller.test.ts +174 -0
- package/src/helpers/BalanceItemRelationsBackfiller.ts +163 -0
- package/src/helpers/BuckarooHelper.ts +2 -4
- package/src/helpers/CheckSettlements.ts +12 -24
- package/src/helpers/Context.ts +15 -10
- package/src/helpers/CookieHelper.ts +1 -2
- package/src/helpers/EmailResumer.ts +1 -2
- package/src/helpers/FileCache.ts +2 -3
- package/src/helpers/FinancialSupportHelper.ts +2 -2
- package/src/helpers/FlagMomentCleanup.ts +1 -2
- package/src/helpers/ForwardHandler.ts +5 -10
- package/src/helpers/GlobalHelper.ts +3 -3
- package/src/helpers/LegacyBillingConverter.ts +787 -0
- package/src/helpers/MemberMerger.test.ts +782 -0
- package/src/helpers/MemberMerger.ts +600 -0
- package/src/helpers/MemberUserSyncer.ts +6 -12
- package/src/helpers/MembershipCharger.ts +2 -4
- package/src/helpers/PaymentCustomerResolver.test.ts +203 -0
- package/src/helpers/PaymentCustomerResolver.ts +144 -0
- package/src/helpers/PeriodHelper.ts +2 -3
- package/src/helpers/RecordAnswerHelper.test.ts +105 -110
- package/src/helpers/RecordAnswerHelper.ts +7 -7
- package/src/helpers/SeedTools.ts +106 -0
- package/src/helpers/ServiceFeeHelper.ts +125 -15
- package/src/helpers/SetupStepUpdater.ts +38 -32
- package/src/helpers/StamhoofdFilterAccessHelper.ts +52 -0
- package/src/helpers/StripeHelper.ts +14 -36
- package/src/helpers/StripeInvoicer.ts +419 -0
- package/src/helpers/StripePayoutChecker.ts +5 -10
- package/src/helpers/TagHelper.ts +7 -8
- package/src/helpers/TemporaryMemberAccess.ts +1 -2
- package/src/helpers/ThrottledQueue.ts +1 -2
- package/src/helpers/UitpasTokenRepository.ts +1 -2
- package/src/helpers/ViesHelper.ts +7 -11
- package/src/helpers/XlsxTransformerColumnHelper.ts +1 -1
- package/src/helpers/outstandingBalanceJoin.ts +2 -2
- package/src/helpers/updateMemberDetailsUitpasNumber.ts +3 -5
- package/src/migrate.ts +12 -5
- package/src/{seeds → migrations}/0000000004-single-organization.ts +10 -1
- package/src/migrations/0000000006-default-organization.ts +139 -0
- package/src/{seeds → migrations}/1715028563-user-permissions.ts +17 -27
- package/src/{seeds/1765896674-document-update-year.test.ts → migrations/1750090029-document-update-year.test.ts} +27 -26
- package/src/migrations/1750090029-document-update-year.ts +103 -0
- package/src/{seeds → migrations}/1750090030-records-configuration.ts +33 -32
- package/src/migrations/1750090031-records-configuration-webshops.ts +36 -0
- package/src/migrations/1752848540-national-numbers.ts +585 -0
- package/src/migrations/1752848550-records-configuration-group-filter.ts +1064 -0
- package/src/{seeds → migrations}/1752848561-groups-registration-periods.ts +70 -26
- package/src/{seeds → migrations}/1754560914-groups-prices.test.ts +1 -1
- package/src/{seeds → migrations}/1754560914-groups-prices.ts +9 -15
- package/src/{seeds → migrations}/1756293699-fill-previous-next-period-id.ts +1 -2
- package/src/migrations/1761665607-sync-member-users.ts +40 -0
- package/src/migrations/1779121240-invoice-email-template.sql +6 -0
- package/src/migrations/1779986893-default-payment-failed-email-templates.sql +4 -0
- package/src/migrations/1780578166-convert-legacy-billing.ts +13 -0
- package/src/{seeds/1755876819-remove-duplicate-members.ts → migrations/1780665426-remove-duplicate-members.ts} +23 -4
- package/src/migrations/1780933598-document-groups.ts +88 -0
- package/src/migrations/1781692342-balance-item-relations.ts +13 -0
- package/src/migrations/1781857866-platform-admins.ts +103 -0
- package/src/migrations/1781857867-rm-old-platform-admins.ts +25 -0
- package/src/seeds/0000000001-throw.ts +5 -0
- package/src/seeds/1760702452-update-balance-price-paid.ts +19 -0
- package/src/seeds/1760702453-update-balance-invoiced.ts +19 -0
- package/src/seeds/1760702454-update-cached-outstanding-balance-from-items.ts +51 -14
- package/src/seeds/1773754928-force-save-members.ts +41 -8
- package/src/seeds/1780665427-schedule-stock-updates.ts +45 -0
- package/src/seeds/1780665428-group-update-occupancy.ts +31 -0
- package/src/seeds/1780915001-fill-payment-customer.ts +70 -0
- package/src/seeds/1780915002-update-orders.ts +39 -0
- package/src/seeds/1782047708-organization-company-address.ts +44 -0
- package/src/seeds-temporary/1769088653-uitpas-status.ts +1 -2
- package/src/seeds-temporary/1780416000-migrate-audit-log-legacy-enums.test.ts +69 -0
- package/src/seeds-temporary/1780416000-migrate-audit-log-legacy-enums.ts +85 -0
- package/src/services/AuditLogService.test.ts +51 -0
- package/src/services/AuditLogService.ts +45 -0
- package/src/services/BalanceItemService.ts +141 -44
- package/src/services/CpuService.ts +3 -6
- package/src/services/DatabaseCollationService.test.ts +1 -2
- package/src/services/DocumentService.ts +1 -2
- package/src/services/EventNotificationService.ts +1 -1
- package/src/services/FileSignService.ts +2 -4
- package/src/services/InvoicePdfService.ts +286 -0
- package/src/services/InvoiceService.ts +204 -251
- package/src/services/InvoiceXMLService.ts +424 -0
- package/src/services/MemberNumberService.ts +6 -11
- package/src/services/MemberRecordStore.ts +8 -10
- package/src/services/MollieService.ts +114 -121
- package/src/services/PaymentMandateService.ts +45 -45
- package/src/services/PaymentReallocationService.test.ts +1 -1
- package/src/services/PaymentReallocationService.ts +7 -9
- package/src/services/PaymentService.ts +444 -308
- package/src/services/PlatformMembershipService.ts +4 -8
- package/src/services/ReferralService.ts +223 -0
- package/src/services/RegistrationService.ts +63 -53
- package/src/services/SSOService.test.ts +119 -0
- package/src/services/SSOService.ts +56 -49
- package/src/services/STPackageService.ts +97 -61
- package/src/services/UniqueMemberNumberService.ts +69 -0
- package/src/services/UniqueUserService.ts +3 -6
- package/src/services/VATService.ts +85 -0
- package/src/services/uitpas/PassholderEndpoints.ts +3 -6
- package/src/services/uitpas/UitpasService.ts +6 -10
- package/src/services/uitpas/checkUitpasNumbers.ts +2 -4
- package/src/services/uitpas/getSocialTariffForUitpasNumbers.ts +3 -6
- package/src/services/uitpas/searchUitpasEvents.ts +1 -2
- package/src/sql-filters/audit-logs.ts +1 -1
- package/src/sql-filters/balance-item-payments.ts +1 -1
- package/src/sql-filters/balance-items.ts +1 -1
- package/src/sql-filters/base-registration-filter-compilers.ts +5 -33
- package/src/sql-filters/document-templates.ts +1 -1
- package/src/sql-filters/documents.ts +1 -1
- package/src/sql-filters/email-recipients.ts +1 -1
- package/src/sql-filters/emails.ts +1 -1
- package/src/sql-filters/event-notifications.ts +1 -1
- package/src/sql-filters/events.ts +6 -1
- package/src/sql-filters/groups.ts +5 -0
- package/src/sql-filters/invoiced-balance-items.ts +1 -1
- package/src/sql-filters/invoices.ts +1 -1
- package/src/sql-filters/member-responsibility-records.ts +1 -1
- package/src/sql-filters/members.ts +1 -1
- package/src/sql-filters/orders.ts +4 -4
- package/src/sql-filters/organization-registration-periods.ts +1 -1
- package/src/sql-filters/organizations.ts +1 -1
- package/src/sql-filters/platform-memberships.ts +3 -3
- package/src/sql-filters/receivable-balances.ts +1 -1
- package/src/sql-filters/registration-periods.ts +1 -1
- package/src/sql-filters/registrations.ts +1 -1
- package/src/sql-filters/tickets.ts +1 -1
- package/src/sql-filters/users.ts +1 -1
- package/src/sql-sorters/groups.ts +23 -0
- package/src/sql-sorters/platform-memberships.ts +16 -16
- package/src/sql-sorters/registration-invitations.ts +2 -2
- package/tests/actions/patchOrganizationMember.ts +1 -1
- package/tests/actions/patchUserMember.ts +1 -1
- package/tests/assertions/assertBalances.ts +6 -12
- package/tests/e2e/api-rate-limits.test.ts +12 -24
- package/tests/e2e/bundle-discounts.test.ts +4 -1
- package/tests/e2e/charge-members.test.ts +13 -11
- package/tests/e2e/documents.test.ts +4 -1
- package/tests/e2e/register.test.ts +7 -9
- package/tests/e2e/stock.test.ts +4 -3
- package/tests/e2e/tickets.test.ts +1 -1
- package/tests/helpers/MollieMocker.ts +462 -0
- package/tests/helpers/PayconiqMocker.ts +138 -45
- package/tests/helpers/StripeMocker.ts +9 -6
- package/tests/helpers/index.ts +4 -0
- package/tests/init/initAdmin.ts +2 -2
- package/tests/init/initBundleDiscount.ts +1 -1
- package/tests/init/initMembershipOrganization.ts +13 -0
- package/tests/init/initPermissionRole.ts +3 -4
- package/tests/vitest.global.setup.ts +1 -1
- package/vitest.config.js +6 -0
- package/.nvmrc +0 -1
- package/src/helpers/GroupBuilder.ts +0 -418
- package/src/seeds/0000000000-example.ts +0 -11
- package/src/seeds/1722256498-group-update-occupancy.ts +0 -52
- package/src/seeds/1726572303-schedule-stock-updates.ts +0 -52
- package/src/seeds/1726847064-setup-steps.ts +0 -16
- package/src/seeds/1728928974-update-cached-outstanding-balance-from-items.ts +0 -31
- package/src/seeds/1729253172-update-orders.ts +0 -21
- package/src/seeds/1733319079-fill-paying-organization-ids.ts +0 -68
- package/src/seeds/1733748412-update-deleted-order-numbers.ts +0 -109
- package/src/seeds/1733994455-balance-item-status-open.ts +0 -30
- package/src/seeds/1740046783-update-membership.ts +0 -17
- package/src/seeds/1741008870-fix-auditlog-description.ts +0 -50
- package/src/seeds/1741011468-fix-auditlog-description-uft16.ts +0 -88
- package/src/seeds/1741268179-fix-group-dates-of-events.ts +0 -32
- package/src/seeds/1751445358-upload-email-attachments.ts +0 -106
- package/src/seeds/1755532883-update-email-sender-ids.ts +0 -47
- package/src/seeds/1755790070-fill-email-recipient-errors.ts +0 -96
- package/src/seeds/1756115432-remove-old-drafts.ts +0 -16
- package/src/seeds/1756115433-fill-email-recipient-organization-id.ts +0 -30
- package/src/seeds/1756303697-update-email-counts.ts +0 -76
- package/src/seeds/1761665607-sync-member-users.ts +0 -59
- package/src/seeds/1765896674-document-update-year.ts +0 -66
- /package/src/{seeds → migrations}/0000000001-development-user.ts +0 -0
- /package/src/{seeds → migrations}/0000000002-clear-stamhoofd-email-templates.ts +0 -0
- /package/src/{seeds → migrations}/0000000003-default-email-templates.ts +0 -0
- /package/src/{seeds → migrations}/1752848561-groups-registration-periods.test.ts +0 -0
- /package/src/{seeds → migrations}/1766150402-document-published-at.test.ts +0 -0
- /package/src/{seeds → migrations}/1766150402-document-published-at.ts +0 -0
- /package/src/{seeds → migrations}/1779121239-default-invoice-email-template.sql +0 -0
- /package/src/{seeds → migrations}/data/default-email-templates.sql +0 -0
package/src/endpoints/global/registration-invitations/PatchRegistrationInvitationsEndpoint.test.ts
CHANGED
|
@@ -35,20 +35,20 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
35
35
|
}),
|
|
36
36
|
]]),
|
|
37
37
|
);
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
const user = await new UserFactory({
|
|
40
40
|
organization,
|
|
41
41
|
permissions: Permissions.create({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
level: PermissionLevel.None,
|
|
43
|
+
resources,
|
|
44
|
+
}),
|
|
45
45
|
}).create();
|
|
46
46
|
|
|
47
47
|
const member = await new MemberFactory({
|
|
48
48
|
organization, user,
|
|
49
49
|
firstName: 'John',
|
|
50
50
|
lastName: 'Doe',
|
|
51
|
-
birthDay: {year: 1994, month: 6, day: 24}
|
|
51
|
+
birthDay: { year: 1994, month: 6, day: 24 },
|
|
52
52
|
}).create();
|
|
53
53
|
|
|
54
54
|
const patch: PatchableArrayAutoEncoder<RegistrationInvitationRequest> = new PatchableArray();
|
|
@@ -56,7 +56,7 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
56
56
|
patch.addPut(RegistrationInvitationRequest.create({
|
|
57
57
|
groupId: group.id,
|
|
58
58
|
memberId: member.id,
|
|
59
|
-
}))
|
|
59
|
+
}));
|
|
60
60
|
|
|
61
61
|
const response = await patchInvitations({
|
|
62
62
|
patch,
|
|
@@ -89,20 +89,20 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
89
89
|
}),
|
|
90
90
|
]]),
|
|
91
91
|
);
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
const user = await new UserFactory({
|
|
94
94
|
organization,
|
|
95
95
|
permissions: Permissions.create({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
level: PermissionLevel.None,
|
|
97
|
+
resources,
|
|
98
|
+
}),
|
|
99
99
|
}).create();
|
|
100
100
|
|
|
101
101
|
const member = await new MemberFactory({
|
|
102
102
|
organization, user,
|
|
103
103
|
firstName: 'John',
|
|
104
104
|
lastName: 'Doe',
|
|
105
|
-
birthDay: {year: 1994, month: 6, day: 24}
|
|
105
|
+
birthDay: { year: 1994, month: 6, day: 24 },
|
|
106
106
|
}).create();
|
|
107
107
|
|
|
108
108
|
const patch: PatchableArrayAutoEncoder<RegistrationInvitationRequest> = new PatchableArray();
|
|
@@ -117,8 +117,8 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
117
117
|
patch,
|
|
118
118
|
organization,
|
|
119
119
|
user,
|
|
120
|
-
})).rejects.toThrow('Je hebt geen
|
|
121
|
-
})
|
|
120
|
+
})).rejects.toThrow('Je hebt geen toegangsrechten om iemand uit te nodigen voor deze groep.');
|
|
121
|
+
});
|
|
122
122
|
|
|
123
123
|
test('Should fail if no read access to member', async () => {
|
|
124
124
|
const organization = await new OrganizationFactory({}).create();
|
|
@@ -134,7 +134,7 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
134
134
|
}),
|
|
135
135
|
]]),
|
|
136
136
|
);
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
const user = await new UserFactory({
|
|
139
139
|
organization,
|
|
140
140
|
permissions: Permissions.create({
|
|
@@ -147,7 +147,7 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
147
147
|
organization,
|
|
148
148
|
firstName: 'John',
|
|
149
149
|
lastName: 'Doe',
|
|
150
|
-
birthDay: {year: 1994, month: 6, day: 24}
|
|
150
|
+
birthDay: { year: 1994, month: 6, day: 24 },
|
|
151
151
|
}).create();
|
|
152
152
|
|
|
153
153
|
const patch: PatchableArrayAutoEncoder<RegistrationInvitationRequest> = new PatchableArray();
|
|
@@ -155,15 +155,15 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
155
155
|
patch.addPut(RegistrationInvitationRequest.create({
|
|
156
156
|
groupId: group.id,
|
|
157
157
|
memberId: member.id,
|
|
158
|
-
}))
|
|
158
|
+
}));
|
|
159
159
|
|
|
160
160
|
// assert
|
|
161
161
|
await expect(patchInvitations({
|
|
162
162
|
patch,
|
|
163
163
|
organization,
|
|
164
164
|
user,
|
|
165
|
-
})).rejects.toThrow('Je hebt geen
|
|
166
|
-
})
|
|
165
|
+
})).rejects.toThrow('Je hebt geen toegangsrechten om dit lid uit te nodigen.');
|
|
166
|
+
});
|
|
167
167
|
|
|
168
168
|
test('Should fail if already registered', async () => {
|
|
169
169
|
const organization = await new OrganizationFactory({}).create();
|
|
@@ -179,23 +179,23 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
179
179
|
}),
|
|
180
180
|
]]),
|
|
181
181
|
);
|
|
182
|
-
|
|
182
|
+
|
|
183
183
|
const user = await new UserFactory({
|
|
184
184
|
organization,
|
|
185
185
|
permissions: Permissions.create({
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
level: PermissionLevel.None,
|
|
187
|
+
resources,
|
|
188
|
+
}),
|
|
189
189
|
}).create();
|
|
190
190
|
|
|
191
191
|
const member = await new MemberFactory({
|
|
192
192
|
organization, user,
|
|
193
193
|
firstName: 'John',
|
|
194
194
|
lastName: 'Doe',
|
|
195
|
-
birthDay: {year: 1994, month: 6, day: 24}
|
|
195
|
+
birthDay: { year: 1994, month: 6, day: 24 },
|
|
196
196
|
}).create();
|
|
197
197
|
|
|
198
|
-
await new RegistrationFactory({member, group}).create();
|
|
198
|
+
await new RegistrationFactory({ member, group }).create();
|
|
199
199
|
|
|
200
200
|
const patch: PatchableArrayAutoEncoder<RegistrationInvitationRequest> = new PatchableArray();
|
|
201
201
|
|
|
@@ -210,9 +210,8 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
210
210
|
organization,
|
|
211
211
|
user,
|
|
212
212
|
})).rejects.toThrow('The member is already registered for this group');
|
|
213
|
-
})
|
|
214
|
-
|
|
215
|
-
})
|
|
213
|
+
});
|
|
214
|
+
});
|
|
216
215
|
|
|
217
216
|
describe('Patch invitation', () => {
|
|
218
217
|
test('Should not be supported', async () => {
|
|
@@ -229,20 +228,20 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
229
228
|
}),
|
|
230
229
|
]]),
|
|
231
230
|
);
|
|
232
|
-
|
|
231
|
+
|
|
233
232
|
const user = await new UserFactory({
|
|
234
233
|
organization,
|
|
235
234
|
permissions: Permissions.create({
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
235
|
+
level: PermissionLevel.None,
|
|
236
|
+
resources,
|
|
237
|
+
}),
|
|
239
238
|
}).create();
|
|
240
239
|
|
|
241
240
|
const member = await new MemberFactory({
|
|
242
241
|
organization, user,
|
|
243
242
|
firstName: 'John',
|
|
244
243
|
lastName: 'Doe',
|
|
245
|
-
birthDay: {year: 1994, month: 6, day: 24}
|
|
244
|
+
birthDay: { year: 1994, month: 6, day: 24 },
|
|
246
245
|
}).create();
|
|
247
246
|
|
|
248
247
|
const patch: PatchableArrayAutoEncoder<RegistrationInvitationRequest> = new PatchableArray();
|
|
@@ -259,8 +258,8 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
259
258
|
organization,
|
|
260
259
|
user,
|
|
261
260
|
})).rejects.toThrow('Patching invitations is not supported. Only puts and deletes are supported.');
|
|
262
|
-
})
|
|
263
|
-
})
|
|
261
|
+
});
|
|
262
|
+
});
|
|
264
263
|
|
|
265
264
|
describe('Delete invitation', () => {
|
|
266
265
|
test('Happy path', async () => {
|
|
@@ -277,13 +276,13 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
277
276
|
}),
|
|
278
277
|
]]),
|
|
279
278
|
);
|
|
280
|
-
|
|
279
|
+
|
|
281
280
|
const user = await new UserFactory({
|
|
282
281
|
organization,
|
|
283
282
|
permissions: Permissions.create({
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
level: PermissionLevel.None,
|
|
284
|
+
resources,
|
|
285
|
+
}),
|
|
287
286
|
}).create();
|
|
288
287
|
|
|
289
288
|
const member = await new MemberFactory({
|
|
@@ -291,10 +290,10 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
291
290
|
user,
|
|
292
291
|
firstName: 'John',
|
|
293
292
|
lastName: 'Doe',
|
|
294
|
-
birthDay: {year: 1994, month: 6, day: 24}
|
|
293
|
+
birthDay: { year: 1994, month: 6, day: 24 },
|
|
295
294
|
}).create();
|
|
296
295
|
|
|
297
|
-
const invitation = await new RegistrationInvitationFactory({member, group, organization}).create();
|
|
296
|
+
const invitation = await new RegistrationInvitationFactory({ member, group, organization }).create();
|
|
298
297
|
|
|
299
298
|
const patch: PatchableArrayAutoEncoder<RegistrationInvitationRequest> = new PatchableArray();
|
|
300
299
|
|
|
@@ -325,13 +324,13 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
325
324
|
}),
|
|
326
325
|
]]),
|
|
327
326
|
);
|
|
328
|
-
|
|
327
|
+
|
|
329
328
|
const user = await new UserFactory({
|
|
330
329
|
organization,
|
|
331
330
|
permissions: Permissions.create({
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
331
|
+
level: PermissionLevel.None,
|
|
332
|
+
resources,
|
|
333
|
+
}),
|
|
335
334
|
}).create();
|
|
336
335
|
|
|
337
336
|
// user has no access to this member
|
|
@@ -339,10 +338,10 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
339
338
|
organization,
|
|
340
339
|
firstName: 'John',
|
|
341
340
|
lastName: 'Doe',
|
|
342
|
-
birthDay: {year: 1994, month: 6, day: 24}
|
|
341
|
+
birthDay: { year: 1994, month: 6, day: 24 },
|
|
343
342
|
}).create();
|
|
344
343
|
|
|
345
|
-
const invitation = await new RegistrationInvitationFactory({member, group, organization}).create();
|
|
344
|
+
const invitation = await new RegistrationInvitationFactory({ member, group, organization }).create();
|
|
346
345
|
|
|
347
346
|
const patch: PatchableArrayAutoEncoder<RegistrationInvitationRequest> = new PatchableArray();
|
|
348
347
|
|
|
@@ -357,7 +356,7 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
357
356
|
// assert
|
|
358
357
|
expect(response.body).toBeDefined();
|
|
359
358
|
expect(response.body).toHaveLength(0);
|
|
360
|
-
})
|
|
359
|
+
});
|
|
361
360
|
|
|
362
361
|
test('Should fail if no write access to group', async () => {
|
|
363
362
|
const organization = await new OrganizationFactory({}).create();
|
|
@@ -373,7 +372,7 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
373
372
|
}),
|
|
374
373
|
]]),
|
|
375
374
|
);
|
|
376
|
-
|
|
375
|
+
|
|
377
376
|
const user = await new UserFactory({
|
|
378
377
|
organization,
|
|
379
378
|
permissions: Permissions.create({
|
|
@@ -386,10 +385,10 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
386
385
|
organization, user,
|
|
387
386
|
firstName: 'John',
|
|
388
387
|
lastName: 'Doe',
|
|
389
|
-
birthDay: {year: 1994, month: 6, day: 24}
|
|
388
|
+
birthDay: { year: 1994, month: 6, day: 24 },
|
|
390
389
|
}).create();
|
|
391
390
|
|
|
392
|
-
const invitation = await new RegistrationInvitationFactory({member, group, organization}).create();
|
|
391
|
+
const invitation = await new RegistrationInvitationFactory({ member, group, organization }).create();
|
|
393
392
|
|
|
394
393
|
const patch: PatchableArrayAutoEncoder<RegistrationInvitationRequest> = new PatchableArray();
|
|
395
394
|
|
|
@@ -399,7 +398,7 @@ describe('Endpoint.PatchRegistrationInvitationsEndpoint', () => {
|
|
|
399
398
|
patch,
|
|
400
399
|
organization,
|
|
401
400
|
user,
|
|
402
|
-
})).rejects.toThrow('Je hebt geen
|
|
403
|
-
})
|
|
401
|
+
})).rejects.toThrow('Je hebt geen toegangsrechten om deze uitnodiging te verwijderen.');
|
|
402
|
+
});
|
|
404
403
|
});
|
|
405
404
|
});
|
package/src/endpoints/global/registration-invitations/PatchRegistrationInvitationsEndpoint.ts
CHANGED
|
@@ -16,7 +16,6 @@ type Body = PatchableArrayAutoEncoder<RegistrationInvitationRequest>;
|
|
|
16
16
|
type ResponseBody = RegistrationInvitationStruct[];
|
|
17
17
|
|
|
18
18
|
export class PatchRegistrationInvitationsEndpoint extends Endpoint<Params, Query, Body, ResponseBody> {
|
|
19
|
-
|
|
20
19
|
bodyDecoder = new PatchableArrayDecoder(
|
|
21
20
|
RegistrationInvitationRequest as Decoder<RegistrationInvitationRequest>,
|
|
22
21
|
RegistrationInvitationRequest.patchType() as Decoder<AutoEncoderPatchType<RegistrationInvitationRequest>>,
|
|
@@ -67,7 +66,7 @@ export class PatchRegistrationInvitationsEndpoint extends Endpoint<Params, Query
|
|
|
67
66
|
.where('groupId', invitation.groupId)
|
|
68
67
|
.andWhere('memberId', invitation.memberId)
|
|
69
68
|
.first(false);
|
|
70
|
-
|
|
69
|
+
|
|
71
70
|
if (duplicate) {
|
|
72
71
|
invitations.push(duplicate);
|
|
73
72
|
}
|
|
@@ -100,7 +99,7 @@ export class PatchRegistrationInvitationsEndpoint extends Endpoint<Params, Query
|
|
|
100
99
|
|
|
101
100
|
// Anyone with write access to the group can delete invitations for the group
|
|
102
101
|
const group = await Group.getByID(invitation.groupId);
|
|
103
|
-
|
|
102
|
+
|
|
104
103
|
if (!group || !await Context.auth.canAccessGroup(group, PermissionLevel.Write)) {
|
|
105
104
|
throw Context.auth.error($t(`%1UN`));
|
|
106
105
|
}
|
|
@@ -145,14 +144,14 @@ export class PatchRegistrationInvitationsEndpoint extends Endpoint<Params, Query
|
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
const member = await Member.getByIdWithUsersAndRegistrations(invitation.memberId);
|
|
148
|
-
|
|
147
|
+
|
|
149
148
|
if (!member
|
|
150
149
|
// in userMode 'organization' we can only invite members from the same organization
|
|
151
150
|
|| (STAMHOOFD.userMode === 'organization' && member.organizationId !== organizationId)
|
|
152
151
|
// read access is suficient
|
|
153
152
|
|| !await Context.auth.canAccessMember(member, PermissionLevel.Read)
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
) {
|
|
154
|
+
throw Context.auth.error($t(`%1Qv`));
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
// cannot invite if already registered
|
|
@@ -162,7 +161,7 @@ export class PatchRegistrationInvitationsEndpoint extends Endpoint<Params, Query
|
|
|
162
161
|
statusCode: 400,
|
|
163
162
|
message: 'The member is already registered for this group',
|
|
164
163
|
human: $t('%1S2'),
|
|
165
|
-
})
|
|
164
|
+
});
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
167
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
3
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
4
|
+
import { CountFilteredRequest, CountResponse } from '@stamhoofd/structures';
|
|
5
|
+
|
|
6
|
+
import { Context } from '../../../helpers/Context.js';
|
|
7
|
+
import { GetRegistrationPeriodsEndpoint } from './GetRegistrationPeriodsEndpoint.js';
|
|
8
|
+
|
|
9
|
+
type Params = Record<string, never>;
|
|
10
|
+
type Query = CountFilteredRequest;
|
|
11
|
+
type Body = undefined;
|
|
12
|
+
type ResponseBody = CountResponse;
|
|
13
|
+
|
|
14
|
+
export class GetRegistrationPeriodsCountEndpoint extends Endpoint<Params, Query, Body, ResponseBody> {
|
|
15
|
+
queryDecoder = CountFilteredRequest as Decoder<CountFilteredRequest>;
|
|
16
|
+
|
|
17
|
+
protected doesMatch(request: Request): [true, Params] | [false] {
|
|
18
|
+
if (request.method !== 'GET') {
|
|
19
|
+
return [false];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const params = Endpoint.parseParameters(request.url, '/registration-periods/count', {});
|
|
23
|
+
|
|
24
|
+
if (params) {
|
|
25
|
+
return [true, params as Params];
|
|
26
|
+
}
|
|
27
|
+
return [false];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async handle(request: DecodedRequest<Params, Query, Body>) {
|
|
31
|
+
await Context.setUserOrganizationScope();
|
|
32
|
+
const query = await GetRegistrationPeriodsEndpoint.buildQuery(request.query);
|
|
33
|
+
|
|
34
|
+
const count = await query
|
|
35
|
+
.count();
|
|
36
|
+
|
|
37
|
+
return new Response(
|
|
38
|
+
CountResponse.create({
|
|
39
|
+
count,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
1
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
2
2
|
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import type { CountFilteredRequest, RegistrationPeriod as RegistrationPeriodStruct, StamhoofdFilter } from '@stamhoofd/structures';
|
|
4
4
|
import { assertSort, getSortFilter, LimitedFilteredRequest, PaginatedResponse } from '@stamhoofd/structures';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ConvertArrayToPatchableArray, Decoder, PatchableArrayAutoEncoder} from '@simonbackx/simple-encoding';
|
|
1
|
+
import type { ConvertArrayToPatchableArray, Decoder, PatchableArrayAutoEncoder } from '@simonbackx/simple-encoding';
|
|
2
2
|
import { PatchableArrayDecoder, StringDecoder, patchObject } from '@simonbackx/simple-encoding';
|
|
3
|
-
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
3
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
4
4
|
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
5
5
|
import { RegistrationPeriod as RegistrationPeriodStruct } from '@stamhoofd/structures';
|
|
6
6
|
|
|
7
7
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
8
|
-
import { Organization, Platform, RegistrationPeriod } from '@stamhoofd/models';
|
|
8
|
+
import { Group, Organization, Platform, RegistrationPeriod } from '@stamhoofd/models';
|
|
9
9
|
import { Context } from '../../../helpers/Context.js';
|
|
10
10
|
import { PeriodHelper } from '../../../helpers/PeriodHelper.js';
|
|
11
11
|
|
|
@@ -69,8 +69,7 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
69
69
|
if (!await Context.auth.hasFullAccess(organization.id)) {
|
|
70
70
|
throw Context.auth.error();
|
|
71
71
|
}
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
72
|
+
} else {
|
|
74
73
|
if (!Context.auth.hasPlatformFullAccess()) {
|
|
75
74
|
throw Context.auth.error();
|
|
76
75
|
}
|
|
@@ -172,6 +171,8 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
172
171
|
|
|
173
172
|
// Schedule patch of all groups in this period
|
|
174
173
|
PeriodHelper.updateGroupsInPeriod(model).catch(console.error);
|
|
174
|
+
|
|
175
|
+
periods.push(model)
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
for (const id of request.body.getDeletes()) {
|
|
@@ -185,6 +186,13 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
185
186
|
});
|
|
186
187
|
}
|
|
187
188
|
|
|
189
|
+
// Delete all groups in this period
|
|
190
|
+
const q = Group.delete().where('periodId', model.id);
|
|
191
|
+
if (organization) {
|
|
192
|
+
q.where('organizationId', organization.id);
|
|
193
|
+
}
|
|
194
|
+
await q;
|
|
195
|
+
|
|
188
196
|
// Now delete the model
|
|
189
197
|
await model.delete();
|
|
190
198
|
await RegistrationPeriod.updatePreviousNextPeriods(model.organizationId);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
1
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
2
2
|
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import { LoginProviderType, OpenIDClientConfiguration } from '@stamhoofd/structures';
|
|
4
4
|
|
|
5
5
|
import { Context } from '../../../helpers/Context.js';
|
|
6
|
-
import {
|
|
7
|
-
import type { Decoder} from '@simonbackx/simple-encoding';
|
|
6
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
8
7
|
import { AutoEncoder, EnumDecoder, field } from '@simonbackx/simple-encoding';
|
|
9
8
|
import { SSOService } from '../../../services/SSOService.js';
|
|
10
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AutoEncoderPatchType, Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
-
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
4
4
|
import { OpenIDClientConfiguration } from '@stamhoofd/structures';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Decoder} from '@simonbackx/simple-encoding';
|
|
1
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
2
2
|
import { AutoEncoder, field, StringDecoder } from '@simonbackx/simple-encoding';
|
|
3
|
-
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
3
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
4
4
|
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
5
5
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
6
|
import { Organization } from '@stamhoofd/models';
|
|
@@ -383,8 +383,7 @@ describe('Endpoint.GetWebshopsEndpoint', () => {
|
|
|
383
383
|
expect(response.status).toBe(200);
|
|
384
384
|
expect(response.body.results).toHaveLength(1);
|
|
385
385
|
expect(response.body.results[0].id).toBe(closedWebshop.id);
|
|
386
|
-
}
|
|
387
|
-
finally {
|
|
386
|
+
} finally {
|
|
388
387
|
await Database.statement('SET collation_connection = DEFAULT');
|
|
389
388
|
}
|
|
390
389
|
});
|
|
@@ -59,8 +59,7 @@ export class GetWebshopsEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
59
59
|
},
|
|
60
60
|
};
|
|
61
61
|
query.where(await compileToSQLFilter(scopeFilter, filterCompilers));
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
62
|
+
} else {
|
|
64
63
|
// Platform context: check platform access
|
|
65
64
|
const tags = Context.auth.getPlatformAccessibleOrganizationTags(PermissionLevel.Read);
|
|
66
65
|
|
|
@@ -124,8 +123,7 @@ export class GetWebshopsEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
124
123
|
|
|
125
124
|
try {
|
|
126
125
|
data = await query.fetch();
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
126
|
+
} catch (error) {
|
|
129
127
|
if (error.message.includes('ER_QUERY_TIMEOUT')) {
|
|
130
128
|
throw new SimpleError({
|
|
131
129
|
code: 'timeout',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
1
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
2
2
|
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
4
4
|
import { BalanceItem } from '@stamhoofd/models';
|
|
@@ -20,7 +20,7 @@ export class GetBalanceItemEndpoint extends Endpoint<Params, Query, Body, Respon
|
|
|
20
20
|
|
|
21
21
|
const params = Endpoint.parseParameters(request.url, '/balance-items/@id', { id: String });
|
|
22
22
|
|
|
23
|
-
if (params) {
|
|
23
|
+
if (params && params.id !== 'count') {
|
|
24
24
|
return [true, params as Params];
|
|
25
25
|
}
|
|
26
26
|
return [false];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
-
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
4
4
|
import { CountFilteredRequest, CountResponse } from '@stamhoofd/structures';
|
|
5
5
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
-
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
4
4
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
5
5
|
import { BalanceItem } from '@stamhoofd/models';
|
|
6
6
|
import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
|
|
7
|
-
import type { BalanceItem as BalanceItemStruct, CountFilteredRequest, StamhoofdFilter} from '@stamhoofd/structures';
|
|
7
|
+
import type { BalanceItem as BalanceItemStruct, CountFilteredRequest, StamhoofdFilter } from '@stamhoofd/structures';
|
|
8
8
|
import { LimitedFilteredRequest, PaginatedResponse, assertSort, getSortFilter } from '@stamhoofd/structures';
|
|
9
9
|
|
|
10
10
|
import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
|
|
@@ -95,8 +95,7 @@ export class GetBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
95
95
|
|
|
96
96
|
try {
|
|
97
97
|
balanceItems = await query.fetch();
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
98
|
+
} catch (error) {
|
|
100
99
|
if (error.message.includes('ER_QUERY_TIMEOUT')) {
|
|
101
100
|
throw new SimpleError({
|
|
102
101
|
code: 'timeout',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder} from '@simonbackx/simple-encoding';
|
|
1
|
+
import type { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder } from '@simonbackx/simple-encoding';
|
|
2
2
|
import { PatchableArrayDecoder, StringDecoder } from '@simonbackx/simple-encoding';
|
|
3
|
-
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
3
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
4
4
|
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
5
5
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
6
|
import { BalanceItem, Member, Order, User } from '@stamhoofd/models';
|
|
@@ -165,8 +165,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
model.memberId = null;
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
168
|
+
} else {
|
|
170
169
|
model.memberId = (await this.validateMemberId(patch.memberId)).id;
|
|
171
170
|
}
|
|
172
171
|
}
|
|
@@ -191,7 +190,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
191
190
|
|
|
192
191
|
const VATPercentageBefore = model.VATPercentage;
|
|
193
192
|
const includedBefore = model.VATIncluded;
|
|
194
|
-
const excemptBefore = model.VATExcempt
|
|
193
|
+
const excemptBefore = model.VATExcempt;
|
|
195
194
|
|
|
196
195
|
model.VATIncluded = patch.VATIncluded === undefined ? model.VATIncluded : patch.VATIncluded;
|
|
197
196
|
model.VATPercentage = patch.VATPercentage === undefined ? model.VATPercentage : patch.VATPercentage;
|
|
@@ -202,8 +201,8 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
202
201
|
throw new SimpleError({
|
|
203
202
|
code: 'invoiced',
|
|
204
203
|
message: 'You cannot change VAT settings of balance items when the balance item has been invoiced',
|
|
205
|
-
human: $t('%1Rt')
|
|
206
|
-
})
|
|
204
|
+
human: $t('%1Rt'),
|
|
205
|
+
});
|
|
207
206
|
}
|
|
208
207
|
}
|
|
209
208
|
|
|
@@ -229,8 +228,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
229
228
|
if (model.pricePaid === 0) {
|
|
230
229
|
model.status = BalanceItemStatus.Hidden;
|
|
231
230
|
}
|
|
232
|
-
}
|
|
233
|
-
else if (patch.status) {
|
|
231
|
+
} else if (patch.status) {
|
|
234
232
|
model.status = patch.status;
|
|
235
233
|
}
|
|
236
234
|
|