@stamhoofd/models 2.104.0 → 2.106.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.
Files changed (72) hide show
  1. package/dist/src/factories/STPackageFactory.d.ts +15 -0
  2. package/dist/src/factories/STPackageFactory.d.ts.map +1 -0
  3. package/dist/src/factories/STPackageFactory.js +38 -0
  4. package/dist/src/factories/STPackageFactory.js.map +1 -0
  5. package/dist/src/factories/index.d.ts +1 -0
  6. package/dist/src/factories/index.d.ts.map +1 -1
  7. package/dist/src/factories/index.js +1 -0
  8. package/dist/src/factories/index.js.map +1 -1
  9. package/dist/src/migrations/1719568079-default-period.sql +1 -1
  10. package/dist/src/migrations/1753363434-service-fees.sql +4 -0
  11. package/dist/src/migrations/1761750780-renamed-invoice-organization-id.sql +2 -0
  12. package/dist/src/migrations/1761750781-rename-index.sql +3 -0
  13. package/dist/src/migrations/1761750782-invoices-add-organization-id.sql +2 -0
  14. package/dist/src/migrations/1761750783-invoices-organization-id-fk.sql +1 -0
  15. package/dist/src/models/BalanceItem.d.ts.map +1 -1
  16. package/dist/src/models/BalanceItem.js.map +1 -1
  17. package/dist/src/models/Organization.d.ts.map +1 -1
  18. package/dist/src/models/Organization.js +1 -1
  19. package/dist/src/models/Organization.js.map +1 -1
  20. package/dist/src/models/PasswordToken.d.ts.map +1 -1
  21. package/dist/src/models/PasswordToken.js +8 -0
  22. package/dist/src/models/PasswordToken.js.map +1 -1
  23. package/dist/src/models/Payment.d.ts +18 -0
  24. package/dist/src/models/Payment.d.ts.map +1 -1
  25. package/dist/src/models/Payment.js +28 -1
  26. package/dist/src/models/Payment.js.map +1 -1
  27. package/dist/src/models/Registration.d.ts.map +1 -1
  28. package/dist/src/models/Registration.js +2 -1
  29. package/dist/src/models/Registration.js.map +1 -1
  30. package/dist/src/models/RegistrationPeriod.d.ts.map +1 -1
  31. package/dist/src/models/RegistrationPeriod.js +1 -1
  32. package/dist/src/models/RegistrationPeriod.js.map +1 -1
  33. package/dist/src/models/STInvoice.d.ts +8 -6
  34. package/dist/src/models/STInvoice.d.ts.map +1 -1
  35. package/dist/src/models/STInvoice.js +56 -6
  36. package/dist/src/models/STInvoice.js.map +1 -1
  37. package/dist/src/models/STPackage.d.ts +1 -1
  38. package/dist/src/models/STPackage.d.ts.map +1 -1
  39. package/dist/src/models/STPackage.js +41 -7
  40. package/dist/src/models/STPackage.js.map +1 -1
  41. package/dist/src/models/Token.d.ts.map +1 -1
  42. package/dist/src/models/Token.js +8 -0
  43. package/dist/src/models/Token.js.map +1 -1
  44. package/dist/src/models/User.d.ts +1 -0
  45. package/dist/src/models/User.d.ts.map +1 -1
  46. package/dist/src/models/User.js +8 -0
  47. package/dist/src/models/User.js.map +1 -1
  48. package/dist/src/structures/OrganizationServerMetaData.d.ts +1 -0
  49. package/dist/src/structures/OrganizationServerMetaData.d.ts.map +1 -1
  50. package/dist/src/structures/OrganizationServerMetaData.js +4 -0
  51. package/dist/src/structures/OrganizationServerMetaData.js.map +1 -1
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/package.json +2 -2
  54. package/src/factories/STPackageFactory.ts +43 -0
  55. package/src/factories/index.ts +1 -0
  56. package/src/migrations/1719568079-default-period.sql +1 -1
  57. package/src/migrations/1753363434-service-fees.sql +4 -0
  58. package/src/migrations/1761750780-renamed-invoice-organization-id.sql +2 -0
  59. package/src/migrations/1761750781-rename-index.sql +3 -0
  60. package/src/migrations/1761750782-invoices-add-organization-id.sql +2 -0
  61. package/src/migrations/1761750783-invoices-organization-id-fk.sql +1 -0
  62. package/src/models/BalanceItem.ts +2 -3
  63. package/src/models/Organization.ts +1 -1
  64. package/src/models/PasswordToken.ts +9 -0
  65. package/src/models/Payment.ts +27 -3
  66. package/src/models/Registration.ts +3 -1
  67. package/src/models/RegistrationPeriod.ts +1 -1
  68. package/src/models/STInvoice.ts +62 -9
  69. package/src/models/STPackage.ts +45 -8
  70. package/src/models/Token.ts +8 -0
  71. package/src/models/User.ts +9 -0
  72. package/src/structures/OrganizationServerMetaData.ts +3 -0
