@stamhoofd/backend 2.39.1 → 2.40.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/eslint.config.mjs +5 -0
- package/index.ts +81 -74
- package/jest.config.cjs +10 -0
- package/migrations.ts +16 -14
- package/package.json +11 -11
- package/src/crons/clear-excel-cache.test.ts +48 -50
- package/src/crons/clear-excel-cache.ts +18 -18
- package/src/crons/setup-steps.ts +2 -2
- package/src/crons.ts +325 -306
- package/src/decoders/StringArrayDecoder.ts +7 -7
- package/src/decoders/StringNullableDecoder.ts +1 -2
- package/src/email-recipient-loaders/members.ts +22 -22
- package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +8 -9
- package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +39 -40
- package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +8 -8
- package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +44 -45
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +58 -57
- package/src/endpoints/auth/CreateAdminEndpoint.ts +48 -45
- package/src/endpoints/auth/CreateTokenEndpoint.test.ts +31 -31
- package/src/endpoints/auth/CreateTokenEndpoint.ts +146 -147
- package/src/endpoints/auth/DeleteTokenEndpoint.ts +7 -7
- package/src/endpoints/auth/DeleteUserEndpoint.ts +15 -15
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +17 -18
- package/src/endpoints/auth/GetOtherUserEndpoint.ts +9 -10
- package/src/endpoints/auth/GetUserEndpoint.test.ts +32 -35
- package/src/endpoints/auth/GetUserEndpoint.ts +5 -6
- package/src/endpoints/auth/PatchApiUserEndpoint.ts +35 -33
- package/src/endpoints/auth/PatchUserEndpoint.ts +55 -52
- package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +9 -9
- package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +8 -8
- package/src/endpoints/auth/SignupEndpoint.ts +37 -36
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +29 -28
- package/src/endpoints/global/addresses/SearchRegionsEndpoint.ts +33 -33
- package/src/endpoints/global/addresses/ValidateAddressEndpoint.ts +7 -7
- package/src/endpoints/global/caddy/CheckDomainCertEndpoint.ts +37 -37
- package/src/endpoints/global/email/CreateEmailEndpoint.ts +30 -30
- package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +13 -13
- package/src/endpoints/global/email/GetEmailEndpoint.ts +13 -13
- package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +16 -16
- package/src/endpoints/global/email/PatchEmailEndpoint.ts +25 -25
- package/src/endpoints/global/events/GetEventsEndpoint.ts +43 -44
- package/src/endpoints/global/events/PatchEventsEndpoint.ts +127 -172
- package/src/endpoints/global/files/ExportToExcelEndpoint.ts +49 -50
- package/src/endpoints/global/files/GetFileCache.ts +13 -13
- package/src/endpoints/global/files/UploadFile.ts +51 -54
- package/src/endpoints/global/files/UploadImage.ts +53 -53
- package/src/endpoints/global/groups/GetGroupsEndpoint.ts +25 -25
- package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +24 -23
- package/src/endpoints/global/members/GetMembersCountEndpoint.ts +8 -8
- package/src/endpoints/global/members/GetMembersEndpoint.ts +105 -102
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +240 -239
- package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +12 -14
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.test.ts +32 -33
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +48 -57
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.test.ts +21 -22
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.ts +28 -28
- package/src/endpoints/global/organizations/GetOrganizationFromUriEndpoint.ts +18 -18
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.test.ts +20 -20
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.ts +17 -17
- package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +81 -75
- package/src/endpoints/global/platform/GetPlatformAdminsEndpoint.ts +14 -14
- package/src/endpoints/global/platform/GetPlatformEnpoint.ts +11 -11
- package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +71 -68
- package/src/endpoints/global/registration/GetPaymentRegistrations.ts +27 -27
- package/src/endpoints/global/registration/GetUserBillingStatusEndpoint.ts +30 -30
- package/src/endpoints/global/registration/GetUserDetailedBillingStatusEndpoint.ts +34 -34
- package/src/endpoints/global/registration/GetUserDocumentsEndpoint.ts +26 -26
- package/src/endpoints/global/registration/GetUserMembersEndpoint.ts +12 -12
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +90 -90
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +118 -121
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +362 -350
- package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +8 -9
- package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +21 -21
- package/src/endpoints/global/webshops/GetWebshopFromDomainEndpoint.ts +65 -65
- package/src/endpoints/organization/dashboard/billing/GetOrganizationBillingStatusEndpoint.ts +9 -9
- package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedBillingStatusEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +17 -17
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesEndpoint.ts +21 -21
- package/src/endpoints/organization/dashboard/documents/GetDocumentsEndpoint.ts +15 -15
- package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +52 -52
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplateEndpoint.ts +37 -37
- package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/email/EmailEndpoint.ts +113 -112
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.ts +29 -29
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +48 -47
- package/src/endpoints/organization/dashboard/mollie/CheckMollieEndpoint.ts +22 -21
- package/src/endpoints/organization/dashboard/mollie/ConnectMollieEndpoint.ts +13 -14
- package/src/endpoints/organization/dashboard/mollie/DisconnectMollieEndpoint.ts +12 -13
- package/src/endpoints/organization/dashboard/mollie/GetMollieDashboardEndpoint.ts +24 -24
- package/src/endpoints/organization/dashboard/nolt/CreateNoltTokenEndpoint.ts +10 -12
- package/src/endpoints/organization/dashboard/organization/GetOrganizationArchivedGroups.ts +14 -14
- package/src/endpoints/organization/dashboard/organization/GetOrganizationDeletedGroups.ts +13 -13
- package/src/endpoints/organization/dashboard/organization/GetOrganizationSSOEndpoint.ts +12 -12
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +120 -124
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +172 -173
- package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +88 -89
- package/src/endpoints/organization/dashboard/organization/SetOrganizationSSOEndpoint.ts +12 -12
- package/src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint.ts +17 -17
- package/src/endpoints/organization/dashboard/payments/GetPaymentsCountEndpoint.ts +8 -8
- package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +66 -67
- package/src/endpoints/organization/dashboard/payments/PatchBalanceItemsEndpoint.ts +47 -47
- package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +93 -91
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.ts +16 -17
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +170 -167
- package/src/endpoints/organization/dashboard/registration-periods/SetupStepReviewEndpoint.ts +25 -24
- package/src/endpoints/organization/dashboard/stripe/ConnectStripeEndpoint.ts +22 -23
- package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +22 -22
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +17 -18
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +8 -9
- package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +17 -18
- package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +14 -15
- package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +19 -19
- package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +19 -19
- package/src/endpoints/organization/dashboard/users/GetApiUsersEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/users/GetOrganizationAdminsEndpoint.ts +12 -12
- package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +103 -100
- package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +11 -12
- package/src/endpoints/organization/dashboard/webshops/GetDiscountCodesEndpoint.ts +15 -15
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/webshops/GetWebshopTicketsEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/webshops/GetWebshopUriAvailabilityEndpoint.ts +23 -23
- package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +54 -52
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +84 -81
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +120 -111
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +24 -24
- package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +18 -18
- package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +141 -130
- package/src/endpoints/organization/shared/GetDocumentHtml.ts +25 -25
- package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +18 -18
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.test.ts +36 -37
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.ts +9 -9
- package/src/endpoints/organization/shared/auth/OpenIDConnectCallbackEndpoint.ts +11 -11
- package/src/endpoints/organization/shared/auth/OpenIDConnectStartEndpoint.ts +28 -27
- package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +20 -20
- package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +22 -22
- package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +14 -14
- package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +57 -56
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.test.ts +65 -66
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +18 -17
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +124 -128
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +154 -145
- package/src/excel-loaders/members.ts +102 -103
- package/src/excel-loaders/payments.ts +155 -156
- package/src/helpers/AddressValidator.test.ts +32 -32
- package/src/helpers/AddressValidator.ts +128 -122
- package/src/helpers/AdminPermissionChecker.ts +339 -236
- package/src/helpers/AuthenticatedStructures.ts +233 -134
- package/src/helpers/BuckarooHelper.ts +134 -134
- package/src/helpers/CheckSettlements.ts +94 -88
- package/src/helpers/Context.ts +87 -86
- package/src/helpers/CookieHelper.ts +23 -22
- package/src/helpers/EmailResumer.ts +10 -10
- package/src/helpers/FileCache.ts +62 -62
- package/src/helpers/ForwardHandler.test.ts +122 -124
- package/src/helpers/ForwardHandler.ts +76 -70
- package/src/helpers/MemberUserSyncer.ts +101 -96
- package/src/helpers/MembershipCharger.ts +69 -69
- package/src/helpers/MembershipHelper.ts +11 -12
- package/src/helpers/OpenIDConnectHelper.ts +85 -82
- package/src/helpers/PeriodHelper.ts +65 -70
- package/src/helpers/StripeHelper.ts +146 -137
- package/src/helpers/StripePayoutChecker.ts +51 -52
- package/src/helpers/ViesHelper.ts +46 -44
- package/src/helpers/fetchToAsyncIterator.ts +14 -14
- package/src/helpers/xlsxAddressTransformerColumnFactory.ts +50 -52
- package/src/middleware/ContextMiddleware.ts +5 -5
- package/src/migrations/1646578856-validate-addresses.ts +6 -9
- package/src/seeds/0000000000-example.ts +3 -5
- package/src/seeds/1715028563-user-permissions.ts +16 -18
- package/src/seeds/1722256498-group-update-occupancy.ts +12 -12
- package/src/seeds/1722344162-sync-member-users.ts +14 -15
- package/src/seeds/1722344162-update-membership.ts +6 -6
- package/src/seeds/1726055544-balance-item-paid.ts +4 -4
- package/src/seeds/1726055545-balance-item-pending.ts +4 -4
- package/src/seeds/1726494419-update-cached-outstanding-balance.ts +16 -16
- package/src/seeds/1726494420-update-cached-outstanding-balance-from-items.ts +12 -12
- package/src/seeds/1726572303-schedule-stock-updates.ts +12 -12
- package/src/seeds/1726847064-setup-steps.ts +16 -0
- package/src/sql-filters/balance-item-payments.ts +7 -7
- package/src/sql-filters/events.ts +14 -14
- package/src/sql-filters/members.ts +96 -96
- package/src/sql-filters/organizations.ts +139 -75
- package/src/sql-filters/payments.ts +28 -28
- package/src/sql-filters/registrations.ts +14 -14
- package/src/sql-sorters/events.ts +25 -25
- package/src/sql-sorters/members.ts +26 -26
- package/src/sql-sorters/organizations.ts +36 -36
- package/src/sql-sorters/payments.ts +26 -26
- package/tests/e2e/stock.test.ts +616 -621
- package/tests/e2e/tickets.test.ts +255 -260
- package/tests/helpers/StripeMocker.ts +177 -179
- package/tests/helpers/TestServer.ts +9 -9
- package/tests/jest.global.setup.ts +14 -13
- package/tests/jest.setup.ts +33 -32
- package/.eslintrc.js +0 -61
- package/jest.config.js +0 -11
- package/src/helpers/SetupStepsUpdater.ts +0 -359
- package/src/seeds/1724076679-setup-steps.ts +0 -16
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { field } from
|
|
2
|
-
import { XlsxBuiltInNumberFormat, XlsxTransformerColumn, XlsxTransformerConcreteColumn } from
|
|
3
|
-
import { StripeAccount } from
|
|
4
|
-
import { BalanceItemPaymentDetailed, BalanceItemRelationType, ExcelExportType, getBalanceItemRelationTypeName, getBalanceItemTypeName, PaginatedResponse, PaymentGeneral, PaymentMethodHelper, PaymentStatusHelper, StripeAccount as StripeAccountStruct } from
|
|
5
|
-
import { Formatter } from
|
|
6
|
-
import { ExportToExcelEndpoint } from
|
|
7
|
-
import { GetPaymentsEndpoint } from
|
|
8
|
-
import { XlsxTransformerColumnHelper } from
|
|
1
|
+
import { field } from '@simonbackx/simple-encoding';
|
|
2
|
+
import { XlsxBuiltInNumberFormat, XlsxTransformerColumn, XlsxTransformerConcreteColumn } from '@stamhoofd/excel-writer';
|
|
3
|
+
import { StripeAccount } from '@stamhoofd/models';
|
|
4
|
+
import { BalanceItemPaymentDetailed, BalanceItemRelationType, ExcelExportType, getBalanceItemRelationTypeName, getBalanceItemTypeName, PaginatedResponse, PaymentGeneral, PaymentMethodHelper, PaymentStatusHelper, StripeAccount as StripeAccountStruct } from '@stamhoofd/structures';
|
|
5
|
+
import { Formatter } from '@stamhoofd/utility';
|
|
6
|
+
import { ExportToExcelEndpoint } from '../endpoints/global/files/ExportToExcelEndpoint';
|
|
7
|
+
import { GetPaymentsEndpoint } from '../endpoints/organization/dashboard/payments/GetPaymentsEndpoint';
|
|
8
|
+
import { XlsxTransformerColumnHelper } from '../helpers/xlsxAddressTransformerColumnFactory';
|
|
9
9
|
|
|
10
10
|
type PaymentWithItem = {
|
|
11
|
-
payment: PaymentGeneral
|
|
12
|
-
balanceItemPayment: BalanceItemPaymentDetailed
|
|
13
|
-
}
|
|
11
|
+
payment: PaymentGeneral;
|
|
12
|
+
balanceItemPayment: BalanceItemPaymentDetailed;
|
|
13
|
+
};
|
|
14
14
|
|
|
15
15
|
export class PaymentGeneralWithStripeAccount extends PaymentGeneral {
|
|
16
16
|
@field({ decoder: StripeAccountStruct, nullable: true })
|
|
17
|
-
stripeAccount: StripeAccountStruct|null = null
|
|
17
|
+
stripeAccount: StripeAccountStruct | null = null;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
ExportToExcelEndpoint.loaders.set(ExcelExportType.Payments, {
|
|
@@ -31,12 +31,12 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Payments, {
|
|
|
31
31
|
|
|
32
32
|
return new PaginatedResponse({
|
|
33
33
|
...data,
|
|
34
|
-
results: data.results.map(p => {
|
|
34
|
+
results: data.results.map((p) => {
|
|
35
35
|
const payment = PaymentGeneralWithStripeAccount.create(p);
|
|
36
36
|
payment.stripeAccount = p.stripeAccountId ? (accounts.find(a => a.id === p.stripeAccountId) ?? null) : null;
|
|
37
37
|
return payment;
|
|
38
|
-
})
|
|
39
|
-
})
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
40
|
},
|
|
41
41
|
sheets: [
|
|
42
42
|
{
|
|
@@ -48,14 +48,14 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Payments, {
|
|
|
48
48
|
...getSettlementColumns(),
|
|
49
49
|
...getStripeColumns(),
|
|
50
50
|
...getTransferColumns(),
|
|
51
|
-
]
|
|
51
|
+
],
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
id: 'balanceItemPayments',
|
|
55
55
|
name: 'Betaallijnen',
|
|
56
56
|
transform: (data: PaymentGeneral): PaymentWithItem[] => data.balanceItemPayments.map(p => ({
|
|
57
57
|
payment: data,
|
|
58
|
-
balanceItemPayment: p
|
|
58
|
+
balanceItemPayment: p,
|
|
59
59
|
})),
|
|
60
60
|
columns: [
|
|
61
61
|
...getBalanceItemColumns(),
|
|
@@ -64,12 +64,12 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Payments, {
|
|
|
64
64
|
...[
|
|
65
65
|
...getGeneralColumns(),
|
|
66
66
|
...getInvoiceColumns(),
|
|
67
|
-
].map(c => {
|
|
67
|
+
].map((c) => {
|
|
68
68
|
if ('match' in c) {
|
|
69
69
|
return {
|
|
70
70
|
...c,
|
|
71
71
|
match: (id: string) => {
|
|
72
|
-
const result = c.match(id)
|
|
72
|
+
const result = c.match(id);
|
|
73
73
|
if (!result) {
|
|
74
74
|
return result;
|
|
75
75
|
}
|
|
@@ -77,24 +77,24 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Payments, {
|
|
|
77
77
|
return result.map(cc => ({
|
|
78
78
|
...cc,
|
|
79
79
|
getValue: (object: PaymentWithItem) => {
|
|
80
|
-
return cc.getValue(object.payment)
|
|
80
|
+
return cc.getValue(object.payment);
|
|
81
81
|
},
|
|
82
|
-
}))
|
|
82
|
+
}));
|
|
83
83
|
},
|
|
84
|
-
}
|
|
84
|
+
};
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
return {
|
|
88
88
|
...c,
|
|
89
89
|
getValue: (object: PaymentWithItem) => {
|
|
90
|
-
return c.getValue(object.payment)
|
|
90
|
+
return c.getValue(object.payment);
|
|
91
91
|
},
|
|
92
|
-
}
|
|
93
|
-
})
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
})
|
|
92
|
+
};
|
|
93
|
+
}),
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
98
|
|
|
99
99
|
function getBalanceItemColumns(): XlsxTransformerColumn<PaymentWithItem>[] {
|
|
100
100
|
return [
|
|
@@ -106,34 +106,34 @@ function getBalanceItemColumns(): XlsxTransformerColumn<PaymentWithItem>[] {
|
|
|
106
106
|
value: object.balanceItemPayment.id,
|
|
107
107
|
style: {
|
|
108
108
|
font: {
|
|
109
|
-
bold: true
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
})
|
|
109
|
+
bold: true,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
id: 'paymentId',
|
|
116
116
|
name: 'Betaling ID',
|
|
117
117
|
width: 40,
|
|
118
118
|
getValue: (object: PaymentWithItem) => ({
|
|
119
|
-
value: object.payment.id
|
|
120
|
-
})
|
|
119
|
+
value: object.payment.id,
|
|
120
|
+
}),
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
id: 'balanceItem.type',
|
|
124
124
|
name: 'Type',
|
|
125
125
|
width: 30,
|
|
126
126
|
getValue: (object: PaymentWithItem) => ({
|
|
127
|
-
value: getBalanceItemTypeName(object.balanceItemPayment.balanceItem.type)
|
|
128
|
-
})
|
|
127
|
+
value: getBalanceItemTypeName(object.balanceItemPayment.balanceItem.type),
|
|
128
|
+
}),
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
131
|
id: 'balanceItem.description',
|
|
132
132
|
name: 'Beschrijving',
|
|
133
133
|
width: 40,
|
|
134
134
|
getValue: (object: PaymentWithItem) => ({
|
|
135
|
-
value: object.balanceItemPayment.balanceItem.description
|
|
136
|
-
})
|
|
135
|
+
value: object.balanceItemPayment.balanceItem.description,
|
|
136
|
+
}),
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
match: (id) => {
|
|
@@ -146,13 +146,13 @@ function getBalanceItemColumns(): XlsxTransformerColumn<PaymentWithItem>[] {
|
|
|
146
146
|
name: getBalanceItemRelationTypeName(type),
|
|
147
147
|
width: 35,
|
|
148
148
|
getValue: (object: PaymentWithItem) => ({
|
|
149
|
-
value: object.balanceItemPayment.balanceItem.relations.get(type)?.name || ''
|
|
150
|
-
})
|
|
151
|
-
}
|
|
152
|
-
]
|
|
149
|
+
value: object.balanceItemPayment.balanceItem.relations.get(type)?.name || '',
|
|
150
|
+
}),
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
}
|
|
155
|
+
},
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
id: 'amount',
|
|
@@ -162,10 +162,10 @@ function getBalanceItemColumns(): XlsxTransformerColumn<PaymentWithItem>[] {
|
|
|
162
162
|
value: object.balanceItemPayment.amount,
|
|
163
163
|
style: {
|
|
164
164
|
numberFormat: {
|
|
165
|
-
id: XlsxBuiltInNumberFormat.Number
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
})
|
|
165
|
+
id: XlsxBuiltInNumberFormat.Number,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
id: 'unitPrice',
|
|
@@ -175,10 +175,10 @@ function getBalanceItemColumns(): XlsxTransformerColumn<PaymentWithItem>[] {
|
|
|
175
175
|
value: object.balanceItemPayment.unitPrice / 100,
|
|
176
176
|
style: {
|
|
177
177
|
numberFormat: {
|
|
178
|
-
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
})
|
|
178
|
+
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
id: 'price',
|
|
@@ -188,15 +188,14 @@ function getBalanceItemColumns(): XlsxTransformerColumn<PaymentWithItem>[] {
|
|
|
188
188
|
value: object.balanceItemPayment.price / 100,
|
|
189
189
|
style: {
|
|
190
190
|
numberFormat: {
|
|
191
|
-
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
})
|
|
191
|
+
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
}),
|
|
195
195
|
},
|
|
196
|
-
]
|
|
196
|
+
];
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
|
|
200
199
|
function getGeneralColumns(): XlsxTransformerConcreteColumn<PaymentGeneral>[] {
|
|
201
200
|
return [
|
|
202
201
|
{
|
|
@@ -207,10 +206,10 @@ function getGeneralColumns(): XlsxTransformerConcreteColumn<PaymentGeneral>[] {
|
|
|
207
206
|
value: object.id,
|
|
208
207
|
style: {
|
|
209
208
|
font: {
|
|
210
|
-
bold: true
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
})
|
|
209
|
+
bold: true,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
}),
|
|
214
213
|
},
|
|
215
214
|
{
|
|
216
215
|
id: 'price',
|
|
@@ -220,34 +219,34 @@ function getGeneralColumns(): XlsxTransformerConcreteColumn<PaymentGeneral>[] {
|
|
|
220
219
|
value: object.price / 100,
|
|
221
220
|
style: {
|
|
222
221
|
numberFormat: {
|
|
223
|
-
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
})
|
|
222
|
+
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
227
226
|
},
|
|
228
227
|
{
|
|
229
228
|
id: 'status',
|
|
230
229
|
name: 'Status',
|
|
231
230
|
width: 18,
|
|
232
231
|
getValue: (object: PaymentGeneralWithStripeAccount) => ({
|
|
233
|
-
value: PaymentStatusHelper.getNameCapitalized(object.status)
|
|
234
|
-
})
|
|
232
|
+
value: PaymentStatusHelper.getNameCapitalized(object.status),
|
|
233
|
+
}),
|
|
235
234
|
},
|
|
236
235
|
{
|
|
237
236
|
id: 'method',
|
|
238
237
|
name: 'Betaalmethode',
|
|
239
238
|
width: 18,
|
|
240
239
|
getValue: (object: PaymentGeneralWithStripeAccount) => ({
|
|
241
|
-
value: PaymentMethodHelper.getNameCapitalized(object.method)
|
|
242
|
-
})
|
|
240
|
+
value: PaymentMethodHelper.getNameCapitalized(object.method),
|
|
241
|
+
}),
|
|
243
242
|
},
|
|
244
243
|
{
|
|
245
244
|
id: 'provider',
|
|
246
245
|
name: 'Betaalprovider',
|
|
247
246
|
width: 16,
|
|
248
247
|
getValue: (object: PaymentGeneralWithStripeAccount) => ({
|
|
249
|
-
value: object.provider
|
|
250
|
-
})
|
|
248
|
+
value: object.provider,
|
|
249
|
+
}),
|
|
251
250
|
},
|
|
252
251
|
{
|
|
253
252
|
id: 'createdAt',
|
|
@@ -257,10 +256,10 @@ function getGeneralColumns(): XlsxTransformerConcreteColumn<PaymentGeneral>[] {
|
|
|
257
256
|
value: object.createdAt,
|
|
258
257
|
style: {
|
|
259
258
|
numberFormat: {
|
|
260
|
-
id: XlsxBuiltInNumberFormat.DateTimeSlash
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
})
|
|
259
|
+
id: XlsxBuiltInNumberFormat.DateTimeSlash,
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
}),
|
|
264
263
|
},
|
|
265
264
|
{
|
|
266
265
|
id: 'paidAt',
|
|
@@ -270,10 +269,10 @@ function getGeneralColumns(): XlsxTransformerConcreteColumn<PaymentGeneral>[] {
|
|
|
270
269
|
value: object.paidAt,
|
|
271
270
|
style: {
|
|
272
271
|
numberFormat: {
|
|
273
|
-
id: XlsxBuiltInNumberFormat.DateTimeSlash
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
})
|
|
272
|
+
id: XlsxBuiltInNumberFormat.DateTimeSlash,
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
}),
|
|
277
276
|
},
|
|
278
277
|
{
|
|
279
278
|
id: 'description',
|
|
@@ -283,12 +282,12 @@ function getGeneralColumns(): XlsxTransformerConcreteColumn<PaymentGeneral>[] {
|
|
|
283
282
|
value: object.balanceItemPayments.map(p => p.toString()).join('\n'),
|
|
284
283
|
style: {
|
|
285
284
|
alignment: {
|
|
286
|
-
wrapText: true
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
})
|
|
285
|
+
wrapText: true,
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
}),
|
|
290
289
|
},
|
|
291
|
-
]
|
|
290
|
+
];
|
|
292
291
|
}
|
|
293
292
|
|
|
294
293
|
function getSettlementColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
@@ -299,9 +298,9 @@ function getSettlementColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
299
298
|
width: 21,
|
|
300
299
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
301
300
|
return {
|
|
302
|
-
value: object.settlement?.reference || ''
|
|
303
|
-
}
|
|
304
|
-
}
|
|
301
|
+
value: object.settlement?.reference || '',
|
|
302
|
+
};
|
|
303
|
+
},
|
|
305
304
|
},
|
|
306
305
|
{
|
|
307
306
|
id: 'settlement.settledAt',
|
|
@@ -312,11 +311,11 @@ function getSettlementColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
312
311
|
value: object.settlement?.settledAt ?? null,
|
|
313
312
|
style: {
|
|
314
313
|
numberFormat: {
|
|
315
|
-
id: XlsxBuiltInNumberFormat.DateSlash
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
314
|
+
id: XlsxBuiltInNumberFormat.DateSlash,
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
},
|
|
320
319
|
},
|
|
321
320
|
{
|
|
322
321
|
id: 'settlement.amount',
|
|
@@ -327,11 +326,11 @@ function getSettlementColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
327
326
|
value: object.settlement?.amount !== undefined ? (object.settlement?.amount / 100) : null,
|
|
328
327
|
style: {
|
|
329
328
|
numberFormat: {
|
|
330
|
-
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
329
|
+
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed,
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
},
|
|
335
334
|
},
|
|
336
335
|
{
|
|
337
336
|
id: 'settlement.fee',
|
|
@@ -342,13 +341,13 @@ function getSettlementColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
342
341
|
value: object.settlement?.fee !== undefined ? (object.settlement?.fee / 100) : null,
|
|
343
342
|
style: {
|
|
344
343
|
numberFormat: {
|
|
345
|
-
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
]
|
|
344
|
+
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed,
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
];
|
|
352
351
|
}
|
|
353
352
|
|
|
354
353
|
function getStripeColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
@@ -362,11 +361,11 @@ function getStripeColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
362
361
|
value: object.transferFee / 100,
|
|
363
362
|
style: {
|
|
364
363
|
numberFormat: {
|
|
365
|
-
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
364
|
+
id: XlsxBuiltInNumberFormat.Currency2DecimalWithRed,
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
},
|
|
370
369
|
},
|
|
371
370
|
{
|
|
372
371
|
id: 'stripeAccountId',
|
|
@@ -374,9 +373,9 @@ function getStripeColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
374
373
|
width: 20,
|
|
375
374
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
376
375
|
return {
|
|
377
|
-
value: object.stripeAccount?.accountId || ''
|
|
378
|
-
}
|
|
379
|
-
}
|
|
376
|
+
value: object.stripeAccount?.accountId || '',
|
|
377
|
+
};
|
|
378
|
+
},
|
|
380
379
|
},
|
|
381
380
|
{
|
|
382
381
|
id: 'iban',
|
|
@@ -384,9 +383,9 @@ function getStripeColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
384
383
|
width: 20,
|
|
385
384
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
386
385
|
return {
|
|
387
|
-
value: object.iban || ''
|
|
388
|
-
}
|
|
389
|
-
}
|
|
386
|
+
value: object.iban || '',
|
|
387
|
+
};
|
|
388
|
+
},
|
|
390
389
|
},
|
|
391
390
|
{
|
|
392
391
|
id: 'ibanName',
|
|
@@ -394,11 +393,11 @@ function getStripeColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
394
393
|
width: 20,
|
|
395
394
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
396
395
|
return {
|
|
397
|
-
value: object.ibanName || ''
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
]
|
|
396
|
+
value: object.ibanName || '',
|
|
397
|
+
};
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
];
|
|
402
401
|
}
|
|
403
402
|
|
|
404
403
|
function getTransferColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
@@ -409,9 +408,9 @@ function getTransferColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
409
408
|
width: 25,
|
|
410
409
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
411
410
|
return {
|
|
412
|
-
value: object.transferDescription || ''
|
|
413
|
-
}
|
|
414
|
-
}
|
|
411
|
+
value: object.transferDescription || '',
|
|
412
|
+
};
|
|
413
|
+
},
|
|
415
414
|
},
|
|
416
415
|
{
|
|
417
416
|
id: 'transferSettings.creditor',
|
|
@@ -420,14 +419,14 @@ function getTransferColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
420
419
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
421
420
|
if (!object.transferSettings && object.stripeAccount && object.stripeAccount?.meta.bank_account_bank_name) {
|
|
422
421
|
return {
|
|
423
|
-
value: (object.stripeAccount.meta.bank_account_name || object.stripeAccount.meta.business_profile?.name || object.stripeAccount.meta.company?.name) + ' (' + (object.stripeAccount?.meta.bank_account_bank_name || '') + ')'
|
|
424
|
-
}
|
|
422
|
+
value: (object.stripeAccount.meta.bank_account_name || object.stripeAccount.meta.business_profile?.name || object.stripeAccount.meta.company?.name) + ' (' + (object.stripeAccount?.meta.bank_account_bank_name || '') + ')',
|
|
423
|
+
};
|
|
425
424
|
}
|
|
426
425
|
|
|
427
426
|
return {
|
|
428
|
-
value: object.transferSettings?.creditor || ''
|
|
429
|
-
}
|
|
430
|
-
}
|
|
427
|
+
value: object.transferSettings?.creditor || '',
|
|
428
|
+
};
|
|
429
|
+
},
|
|
431
430
|
},
|
|
432
431
|
{
|
|
433
432
|
id: 'transferSettings.iban',
|
|
@@ -436,16 +435,16 @@ function getTransferColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
436
435
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
437
436
|
if (!object.transferSettings && object.stripeAccount && object.stripeAccount?.meta.bank_account_last4) {
|
|
438
437
|
return {
|
|
439
|
-
value: 'xxxx ' + object.stripeAccount?.meta.bank_account_last4
|
|
440
|
-
}
|
|
438
|
+
value: 'xxxx ' + object.stripeAccount?.meta.bank_account_last4,
|
|
439
|
+
};
|
|
441
440
|
}
|
|
442
441
|
|
|
443
442
|
return {
|
|
444
|
-
value: object.transferSettings?.iban || ''
|
|
445
|
-
}
|
|
446
|
-
}
|
|
443
|
+
value: object.transferSettings?.iban || '',
|
|
444
|
+
};
|
|
445
|
+
},
|
|
447
446
|
},
|
|
448
|
-
]
|
|
447
|
+
];
|
|
449
448
|
}
|
|
450
449
|
|
|
451
450
|
function getInvoiceColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
@@ -456,9 +455,9 @@ function getInvoiceColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
456
455
|
width: 30,
|
|
457
456
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
458
457
|
return {
|
|
459
|
-
value: object.customer?.name || ''
|
|
460
|
-
}
|
|
461
|
-
}
|
|
458
|
+
value: object.customer?.name || '',
|
|
459
|
+
};
|
|
460
|
+
},
|
|
462
461
|
},
|
|
463
462
|
{
|
|
464
463
|
id: 'customer.email',
|
|
@@ -466,9 +465,9 @@ function getInvoiceColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
466
465
|
width: 40,
|
|
467
466
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
468
467
|
return {
|
|
469
|
-
value: object.customer?.email || ''
|
|
470
|
-
}
|
|
471
|
-
}
|
|
468
|
+
value: object.customer?.email || '',
|
|
469
|
+
};
|
|
470
|
+
},
|
|
472
471
|
},
|
|
473
472
|
{
|
|
474
473
|
id: 'customer.company.name',
|
|
@@ -476,9 +475,9 @@ function getInvoiceColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
476
475
|
width: 30,
|
|
477
476
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
478
477
|
return {
|
|
479
|
-
value: object.customer?.company?.name || ''
|
|
480
|
-
}
|
|
481
|
-
}
|
|
478
|
+
value: object.customer?.company?.name || '',
|
|
479
|
+
};
|
|
480
|
+
},
|
|
482
481
|
},
|
|
483
482
|
{
|
|
484
483
|
id: 'customer.company.VATNumber',
|
|
@@ -486,9 +485,9 @@ function getInvoiceColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
486
485
|
width: 20,
|
|
487
486
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
488
487
|
return {
|
|
489
|
-
value: object.customer?.company?.VATNumber || ''
|
|
490
|
-
}
|
|
491
|
-
}
|
|
488
|
+
value: object.customer?.company?.VATNumber || '',
|
|
489
|
+
};
|
|
490
|
+
},
|
|
492
491
|
},
|
|
493
492
|
{
|
|
494
493
|
id: 'customer.company.companyNumber',
|
|
@@ -496,14 +495,14 @@ function getInvoiceColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
496
495
|
width: 20,
|
|
497
496
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
498
497
|
return {
|
|
499
|
-
value: object.customer?.company?.companyNumber || ''
|
|
500
|
-
}
|
|
501
|
-
}
|
|
498
|
+
value: object.customer?.company?.companyNumber || '',
|
|
499
|
+
};
|
|
500
|
+
},
|
|
502
501
|
},
|
|
503
502
|
XlsxTransformerColumnHelper.createAddressColumns<PaymentGeneralWithStripeAccount>({
|
|
504
503
|
matchId: 'customer.company.address',
|
|
505
|
-
getAddress:
|
|
506
|
-
identifier: 'Adres'
|
|
504
|
+
getAddress: object => object.customer?.company?.address,
|
|
505
|
+
identifier: 'Adres',
|
|
507
506
|
}),
|
|
508
507
|
{
|
|
509
508
|
id: 'customer.company.administrationEmail',
|
|
@@ -511,9 +510,9 @@ function getInvoiceColumns(): XlsxTransformerColumn<PaymentGeneral>[] {
|
|
|
511
510
|
width: 30,
|
|
512
511
|
getValue: (object: PaymentGeneralWithStripeAccount) => {
|
|
513
512
|
return {
|
|
514
|
-
value: object.customer?.company?.administrationEmail || ''
|
|
515
|
-
}
|
|
516
|
-
}
|
|
513
|
+
value: object.customer?.company?.administrationEmail || '',
|
|
514
|
+
};
|
|
515
|
+
},
|
|
517
516
|
},
|
|
518
|
-
]
|
|
517
|
+
];
|
|
519
518
|
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { City, PostalCode, Province } from
|
|
2
|
-
import { Address, Country } from
|
|
1
|
+
import { City, PostalCode, Province } from '@stamhoofd/models';
|
|
2
|
+
import { Address, Country } from '@stamhoofd/structures';
|
|
3
3
|
|
|
4
|
-
import { AddressValidator } from
|
|
4
|
+
import { AddressValidator } from './AddressValidator';
|
|
5
5
|
|
|
6
|
-
describe(
|
|
7
|
-
it(
|
|
8
|
-
const province = new Province()
|
|
9
|
-
province.name =
|
|
10
|
-
province.country = Country.Belgium
|
|
11
|
-
await province.save()
|
|
6
|
+
describe('AddressValidator', () => {
|
|
7
|
+
it('Can validate a city', async () => {
|
|
8
|
+
const province = new Province();
|
|
9
|
+
province.name = 'Oost-Vlaanderen';
|
|
10
|
+
province.country = Country.Belgium;
|
|
11
|
+
await province.save();
|
|
12
12
|
|
|
13
|
-
const city = new City()
|
|
14
|
-
city.name =
|
|
15
|
-
city.country = Country.Belgium
|
|
16
|
-
city.provinceId = province.id
|
|
17
|
-
await city.save()
|
|
13
|
+
const city = new City();
|
|
14
|
+
city.name = 'Wetteren';
|
|
15
|
+
city.country = Country.Belgium;
|
|
16
|
+
city.provinceId = province.id;
|
|
17
|
+
await city.save();
|
|
18
18
|
|
|
19
|
-
const postalCode = new PostalCode()
|
|
20
|
-
postalCode.cityId = city.id
|
|
21
|
-
postalCode.postalCode =
|
|
22
|
-
postalCode.country = Country.Belgium
|
|
23
|
-
await postalCode.save()
|
|
19
|
+
const postalCode = new PostalCode();
|
|
20
|
+
postalCode.cityId = city.id;
|
|
21
|
+
postalCode.postalCode = '9230';
|
|
22
|
+
postalCode.country = Country.Belgium;
|
|
23
|
+
await postalCode.save();
|
|
24
24
|
|
|
25
|
-
expect(true).toBe(true)
|
|
25
|
+
expect(true).toBe(true);
|
|
26
26
|
|
|
27
27
|
const validateAddress = Address.create({
|
|
28
28
|
country: Country.Belgium,
|
|
29
|
-
city:
|
|
30
|
-
street:
|
|
31
|
-
postalCode:
|
|
32
|
-
number:
|
|
33
|
-
})
|
|
34
|
-
const validated = await AddressValidator.validate(validateAddress)
|
|
35
|
-
expect(validated.street).toEqual(
|
|
36
|
-
expect(validated.city).toEqual(
|
|
37
|
-
expect(validated.postalCode).toEqual(
|
|
38
|
-
expect(validated.number).toEqual(
|
|
39
|
-
})
|
|
40
|
-
})
|
|
29
|
+
city: 'Wetteren',
|
|
30
|
+
street: 'Kerkstraat',
|
|
31
|
+
postalCode: '9230',
|
|
32
|
+
number: '12',
|
|
33
|
+
});
|
|
34
|
+
const validated = await AddressValidator.validate(validateAddress);
|
|
35
|
+
expect(validated.street).toEqual('Kerkstraat');
|
|
36
|
+
expect(validated.city).toEqual('Wetteren');
|
|
37
|
+
expect(validated.postalCode).toEqual('9230');
|
|
38
|
+
expect(validated.number).toEqual('12');
|
|
39
|
+
});
|
|
40
|
+
});
|