@accounter/server 0.0.9-alpha-20251211084417-bd969ff3311bc514c5796ad31c7d5b5691e3645e → 0.0.9-alpha-20251211102658-1b334ef361fc6faf8cd44900059dd236994fe9ab
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/CHANGELOG.md +5 -5
- package/GMAIL_LISTENER.md +7 -7
- package/dist/server/src/__tests__/factories/charge.d.ts +1 -3
- package/dist/server/src/__tests__/factories/charge.js +1 -2
- package/dist/server/src/__tests__/factories/charge.js.map +1 -1
- package/dist/server/src/__tests__/factories/transaction.d.ts +1 -3
- package/dist/server/src/__tests__/factories/transaction.js +0 -1
- package/dist/server/src/__tests__/factories/transaction.js.map +1 -1
- package/dist/server/src/__tests__/helpers/fixture-loader.d.ts +3 -7
- package/dist/server/src/__tests__/helpers/fixture-loader.js +20 -28
- package/dist/server/src/__tests__/helpers/fixture-loader.js.map +1 -1
- package/dist/server/src/__tests__/helpers/fixture-types.d.ts +3 -1
- package/dist/server/src/modules/accountant-approval/index.js +1 -1
- package/dist/server/src/modules/accountant-approval/index.js.map +1 -1
- package/dist/server/src/modules/admin-context/index.js +1 -1
- package/dist/server/src/modules/admin-context/index.js.map +1 -1
- package/dist/server/src/modules/bank-deposits/index.js +1 -1
- package/dist/server/src/modules/bank-deposits/index.js.map +1 -1
- package/dist/server/src/modules/bank-deposits/providers/bank-deposit-transactions.provider.d.ts +4 -4
- package/dist/server/src/modules/business-trips/index.js +3 -3
- package/dist/server/src/modules/business-trips/index.js.map +1 -1
- package/dist/server/src/modules/charges/index.js +4 -4
- package/dist/server/src/modules/charges/index.js.map +1 -1
- package/dist/server/src/modules/charges-matcher/index.js +1 -1
- package/dist/server/src/modules/charges-matcher/index.js.map +1 -1
- package/dist/server/src/modules/charts/index.js +1 -1
- package/dist/server/src/modules/charts/index.js.map +1 -1
- package/dist/server/src/modules/common/index.js +4 -4
- package/dist/server/src/modules/common/index.js.map +1 -1
- package/dist/server/src/modules/common/resolvers/timeless-date.d.ts +1 -1
- package/dist/server/src/modules/contracts/index.js +1 -1
- package/dist/server/src/modules/contracts/index.js.map +1 -1
- package/dist/server/src/modules/corn-jobs/index.js +1 -1
- package/dist/server/src/modules/corn-jobs/index.js.map +1 -1
- package/dist/server/src/modules/corporate-taxes/index.js +1 -1
- package/dist/server/src/modules/corporate-taxes/index.js.map +1 -1
- package/dist/server/src/modules/corporate-taxes/providers/corporate-taxes.provider.d.ts +1 -1
- package/dist/server/src/modules/countries/index.js +1 -1
- package/dist/server/src/modules/countries/index.js.map +1 -1
- package/dist/server/src/modules/deel/index.js +1 -1
- package/dist/server/src/modules/deel/index.js.map +1 -1
- package/dist/server/src/modules/depreciation/index.js +1 -1
- package/dist/server/src/modules/depreciation/index.js.map +1 -1
- package/dist/server/src/modules/dividends/index.js +1 -1
- package/dist/server/src/modules/dividends/index.js.map +1 -1
- package/dist/server/src/modules/documents/index.js +3 -3
- package/dist/server/src/modules/documents/index.js.map +1 -1
- package/dist/server/src/modules/exchange-rates/index.js +1 -1
- package/dist/server/src/modules/exchange-rates/index.js.map +1 -1
- package/dist/server/src/modules/financial-accounts/index.js +2 -2
- package/dist/server/src/modules/financial-accounts/index.js.map +1 -1
- package/dist/server/src/modules/financial-entities/index.js +6 -6
- package/dist/server/src/modules/financial-entities/index.js.map +1 -1
- package/dist/server/src/modules/green-invoice/index.js +1 -1
- package/dist/server/src/modules/green-invoice/index.js.map +1 -1
- package/dist/server/src/modules/ledger/__tests__/helpers/ledger-assertions.js +4 -4
- package/dist/server/src/modules/ledger/index.js +1 -1
- package/dist/server/src/modules/ledger/index.js.map +1 -1
- package/dist/server/src/modules/misc-expenses/index.js +1 -1
- package/dist/server/src/modules/misc-expenses/index.js.map +1 -1
- package/dist/server/src/modules/reports/helpers/pcn.helper.d.ts +1 -1
- package/dist/server/src/modules/reports/index.js +12 -12
- package/dist/server/src/modules/reports/index.js.map +1 -1
- package/dist/server/src/modules/salaries/index.js +3 -3
- package/dist/server/src/modules/salaries/index.js.map +1 -1
- package/dist/server/src/modules/sort-codes/index.js +1 -1
- package/dist/server/src/modules/sort-codes/index.js.map +1 -1
- package/dist/server/src/modules/tags/index.js +1 -1
- package/dist/server/src/modules/tags/index.js.map +1 -1
- package/dist/server/src/modules/transactions/helpers/effective-date.helper.d.ts +1 -1
- package/dist/server/src/modules/transactions/index.js +3 -3
- package/dist/server/src/modules/transactions/index.js.map +1 -1
- package/dist/server/src/modules/vat/index.js +1 -1
- package/dist/server/src/modules/vat/index.js.map +1 -1
- package/dist/server/src/modules/vat/providers/vat.provider.d.ts +1 -1
- package/docs/implementation-guide.md +2 -2
- package/package.json +1 -1
- package/src/__tests__/factories/charge.ts +2 -4
- package/src/__tests__/factories/transaction.ts +1 -3
- package/src/__tests__/helpers/fixture-loader.ts +22 -30
- package/src/__tests__/helpers/fixture-types.ts +3 -1
- package/src/modules/accountant-approval/index.ts +1 -1
- package/src/modules/admin-context/index.ts +1 -1
- package/src/modules/bank-deposits/index.ts +1 -1
- package/src/modules/business-trips/index.ts +3 -3
- package/src/modules/charges/index.ts +4 -4
- package/src/modules/charges-matcher/README.md +12 -12
- package/src/modules/charges-matcher/documentation/SPEC.md +103 -103
- package/src/modules/charges-matcher/index.ts +1 -1
- package/src/modules/charts/index.ts +1 -1
- package/src/modules/common/index.ts +4 -4
- package/src/modules/contracts/index.ts +1 -1
- package/src/modules/corn-jobs/index.ts +1 -1
- package/src/modules/corporate-taxes/index.ts +1 -1
- package/src/modules/countries/index.ts +1 -1
- package/src/modules/deel/index.ts +1 -1
- package/src/modules/depreciation/index.ts +1 -1
- package/src/modules/dividends/index.ts +1 -1
- package/src/modules/documents/index.ts +3 -3
- package/src/modules/exchange-rates/index.ts +1 -1
- package/src/modules/financial-accounts/index.ts +2 -2
- package/src/modules/financial-entities/index.ts +6 -6
- package/src/modules/green-invoice/index.ts +1 -1
- package/src/modules/ledger/__tests__/helpers/ledger-assertions.ts +5 -4
- package/src/modules/ledger/__tests__/ledger-scenario-a.integration.test.ts +2 -2
- package/src/modules/ledger/index.ts +1 -1
- package/src/modules/misc-expenses/index.ts +1 -1
- package/src/modules/reports/index.ts +12 -12
- package/src/modules/salaries/index.ts +3 -3
- package/src/modules/sort-codes/index.ts +1 -1
- package/src/modules/tags/index.ts +1 -1
- package/src/modules/transactions/index.ts +3 -3
- package/src/modules/vat/index.ts +1 -1
|
@@ -91,8 +91,8 @@ Avoids full GraphQL application boot:
|
|
|
91
91
|
Usage Pattern:
|
|
92
92
|
|
|
93
93
|
```typescript
|
|
94
|
-
const { injector, adminContext } = createLedgerTestContext({ pool, mockExchangeRates })
|
|
95
|
-
const result = await ledgerGenerationByCharge({ chargeId }, { injector, adminContext })
|
|
94
|
+
const { injector, adminContext } = createLedgerTestContext({ pool, mockExchangeRates })
|
|
95
|
+
const result = await ledgerGenerationByCharge({ chargeId }, { injector, adminContext })
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
## 8. Environment Isolation
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Based on charges table schema from migrations and charges.provider.ts:
|
|
7
7
|
* - Required: owner_id
|
|
8
|
-
* - Optional: type, accountant_status, user_description, tax_category_id, optional_vat, documents_optional_flag
|
|
8
|
+
* - Optional: type, accountant_status, user_description, tax_category_id, optional_vat, documents_optional_flag
|
|
9
9
|
*
|
|
10
10
|
* @see packages/server/src/modules/charges/providers/charges.provider.ts (generateCharge query)
|
|
11
11
|
* @see packages/migrations/src/actions/*-charges-*.ts (migrations)
|
|
@@ -22,7 +22,6 @@ import { makeUUID, makeUUIDLegacy } from '../../demo-fixtures/helpers/determinis
|
|
|
22
22
|
export interface ChargeInsertParams {
|
|
23
23
|
id?: string;
|
|
24
24
|
owner_id: string;
|
|
25
|
-
is_property?: boolean | null;
|
|
26
25
|
type?: string | null;
|
|
27
26
|
accountant_status?: string | null;
|
|
28
27
|
user_description?: string | null;
|
|
@@ -46,7 +45,6 @@ export interface ChargeInsertParams {
|
|
|
46
45
|
* - accountant_status defaults to 'PENDING' (database requires NOT NULL)
|
|
47
46
|
* - optional_vat defaults to false (database requires NOT NULL)
|
|
48
47
|
* - documents_optional_flag defaults to false (database requires NOT NULL)
|
|
49
|
-
* - is_property defaults to null (property-related charges can override to true)
|
|
50
48
|
* - id defaults to deterministic UUID if not provided
|
|
51
49
|
*
|
|
52
50
|
* @example
|
|
@@ -99,4 +97,4 @@ export function createCharge(
|
|
|
99
97
|
documents_optional_flag: false,
|
|
100
98
|
...overrides,
|
|
101
99
|
};
|
|
102
|
-
}
|
|
100
|
+
}
|
|
@@ -31,10 +31,9 @@ export interface TransactionInsertParams {
|
|
|
31
31
|
event_date: string;
|
|
32
32
|
debit_date?: string | null;
|
|
33
33
|
amount: string; // PostgreSQL numeric -> string
|
|
34
|
-
current_balance
|
|
34
|
+
current_balance: string; // PostgreSQL numeric -> string
|
|
35
35
|
business_id?: string | null;
|
|
36
36
|
is_fee?: boolean | null;
|
|
37
|
-
currency_rate?: number | null;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
/**
|
|
@@ -51,7 +50,6 @@ export interface TransactionInsertParams {
|
|
|
51
50
|
* - currency is required (e.g., 'ILS', 'USD', 'EUR')
|
|
52
51
|
* - event_date is required (transaction date)
|
|
53
52
|
* - is_fee defaults to false (regular transaction, not a fee)
|
|
54
|
-
* - currency_rate defaults to null (foreign currency transactions can specify exchange rate)
|
|
55
53
|
* - account_id defaults to deterministic UUID if not provided
|
|
56
54
|
* - source_id defaults to deterministic UUID (raw transaction reference)
|
|
57
55
|
* - source_description defaults to null
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @see packages/server/src/__tests__/helpers/fixture-validation.ts for validation logic
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type { PoolClient } from 'pg';
|
|
12
12
|
import type { Fixture } from './fixture-types.js';
|
|
13
13
|
import { assertValidFixture } from './fixture-validation.js';
|
|
14
14
|
import { qualifyTable } from './test-db-config.js';
|
|
@@ -85,16 +85,12 @@ export type FixtureIdMapping = Map<string, string>;
|
|
|
85
85
|
* - Checks referential integrity (charge IDs, business IDs, etc.)
|
|
86
86
|
* - Validates required fields
|
|
87
87
|
*
|
|
88
|
-
* @param client - PostgreSQL client
|
|
88
|
+
* @param client - PostgreSQL client within an active transaction
|
|
89
89
|
* @param fixture - Complete fixture to insert
|
|
90
90
|
* @returns Promise resolving to ID mapping (fixture ID → database ID)
|
|
91
91
|
* @throws {Error} If fixture validation fails (via assertValidFixture)
|
|
92
92
|
* @throws {FixtureInsertionError} If any insertion section fails
|
|
93
93
|
*
|
|
94
|
-
* @remarks
|
|
95
|
-
* Type Safety: Accepts both PoolClient and Client to support both test transactions
|
|
96
|
-
* (pool.connect()) and standalone connections (new pg.Client()) used in seed scripts.
|
|
97
|
-
*
|
|
98
94
|
* @example
|
|
99
95
|
* ```typescript
|
|
100
96
|
* import { withTestTransaction } from './test-transaction.js';
|
|
@@ -116,7 +112,7 @@ export type FixtureIdMapping = Map<string, string>;
|
|
|
116
112
|
* ```
|
|
117
113
|
*/
|
|
118
114
|
export async function insertFixture(
|
|
119
|
-
client: PoolClient
|
|
115
|
+
client: PoolClient,
|
|
120
116
|
fixture: Fixture,
|
|
121
117
|
): Promise<FixtureIdMapping> {
|
|
122
118
|
// Validate fixture before insertion
|
|
@@ -178,13 +174,13 @@ export async function insertFixture(
|
|
|
178
174
|
business.website,
|
|
179
175
|
business.phoneNumber,
|
|
180
176
|
business.governmentId, // Maps to vat_number column
|
|
181
|
-
business.exemptDealer
|
|
182
|
-
business.suggestions
|
|
183
|
-
business.optionalVat
|
|
184
|
-
business.country
|
|
185
|
-
business.pcn874RecordTypeOverride
|
|
186
|
-
business.isReceiptEnough
|
|
187
|
-
business.isDocumentsOptional
|
|
177
|
+
business.exemptDealer,
|
|
178
|
+
business.suggestions,
|
|
179
|
+
business.optionalVat,
|
|
180
|
+
business.country,
|
|
181
|
+
business.pcn874RecordTypeOverride,
|
|
182
|
+
business.isReceiptEnough,
|
|
183
|
+
business.isDocumentsOptional,
|
|
188
184
|
],
|
|
189
185
|
);
|
|
190
186
|
|
|
@@ -218,7 +214,7 @@ export async function insertFixture(
|
|
|
218
214
|
)
|
|
219
215
|
VALUES ($1, $2, $3)
|
|
220
216
|
ON CONFLICT (id) DO NOTHING`,
|
|
221
|
-
[taxCategory.id, taxCategory.hashavshevetName, taxCategory.taxExcluded
|
|
217
|
+
[taxCategory.id, taxCategory.hashavshevetName, taxCategory.taxExcluded],
|
|
222
218
|
);
|
|
223
219
|
|
|
224
220
|
if (entityResult.rows.length > 0) {
|
|
@@ -297,21 +293,19 @@ export async function insertFixture(
|
|
|
297
293
|
await client.query(
|
|
298
294
|
`INSERT INTO ${qualifyTable('charges')} (
|
|
299
295
|
id, owner_id, type, accountant_status, user_description,
|
|
300
|
-
tax_category_id, optional_vat, documents_optional_flag
|
|
301
|
-
is_property, created_at, updated_at
|
|
296
|
+
tax_category_id, optional_vat, documents_optional_flag
|
|
302
297
|
)
|
|
303
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8
|
|
298
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
|
304
299
|
ON CONFLICT (id) DO NOTHING`,
|
|
305
300
|
[
|
|
306
301
|
charge.id,
|
|
307
302
|
charge.owner_id,
|
|
308
|
-
charge.type
|
|
309
|
-
charge.accountant_status
|
|
303
|
+
charge.type,
|
|
304
|
+
charge.accountant_status,
|
|
310
305
|
charge.user_description,
|
|
311
|
-
charge.tax_category_id
|
|
312
|
-
charge.optional_vat
|
|
313
|
-
charge.documents_optional_flag
|
|
314
|
-
charge.is_property ?? false,
|
|
306
|
+
charge.tax_category_id,
|
|
307
|
+
charge.optional_vat,
|
|
308
|
+
charge.documents_optional_flag,
|
|
315
309
|
],
|
|
316
310
|
);
|
|
317
311
|
|
|
@@ -355,10 +349,9 @@ export async function insertFixture(
|
|
|
355
349
|
`INSERT INTO ${qualifyTable('transactions')} (
|
|
356
350
|
id, account_id, charge_id, source_id, source_description,
|
|
357
351
|
currency, event_date, debit_date, amount, current_balance,
|
|
358
|
-
business_id, is_fee, source_reference, source_origin, origin_key
|
|
359
|
-
currency_rate, created_at, updated_at
|
|
352
|
+
business_id, is_fee, source_reference, source_origin, origin_key
|
|
360
353
|
)
|
|
361
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15
|
|
354
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)
|
|
362
355
|
ON CONFLICT (id) DO NOTHING`,
|
|
363
356
|
[
|
|
364
357
|
transaction.id,
|
|
@@ -370,13 +363,12 @@ export async function insertFixture(
|
|
|
370
363
|
transaction.event_date,
|
|
371
364
|
transaction.debit_date,
|
|
372
365
|
transaction.amount,
|
|
373
|
-
transaction.current_balance
|
|
366
|
+
transaction.current_balance,
|
|
374
367
|
transaction.business_id,
|
|
375
|
-
transaction.is_fee
|
|
368
|
+
transaction.is_fee,
|
|
376
369
|
'TEST-REF', // source_reference (NOT NULL)
|
|
377
370
|
'TEST', // source_origin (NOT NULL)
|
|
378
371
|
dummyEtherscanId, // origin_key (NOT NULL) - must match etherscan_id in raw list
|
|
379
|
-
transaction.currency_rate ?? 1,
|
|
380
372
|
],
|
|
381
373
|
);
|
|
382
374
|
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
* @see packages/server/src/__tests__/helpers/fixture-loader.ts for insertion logic
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import type { ChargeInsertParams
|
|
16
|
+
import type { ChargeInsertParams } from '../factories/charge.js';
|
|
17
|
+
import type { TransactionInsertParams } from '../factories/transaction.js';
|
|
18
|
+
import type { DocumentInsertParams } from '../factories/document.js';
|
|
17
19
|
import type { financial_account_type } from '../../modules/transactions/types.js';
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import accountantApproval from './typeDefs/accountant-approval.graphql.js';
|
|
2
1
|
import { createModule } from 'graphql-modules';
|
|
3
2
|
import { accountantApprovalResolvers } from './resolvers/accountant-approval.resolver.js';
|
|
3
|
+
import accountantApproval from './typeDefs/accountant-approval.graphql.js';
|
|
4
4
|
|
|
5
5
|
const __dirname = new URL('.', import.meta.url).pathname;
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import adminContext from './typeDefs/admin-context.graphql.js';
|
|
2
1
|
import { createModule } from 'graphql-modules';
|
|
3
2
|
import { AdminContextProvider } from './providers/admin-context.provider.js';
|
|
4
3
|
import { adminContextResolvers } from './resolvers/admin-context.resolvers.js';
|
|
4
|
+
import adminContext from './typeDefs/admin-context.graphql.js';
|
|
5
5
|
|
|
6
6
|
const __dirname = new URL('.', import.meta.url).pathname;
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import bankDeposits from './typeDefs/bank-deposits.graphql.js';
|
|
2
1
|
import { createModule } from 'graphql-modules';
|
|
3
2
|
import { BankDepositTransactionsProvider } from './providers/bank-deposit-transactions.provider.js';
|
|
4
3
|
import { bankDepositTransactionsResolvers } from './resolvers/bank-deposit-transactions.resolver.js';
|
|
4
|
+
import bankDeposits from './typeDefs/bank-deposits.graphql.js';
|
|
5
5
|
|
|
6
6
|
const __dirname = new URL('.', import.meta.url).pathname;
|
|
7
7
|
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import businessTripAttendees from './typeDefs/business-trip-attendees.graphql.js';
|
|
2
|
-
import businessTripExpenses from './typeDefs/business-trip-expenses.graphql.js';
|
|
3
|
-
import businessTrips from './typeDefs/business-trips.graphql.js';
|
|
4
1
|
import { createModule } from 'graphql-modules';
|
|
5
2
|
import { BusinessTripAttendeesProvider } from './providers/business-trips-attendees.provider.js';
|
|
6
3
|
import { BusinessTripEmployeePaymentsProvider } from './providers/business-trips-employee-payments.provider.js';
|
|
@@ -16,6 +13,9 @@ import { BusinessTripsProvider } from './providers/business-trips.provider.js';
|
|
|
16
13
|
import { businessTripAttendeesResolvers } from './resolvers/business-trip-attendees.resolver.js';
|
|
17
14
|
import { businessTripExpensesResolvers } from './resolvers/business-trips-expenses.resolver.js';
|
|
18
15
|
import { businessTripsResolvers } from './resolvers/business-trips.resolver.js';
|
|
16
|
+
import businessTripAttendees from './typeDefs/business-trip-attendees.graphql.js';
|
|
17
|
+
import businessTripExpenses from './typeDefs/business-trip-expenses.graphql.js';
|
|
18
|
+
import businessTrips from './typeDefs/business-trips.graphql.js';
|
|
19
19
|
|
|
20
20
|
const __dirname = new URL('.', import.meta.url).pathname;
|
|
21
21
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import chargeSuggestions from './typeDefs/charge-suggestions.graphql.js';
|
|
2
|
-
import chargeValidation from './typeDefs/charge-validation.graphql.js';
|
|
3
|
-
import charges from './typeDefs/charges.graphql.js';
|
|
4
|
-
import financialCharges from './typeDefs/financial-charges.graphql.js';
|
|
5
1
|
import { createModule } from 'graphql-modules';
|
|
6
2
|
import { ChargeSpreadProvider } from './providers/charge-spread.provider.js';
|
|
7
3
|
import { ChargesProvider } from './providers/charges.provider.js';
|
|
8
4
|
import { chargeSuggestionsResolvers } from './resolvers/charge-suggestions/charge-suggestions.resolver.js';
|
|
9
5
|
import { chargesResolvers } from './resolvers/charges.resolver.js';
|
|
10
6
|
import { financialChargesResolvers } from './resolvers/financial-charges.resolver.js';
|
|
7
|
+
import chargeSuggestions from './typeDefs/charge-suggestions.graphql.js';
|
|
8
|
+
import chargeValidation from './typeDefs/charge-validation.graphql.js';
|
|
9
|
+
import charges from './typeDefs/charges.graphql.js';
|
|
10
|
+
import financialCharges from './typeDefs/financial-charges.graphql.js';
|
|
11
11
|
|
|
12
12
|
const __dirname = new URL('.', import.meta.url).pathname;
|
|
13
13
|
|
|
@@ -107,17 +107,17 @@ import {
|
|
|
107
107
|
createMockTransaction,
|
|
108
108
|
createMockDocument,
|
|
109
109
|
createMockAggregatedTransaction,
|
|
110
|
-
createMockAggregatedDocument
|
|
111
|
-
} from './__tests__/test-helpers.js'
|
|
110
|
+
createMockAggregatedDocument
|
|
111
|
+
} from './__tests__/test-helpers.js'
|
|
112
112
|
|
|
113
113
|
// Create a transaction with defaults
|
|
114
|
-
const transaction = createMockTransaction()
|
|
114
|
+
const transaction = createMockTransaction()
|
|
115
115
|
|
|
116
116
|
// Create with overrides
|
|
117
117
|
const customTransaction = createMockTransaction({
|
|
118
118
|
amount: '250.00',
|
|
119
|
-
currency: 'USD'
|
|
120
|
-
})
|
|
119
|
+
currency: 'USD'
|
|
120
|
+
})
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
### Helper Functions
|
|
@@ -128,19 +128,19 @@ import {
|
|
|
128
128
|
roundConfidence,
|
|
129
129
|
isValidConfidenceScore,
|
|
130
130
|
daysDifference,
|
|
131
|
-
isWithinDays
|
|
132
|
-
} from './__tests__/test-helpers.js'
|
|
131
|
+
isWithinDays
|
|
132
|
+
} from './__tests__/test-helpers.js'
|
|
133
133
|
|
|
134
134
|
// Calculate weighted confidence
|
|
135
|
-
const scores = { amount: 0.9, currency: 1.0, business: 0.5, date: 0.8 }
|
|
136
|
-
const confidence = calculateExpectedConfidence(scores)
|
|
135
|
+
const scores = { amount: 0.9, currency: 1.0, business: 0.5, date: 0.8 }
|
|
136
|
+
const confidence = calculateExpectedConfidence(scores) // 0.79
|
|
137
137
|
|
|
138
138
|
// Round to 2 decimal places
|
|
139
|
-
const rounded = roundConfidence(0.956789)
|
|
139
|
+
const rounded = roundConfidence(0.956789) // 0.96
|
|
140
140
|
|
|
141
141
|
// Validate score range
|
|
142
|
-
isValidConfidenceScore(0.95)
|
|
143
|
-
isValidConfidenceScore(1.5)
|
|
142
|
+
isValidConfidenceScore(0.95) // true
|
|
143
|
+
isValidConfidenceScore(1.5) // false
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
## Key Concepts
|