@@ -37,6 +37,7 @@ class OrganizationServerMetaData extends simple_encoding_1.AutoEncoder {
37
37
  lastInvalidDNSDates;
38
38
  isDNSUnstable = false;
39
39
  mollieCustomerId;
40
+ mollieMandateId = null;
40
41
  ssoConfiguration = null;
41
42
  /**
42
43
  * List of specific emails that were send to this organization
@@ -111,6 +112,9 @@ tslib_1.__decorate([
111
112
  tslib_1.__decorate([
112
113
  (0, simple_encoding_1.field)({ decoder: simple_encoding_1.StringDecoder, optional: true, version: 86 })
113
114
  ], OrganizationServerMetaData.prototype, "mollieCustomerId", void 0);
115
+ tslib_1.__decorate([
116
+ (0, simple_encoding_1.field)({ decoder: simple_encoding_1.StringDecoder, optional: true, nullable: true })
117
+ ], OrganizationServerMetaData.prototype, "mollieMandateId", void 0);
114
118
  tslib_1.__decorate([
115
119
  (0, simple_encoding_1.field)({ decoder: structures_1.OpenIDClientConfiguration, nullable: true, version: 189 })
116
120
  ], OrganizationServerMetaData.prototype, "ssoConfiguration", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"OrganizationServerMetaData.js","sourceRoot":"","sources":["../../../src/structures/OrganizationServerMetaData.ts"],"names":[],"mappings":";;;;AAAA,iEAAuJ;AACvJ,sDAAkE;AAElE,MAAa,SAAU,SAAQ,6BAAW;IAEtC,EAAE,CAAS;IAGX,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;CACrB;AAND,8BAMC;AAJG;IADC,IAAA,uBAAK,EAAC,EAAE,OAAO,EAAE,+BAAa,EAAE,CAAC;qCACvB;AAGX;IADC,IAAA,uBAAK,EAAC,EAAE,OAAO,EAAE,6BAAW,EAAE,CAAC;uCACd;AAGtB,MAAa,0BAA2B,SAAQ,6BAAW;IAEvD,cAAc,CAAU;IAGxB,aAAa,CAAU;IAGvB,gBAAgB,CAAU;IAE1B;;;OAGG;IAEH,sBAAsB,CAAQ;IAE9B;;;OAGG;IAEH,sBAAsB,GAAG,IAAI,CA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MAAM,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;YACxD,OAAO,CAAC,CAAC;QACb,CAAC,EAAE,CAAC;IACH,IAAA,uBAAK,EAAC,EAAE,OAAO,EAAE,IAAI,4BAAU,CAAC,+BAAa,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE;YACpG,MAAM,CAAC,GAAG,IAAI,GAAG,EAAqB,CAAC;YACvC,MAAM,UAAU,GAAG,yBAAyB,CAAC;YAC7C,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;YACxD,OAAO,CAAC,CAAC;QACb,CAAC,EAAE,CAAC;iEAC8C"}
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/factories/addressfactory.ts","../src/factories/balanceitemfactory.ts","../src/factories/documenttemplatefactory.ts","../src/factories/emailtemplatefactory.ts","../src/factories/emergencycontactfactory.ts","../src/factories/eventfactory.ts","../src/factories/eventnotificationfactory.ts","../src/factories/eventnotificationtypefactory.ts","../src/factories/groupfactory.ts","../src/factories/memberfactory.ts","../src/factories/memberresponsibilityrecordfactory.ts","../src/factories/organizationfactory.ts","../src/factories/organizationregistrationperiodfactory.ts","../src/factories/organizationtagfactory.ts","../src/factories/parentfactory.ts","../src/factories/platformeventtypefactory.ts","../src/factories/platformresponsibilityfactory.ts","../src/factories/recordanswerfactory.ts","../src/factories/recordcategoryfactory.ts","../src/factories/recordfactory.ts","../src/factories/registercodefactory.ts","../src/factories/registrationfactory.ts","../src/factories/registrationperiodfactory.ts","../src/factories/userfactory.ts","../src/factories/webshopfactory.ts","../src/factories/index.ts","../src/helpers/dnsvalidator.ts","../src/helpers/emailbuilder.ts","../src/helpers/groupbuilder.ts","../src/helpers/handlebars.ts","../src/helpers/membermerger.test.ts","../src/helpers/membermerger.ts","../src/helpers/ratelimiter.ts","../src/helpers/webshopcounter.ts","../src/migrations/1605262045-import-postcodes.ts","../src/migrations/1605262046-import-postcodes-nl.ts","../src/models/auditlog.ts","../src/models/balanceitem.ts","../src/models/balanceitempayment.ts","../src/models/buckaroopayment.ts","../src/models/cachedbalance.ts","../src/models/document.ts","../src/models/documenttemplate.ts","../src/models/email.test.ts","../src/models/email.ts","../src/models/emailrecipient.ts","../src/models/emailtemplate.ts","../src/models/emailverificationcode.ts","../src/models/event.ts","../src/models/eventnotification.ts","../src/models/group.ts","../src/models/image.ts","../src/models/member.ts","../src/models/memberplatformmembership.ts","../src/models/memberresponsibilityrecord.ts","../src/models/memberuser.ts","../src/models/mergedmember.ts","../src/models/molliepayment.ts","../src/models/mollietoken.ts","../src/models/onetimetoken.ts","../src/models/order.ts","../src/models/organization.ts","../src/models/organizationregistrationperiod.ts","../src/models/passwordtoken.ts","../src/models/payconiqpayment.ts","../src/models/payment.ts","../src/models/platform.test.ts","../src/models/platform.ts","../src/models/registercode.ts","../src/models/registration.ts","../src/models/registrationperiod.ts","../src/models/stcredit.ts","../src/models/stinvoice.ts","../src/models/stpackage.ts","../src/models/stpendinginvoice.ts","../src/models/stripeaccount.ts","../src/models/stripecheckoutsession.ts","../src/models/stripepaymentintent.ts","../src/models/ticket.ts","../src/models/token.test.ts","../src/models/token.ts","../src/models/uitpasclientcredential.ts","../src/models/usedregistercode.ts","../src/models/user.ts","../src/models/userpermissions.ts","../src/models/webshop.ts","../src/models/webshopdiscountcode.ts","../src/models/webshopuitpasnumber.ts","../src/models/index.ts","../src/models/addresses/city.ts","../src/models/addresses/postalcode.test.ts","../src/models/addresses/postalcode.ts","../src/models/addresses/province.ts","../src/models/addresses/street.ts","../src/structures/organizationservermetadata.ts","../tests/jest.global.setup.ts","../tests/jest.setup.ts","../../../../environment.d.ts","../../../../jest-extended.d.ts","../../../stamhoofd.d.ts"],"version":"5.8.3"}
1
+ {"root":["../src/index.ts","../src/factories/addressfactory.ts","../src/factories/balanceitemfactory.ts","../src/factories/documenttemplatefactory.ts","../src/factories/emailtemplatefactory.ts","../src/factories/emergencycontactfactory.ts","../src/factories/eventfactory.ts","../src/factories/eventnotificationfactory.ts","../src/factories/eventnotificationtypefactory.ts","../src/factories/groupfactory.ts","../src/factories/memberfactory.ts","../src/factories/memberresponsibilityrecordfactory.ts","../src/factories/organizationfactory.ts","../src/factories/organizationregistrationperiodfactory.ts","../src/factories/organizationtagfactory.ts","../src/factories/parentfactory.ts","../src/factories/platformeventtypefactory.ts","../src/factories/platformresponsibilityfactory.ts","../src/factories/recordanswerfactory.ts","../src/factories/recordcategoryfactory.ts","../src/factories/recordfactory.ts","../src/factories/registercodefactory.ts","../src/factories/registrationfactory.ts","../src/factories/registrationperiodfactory.ts","../src/factories/stpackagefactory.ts","../src/factories/userfactory.ts","../src/factories/webshopfactory.ts","../src/factories/index.ts","../src/helpers/dnsvalidator.ts","../src/helpers/emailbuilder.ts","../src/helpers/groupbuilder.ts","../src/helpers/handlebars.ts","../src/helpers/membermerger.test.ts","../src/helpers/membermerger.ts","../src/helpers/ratelimiter.ts","../src/helpers/webshopcounter.ts","../src/migrations/1605262045-import-postcodes.ts","../src/migrations/1605262046-import-postcodes-nl.ts","../src/models/auditlog.ts","../src/models/balanceitem.ts","../src/models/balanceitempayment.ts","../src/models/buckaroopayment.ts","../src/models/cachedbalance.ts","../src/models/document.ts","../src/models/documenttemplate.ts","../src/models/email.test.ts","../src/models/email.ts","../src/models/emailrecipient.ts","../src/models/emailtemplate.ts","../src/models/emailverificationcode.ts","../src/models/event.ts","../src/models/eventnotification.ts","../src/models/group.ts","../src/models/image.ts","../src/models/member.ts","../src/models/memberplatformmembership.ts","../src/models/memberresponsibilityrecord.ts","../src/models/memberuser.ts","../src/models/mergedmember.ts","../src/models/molliepayment.ts","../src/models/mollietoken.ts","../src/models/onetimetoken.ts","../src/models/order.ts","../src/models/organization.ts","../src/models/organizationregistrationperiod.ts","../src/models/passwordtoken.ts","../src/models/payconiqpayment.ts","../src/models/payment.ts","../src/models/platform.test.ts","../src/models/platform.ts","../src/models/registercode.ts","../src/models/registration.ts","../src/models/registrationperiod.ts","../src/models/stcredit.ts","../src/models/stinvoice.ts","../src/models/stpackage.ts","../src/models/stpendinginvoice.ts","../src/models/stripeaccount.ts","../src/models/stripecheckoutsession.ts","../src/models/stripepaymentintent.ts","../src/models/ticket.ts","../src/models/token.test.ts","../src/models/token.ts","../src/models/uitpasclientcredential.ts","../src/models/usedregistercode.ts","../src/models/user.ts","../src/models/userpermissions.ts","../src/models/webshop.ts","../src/models/webshopdiscountcode.ts","../src/models/webshopuitpasnumber.ts","../src/models/index.ts","../src/models/addresses/city.ts","../src/models/addresses/postalcode.test.ts","../src/models/addresses/postalcode.ts","../src/models/addresses/province.ts","../src/models/addresses/street.ts","../src/structures/organizationservermetadata.ts","../tests/jest.global.setup.ts","../tests/jest.setup.ts","../../../../environment.d.ts","../../../../jest-extended.d.ts","../../../stamhoofd.d.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamhoofd/models",
3
- "version": "2.104.0",
3
+ "version": "2.106.0",
4
4
  "main": "./dist/src/index.js",
5
5
  "types": "./dist/src/index.d.ts",
6
6
  "license": "UNLICENCED",
@@ -30,5 +30,5 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "gitHead": "b0ab736ce6f13f9f663503ff0967caa8bb660723"
33
+ "gitHead": "56fde0bd7b4d4ff0c3a4cd07924dcfe78a438215"
34
34
  }
@@ -0,0 +1,43 @@
1
+ import { Factory } from '@simonbackx/simple-database';
2
+
3
+ import { STPackage } from '../models';
4
+ import { Organization } from '../models/Organization';
5
+ import { STPackageBundle, STPackageBundleHelper } from '@stamhoofd/structures';
6
+
7
+ class Options {
8
+ organization: Organization;
9
+ bundle?: STPackageBundle;
10
+ removeAt?: Date | null;
11
+ validAt?: Date | null;
12
+ }
13
+
14
+ export class STPackageFactory extends Factory<Options, STPackage> {
15
+ async create(): Promise<STPackage> {
16
+ const pack = new STPackage();
17
+ pack.organizationId = this.options.organization.id;
18
+
19
+ const m = STPackageBundleHelper.getCurrentPackage(this.options.bundle ?? STPackageBundle.Webshops, new Date());
20
+
21
+ pack.meta = m.meta;
22
+ pack.validUntil = m.validUntil;
23
+ pack.removeAt = m.removeAt;
24
+
25
+ if (this.options.removeAt) {
26
+ pack.validAt = new Date(this.options.removeAt.getTime() - 365 * 1000 * 60 * 60 * 24);
27
+ }
28
+ else {
29
+ pack.validAt = this.options.validAt !== undefined ? this.options.validAt : new Date();
30
+ }
31
+
32
+ if (this.options.removeAt !== undefined) {
33
+ pack.removeAt = this.options.removeAt;
34
+ }
35
+
36
+ if (this.options.validAt !== undefined) {
37
+ pack.validAt = this.options.validAt;
38
+ }
39
+
40
+ await pack.save();
41
+ return pack;
42
+ }
43
+ }
@@ -23,3 +23,4 @@ export * from './EmailTemplateFactory';
23
23
  export * from './RecordCategoryFactory';
24
24
  export * from './RecordAnswerFactory';
25
25
  export * from './DocumentTemplateFactory';
26
+ export * from './STPackageFactory';
@@ -1,2 +1,2 @@
1
1
  INSERT INTO `registration_periods` (`id`, `startDate`, `endDate`, `locked`, `organizationId`, `settings`, `createdAt`, `updatedAt`) VALUES
2
- ('9785ddf1-bb80-4e50-a7ae-6a3a1bc6c3ff', '2024-09-01 09:33:00', '2025-08-31 09:33:00', 0, NULL, '{\"value\": {}, \"version\": 263}', '2024-06-28 09:33:42', '2024-06-28 09:33:42');
2
+ ('9785ddf1-bb80-4e50-a7ae-6a3a1bc6c3ff', '2025-08-31 22:00:00', '2026-08-31 21:59:59', 0, NULL, '{\"value\": {}, \"version\": 263}', '2025-08-31 22:00:00', '2026-08-31 22:00:00');
@@ -0,0 +1,4 @@
1
+ ALTER TABLE `payments`
2
+ ADD COLUMN `serviceFeePayout` int NOT NULL DEFAULT '0' AFTER `stripeAccountId`,
3
+ ADD COLUMN `serviceFeeManual` int NOT NULL DEFAULT '0' AFTER `stripeAccountId`,
4
+ ADD COLUMN `serviceFeeManualCharged` int NOT NULL DEFAULT '0' AFTER `stripeAccountId`;
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `stamhoofd_invoices`
2
+ CHANGE `organizationId` `payingOrganizationId` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL;
@@ -0,0 +1,3 @@
1
+ ALTER TABLE `stamhoofd_invoices`
2
+ DROP INDEX `organizationId`,
3
+ ADD INDEX `payingOrganizationId` (`payingOrganizationId`) USING BTREE;
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `stamhoofd_invoices`
2
+ ADD COLUMN `organizationId` varchar(36) NULL AFTER `id`;
@@ -0,0 +1 @@
1
+ ALTER TABLE `stamhoofd_invoices` ADD FOREIGN KEY (`organizationId`) REFERENCES `organizations` (`id`) ON UPDATE CASCADE ON DELETE CASCADE;
@@ -4,9 +4,8 @@ import { Formatter } from '@stamhoofd/utility';
4
4
  import { v4 as uuidv4 } from 'uuid';
5
5
 
6
6
  import { EnumDecoder, MapDecoder } from '@simonbackx/simple-encoding';
7
- import { QueryableModel, SQL } from '@stamhoofd/sql';
8
- import { Document, MemberUser, Payment } from './';
9
- import { CachedBalance } from './CachedBalance';
7
+ import { QueryableModel } from '@stamhoofd/sql';
8
+ import { Payment } from './';
10
9
 
11
10
  /**
12
11
  * Keeps track of how much a member/user owes or needs to be reimbursed.
@@ -50,7 +50,7 @@ export class Organization extends QueryableModel {
50
50
  * Public meta data
51
51
  */
52
52
  @column({ type: 'json', decoder: OrganizationMetaData })
53
- meta: OrganizationMetaData;
53
+ meta: OrganizationMetaData = OrganizationMetaData.create({});
54
54
 
55
55
  /**
56
56
  * Data only accessible by the owners / users with special permissions
@@ -5,6 +5,7 @@ import basex from 'base-x';
5
5
  import crypto from 'crypto';
6
6
 
7
7
  import { Organization, User } from './';
8
+ import { SimpleError } from '@simonbackx/simple-errors';
8
9
  const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
9
10
  const bs58 = basex(ALPHABET);
10
11
 
@@ -95,6 +96,14 @@ export class PasswordToken extends QueryableModel {
95
96
  * Create a token without saving it
96
97
  */
97
98
  static async createToken<U extends User>(user: U, validUntil?: Date): Promise<PasswordTokenWithUser> {
99
+ if (user.isSystemUser) {
100
+ throw new SimpleError({
101
+ code: 'internal_error',
102
+ message: 'Cannot create password token for system user',
103
+ statusCode: 500,
104
+ });
105
+ }
106
+
98
107
  const token = new PasswordToken().setRelation(PasswordToken.user, user);
99
108
 
100
109
  if (validUntil) {
@@ -80,10 +80,34 @@ export class Payment extends QueryableModel {
80
80
 
81
81
  /**
82
82
  * Fee paid to the payment provider (if available, otherwise set to 0)
83
+ * Note: only set when we substract it from the payouts and need to invoice it (if using Stripe Express)
83
84
  */
84
85
  @column({ type: 'integer' })
85
86
  transferFee = 0;
86
87
 
88
+ /**
89
+ * Service fee that will be substracted from the payout (in addition to the transfer fee)
90
+ * Will get invoiced at the end of the month
91
+ *
92
+ * This INCLUDES VAT
93
+ */
94
+ @column({ type: 'integer' })
95
+ serviceFeePayout = 0;
96
+
97
+ /**
98
+ * Service fee, not substracted from a payout, that needs to be paid via a different payment
99
+ *
100
+ * This EXCLUDES VAT
101
+ */
102
+ @column({ type: 'integer' })
103
+ serviceFeeManual = 0;
104
+
105
+ /**
106
+ * Part of the serviceFeeManual, that has been invoiced (added to outstanding balance)
107
+ */
108
+ @column({ type: 'integer' })
109
+ serviceFeeManualCharged = 0;
110
+
87
111
  /**
88
112
  * Included in the total price
89
113
  */
@@ -173,8 +197,8 @@ export class Payment extends QueryableModel {
173
197
  ...payment,
174
198
  payingOrganization: payingOrganization
175
199
  ? BaseOrganization.create({
176
- ...payingOrganization,
177
- })
200
+ ...payingOrganization,
201
+ })
178
202
  : null,
179
203
  balanceItemPayments: balanceItemPayments.filter(item => item.paymentId === payment.id).map((item) => {
180
204
  const balanceItem = balanceItems.find(b => b.id === item.balanceItemId);
@@ -187,7 +211,7 @@ export class Payment extends QueryableModel {
187
211
  });
188
212
  }),
189
213
  ...(payment.provider !== PaymentProvider.Stripe ? { stripeAccountId: null } : {}),
190
- ...(!includeSettlements) ? { settlement: null, transferFee: 0, stripeAccountId: null } : {},
214
+ ...(!includeSettlements) ? { settlement: null, transferFee: 0, stripeAccountId: null, serviceFeeManual: 0, serviceFeeManualCharged: 0, serviceFeePayout: 0 } : {},
191
215
  });
