vona-module-test-pay 5.0.8 → 5.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-module-test-pay",
3
- "version": "5.0.8",
3
+ "version": "5.0.9",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "Vona Module"
@@ -30,9 +30,9 @@
30
30
  "postpack": "clean-package restore"
31
31
  },
32
32
  "dependencies": {
33
- "vona-module-a-pay": "5.0.9",
34
- "vona-module-pay-mock": "5.0.9",
35
- "vona-module-pay-stripe": "5.0.9"
33
+ "vona-module-a-pay": "5.0.10",
34
+ "vona-module-pay-mock": "5.0.10",
35
+ "vona-module-pay-stripe": "5.0.10"
36
36
  },
37
37
  "title": "test-pay",
38
38
  "vonaModule": {
@@ -52,5 +52,5 @@
52
52
  }
53
53
  }
54
54
  },
55
- "gitHead": "94435329d69fc19d0d15e4e10c3b1111e99ab1cf"
55
+ "gitHead": "8d575dd958be6aa16daa249bdbdb024d20d0789d"
56
56
  }
@@ -0,0 +1,66 @@
1
+ import type { IMetaOptionsIndex } from 'vona-module-a-index';
2
+
3
+ import assert from 'node:assert/strict';
4
+ import { describe, it } from 'node:test';
5
+ import { appResource } from 'vona';
6
+ import { app } from 'vona-mock';
7
+
8
+ const expectedIndexes = {
9
+ payPaymentSession: [
10
+ 'businessReference',
11
+ 'providerCorrelationReference',
12
+ 'state+expiresAt',
13
+ 'providerPaymentId',
14
+ 'providerOrderId',
15
+ 'providerCaptureId',
16
+ ],
17
+ payProviderOperation: [
18
+ 'paymentSessionId+kind',
19
+ 'refundOperationId',
20
+ 'nextAttemptAt+state',
21
+ 'claimExpiresAt+state',
22
+ 'idempotencyKey',
23
+ ],
24
+ payProviderOperationRecoveryAudit: [
25
+ 'providerOperationId+actionIdempotencyKey',
26
+ 'occurredAt+providerOperationId',
27
+ ],
28
+ payRefundOperation: [
29
+ 'paymentSessionId',
30
+ 'providerCorrelationReference',
31
+ 'providerRefundId',
32
+ 'state',
33
+ ],
34
+ payWebhookInbox: ['providerName+clientName', 'providerEventId', 'paymentSessionId', 'state'],
35
+ payPaymentAudit: 'paymentSessionId',
36
+ payOutboxEvent: ['refundOperationId', 'nextAttemptAt+state', 'claimExpiresAt+state'],
37
+ };
38
+
39
+ describe('paymentIndexes.test.ts', { concurrency: false }, () => {
40
+ it('registers every payment index without overwriting table keys', () => {
41
+ const options = appResource.getBean('a-pay.meta.index')?.options as IMetaOptionsIndex;
42
+ assert.ok(options);
43
+ assert.deepEqual(options.indexes, expectedIndexes);
44
+ });
45
+
46
+ it('creates the refund and recovery lookup indexes', async () => {
47
+ await app.bean.executor.mockCtx(async () => {
48
+ const db = app.bean.database.current;
49
+ for (const table of [
50
+ 'payRefundOperation',
51
+ 'payProviderOperation',
52
+ 'payProviderOperationRecoveryAudit',
53
+ ]) {
54
+ const indexes = await db.dialect.fetchIndexes(db.connection.schema, table);
55
+ const names = new Set(indexes.map(index => index.indexName));
56
+ for (const field of expectedIndexes[table]) {
57
+ const firstColumn = field.split('+')[0];
58
+ assert.ok(
59
+ names.has(`idx_${table}_${firstColumn}`),
60
+ `${table}: ${field}; indexes: ${[...names]}`,
61
+ );
62
+ }
63
+ }
64
+ });
65
+ });
66
+ });