@stamhoofd/models 2.148.0 → 2.150.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/dist/migrations/1788194373-settlements-sync-errors.sql +1 -0
- package/dist/models/Settlement.d.ts +6 -0
- package/dist/models/Settlement.d.ts.map +1 -1
- package/dist/models/Settlement.js +10 -0
- package/dist/models/Settlement.js.map +1 -1
- package/package.json +6 -6
- package/src/migrations/1788194373-settlements-sync-errors.sql +1 -0
- package/src/models/Settlement.ts +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `settlements` ADD COLUMN `syncErrors` json NULL AFTER `syncFailureCount`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QueryableModel } from '@stamhoofd/sql';
|
|
2
2
|
import type { PaymentProvider } from '@stamhoofd/structures';
|
|
3
3
|
import { SettlementStatus } from '@stamhoofd/structures/settlements/SettlementStatus.js';
|
|
4
|
+
import { SettlementSyncError } from '@stamhoofd/structures/settlements/SettlementSyncError.js';
|
|
4
5
|
/**
|
|
5
6
|
* One payout of a payment provider, always owned by the organization whose provider account paid
|
|
6
7
|
* out. The platform's own accounts (the platform Stripe account, the platform Mollie token) belong
|
|
@@ -32,6 +33,11 @@ export declare class Settlement extends QueryableModel {
|
|
|
32
33
|
*/
|
|
33
34
|
syncedAt: Date | null;
|
|
34
35
|
syncFailureCount: number;
|
|
36
|
+
/**
|
|
37
|
+
* Errors of the last sync attempt; NULL when it completed without errors. The queryable error
|
|
38
|
+
* queue: `syncErrors IS NOT NULL` lists every payout that needs a look.
|
|
39
|
+
*/
|
|
40
|
+
syncErrors: SettlementSyncError[] | null;
|
|
35
41
|
/**
|
|
36
42
|
* amount minus the sum of all stored payment lines, charges and pending fees, cached after
|
|
37
43
|
* every sync. Expected to be 0.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settlement.d.ts","sourceRoot":"","sources":["../../src/models/Settlement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Settlement.d.ts","sourceRoot":"","sources":["../../src/models/Settlement.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uDAAuD,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAG/F;;;;;;GAMG;AACH,qBAAa,UAAW,SAAQ,cAAc;IAC1C,MAAM,CAAC,KAAK,SAAiB;IAO7B,EAAE,EAAG,MAAM,CAAC;IAGZ,QAAQ,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IAEH,UAAU,EAAE,MAAM,CAAC;IAGnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAGtC,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IAEH,SAAS,SAAM;IAGf,MAAM,SAAK;IAGX,QAAQ,SAAS;IAGjB,MAAM,EAAE,gBAAgB,CAAyB;IAGjD,SAAS,EAAE,IAAI,CAAC;IAEhB;;OAEG;IAEH,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAQ;IAG7B,gBAAgB,SAAK;IAErB;;;OAGG;IAEH,UAAU,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAQ;IAEhD;;;OAGG;IAEH,iBAAiB,SAAK;IAEtB;;;;OAIG;IAEH,WAAW,SAAK;IAEhB;;;;;OAKG;IAEH,iBAAiB,SAAK;IAEtB;;OAEG;IAEH,gBAAgB,SAAK;IAYrB,SAAS,EAAE,IAAI,CAAC;IAUhB,SAAS,EAAE,IAAI,CAAC;CACnB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { column } from '@simonbackx/simple-database';
|
|
3
|
+
import { ArrayDecoder } from '@simonbackx/simple-encoding';
|
|
3
4
|
import { QueryableModel } from '@stamhoofd/sql';
|
|
4
5
|
import { SettlementStatus } from '@stamhoofd/structures/settlements/SettlementStatus.js';
|
|
6
|
+
import { SettlementSyncError } from '@stamhoofd/structures/settlements/SettlementSyncError.js';
|
|
5
7
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
8
|
/**
|
|
7
9
|
* One payout of a payment provider, always owned by the organization whose provider account paid
|
|
@@ -34,6 +36,11 @@ export class Settlement extends QueryableModel {
|
|
|
34
36
|
*/
|
|
35
37
|
syncedAt = null;
|
|
36
38
|
syncFailureCount = 0;
|
|
39
|
+
/**
|
|
40
|
+
* Errors of the last sync attempt; NULL when it completed without errors. The queryable error
|
|
41
|
+
* queue: `syncErrors IS NOT NULL` lists every payout that needs a look.
|
|
42
|
+
*/
|
|
43
|
+
syncErrors = null;
|
|
37
44
|
/**
|
|
38
45
|
* amount minus the sum of all stored payment lines, charges and pending fees, cached after
|
|
39
46
|
* every sync. Expected to be 0.
|
|
@@ -99,6 +106,9 @@ __decorate([
|
|
|
99
106
|
__decorate([
|
|
100
107
|
column({ type: 'integer' })
|
|
101
108
|
], Settlement.prototype, "syncFailureCount", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
column({ type: 'json', decoder: new ArrayDecoder(SettlementSyncError), nullable: true })
|
|
111
|
+
], Settlement.prototype, "syncErrors", void 0);
|
|
102
112
|
__decorate([
|
|
103
113
|
column({ type: 'integer' })
|
|
104
114
|
], Settlement.prototype, "unexplainedAmount", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settlement.js","sourceRoot":"","sources":["../../src/models/Settlement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uDAAuD,CAAC;AACzF,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC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AAO,IAAI,CAAC;QAChB,CAAC;QACD,UAAU,EAAE,IAAI;KACnB,CAAC;6CACc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stamhoofd/models",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.150.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@simonbackx/simple-encoding": "2.26.11",
|
|
36
36
|
"@simonbackx/simple-endpoints": "1.22.0",
|
|
37
37
|
"@simonbackx/simple-errors": "1.5.0",
|
|
38
|
-
"argon2": "0.
|
|
38
|
+
"argon2": "0.45.1",
|
|
39
39
|
"base-x": "3.0.11",
|
|
40
40
|
"handlebars": "4.7.9",
|
|
41
41
|
"luxon": "3.7.2",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"uuid": "14.0.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@simonbackx/simple-database": "1.
|
|
47
|
-
"@stamhoofd/test-utils": "2.
|
|
46
|
+
"@simonbackx/simple-database": "1.40.0",
|
|
47
|
+
"@stamhoofd/test-utils": "2.150.0",
|
|
48
48
|
"@types/luxon": "3.7.2",
|
|
49
49
|
"@types/uuid": "8.3.4",
|
|
50
50
|
"vitest": "4.1.10"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@simonbackx/simple-database": "1.
|
|
53
|
+
"@simonbackx/simple-database": "1.40.0",
|
|
54
54
|
"@stamhoofd/backend-i18n": "*",
|
|
55
55
|
"@stamhoofd/email": "*",
|
|
56
56
|
"@stamhoofd/queues": "*",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "94d90d85b97e7e2ad677897a17920f5a8151d296"
|
|
67
67
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `settlements` ADD COLUMN `syncErrors` json NULL AFTER `syncFailureCount`;
|
package/src/models/Settlement.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { column } from '@simonbackx/simple-database';
|
|
2
|
+
import { ArrayDecoder } from '@simonbackx/simple-encoding';
|
|
2
3
|
import { QueryableModel } from '@stamhoofd/sql';
|
|
3
4
|
import type { PaymentProvider } from '@stamhoofd/structures';
|
|
4
5
|
import { SettlementStatus } from '@stamhoofd/structures/settlements/SettlementStatus.js';
|
|
6
|
+
import { SettlementSyncError } from '@stamhoofd/structures/settlements/SettlementSyncError.js';
|
|
5
7
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -64,6 +66,13 @@ export class Settlement extends QueryableModel {
|
|
|
64
66
|
@column({ type: 'integer' })
|
|
65
67
|
syncFailureCount = 0;
|
|
66
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Errors of the last sync attempt; NULL when it completed without errors. The queryable error
|
|
71
|
+
* queue: `syncErrors IS NOT NULL` lists every payout that needs a look.
|
|
72
|
+
*/
|
|
73
|
+
@column({ type: 'json', decoder: new ArrayDecoder(SettlementSyncError), nullable: true })
|
|
74
|
+
syncErrors: SettlementSyncError[] | null = null;
|
|
75
|
+
|
|
67
76
|
/**
|
|
68
77
|
* amount minus the sum of all stored payment lines, charges and pending fees, cached after
|
|
69
78
|
* every sync. Expected to be 0.
|