192
216
  });
193
217
  }
@@ -189,6 +189,8 @@ export class Registration extends QueryableModel {
189
189
  return [];
190
190
  }
191
191
 
192
+ const allowedEmails = member.details.getNotificationEmails();
193
+
192
194
  return member.users.map(user => Recipient.create({
193
195
  firstName: user.firstName,
194
196
  lastName: user.lastName,
@@ -212,7 +214,7 @@ export class Registration extends QueryableModel {
212
214
  value: group.settings.name.toString(),
213
215
  }),
214
216
  ],
215
- }));
217
+ })).filter(r => allowedEmails.includes(r.email.toLocaleLowerCase()));
216
218
  }
217
219
 
218
220
  async sendEmailTemplate(data: {
@@ -33,7 +33,7 @@ export class RegistrationPeriod extends QueryableModel {
33
33
  endDate: Date;
34
34
 
35
35
  @column({ type: 'json', decoder: RegistrationPeriodSettings })
36
- settings: RegistrationPeriodSettings;
36
+ settings = RegistrationPeriodSettings.create({});
37
37
 
38
38
  @column({ type: 'boolean' })
39
39
  locked = false;
@@ -1,9 +1,10 @@
1
- import { column, ManyToOneRelation } from '@simonbackx/simple-database';
1
+ import { createMollieClient } from '@mollie/api-client';
2
+ import { column } from '@simonbackx/simple-database';
3
+ import { SimpleError } from '@simonbackx/simple-errors';
2
4
  import { QueryableModel } from '@stamhoofd/sql';
3
- import { STInvoiceMeta } from '@stamhoofd/structures';
5
+ import { OrganizationPaymentMandate, OrganizationPaymentMandateDetails, STInvoiceMeta } from '@stamhoofd/structures';
4
6
  import { v4 as uuidv4 } from 'uuid';
5
-
6
- import { Organization, Payment } from './';
7
+ import { Organization } from './';
7
8
 
8
9
  export class STInvoice extends QueryableModel {
9
10
  static table = 'stamhoofd_invoices';
@@ -19,11 +20,17 @@ export class STInvoice extends QueryableModel {
19
20
  id!: string;
20
21
 
21
22
  /**
22
- * Is null for deleted organizations
23
+ * Organization that made the invoice. Can be null if the organization was deleted and for the migration from V1 -> V2
23
24
  */
24
- @column({ foreignKey: STInvoice.organization, type: 'string', nullable: true })
25
+ @column({ type: 'string', nullable: true })
25
26
  organizationId: string | null;
26
27
 
28
+ /**
29
+ * Organization that is associated with this invoice (can be null if deleted or unknown)
30
+ */
31
+ @column({ type: 'string', nullable: true })
32
+ payingOrganizationId: string | null;
33
+
27
34
  /**
28
35
  * An associated STCredit, that was used to remove credits from the user's credits.
29
36
  * If the invoice is marked as failed, we need to delete this one
@@ -34,7 +41,7 @@ export class STInvoice extends QueryableModel {
34
41
  /**
35
42
  * Note: always create a new invoice for failed payments. We never create an actual invoice until we received the payment
36
43
  */
37
- @column({ type: 'string', nullable: true, foreignKey: STInvoice.payment })
44
+ @column({ type: 'string', nullable: true })
38
45
  paymentId: string | null = null;
39
46
 
40
47
  @column({ type: 'json', decoder: STInvoiceMeta })
@@ -74,6 +81,52 @@ export class STInvoice extends QueryableModel {
74
81
  @column({ type: 'string', nullable: true })
75
82
  reference: string | null = null;
76
83
 
77
- static organization = new ManyToOneRelation(Organization, 'organization');
78
- static payment = new ManyToOneRelation(Payment, 'payment');
84
+ // static organization = new ManyToOneRelation(Organization, 'organization');
85
+ // static payment = new ManyToOneRelation(Payment, 'payment');
86
+
87
+ static async getMollieMandates(organization: Organization) {
88
+ // Poll mollie status
89
+ // Mollie payment is required
90
+ const mandates: OrganizationPaymentMandate[] = [];
91
+
92
+ try {
93
+ const apiKey = STAMHOOFD.MOLLIE_API_KEY;
94
+ if (!apiKey) {
95
+ throw new SimpleError({
96
+ code: '',
97
+ message: 'Mollie niet correct gekoppeld',
98
+ });
99
+ }
100
+
101
+ const mollieClient = createMollieClient({ apiKey });
102
+
103
+ if (organization.serverMeta.mollieCustomerId) {
104
+ const m = await mollieClient.customerMandates.page({ customerId: organization.serverMeta.mollieCustomerId, limit: 250 });
105
+ for (const mandate of m) {
106
+ try {
107
+ const details = mandate.details;
108
+ mandates.push(OrganizationPaymentMandate.create({
109
+ ...mandate,
110
+ isDefault: mandate.id === organization.serverMeta.mollieMandateId,
111
+ createdAt: new Date(mandate.createdAt),
112
+ details: OrganizationPaymentMandateDetails.create({
113
+ consumerName: ('consumerName' in details ? details.consumerName : details.cardHolder) ?? undefined,
114
+ consumerAccount: ('consumerAccount' in details ? details.consumerAccount : details.cardNumber) ?? undefined,
115
+ consumerBic: ('consumerBic' in details ? details.consumerBic : details.cardExpiryDate) ?? undefined,
116
+ cardExpiryDate: ('cardExpiryDate' in details ? details.cardExpiryDate : null),
117
+ cardLabel: ('cardLabel' in details ? details.cardLabel : null),
118
+ }),
119
+ }));
120
+ }
121
+ catch (e) {
122
+ console.error(e);
123
+ }
124
+ }
125
+ }
126
+ }
127
+ catch (e) {
128
+ console.error(e);
129
+ }
130
+ return mandates;
131
+ }
79
132
  }
@@ -1,10 +1,10 @@
1
1
  import { column } from '@simonbackx/simple-database';
2
2
  import { SimpleError } from '@simonbackx/simple-errors';
3
- import { QueryableModel } from '@stamhoofd/sql';
4
- import { EmailTemplateType, Recipient, Replacement, STPackageMeta, STPackageStatus, STPackageType } from '@stamhoofd/structures';
3
+ import { EmailTemplateType, Recipient, Replacement, STPackageMeta, STPackageStatus, STPackageStatusServiceFee, STPackageType, STPricingType } from '@stamhoofd/structures';
5
4
  import { Formatter } from '@stamhoofd/utility';
6
5
  import { v4 as uuidv4 } from 'uuid';
7
6
 
7
+ import { QueryableModel } from '@stamhoofd/sql';
8
8
  import { sendEmailTemplate } from '../helpers/EmailBuilder';
9
9
  import { GroupBuilder } from '../helpers/GroupBuilder';
10
10
  import { Organization } from './';
@@ -179,11 +179,36 @@ export class STPackage extends QueryableModel {
179
179
  pack.removeAt.setMonth(pack.removeAt.getMonth() + 3);
180
180
 
181
181
  // Custom renewals for single webshop:
182
- if (this.meta.type === STPackageType.SingleWebshop) {
182
+ /* if (this.meta.type === STPackageType.SingleWebshop) {
183
183
  // Disable functions after two months
184
- pack.validUntil = new Date(pack.meta.startDate);
185
- pack.validUntil.setMonth(pack.validUntil.getMonth() + 2);
186
- pack.removeAt = new Date(pack.validUntil);
184
+ pack.validUntil = new Date(pack.meta.startDate)
185
+ pack.validUntil.setMonth(pack.validUntil.getMonth() + 2)
186
+ pack.removeAt = new Date(pack.validUntil)
187
+ } */
188
+ if (this.meta.type === STPackageType.SingleWebshop) {
189
+ pack.meta.type = STPackageType.Webshops;
190
+ }
191
+
192
+ // Change prices
193
+ if (pack.meta.type === STPackageType.Webshops) {
194
+ pack.meta.serviceFeeFixed = 0;
195
+ pack.meta.serviceFeePercentage = 2_00;
196
+ pack.meta.serviceFeeMinimum = 0;
197
+ pack.meta.serviceFeeMaximum = 20;
198
+
199
+ pack.meta.unitPrice = 0;
200
+ pack.meta.pricingType = STPricingType.Fixed;
201
+ pack.validUntil = null;
202
+ pack.removeAt = null;
203
+ }
204
+ else if (pack.meta.type === STPackageType.Members) {
205
+ pack.meta.serviceFeeFixed = 0;
206
+ pack.meta.serviceFeePercentage = 0;
207
+ pack.meta.serviceFeeMinimum = 0;
208
+ pack.meta.serviceFeeMaximum = 0;
209
+
210
+ pack.meta.unitPrice = 100;
211
+ pack.meta.pricingType = STPricingType.PerMember;
187
212
  }
188
213
 
189
214
  return pack;
@@ -197,6 +222,18 @@ export class STPackage extends QueryableModel {
197
222
  validUntil: this.validUntil,
198
223
  removeAt: this.removeAt,
199
224
  firstFailedPayment: this.meta.firstFailedPayment,
225
+ serviceFees: [
226
+ STPackageStatusServiceFee.create({
227
+ fixed: this.meta.serviceFeeFixed,
228
+ percentage: this.meta.serviceFeePercentage,
229
+ minimum: this.meta.serviceFeeMinimum,
230
+ maximum: this.meta.serviceFeeMaximum,
231
+ startDate: this.meta.startDate,
232
+ endDate: this.validUntil && this.removeAt
233
+ ? new Date(Math.min(this.validUntil.getTime(), this.removeAt.getTime()))
234
+ : (this.validUntil ?? this.removeAt),
235
+ },
236
+ )],
200
237
  });
201
238
  }
202
239
 
@@ -288,11 +325,11 @@ export class STPackage extends QueryableModel {
288
325
  }),
289
326
  Replacement.create({
290
327
  token: 'validUntil',
291
- value: this.validUntil ? Formatter.dateTime(this.validUntil) : $t(`a402f8d1-b470-4b1e-948b-1524576708ea`),
328
+ value: this.validUntil ? Formatter.dateTime(this.validUntil) : 'nooit',
292
329
  }),
293
330
  Replacement.create({
294
331
  token: 'validUntilDate',
295
- value: this.validUntil ? Formatter.date(this.validUntil) : $t(`a402f8d1-b470-4b1e-948b-1524576708ea`),
332
+ value: this.validUntil ? Formatter.date(this.validUntil) : 'nooit',
296
333
  }),
297
334
  Replacement.create({
298
335
  token: 'renewUrl',
@@ -5,6 +5,7 @@ import crypto from 'crypto';
5
5
 
6
6
  import { RateLimiter } from '../helpers/RateLimiter';
7
7
  import { User } from './';
8
+ import { SimpleError } from '@simonbackx/simple-errors';
8
9
 
9
10
  export type TokenWithUser = Token & { user: User };
10
11
 
@@ -184,6 +185,13 @@ export class Token extends QueryableModel {
184
185
  * Create a token without saving it
185
186
  */
186
187
  static async createUnsavedToken<U extends User>(user: U): Promise<(Token & { user: U })> {
188
+ if (user.isSystemUser) {
189
+ throw new SimpleError({
190
+ code: 'internal_error',
191
+ message: 'Cannot create token for system user',
192
+ statusCode: 500,
193
+ });
194
+ }
187
195
  // Get all the tokens of the user that are olde
188
196
 
189
197
  // First search if we already have more than 5 tokens (we only allow up to 5 devices)
@@ -290,6 +290,10 @@ export class User extends QueryableModel {
290
290
  return !this.email.includes('@') && this.email.endsWith('.api') && this.verified;
291
291
  }
292
292
 
293
+ get isSystemUser() {
294
+ return this.id === '1';
295
+ }
296
+
293
297
  hasAccount() {
294
298
  if (this.hasPasswordBasedAccount()) {
295
299
  return true;
@@ -529,6 +533,11 @@ export class User extends QueryableModel {
529
533
  }
530
534
 
531
535
  async changePassword(password: string) {
536
+ if (this.isSystemUser) {
537
+ // Can't set password
538
+ this.password = null;
539
+ return;
540
+ }
532
541
  this.password = await User.hash(password);
533
542
  }
534
543
 
@@ -49,6 +49,9 @@ export class OrganizationServerMetaData extends AutoEncoder {
49
49
  @field({ decoder: StringDecoder, optional: true, version: 86 })
50
50
  mollieCustomerId?: string;
51
51
 
52
+ @field({ decoder: StringDecoder, optional: true, nullable: true })
53
+ mollieMandateId: string | null = null;
54
+
52
55
  @field({ decoder: OpenIDClientConfiguration, nullable: true, version: 189 })
53
56
  ssoConfiguration: OpenIDClientConfiguration | null = null;
54
57