@classytic/revenue 2.1.3 → 2.3.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/CHANGELOG.md +50 -0
- package/README.md +8 -0
- package/dist/{bank-feed-BlQeq2rK.mjs → bank-feed-ClxNob_I.mjs} +1 -1
- package/dist/{bank-feed.enums-BadqNJTC.d.mts → bank-feed.enums-BwJbImM6.d.mts} +2 -0
- package/dist/{bank-feed.enums-kYTLTTbe.mjs → bank-feed.enums-CU38W8dv.mjs} +6 -3
- package/dist/core/state-machines.d.mts +1 -1
- package/dist/core/state-machines.mjs +4 -3
- package/dist/{engine-types-Jctrbasz.d.mts → engine-types-34VmC7t6.d.mts} +49 -2
- package/dist/enums/index.d.mts +1 -1
- package/dist/enums/index.mjs +1 -1
- package/dist/{errors-LYYg9wcs.mjs → errors-Bt5NRVMq.mjs} +19 -2
- package/dist/{escrow.schema-C-b41z_G.mjs → escrow.schema-BcKdzrJ7.mjs} +5 -0
- package/dist/{escrow.schema-YuBgjL-I.d.mts → escrow.schema-C_UeLtsC.d.mts} +90 -30
- package/dist/{event-constants-Dn1TKahe.mjs → event-constants-DM_-A57b.mjs} +7 -0
- package/dist/events/index.d.mts +1 -1
- package/dist/events/index.mjs +2 -2
- package/dist/index.d.mts +29 -7
- package/dist/index.mjs +15 -8
- package/dist/providers/index.d.mts +1 -1
- package/dist/providers/index.mjs +1 -1
- package/dist/{registry-h8sasoLh.d.mts → registry-BpEeN8eW.d.mts} +1 -1
- package/dist/repositories/create-repositories.d.mts +1 -1
- package/dist/repositories/create-repositories.mjs +1 -1
- package/dist/{revenue-event-catalog-BvjNVnPd.mjs → revenue-event-catalog-B9aZmNpL.mjs} +90 -2
- package/dist/{revenue-event-catalog-JpJcyK1E.d.mts → revenue-event-catalog-j8Fh7Yag.d.mts} +645 -0
- package/dist/{settlement.repository-BAdc9qGl.mjs → settlement.repository-CdM3myTI.mjs} +67 -6
- package/dist/validators/index.d.mts +1 -1
- package/dist/validators/index.mjs +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,56 @@
|
|
|
3
3
|
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
4
4
|
adhering to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
5
|
|
|
6
|
+
## [2.3.0] - 2026-06-02
|
|
7
|
+
|
|
8
|
+
### Added — `reconciled_external` terminal bank-feed status
|
|
9
|
+
|
|
10
|
+
New `BANK_FEED_STATUS.RECONCILED_EXTERNAL` (`'reconciled_external'`) for rows
|
|
11
|
+
that are already reconciled at the source vendor (e.g. synced Xero Payments or
|
|
12
|
+
bank-transfer legs whose GL the vendor already owns). It is a **terminal island**
|
|
13
|
+
in the bank-feed state machine: no inbound edge (cannot be flipped in from
|
|
14
|
+
`imported`/`matched`) and no outbound edge — so `match()`/`journalize()`/
|
|
15
|
+
`unmatch()` all throw `InvalidStateTransition`. Such rows can never post a
|
|
16
|
+
journal entry, so surfacing them for visibility can't double-count the ledger.
|
|
17
|
+
|
|
18
|
+
### Added — `initialStatus` option on `TransactionRepository.import()`
|
|
19
|
+
|
|
20
|
+
`import(rows, { …, initialStatus }, ctx)` overrides the born status of newly
|
|
21
|
+
inserted bank-feed rows (default `imported`). Pass `reconciled_external` so
|
|
22
|
+
vendor-reconciled rows are **born** terminal + non-matchable (closes the
|
|
23
|
+
race where a row could be matched in the window between insert and a later
|
|
24
|
+
status flip). Applies to `$setOnInsert` only — re-imports never overwrite an
|
|
25
|
+
existing row's status.
|
|
26
|
+
|
|
27
|
+
## [2.2.0] - 2026-05-26
|
|
28
|
+
|
|
29
|
+
### Added — auth/capture + dispute event coverage
|
|
30
|
+
|
|
31
|
+
Seven new event constants on `REVENUE_EVENTS` aligning with the
|
|
32
|
+
`@classytic/primitives@0.7.1` payment event catalogue:
|
|
33
|
+
`PAYMENT_AUTHORIZED`, `PAYMENT_CAPTURED`, `PAYMENT_AUTH_VOIDED`,
|
|
34
|
+
`PAYMENT_DISPUTED`, `PAYMENT_DISPUTE_WON`, `PAYMENT_DISPUTE_LOST`,
|
|
35
|
+
`PAYMENT_SETTLED`. Catalog payload schemas updated to match.
|
|
36
|
+
|
|
37
|
+
### Added — `RevenueError.httpStatus`
|
|
38
|
+
|
|
39
|
+
`RevenueError` carries an optional `httpStatus` field so Arc / Express
|
|
40
|
+
hosts can map errors to response codes without per-error switch
|
|
41
|
+
statements. Defaults to 500 in the host mapper when unset.
|
|
42
|
+
|
|
43
|
+
### Added — `MethodKindLockedError` (409)
|
|
44
|
+
|
|
45
|
+
New error thrown by `TransactionRepository.backfillMethodKind` when the
|
|
46
|
+
existing doc is not backfill-eligible (methodKind already specific OR
|
|
47
|
+
status no longer `pending`). 409 because the request is well-formed but
|
|
48
|
+
conflicts with current resource state.
|
|
49
|
+
|
|
50
|
+
### Changed — peer bump: `@classytic/primitives` `>=0.7.1`
|
|
51
|
+
|
|
52
|
+
Catalogue now imports `PAYMENT_METHOD_KIND` from
|
|
53
|
+
`@classytic/primitives/payment-method-kind`. Hosts must bump primitives
|
|
54
|
+
to `>=0.7.1`.
|
|
55
|
+
|
|
6
56
|
## [2.1.1] — multi-tenant scope correctness across all repos
|
|
7
57
|
|
|
8
58
|
**Fix.** `SubscriptionRepository` and `SettlementRepository` lifecycle verbs
|
package/README.md
CHANGED
|
@@ -48,6 +48,14 @@ const refundTxn = await revenue.repositories.transaction.refund(
|
|
|
48
48
|
// refundTxn.type → 'refund', refundTxn.flow → 'outflow', refundTxn.amount → 5000
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
## Hosted-checkout `methodKind` backfill
|
|
52
|
+
|
|
53
|
+
Every transaction carries a `methodKind: PaymentMethodKind` (`card`, `bank_transfer`, `wallet`, `cash`, `cheque`, `cryptocurrency`, `manual`, `other`). For hosted-checkout flows where the customer picks their method on the gateway's UI (Stripe Checkout, PayPal redirect, Razorpay Checkout), create the PaymentIntent with `methodKind: 'other'` — then call `transactionRepository.backfillMethodKind(transactionId, kind)` from your verification webhook handler once you know the actual choice. The backfill is an atomic CAS — allowed only when the doc still has `methodKind === 'other'` AND `status === 'pending'`; any other transition throws `MethodKindLockedError` (HTTP 409). For the Stripe case, `@classytic/revenue-stripe` exposes `stripePaymentIntentToKind(intent)` so the host doesn't write the mapping table itself.
|
|
54
|
+
|
|
55
|
+
## Bank-feed `import()` requires `methodKind`
|
|
56
|
+
|
|
57
|
+
`TransactionRepository.import()` (and the higher-level `drainSync` / `parseAndImport`) require an explicit `opts.methodKind` — no silent default. Pass `'bank_transfer'` for Plaid/OFX/CAMT/MT940 drains, `'card'` for a Stripe-balance import, `'wallet'` for PayPal exports, `'cryptocurrency'` for exchange CSVs. This forces every feed integration to be intentional about how its rows show up in downstream analytics and accounting reports.
|
|
58
|
+
|
|
51
59
|
## Architecture
|
|
52
60
|
|
|
53
61
|
```
|
|
@@ -22,6 +22,7 @@ declare const TRANSACTION_STATUS: {
|
|
|
22
22
|
readonly MATCHED: "matched";
|
|
23
23
|
readonly JOURNALIZED: "journalized";
|
|
24
24
|
readonly REJECTED: "rejected";
|
|
25
|
+
readonly RECONCILED_EXTERNAL: "reconciled_external";
|
|
25
26
|
};
|
|
26
27
|
type TransactionStatus = typeof TRANSACTION_STATUS;
|
|
27
28
|
type TransactionStatusValue = TransactionStatus[keyof TransactionStatus];
|
|
@@ -69,6 +70,7 @@ declare const BANK_FEED_STATUS: {
|
|
|
69
70
|
readonly MATCHED: "matched";
|
|
70
71
|
readonly JOURNALIZED: "journalized";
|
|
71
72
|
readonly REJECTED: "rejected";
|
|
73
|
+
readonly RECONCILED_EXTERNAL: "reconciled_external";
|
|
72
74
|
};
|
|
73
75
|
type BankFeedStatusValue = (typeof BANK_FEED_STATUS)[keyof typeof BANK_FEED_STATUS];
|
|
74
76
|
declare const BANK_FEED_STATUS_VALUES: BankFeedStatusValue[];
|
|
@@ -19,7 +19,8 @@ const TRANSACTION_STATUS = {
|
|
|
19
19
|
IMPORTED: "imported",
|
|
20
20
|
MATCHED: "matched",
|
|
21
21
|
JOURNALIZED: "journalized",
|
|
22
|
-
REJECTED: "rejected"
|
|
22
|
+
REJECTED: "rejected",
|
|
23
|
+
RECONCILED_EXTERNAL: "reconciled_external"
|
|
23
24
|
};
|
|
24
25
|
const TRANSACTION_STATUS_VALUES = Object.values(TRANSACTION_STATUS);
|
|
25
26
|
const LIBRARY_CATEGORIES = {
|
|
@@ -71,7 +72,8 @@ const BANK_FEED_STATUS = {
|
|
|
71
72
|
IMPORTED: "imported",
|
|
72
73
|
MATCHED: "matched",
|
|
73
74
|
JOURNALIZED: "journalized",
|
|
74
|
-
REJECTED: "rejected"
|
|
75
|
+
REJECTED: "rejected",
|
|
76
|
+
RECONCILED_EXTERNAL: "reconciled_external"
|
|
75
77
|
};
|
|
76
78
|
const BANK_FEED_STATUS_VALUES = Object.values(BANK_FEED_STATUS);
|
|
77
79
|
const bankFeedStatusSet = new Set(BANK_FEED_STATUS_VALUES);
|
|
@@ -129,7 +131,8 @@ const STATUSES_BY_KIND = {
|
|
|
129
131
|
TRANSACTION_STATUS.IMPORTED,
|
|
130
132
|
TRANSACTION_STATUS.MATCHED,
|
|
131
133
|
TRANSACTION_STATUS.JOURNALIZED,
|
|
132
|
-
TRANSACTION_STATUS.REJECTED
|
|
134
|
+
TRANSACTION_STATUS.REJECTED,
|
|
135
|
+
TRANSACTION_STATUS.RECONCILED_EXTERNAL
|
|
133
136
|
]),
|
|
134
137
|
[TRANSACTION_KIND.MANUAL]: new Set([
|
|
135
138
|
TRANSACTION_STATUS.PENDING,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { U as HoldStatusValue, b as SplitStatusValue, c as SubscriptionStatusValue, j as SettlementStatusValue } from "../subscription.enums-k24kLpF7.mjs";
|
|
2
|
-
import { O as TransactionStatusValue, u as TransactionKindValue } from "../bank-feed.enums-
|
|
2
|
+
import { O as TransactionStatusValue, u as TransactionKindValue } from "../bank-feed.enums-BwJbImM6.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/state-machines.d.ts
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as TRANSACTION_STATUS, a as TRANSACTION_KIND } from "../bank-feed.enums-
|
|
1
|
+
import { _ as TRANSACTION_STATUS, a as TRANSACTION_KIND } from "../bank-feed.enums-CU38W8dv.mjs";
|
|
2
2
|
import { g as SETTLEMENT_STATUS, l as SPLIT_STATUS, r as SUBSCRIPTION_STATUS, w as HOLD_STATUS } from "../subscription.enums-95othr0i.mjs";
|
|
3
|
-
import { a as InvalidStateTransitionError } from "../errors-
|
|
3
|
+
import { a as InvalidStateTransitionError } from "../errors-Bt5NRVMq.mjs";
|
|
4
4
|
import { defineStateMachine } from "@classytic/primitives/state-machine";
|
|
5
5
|
|
|
6
6
|
//#region src/core/state-machines.ts
|
|
@@ -154,7 +154,8 @@ const BANK_FEED_STATE_MACHINE = new StateMachine(new Map([
|
|
|
154
154
|
[TRANSACTION_STATUS.IMPORTED, new Set([TRANSACTION_STATUS.MATCHED, TRANSACTION_STATUS.REJECTED])],
|
|
155
155
|
[TRANSACTION_STATUS.MATCHED, new Set([TRANSACTION_STATUS.IMPORTED, TRANSACTION_STATUS.JOURNALIZED])],
|
|
156
156
|
[TRANSACTION_STATUS.JOURNALIZED, /* @__PURE__ */ new Set([])],
|
|
157
|
-
[TRANSACTION_STATUS.REJECTED, /* @__PURE__ */ new Set([])]
|
|
157
|
+
[TRANSACTION_STATUS.REJECTED, /* @__PURE__ */ new Set([])],
|
|
158
|
+
[TRANSACTION_STATUS.RECONCILED_EXTERNAL, /* @__PURE__ */ new Set([])]
|
|
158
159
|
]), "transaction.bank_feed");
|
|
159
160
|
const MANUAL_STATE_MACHINE = new StateMachine(new Map([
|
|
160
161
|
[TRANSACTION_STATUS.PENDING, new Set([TRANSACTION_STATUS.MATCHED, TRANSACTION_STATUS.REJECTED])],
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { t as RevenueContext } from "./context-pjP1QeE3.mjs";
|
|
2
2
|
import { t as RevenueBridges } from "./revenue-bridges-BtkWFsJu.mjs";
|
|
3
|
-
import { u as TransactionKindValue } from "./bank-feed.enums-
|
|
4
|
-
import { a as BankFeedProviderRegistry, d as PaymentProvider, o as FetchTransactionsParams, r as BankFeedProvider, t as ProviderRegistry } from "./registry-
|
|
3
|
+
import { O as TransactionStatusValue, u as TransactionKindValue } from "./bank-feed.enums-BwJbImM6.mjs";
|
|
4
|
+
import { a as BankFeedProviderRegistry, d as PaymentProvider, o as FetchTransactionsParams, r as BankFeedProvider, t as ProviderRegistry } from "./registry-BpEeN8eW.mjs";
|
|
5
5
|
import { RepositoryPluginBundle, RevenueRepositories } from "./repositories/create-repositories.mjs";
|
|
6
6
|
import { PluginType, Repository } from "@classytic/mongokit";
|
|
7
7
|
import { TenantConfig } from "@classytic/repo-core/tenant";
|
|
8
8
|
import mongoose, { Connection, Model, Schema } from "mongoose";
|
|
9
|
+
import { PaymentMethodKind } from "@classytic/primitives/payment-method-kind";
|
|
9
10
|
import { DomainEvent, EventTransport } from "@classytic/primitives/events";
|
|
10
11
|
import { OutboxStore } from "@classytic/primitives/outbox";
|
|
11
12
|
import { BankImportReport, BankImportRowError, BankTransaction } from "@classytic/primitives/bank-transaction";
|
|
@@ -68,6 +69,7 @@ interface TransactionDocument {
|
|
|
68
69
|
originalAmount?: number;
|
|
69
70
|
originalCurrency?: string;
|
|
70
71
|
method: string;
|
|
72
|
+
methodKind: PaymentMethodKind;
|
|
71
73
|
status: string;
|
|
72
74
|
/**
|
|
73
75
|
* Optional embedded approval chain — P7. Hosts that gate manual /
|
|
@@ -486,6 +488,7 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
486
488
|
amount: number;
|
|
487
489
|
currency?: string;
|
|
488
490
|
gateway: string;
|
|
491
|
+
methodKind: PaymentMethodKind;
|
|
489
492
|
paymentData?: Record<string, unknown>;
|
|
490
493
|
metadata?: Record<string, unknown>;
|
|
491
494
|
idempotencyKey?: string;
|
|
@@ -578,7 +581,17 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
578
581
|
import(rows: BankTransaction[], opts: {
|
|
579
582
|
bankAccountId: string;
|
|
580
583
|
source: string;
|
|
584
|
+
methodKind: PaymentMethodKind;
|
|
581
585
|
method?: string;
|
|
586
|
+
/**
|
|
587
|
+
* Override the born status of newly-inserted rows. Defaults to
|
|
588
|
+
* `initialStatusFor(bank_feed)` = `imported` (matchable). Pass
|
|
589
|
+
* `reconciled_external` for vendor-reconciled rows (Xero Payments /
|
|
590
|
+
* transfer legs) so they are BORN terminal + non-matchable and can
|
|
591
|
+
* never post a journal entry. Applies to `$setOnInsert` only — re-imports
|
|
592
|
+
* never overwrite an existing row's status.
|
|
593
|
+
*/
|
|
594
|
+
initialStatus?: TransactionStatusValue;
|
|
582
595
|
}, ctx?: RevenueContext): Promise<BankImportReport>;
|
|
583
596
|
/**
|
|
584
597
|
* Drain a bank-feed provider into the collection.
|
|
@@ -598,6 +611,7 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
598
611
|
*/
|
|
599
612
|
drainSync(providerName: string, params: FetchTransactionsParams & {
|
|
600
613
|
bankAccountId: string;
|
|
614
|
+
methodKind: PaymentMethodKind;
|
|
601
615
|
}, ctx?: RevenueContext): Promise<{
|
|
602
616
|
totalImported: number;
|
|
603
617
|
totalUpdated: number;
|
|
@@ -617,6 +631,7 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
617
631
|
buffer: Buffer | string | Uint8Array;
|
|
618
632
|
format?: string;
|
|
619
633
|
bankAccountId: string;
|
|
634
|
+
methodKind: PaymentMethodKind;
|
|
620
635
|
}, ctx?: RevenueContext): Promise<BankImportReport>;
|
|
621
636
|
/**
|
|
622
637
|
* Hand-keyed entry — treasurer logs a cash deposit, owner injects
|
|
@@ -630,6 +645,7 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
630
645
|
currency: string;
|
|
631
646
|
flow: 'inflow' | 'outflow';
|
|
632
647
|
type: string;
|
|
648
|
+
methodKind: PaymentMethodKind;
|
|
633
649
|
description?: string;
|
|
634
650
|
counterparty?: TransactionDocument['counterparty'];
|
|
635
651
|
reference?: string;
|
|
@@ -640,6 +656,37 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
640
656
|
sourceModel?: string;
|
|
641
657
|
metadata?: Record<string, unknown>;
|
|
642
658
|
}, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
659
|
+
/**
|
|
660
|
+
* Backfill the `methodKind` on a Transaction created with kind
|
|
661
|
+
* unknown — the canonical use case is hosted-checkout (Stripe
|
|
662
|
+
* Checkout, PayPal redirect, Razorpay Checkout) where the customer
|
|
663
|
+
* picks their payment method on the gateway's UI, AFTER the host has
|
|
664
|
+
* already created the PaymentIntent + Transaction with
|
|
665
|
+
* `methodKind: 'other'`.
|
|
666
|
+
*
|
|
667
|
+
* Call this from your verification / webhook handler once you know
|
|
668
|
+
* the customer's actual choice — e.g. inside
|
|
669
|
+
* `payment_intent.succeeded`:
|
|
670
|
+
*
|
|
671
|
+
* ```ts
|
|
672
|
+
* await transactionRepository.backfillMethodKind(
|
|
673
|
+
* tx._id,
|
|
674
|
+
* stripePaymentIntentToKind(event.data.object),
|
|
675
|
+
* ctx,
|
|
676
|
+
* );
|
|
677
|
+
* ```
|
|
678
|
+
*
|
|
679
|
+
* **Guard rule.** Atomic CAS — succeeds only when the doc has
|
|
680
|
+
* `methodKind === 'other'` AND `status === 'pending'`. Any other
|
|
681
|
+
* combination throws `MethodKindLockedError` (HTTP 409): once a
|
|
682
|
+
* transaction has a specific kind (or has settled past pending),
|
|
683
|
+
* silently overwriting it would corrupt downstream analytics and
|
|
684
|
+
* accounting reports.
|
|
685
|
+
*
|
|
686
|
+
* Emits `revenue:transaction.updated` with `changedFields:
|
|
687
|
+
* ['methodKind']` so subscribers can re-bucket the row.
|
|
688
|
+
*/
|
|
689
|
+
backfillMethodKind(transactionId: string, methodKind: PaymentMethodKind, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
643
690
|
/**
|
|
644
691
|
* Match a bank-feed / manual transaction to GL accounts, optionally
|
|
645
692
|
* cross-linking to an upstream payment-flow transaction.
|
package/dist/enums/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { A as SettlementStatus, B as HoldReason, C as isPayoutMethod, D as SETTLEMENT_STATUS_VALUES, E as SETTLEMENT_STATUS, F as isSettlementType, G as RELEASE_REASON_VALUES, H as HoldStatus, I as HOLD_REASON, J as isHoldReason, K as ReleaseReason, L as HOLD_REASON_VALUES, M as SettlementType, N as SettlementTypeValue, O as SETTLEMENT_TYPE, P as isSettlementStatus, R as HOLD_STATUS, S as SplitTypeValue, T as isSplitType, U as HoldStatusValue, V as HoldReasonValue, W as RELEASE_REASON, X as isReleaseReason, Y as isHoldStatus, _ as SPLIT_TYPE, a as SUBSCRIPTION_STATUS, b as SplitStatusValue, c as SubscriptionStatusValue, d as PAYOUT_METHOD, f as PAYOUT_METHOD_VALUES, g as SPLIT_STATUS_VALUES, h as SPLIT_STATUS, i as PlanKeys, j as SettlementStatusValue, k as SETTLEMENT_TYPE_VALUES, l as isPlanKey, m as PayoutMethodValue, n as PLAN_KEY_VALUES, o as SUBSCRIPTION_STATUS_VALUES, p as PayoutMethod, q as ReleaseReasonValue, r as PlanKeyValue, s as SubscriptionStatus, t as PLAN_KEYS, u as isSubscriptionStatus, v as SPLIT_TYPE_VALUES, w as isSplitStatus, x as SplitType, y as SplitStatus, z as HOLD_STATUS_VALUES } from "../subscription.enums-k24kLpF7.mjs";
|
|
2
|
-
import { A as isTransactionFlow, C as TRANSACTION_STATUS, D as TransactionStatus, E as TransactionFlowValue, O as TransactionStatusValue, S as TRANSACTION_FLOW_VALUES, T as TransactionFlow, _ as LIBRARY_CATEGORIES, a as BankFeedSourceValue, b as LibraryCategoryValue, c as TRANSACTION_KIND_VALUES, d as initialStatusFor, f as isBankFeedSource, g as statusesForKind, h as isTransactionKind, i as BANK_FEED_STATUS_VALUES, j as isTransactionStatus, k as isLibraryCategory, l as TransactionKind, m as isStatusValidForKind, n as BANK_FEED_SOURCE_VALUES, o as BankFeedStatusValue, p as isBankFeedStatus, r as BANK_FEED_STATUS, s as TRANSACTION_KIND, t as BANK_FEED_SOURCE, u as TransactionKindValue, v as LIBRARY_CATEGORY_VALUES, w as TRANSACTION_STATUS_VALUES, x as TRANSACTION_FLOW, y as LibraryCategories } from "../bank-feed.enums-
|
|
2
|
+
import { A as isTransactionFlow, C as TRANSACTION_STATUS, D as TransactionStatus, E as TransactionFlowValue, O as TransactionStatusValue, S as TRANSACTION_FLOW_VALUES, T as TransactionFlow, _ as LIBRARY_CATEGORIES, a as BankFeedSourceValue, b as LibraryCategoryValue, c as TRANSACTION_KIND_VALUES, d as initialStatusFor, f as isBankFeedSource, g as statusesForKind, h as isTransactionKind, i as BANK_FEED_STATUS_VALUES, j as isTransactionStatus, k as isLibraryCategory, l as TransactionKind, m as isStatusValidForKind, n as BANK_FEED_SOURCE_VALUES, o as BankFeedStatusValue, p as isBankFeedStatus, r as BANK_FEED_STATUS, s as TRANSACTION_KIND, t as BANK_FEED_SOURCE, u as TransactionKindValue, v as LIBRARY_CATEGORY_VALUES, w as TRANSACTION_STATUS_VALUES, x as TRANSACTION_FLOW, y as LibraryCategories } from "../bank-feed.enums-BwJbImM6.mjs";
|
|
3
3
|
import { a as isMonetizationType, c as PAYMENT_STATUS, d as PaymentGatewayTypeValue, f as PaymentStatus, h as isPaymentStatus, i as MonetizationTypes, l as PAYMENT_STATUS_VALUES, m as isPaymentGatewayType, n as MONETIZATION_TYPE_VALUES, o as PAYMENT_GATEWAY_TYPE, p as PaymentStatusValue, r as MonetizationTypeValue, s as PAYMENT_GATEWAY_TYPE_VALUES, t as MONETIZATION_TYPES, u as PaymentGatewayType } from "../monetization.enums-DzAI4sT7.mjs";
|
|
4
4
|
export { BANK_FEED_SOURCE, BANK_FEED_SOURCE_VALUES, BANK_FEED_STATUS, BANK_FEED_STATUS_VALUES, BankFeedSourceValue, BankFeedStatusValue, HOLD_REASON, HOLD_REASON_VALUES, HOLD_STATUS, HOLD_STATUS_VALUES, HoldReason, HoldReasonValue, HoldStatus, HoldStatusValue, LIBRARY_CATEGORIES, LIBRARY_CATEGORY_VALUES, LibraryCategories, LibraryCategoryValue, MONETIZATION_TYPES, MONETIZATION_TYPE_VALUES, MonetizationTypeValue, MonetizationTypes, PAYMENT_GATEWAY_TYPE, PAYMENT_GATEWAY_TYPE_VALUES, PAYMENT_STATUS, PAYMENT_STATUS_VALUES, PAYOUT_METHOD, PAYOUT_METHOD_VALUES, PLAN_KEYS, PLAN_KEY_VALUES, PaymentGatewayType, PaymentGatewayTypeValue, PaymentStatus, PaymentStatusValue, PayoutMethod, PayoutMethodValue, PlanKeyValue, PlanKeys, RELEASE_REASON, RELEASE_REASON_VALUES, ReleaseReason, ReleaseReasonValue, SETTLEMENT_STATUS, SETTLEMENT_STATUS_VALUES, SETTLEMENT_TYPE, SETTLEMENT_TYPE_VALUES, SPLIT_STATUS, SPLIT_STATUS_VALUES, SPLIT_TYPE, SPLIT_TYPE_VALUES, SUBSCRIPTION_STATUS, SUBSCRIPTION_STATUS_VALUES, SettlementStatus, SettlementStatusValue, SettlementType, SettlementTypeValue, SplitStatus, SplitStatusValue, SplitType, SplitTypeValue, SubscriptionStatus, SubscriptionStatusValue, TRANSACTION_FLOW, TRANSACTION_FLOW_VALUES, TRANSACTION_KIND, TRANSACTION_KIND_VALUES, TRANSACTION_STATUS, TRANSACTION_STATUS_VALUES, TransactionFlow, TransactionFlowValue, TransactionKind, TransactionKindValue, TransactionStatus, TransactionStatusValue, initialStatusFor, isBankFeedSource, isBankFeedStatus, isHoldReason, isHoldStatus, isLibraryCategory, isMonetizationType, isPaymentGatewayType, isPaymentStatus, isPayoutMethod, isPlanKey, isReleaseReason, isSettlementStatus, isSettlementType, isSplitStatus, isSplitType, isStatusValidForKind, isSubscriptionStatus, isTransactionFlow, isTransactionKind, isTransactionStatus, statusesForKind };
|
package/dist/enums/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as TRANSACTION_STATUS, a as TRANSACTION_KIND, b as isTransactionFlow, c as isBankFeedSource, d as isTransactionKind, f as statusesForKind, g as TRANSACTION_FLOW_VALUES, h as TRANSACTION_FLOW, i as BANK_FEED_STATUS_VALUES, l as isBankFeedStatus, m as LIBRARY_CATEGORY_VALUES, n as BANK_FEED_SOURCE_VALUES, o as TRANSACTION_KIND_VALUES, p as LIBRARY_CATEGORIES, r as BANK_FEED_STATUS, s as initialStatusFor, t as BANK_FEED_SOURCE, u as isStatusValidForKind, v as TRANSACTION_STATUS_VALUES, x as isTransactionStatus, y as isLibraryCategory } from "../bank-feed.enums-
|
|
1
|
+
import { _ as TRANSACTION_STATUS, a as TRANSACTION_KIND, b as isTransactionFlow, c as isBankFeedSource, d as isTransactionKind, f as statusesForKind, g as TRANSACTION_FLOW_VALUES, h as TRANSACTION_FLOW, i as BANK_FEED_STATUS_VALUES, l as isBankFeedStatus, m as LIBRARY_CATEGORY_VALUES, n as BANK_FEED_SOURCE_VALUES, o as TRANSACTION_KIND_VALUES, p as LIBRARY_CATEGORIES, r as BANK_FEED_STATUS, s as initialStatusFor, t as BANK_FEED_SOURCE, u as isStatusValidForKind, v as TRANSACTION_STATUS_VALUES, x as isTransactionStatus, y as isLibraryCategory } from "../bank-feed.enums-CU38W8dv.mjs";
|
|
2
2
|
import { A as isReleaseReason, C as HOLD_REASON_VALUES, D as RELEASE_REASON_VALUES, E as RELEASE_REASON, O as isHoldReason, S as HOLD_REASON, T as HOLD_STATUS_VALUES, _ as SETTLEMENT_STATUS_VALUES, a as isPlanKey, b as isSettlementStatus, c as PAYOUT_METHOD_VALUES, d as SPLIT_TYPE, f as SPLIT_TYPE_VALUES, g as SETTLEMENT_STATUS, h as isSplitType, i as SUBSCRIPTION_STATUS_VALUES, k as isHoldStatus, l as SPLIT_STATUS, m as isSplitStatus, n as PLAN_KEY_VALUES, o as isSubscriptionStatus, p as isPayoutMethod, r as SUBSCRIPTION_STATUS, s as PAYOUT_METHOD, t as PLAN_KEYS, u as SPLIT_STATUS_VALUES, v as SETTLEMENT_TYPE, w as HOLD_STATUS, x as isSettlementType, y as SETTLEMENT_TYPE_VALUES } from "../subscription.enums-95othr0i.mjs";
|
|
3
3
|
import { a as PAYMENT_GATEWAY_TYPE_VALUES, c as isPaymentGatewayType, i as PAYMENT_GATEWAY_TYPE, l as isPaymentStatus, n as MONETIZATION_TYPE_VALUES, o as PAYMENT_STATUS, r as isMonetizationType, s as PAYMENT_STATUS_VALUES, t as MONETIZATION_TYPES } from "../monetization.enums-B9HBOecd.mjs";
|
|
4
4
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
//#region src/core/errors.ts
|
|
2
2
|
var RevenueError = class extends Error {
|
|
3
|
-
constructor(message, code, details) {
|
|
3
|
+
constructor(message, code, details, httpStatus) {
|
|
4
4
|
super(message);
|
|
5
5
|
this.code = code;
|
|
6
6
|
this.details = details;
|
|
7
|
+
this.httpStatus = httpStatus;
|
|
7
8
|
this.name = "RevenueError";
|
|
8
9
|
}
|
|
9
10
|
};
|
|
@@ -103,6 +104,22 @@ var WrongTransactionKindError = class extends RevenueError {
|
|
|
103
104
|
this.name = "WrongTransactionKindError";
|
|
104
105
|
}
|
|
105
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Thrown by `TransactionRepository.backfillMethodKind` when the existing
|
|
109
|
+
* doc is NOT eligible for backfill (methodKind already specific, or
|
|
110
|
+
* status no longer `'pending'`). 409 because the request is well-formed
|
|
111
|
+
* but conflicts with the current resource state.
|
|
112
|
+
*/
|
|
113
|
+
var MethodKindLockedError = class extends RevenueError {
|
|
114
|
+
constructor(transactionId, currentMethodKind, currentStatus) {
|
|
115
|
+
super(`Transaction '${transactionId}' methodKind is locked (current: '${currentMethodKind}', status: '${currentStatus}'). Backfill is allowed only when methodKind === 'other' AND status === 'pending'.`, "METHOD_KIND_LOCKED", {
|
|
116
|
+
transactionId,
|
|
117
|
+
currentMethodKind,
|
|
118
|
+
currentStatus
|
|
119
|
+
}, 409);
|
|
120
|
+
this.name = "MethodKindLockedError";
|
|
121
|
+
}
|
|
122
|
+
};
|
|
106
123
|
var BankFeedProviderNotFoundError = class extends RevenueError {
|
|
107
124
|
constructor(providerName) {
|
|
108
125
|
super(`Bank-feed provider '${providerName}' not registered. Use \`engine.bankFeedProviders.register(name, provider)\`.`, "BANK_FEED_PROVIDER_NOT_FOUND", { providerName });
|
|
@@ -111,4 +128,4 @@ var BankFeedProviderNotFoundError = class extends RevenueError {
|
|
|
111
128
|
};
|
|
112
129
|
|
|
113
130
|
//#endregion
|
|
114
|
-
export { InvalidStateTransitionError as a,
|
|
131
|
+
export { WrongTransactionKindError as _, InvalidStateTransitionError as a, PaymentVerificationError as c, RefundNotSupportedError as d, RevenueError as f, ValidationError as g, TransactionNotFoundError as h, ConfigurationError as i, ProviderCapabilityError as l, SubscriptionNotFoundError as m, BankFeedImportError as n, MethodKindLockedError as o, SettlementNotFoundError as p, BankFeedProviderNotFoundError as r, PaymentIntentCreationError as s, AlreadyVerifiedError as t, ProviderNotFoundError as u };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { PAYMENT_METHOD_KIND } from "@classytic/primitives/payment-method-kind";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
|
|
3
4
|
//#region src/validators/transaction.schema.ts
|
|
5
|
+
const PAYMENT_METHOD_KIND_VALUES$1 = Object.values(PAYMENT_METHOD_KIND);
|
|
4
6
|
const commissionSchema = z.object({
|
|
5
7
|
rate: z.number().min(0).max(1),
|
|
6
8
|
grossAmount: z.number().int(),
|
|
@@ -78,6 +80,7 @@ const transactionBaseSchema = z.object({
|
|
|
78
80
|
isInclusive: z.boolean().optional()
|
|
79
81
|
}).optional(),
|
|
80
82
|
method: z.string(),
|
|
83
|
+
methodKind: z.enum(PAYMENT_METHOD_KIND_VALUES$1),
|
|
81
84
|
status: z.string().default("pending"),
|
|
82
85
|
gateway: gatewaySchema.optional(),
|
|
83
86
|
paymentDetails: z.record(z.string(), z.unknown()).optional(),
|
|
@@ -265,10 +268,12 @@ const settlementListFilterSchema = z.object({
|
|
|
265
268
|
|
|
266
269
|
//#endregion
|
|
267
270
|
//#region src/validators/payment.schema.ts
|
|
271
|
+
const PAYMENT_METHOD_KIND_VALUES = Object.values(PAYMENT_METHOD_KIND);
|
|
268
272
|
const paymentIntentSchema = z.object({
|
|
269
273
|
amount: z.number().int().min(1),
|
|
270
274
|
currency: z.string().min(3).max(3),
|
|
271
275
|
gateway: z.string(),
|
|
276
|
+
methodKind: z.enum(PAYMENT_METHOD_KIND_VALUES),
|
|
272
277
|
customerId: z.string().optional(),
|
|
273
278
|
sourceId: z.string().optional(),
|
|
274
279
|
sourceModel: z.string().optional(),
|
|
@@ -26,6 +26,21 @@ declare const transactionBaseSchema: z.ZodObject<{
|
|
|
26
26
|
isInclusive: z.ZodOptional<z.ZodBoolean>;
|
|
27
27
|
}, z.core.$strip>>;
|
|
28
28
|
method: z.ZodString;
|
|
29
|
+
methodKind: z.ZodEnum<{
|
|
30
|
+
card: "card";
|
|
31
|
+
bank_transfer: "bank_transfer";
|
|
32
|
+
instant_bank_transfer: "instant_bank_transfer";
|
|
33
|
+
direct_debit: "direct_debit";
|
|
34
|
+
wallet: "wallet";
|
|
35
|
+
mobile_money: "mobile_money";
|
|
36
|
+
bnpl: "bnpl";
|
|
37
|
+
gift_card: "gift_card";
|
|
38
|
+
cash: "cash";
|
|
39
|
+
cheque: "cheque";
|
|
40
|
+
cryptocurrency: "cryptocurrency";
|
|
41
|
+
manual: "manual";
|
|
42
|
+
other: "other";
|
|
43
|
+
}>;
|
|
29
44
|
status: z.ZodDefault<z.ZodString>;
|
|
30
45
|
gateway: z.ZodOptional<z.ZodObject<{
|
|
31
46
|
type: z.ZodString;
|
|
@@ -95,30 +110,16 @@ declare const transactionBaseSchema: z.ZodObject<{
|
|
|
95
110
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
96
111
|
}, z.core.$strip>;
|
|
97
112
|
declare const transactionCreateSchema: z.ZodObject<{
|
|
113
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
114
|
+
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
115
|
type: z.ZodString;
|
|
99
|
-
amount: z.ZodNumber;
|
|
100
|
-
currency: z.ZodString;
|
|
101
|
-
relatedTransactionId: z.ZodOptional<z.ZodString>;
|
|
102
116
|
flow: z.ZodEnum<{
|
|
103
117
|
inflow: "inflow";
|
|
104
118
|
outflow: "outflow";
|
|
105
119
|
}>;
|
|
106
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
107
|
-
status: z.ZodDefault<z.ZodString>;
|
|
108
|
-
gateway: z.ZodOptional<z.ZodObject<{
|
|
109
|
-
type: z.ZodString;
|
|
110
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
111
|
-
paymentIntentId: z.ZodOptional<z.ZodString>;
|
|
112
|
-
chargeId: z.ZodOptional<z.ZodString>;
|
|
113
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
114
|
-
verificationData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
115
|
-
}, z.core.$strip>>;
|
|
116
|
-
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
|
-
sourceId: z.ZodOptional<z.ZodString>;
|
|
118
|
-
sourceModel: z.ZodOptional<z.ZodString>;
|
|
119
|
-
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
120
|
-
organizationId: z.ZodOptional<z.ZodString>;
|
|
121
120
|
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
121
|
+
amount: z.ZodNumber;
|
|
122
|
+
currency: z.ZodString;
|
|
122
123
|
fee: z.ZodDefault<z.ZodNumber>;
|
|
123
124
|
tax: z.ZodDefault<z.ZodNumber>;
|
|
124
125
|
net: z.ZodDefault<z.ZodNumber>;
|
|
@@ -132,6 +133,31 @@ declare const transactionCreateSchema: z.ZodObject<{
|
|
|
132
133
|
isInclusive: z.ZodOptional<z.ZodBoolean>;
|
|
133
134
|
}, z.core.$strip>>;
|
|
134
135
|
method: z.ZodString;
|
|
136
|
+
methodKind: z.ZodEnum<{
|
|
137
|
+
card: "card";
|
|
138
|
+
bank_transfer: "bank_transfer";
|
|
139
|
+
instant_bank_transfer: "instant_bank_transfer";
|
|
140
|
+
direct_debit: "direct_debit";
|
|
141
|
+
wallet: "wallet";
|
|
142
|
+
mobile_money: "mobile_money";
|
|
143
|
+
bnpl: "bnpl";
|
|
144
|
+
gift_card: "gift_card";
|
|
145
|
+
cash: "cash";
|
|
146
|
+
cheque: "cheque";
|
|
147
|
+
cryptocurrency: "cryptocurrency";
|
|
148
|
+
manual: "manual";
|
|
149
|
+
other: "other";
|
|
150
|
+
}>;
|
|
151
|
+
status: z.ZodDefault<z.ZodString>;
|
|
152
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
153
|
+
gateway: z.ZodOptional<z.ZodObject<{
|
|
154
|
+
type: z.ZodString;
|
|
155
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
156
|
+
paymentIntentId: z.ZodOptional<z.ZodString>;
|
|
157
|
+
chargeId: z.ZodOptional<z.ZodString>;
|
|
158
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
159
|
+
verificationData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
160
|
+
}, z.core.$strip>>;
|
|
135
161
|
paymentDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
136
162
|
commission: z.ZodOptional<z.ZodObject<{
|
|
137
163
|
rate: z.ZodNumber;
|
|
@@ -172,6 +198,10 @@ declare const transactionCreateSchema: z.ZodObject<{
|
|
|
172
198
|
}, z.core.$strip>>>;
|
|
173
199
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
174
200
|
}, z.core.$strip>>;
|
|
201
|
+
sourceId: z.ZodOptional<z.ZodString>;
|
|
202
|
+
sourceModel: z.ZodOptional<z.ZodString>;
|
|
203
|
+
relatedTransactionId: z.ZodOptional<z.ZodString>;
|
|
204
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
175
205
|
}, z.core.$strip>;
|
|
176
206
|
declare const transactionUpdateSchema: z.ZodObject<{
|
|
177
207
|
publicId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -198,6 +228,21 @@ declare const transactionUpdateSchema: z.ZodObject<{
|
|
|
198
228
|
isInclusive: z.ZodOptional<z.ZodBoolean>;
|
|
199
229
|
}, z.core.$strip>>>;
|
|
200
230
|
method: z.ZodOptional<z.ZodString>;
|
|
231
|
+
methodKind: z.ZodOptional<z.ZodEnum<{
|
|
232
|
+
card: "card";
|
|
233
|
+
bank_transfer: "bank_transfer";
|
|
234
|
+
instant_bank_transfer: "instant_bank_transfer";
|
|
235
|
+
direct_debit: "direct_debit";
|
|
236
|
+
wallet: "wallet";
|
|
237
|
+
mobile_money: "mobile_money";
|
|
238
|
+
bnpl: "bnpl";
|
|
239
|
+
gift_card: "gift_card";
|
|
240
|
+
cash: "cash";
|
|
241
|
+
cheque: "cheque";
|
|
242
|
+
cryptocurrency: "cryptocurrency";
|
|
243
|
+
manual: "manual";
|
|
244
|
+
other: "other";
|
|
245
|
+
}>>;
|
|
201
246
|
status: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
202
247
|
gateway: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
203
248
|
type: z.ZodString;
|
|
@@ -315,14 +360,14 @@ declare const subscriptionBaseSchema: z.ZodObject<{
|
|
|
315
360
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
316
361
|
}, z.core.$strip>;
|
|
317
362
|
declare const subscriptionCreateSchema: z.ZodObject<{
|
|
363
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
364
|
+
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
318
365
|
amount: z.ZodNumber;
|
|
319
366
|
currency: z.ZodOptional<z.ZodString>;
|
|
320
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
321
|
-
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
322
|
-
planKey: z.ZodString;
|
|
323
367
|
paymentIntentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
368
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
324
369
|
transactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
325
|
-
|
|
370
|
+
planKey: z.ZodString;
|
|
326
371
|
startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
327
372
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
328
373
|
pauseReason: z.ZodOptional<z.ZodString>;
|
|
@@ -387,12 +432,12 @@ declare const settlementBaseSchema: z.ZodObject<{
|
|
|
387
432
|
}>;
|
|
388
433
|
status: z.ZodDefault<z.ZodString>;
|
|
389
434
|
payoutMethod: z.ZodEnum<{
|
|
390
|
-
|
|
435
|
+
check: "check";
|
|
391
436
|
bank_transfer: "bank_transfer";
|
|
437
|
+
manual: "manual";
|
|
392
438
|
mobile_wallet: "mobile_wallet";
|
|
393
439
|
platform_balance: "platform_balance";
|
|
394
440
|
crypto: "crypto";
|
|
395
|
-
check: "check";
|
|
396
441
|
}>;
|
|
397
442
|
amount: z.ZodNumber;
|
|
398
443
|
currency: z.ZodString;
|
|
@@ -433,6 +478,7 @@ declare const settlementBaseSchema: z.ZodObject<{
|
|
|
433
478
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
434
479
|
}, z.core.$strip>;
|
|
435
480
|
declare const settlementCreateSchema: z.ZodObject<{
|
|
481
|
+
organizationId: z.ZodString;
|
|
436
482
|
type: z.ZodEnum<{
|
|
437
483
|
split_payout: "split_payout";
|
|
438
484
|
platform_withdrawal: "platform_withdrawal";
|
|
@@ -441,7 +487,6 @@ declare const settlementCreateSchema: z.ZodObject<{
|
|
|
441
487
|
}>;
|
|
442
488
|
amount: z.ZodNumber;
|
|
443
489
|
currency: z.ZodString;
|
|
444
|
-
notes: z.ZodOptional<z.ZodString>;
|
|
445
490
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
446
491
|
recipientId: z.ZodString;
|
|
447
492
|
recipientType: z.ZodEnum<{
|
|
@@ -451,14 +496,13 @@ declare const settlementCreateSchema: z.ZodObject<{
|
|
|
451
496
|
affiliate: "affiliate";
|
|
452
497
|
partner: "partner";
|
|
453
498
|
}>;
|
|
454
|
-
organizationId: z.ZodString;
|
|
455
499
|
payoutMethod: z.ZodEnum<{
|
|
456
|
-
|
|
500
|
+
check: "check";
|
|
457
501
|
bank_transfer: "bank_transfer";
|
|
502
|
+
manual: "manual";
|
|
458
503
|
mobile_wallet: "mobile_wallet";
|
|
459
504
|
platform_balance: "platform_balance";
|
|
460
505
|
crypto: "crypto";
|
|
461
|
-
check: "check";
|
|
462
506
|
}>;
|
|
463
507
|
sourceTransactionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
464
508
|
sourceSplitIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -486,6 +530,7 @@ declare const settlementCreateSchema: z.ZodObject<{
|
|
|
486
530
|
transferredAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
487
531
|
}, z.core.$strip>>;
|
|
488
532
|
scheduledAt: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
533
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
489
534
|
}, z.core.$strip>;
|
|
490
535
|
declare const settlementUpdateSchema: z.ZodObject<{
|
|
491
536
|
publicId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -506,12 +551,12 @@ declare const settlementUpdateSchema: z.ZodObject<{
|
|
|
506
551
|
}>>;
|
|
507
552
|
status: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
508
553
|
payoutMethod: z.ZodOptional<z.ZodEnum<{
|
|
509
|
-
|
|
554
|
+
check: "check";
|
|
510
555
|
bank_transfer: "bank_transfer";
|
|
556
|
+
manual: "manual";
|
|
511
557
|
mobile_wallet: "mobile_wallet";
|
|
512
558
|
platform_balance: "platform_balance";
|
|
513
559
|
crypto: "crypto";
|
|
514
|
-
check: "check";
|
|
515
560
|
}>>;
|
|
516
561
|
amount: z.ZodOptional<z.ZodNumber>;
|
|
517
562
|
currency: z.ZodOptional<z.ZodString>;
|
|
@@ -572,6 +617,21 @@ declare const paymentIntentSchema: z.ZodObject<{
|
|
|
572
617
|
amount: z.ZodNumber;
|
|
573
618
|
currency: z.ZodString;
|
|
574
619
|
gateway: z.ZodString;
|
|
620
|
+
methodKind: z.ZodEnum<{
|
|
621
|
+
card: "card";
|
|
622
|
+
bank_transfer: "bank_transfer";
|
|
623
|
+
instant_bank_transfer: "instant_bank_transfer";
|
|
624
|
+
direct_debit: "direct_debit";
|
|
625
|
+
wallet: "wallet";
|
|
626
|
+
mobile_money: "mobile_money";
|
|
627
|
+
bnpl: "bnpl";
|
|
628
|
+
gift_card: "gift_card";
|
|
629
|
+
cash: "cash";
|
|
630
|
+
cheque: "cheque";
|
|
631
|
+
cryptocurrency: "cryptocurrency";
|
|
632
|
+
manual: "manual";
|
|
633
|
+
other: "other";
|
|
634
|
+
}>;
|
|
575
635
|
customerId: z.ZodOptional<z.ZodString>;
|
|
576
636
|
sourceId: z.ZodOptional<z.ZodString>;
|
|
577
637
|
sourceModel: z.ZodOptional<z.ZodString>;
|
|
@@ -27,6 +27,13 @@ const REVENUE_EVENTS = {
|
|
|
27
27
|
PAYMENT_REFUNDED: "revenue:payment.refunded",
|
|
28
28
|
PAYMENT_REQUIRES_ACTION: "revenue:payment.requires_action",
|
|
29
29
|
PAYMENT_PROCESSING: "revenue:payment.processing",
|
|
30
|
+
PAYMENT_AUTHORIZED: "revenue:payment.authorized",
|
|
31
|
+
PAYMENT_CAPTURED: "revenue:payment.captured",
|
|
32
|
+
PAYMENT_AUTH_VOIDED: "revenue:payment.auth_voided",
|
|
33
|
+
PAYMENT_DISPUTED: "revenue:payment.disputed",
|
|
34
|
+
PAYMENT_DISPUTE_WON: "revenue:payment.dispute_won",
|
|
35
|
+
PAYMENT_DISPUTE_LOST: "revenue:payment.dispute_lost",
|
|
36
|
+
PAYMENT_SETTLED: "revenue:payment.settled",
|
|
30
37
|
MONETIZATION_CREATED: "revenue:monetization.created",
|
|
31
38
|
PURCHASE_CREATED: "revenue:purchase.created",
|
|
32
39
|
FREE_CREATED: "revenue:free.created",
|
package/dist/events/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as TransactionJournalizedPayload, A as SettlementCreated, B as SubscriptionCancelled, C as PurchaseCreated, D as RevenueEventSchema, E as RevenueEventPayloadOf, F as SettlementProcessingPayload, G as SubscriptionPausedPayload, H as SubscriptionCreated, I as SettlementScheduled, J as SubscriptionResumed, K as SubscriptionRenewed, L as SettlementScheduledPayload, M as SettlementFailed, N as SettlementFailedPayload, O as SettlementCompleted, P as SettlementProcessing, Q as TransactionJournalized, R as SubscriptionActivated, S as PaymentVerifiedPayload, T as RevenueEventDefinition, U as SubscriptionCreatedPayload, V as SubscriptionCancelledPayload, W as SubscriptionPaused, X as TransactionImported, Y as SubscriptionResumedPayload, Z as TransactionImportedPayload, _ as PaymentRefunded, _t as InProcessRevenueBusOptions, a as EscrowReleased, at as TransactionRemovedByFeedPayload, b as PaymentRequiresActionPayload, c as EscrowSplitPayload, ct as TransactionUpdated, d as MonetizationCreated, dt as WebhookProcessedPayload, et as TransactionMatched, f as MonetizationCreatedPayload, ft as revenueEventDefinitions, g as PaymentProcessingPayload, gt as InProcessRevenueBus, h as PaymentProcessing, ht as createEvent, i as EscrowHeldPayload, it as TransactionRemovedByFeed, j as SettlementCreatedPayload, k as SettlementCompletedPayload, l as FreeCreated, lt as TransactionUpdatedPayload, m as PaymentFailedPayload, mt as RevenueEventName, n as EscrowCancelledPayload, nt as TransactionRejected, o as EscrowReleasedPayload, ot as TransactionUnmatched, p as PaymentFailed, pt as REVENUE_EVENTS, q as SubscriptionRenewedPayload, r as EscrowHeld, rt as TransactionRejectedPayload, s as EscrowSplit, st as TransactionUnmatchedPayload, t as EscrowCancelled, tt as TransactionMatchedPayload, u as FreeCreatedPayload, ut as WebhookProcessed, v as PaymentRefundedPayload, w as PurchaseCreatedPayload, x as PaymentVerified, y as PaymentRequiresAction, z as SubscriptionActivatedPayload } from "../revenue-event-catalog-
|
|
1
|
+
import { $ as TransactionJournalizedPayload, A as SettlementCreated, B as SubscriptionCancelled, C as PurchaseCreated, D as RevenueEventSchema, E as RevenueEventPayloadOf, F as SettlementProcessingPayload, G as SubscriptionPausedPayload, H as SubscriptionCreated, I as SettlementScheduled, J as SubscriptionResumed, K as SubscriptionRenewed, L as SettlementScheduledPayload, M as SettlementFailed, N as SettlementFailedPayload, O as SettlementCompleted, P as SettlementProcessing, Q as TransactionJournalized, R as SubscriptionActivated, S as PaymentVerifiedPayload, T as RevenueEventDefinition, U as SubscriptionCreatedPayload, V as SubscriptionCancelledPayload, W as SubscriptionPaused, X as TransactionImported, Y as SubscriptionResumedPayload, Z as TransactionImportedPayload, _ as PaymentRefunded, _t as InProcessRevenueBusOptions, a as EscrowReleased, at as TransactionRemovedByFeedPayload, b as PaymentRequiresActionPayload, c as EscrowSplitPayload, ct as TransactionUpdated, d as MonetizationCreated, dt as WebhookProcessedPayload, et as TransactionMatched, f as MonetizationCreatedPayload, ft as revenueEventDefinitions, g as PaymentProcessingPayload, gt as InProcessRevenueBus, h as PaymentProcessing, ht as createEvent, i as EscrowHeldPayload, it as TransactionRemovedByFeed, j as SettlementCreatedPayload, k as SettlementCompletedPayload, l as FreeCreated, lt as TransactionUpdatedPayload, m as PaymentFailedPayload, mt as RevenueEventName, n as EscrowCancelledPayload, nt as TransactionRejected, o as EscrowReleasedPayload, ot as TransactionUnmatched, p as PaymentFailed, pt as REVENUE_EVENTS, q as SubscriptionRenewedPayload, r as EscrowHeld, rt as TransactionRejectedPayload, s as EscrowSplit, st as TransactionUnmatchedPayload, t as EscrowCancelled, tt as TransactionMatchedPayload, u as FreeCreatedPayload, ut as WebhookProcessed, v as PaymentRefundedPayload, w as PurchaseCreatedPayload, x as PaymentVerified, y as PaymentRequiresAction, z as SubscriptionActivatedPayload } from "../revenue-event-catalog-j8Fh7Yag.mjs";
|
|
2
2
|
import { DomainEvent, EventHandler, EventTransport } from "@classytic/primitives/events";
|
|
3
3
|
export { type DomainEvent, EscrowCancelled, type EscrowCancelledPayload, EscrowHeld, type EscrowHeldPayload, EscrowReleased, type EscrowReleasedPayload, EscrowSplit, type EscrowSplitPayload, type EventHandler, type EventTransport, FreeCreated, type FreeCreatedPayload, InProcessRevenueBus, type InProcessRevenueBusOptions, MonetizationCreated, type MonetizationCreatedPayload, PaymentFailed, type PaymentFailedPayload, PaymentProcessing, type PaymentProcessingPayload, PaymentRefunded, type PaymentRefundedPayload, PaymentRequiresAction, type PaymentRequiresActionPayload, PaymentVerified, type PaymentVerifiedPayload, PurchaseCreated, type PurchaseCreatedPayload, REVENUE_EVENTS, type RevenueEventDefinition, type RevenueEventName, type RevenueEventPayloadOf, type RevenueEventSchema, SettlementCompleted, type SettlementCompletedPayload, SettlementCreated, type SettlementCreatedPayload, SettlementFailed, type SettlementFailedPayload, SettlementProcessing, type SettlementProcessingPayload, SettlementScheduled, type SettlementScheduledPayload, SubscriptionActivated, type SubscriptionActivatedPayload, SubscriptionCancelled, type SubscriptionCancelledPayload, SubscriptionCreated, type SubscriptionCreatedPayload, SubscriptionPaused, type SubscriptionPausedPayload, SubscriptionRenewed, type SubscriptionRenewedPayload, SubscriptionResumed, type SubscriptionResumedPayload, TransactionImported, type TransactionImportedPayload, TransactionJournalized, type TransactionJournalizedPayload, TransactionMatched, type TransactionMatchedPayload, TransactionRejected, type TransactionRejectedPayload, TransactionRemovedByFeed, type TransactionRemovedByFeedPayload, TransactionUnmatched, type TransactionUnmatchedPayload, TransactionUpdated, type TransactionUpdatedPayload, WebhookProcessed, type WebhookProcessedPayload, createEvent, revenueEventDefinitions };
|
package/dist/events/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createEvent, t as REVENUE_EVENTS } from "../event-constants-
|
|
2
|
-
import { A as TransactionUpdated, C as SubscriptionResumed, D as TransactionRejected, E as TransactionMatched, M as revenueEventDefinitions, N as InProcessRevenueBus, O as TransactionRemovedByFeed, S as SubscriptionRenewed, T as TransactionJournalized, _ as SettlementScheduled, a as FreeCreated, b as SubscriptionCreated, c as PaymentProcessing, d as PaymentVerified, f as PurchaseCreated, g as SettlementProcessing, h as SettlementFailed, i as EscrowSplit, j as WebhookProcessed, k as TransactionUnmatched, l as PaymentRefunded, m as SettlementCreated, n as EscrowHeld, o as MonetizationCreated, p as SettlementCompleted, r as EscrowReleased, s as PaymentFailed, t as EscrowCancelled, u as PaymentRequiresAction, v as SubscriptionActivated, w as TransactionImported, x as SubscriptionPaused, y as SubscriptionCancelled } from "../revenue-event-catalog-
|
|
1
|
+
import { n as createEvent, t as REVENUE_EVENTS } from "../event-constants-DM_-A57b.mjs";
|
|
2
|
+
import { A as TransactionUpdated, C as SubscriptionResumed, D as TransactionRejected, E as TransactionMatched, M as revenueEventDefinitions, N as InProcessRevenueBus, O as TransactionRemovedByFeed, S as SubscriptionRenewed, T as TransactionJournalized, _ as SettlementScheduled, a as FreeCreated, b as SubscriptionCreated, c as PaymentProcessing, d as PaymentVerified, f as PurchaseCreated, g as SettlementProcessing, h as SettlementFailed, i as EscrowSplit, j as WebhookProcessed, k as TransactionUnmatched, l as PaymentRefunded, m as SettlementCreated, n as EscrowHeld, o as MonetizationCreated, p as SettlementCompleted, r as EscrowReleased, s as PaymentFailed, t as EscrowCancelled, u as PaymentRequiresAction, v as SubscriptionActivated, w as TransactionImported, x as SubscriptionPaused, y as SubscriptionCancelled } from "../revenue-event-catalog-B9aZmNpL.mjs";
|
|
3
3
|
|
|
4
4
|
export { EscrowCancelled, EscrowHeld, EscrowReleased, EscrowSplit, FreeCreated, InProcessRevenueBus, MonetizationCreated, PaymentFailed, PaymentProcessing, PaymentRefunded, PaymentRequiresAction, PaymentVerified, PurchaseCreated, REVENUE_EVENTS, SettlementCompleted, SettlementCreated, SettlementFailed, SettlementProcessing, SettlementScheduled, SubscriptionActivated, SubscriptionCancelled, SubscriptionCreated, SubscriptionPaused, SubscriptionRenewed, SubscriptionResumed, TransactionImported, TransactionJournalized, TransactionMatched, TransactionRejected, TransactionRemovedByFeed, TransactionUnmatched, TransactionUpdated, WebhookProcessed, createEvent, revenueEventDefinitions };
|