@openora/core 0.4.1-canary.278 → 0.4.1-canary.280
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/.tsbuildinfo +1 -1
- package/dist/admin-console/contract/index.d.ts +6 -0
- package/dist/admin-console/contract/index.d.ts.map +1 -1
- package/dist/admin-console/plugin.d.ts +1 -0
- package/dist/admin-console/plugin.d.ts.map +1 -1
- package/dist/admin-console/router/index.d.ts +3 -0
- package/dist/admin-console/router/index.d.ts.map +1 -1
- package/dist/analytics/plugin.d.ts +1 -0
- package/dist/analytics/plugin.d.ts.map +1 -1
- package/dist/audit/plugin.d.ts +1 -0
- package/dist/audit/plugin.d.ts.map +1 -1
- package/dist/casino/gaming/plugin.d.ts +1 -0
- package/dist/casino/gaming/plugin.d.ts.map +1 -1
- package/dist/casino/lobby/plugin.d.ts +1 -0
- package/dist/casino/lobby/plugin.d.ts.map +1 -1
- package/dist/cms/plugin.d.ts +1 -0
- package/dist/cms/plugin.d.ts.map +1 -1
- package/dist/compliance/__tests__/rg-monitoring.service.int.test.js +11 -0
- package/dist/compliance/__tests__/rg-monitoring.service.int.test.js.map +1 -1
- package/dist/compliance/plugin.d.ts +1 -0
- package/dist/compliance/plugin.d.ts.map +1 -1
- package/dist/compliance/service/rg-monitoring.service.d.ts.map +1 -1
- package/dist/compliance/service/rg-monitoring.service.js +6 -2
- package/dist/compliance/service/rg-monitoring.service.js.map +1 -1
- package/dist/contracts/adapters/deposit-hold.d.ts +25 -0
- package/dist/contracts/adapters/deposit-hold.d.ts.map +1 -0
- package/dist/contracts/adapters/deposit-hold.js +3 -0
- package/dist/contracts/adapters/deposit-hold.js.map +1 -0
- package/dist/contracts/adapters/index.d.ts +2 -0
- package/dist/contracts/adapters/index.d.ts.map +1 -1
- package/dist/contracts/adapters/index.js +1 -0
- package/dist/contracts/adapters/index.js.map +1 -1
- package/dist/contracts/adapters/payment.d.ts +11 -0
- package/dist/contracts/adapters/payment.d.ts.map +1 -1
- package/dist/contracts/adapters/payment.js.map +1 -1
- package/dist/contracts/adapters/play-eligibility.d.ts +4 -1
- package/dist/contracts/adapters/play-eligibility.d.ts.map +1 -1
- package/dist/contracts/adapters/play-eligibility.js.map +1 -1
- package/dist/contracts/schemas/events.d.ts +7 -0
- package/dist/contracts/schemas/events.d.ts.map +1 -1
- package/dist/contracts/schemas/events.js +3 -0
- package/dist/contracts/schemas/events.js.map +1 -1
- package/dist/contracts/schemas/mail.d.ts +15 -1
- package/dist/contracts/schemas/mail.d.ts.map +1 -1
- package/dist/contracts/schemas/mail.js +3 -0
- package/dist/contracts/schemas/mail.js.map +1 -1
- package/dist/contracts/schemas/wallet-tx.d.ts +4 -2
- package/dist/contracts/schemas/wallet-tx.d.ts.map +1 -1
- package/dist/contracts/schemas/wallet-tx.js +3 -0
- package/dist/contracts/schemas/wallet-tx.js.map +1 -1
- package/dist/engagement/chat/__tests__/context-rooms.int.test.js +25 -0
- package/dist/engagement/chat/__tests__/context-rooms.int.test.js.map +1 -1
- package/dist/engagement/chat/drizzle/migrations/0021_chat_message_created_at_clock.sql +1 -0
- package/dist/engagement/chat/drizzle/migrations/meta/0021_snapshot.json +2100 -0
- package/dist/engagement/chat/drizzle/migrations/meta/_journal.json +7 -0
- package/dist/engagement/chat/plugin.d.ts +1 -0
- package/dist/engagement/chat/plugin.d.ts.map +1 -1
- package/dist/engagement/chat/schema/index.d.ts.map +1 -1
- package/dist/engagement/chat/schema/index.js +3 -1
- package/dist/engagement/chat/schema/index.js.map +1 -1
- package/dist/engagement/chat-commands/plugin.d.ts +1 -0
- package/dist/engagement/chat-commands/plugin.d.ts.map +1 -1
- package/dist/engagement/notifications/__tests__/notification-event-map.test.js +20 -0
- package/dist/engagement/notifications/__tests__/notification-event-map.test.js.map +1 -1
- package/dist/engagement/notifications/contract/index.d.ts +7 -3
- package/dist/engagement/notifications/contract/index.d.ts.map +1 -1
- package/dist/engagement/notifications/contract/index.js +1 -0
- package/dist/engagement/notifications/contract/index.js.map +1 -1
- package/dist/engagement/notifications/plugin.d.ts +1 -0
- package/dist/engagement/notifications/plugin.d.ts.map +1 -1
- package/dist/engagement/notifications/plugin.js +17 -0
- package/dist/engagement/notifications/plugin.js.map +1 -1
- package/dist/engagement/notifications/router/index.d.ts +3 -2
- package/dist/engagement/notifications/router/index.d.ts.map +1 -1
- package/dist/engagement/social/plugin.d.ts +1 -0
- package/dist/engagement/social/plugin.d.ts.map +1 -1
- package/dist/fx/exchange-rate/plugin.d.ts +1 -0
- package/dist/fx/exchange-rate/plugin.d.ts.map +1 -1
- package/dist/iam/plugin.d.ts +1 -0
- package/dist/iam/plugin.d.ts.map +1 -1
- package/dist/mail/adapters/default-email-template-renderer.d.ts.map +1 -1
- package/dist/mail/adapters/default-email-template-renderer.js +5 -0
- package/dist/mail/adapters/default-email-template-renderer.js.map +1 -1
- package/dist/mail/contract/index.d.ts +8 -0
- package/dist/mail/contract/index.d.ts.map +1 -1
- package/dist/mail/plugin.d.ts +1 -0
- package/dist/mail/plugin.d.ts.map +1 -1
- package/dist/pam/identity/__tests__/play-eligibility.service.int.test.js +17 -0
- package/dist/pam/identity/__tests__/play-eligibility.service.int.test.js.map +1 -1
- package/dist/pam/identity/plugin.d.ts +1 -0
- package/dist/pam/identity/plugin.d.ts.map +1 -1
- package/dist/pam/identity/service/play-eligibility.service.d.ts.map +1 -1
- package/dist/pam/identity/service/play-eligibility.service.js +2 -1
- package/dist/pam/identity/service/play-eligibility.service.js.map +1 -1
- package/dist/pam/player-management/plugin.d.ts +1 -0
- package/dist/pam/player-management/plugin.d.ts.map +1 -1
- package/dist/pam/player-note/plugin.d.ts +1 -0
- package/dist/pam/player-note/plugin.d.ts.map +1 -1
- package/dist/pam/profile/plugin.d.ts +1 -0
- package/dist/pam/profile/plugin.d.ts.map +1 -1
- package/dist/pam/tag/plugin.d.ts +1 -0
- package/dist/pam/tag/plugin.d.ts.map +1 -1
- package/dist/promo/bonus/plugin.d.ts +1 -0
- package/dist/promo/bonus/plugin.d.ts.map +1 -1
- package/dist/promo/gamification/plugin.d.ts +1 -0
- package/dist/promo/gamification/plugin.d.ts.map +1 -1
- package/dist/server/runtime/core-token-catalog.d.ts +1 -0
- package/dist/server/runtime/core-token-catalog.d.ts.map +1 -1
- package/dist/server/runtime/core-token-catalog.js +2 -1
- package/dist/server/runtime/core-token-catalog.js.map +1 -1
- package/dist/wallet/__tests__/reconciliation.service.int.test.js +516 -66
- package/dist/wallet/__tests__/reconciliation.service.int.test.js.map +1 -1
- package/dist/wallet/__tests__/settlement-network.test.js +15 -1
- package/dist/wallet/__tests__/settlement-network.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet-auto-withdrawal.int.test.js +17 -2
- package/dist/wallet/__tests__/wallet-auto-withdrawal.int.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet-custody-routes.router.test.js +19 -0
- package/dist/wallet/__tests__/wallet-custody-routes.router.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet.service.int.test.js +95 -0
- package/dist/wallet/__tests__/wallet.service.int.test.js.map +1 -1
- package/dist/wallet/admin-reporting.d.ts +2 -2
- package/dist/wallet/contract/agent-tools.d.ts +2 -0
- package/dist/wallet/contract/agent-tools.d.ts.map +1 -1
- package/dist/wallet/contract/index.d.ts +58 -3
- package/dist/wallet/contract/index.d.ts.map +1 -1
- package/dist/wallet/contract/index.js +23 -4
- package/dist/wallet/contract/index.js.map +1 -1
- package/dist/wallet/drizzle/migrations/0030_brainy_black_panther.sql +1 -0
- package/dist/wallet/drizzle/migrations/0031_eminent_star_brand.sql +1 -0
- package/dist/wallet/drizzle/migrations/0032_clumsy_ink.sql +1 -0
- package/dist/wallet/drizzle/migrations/0033_lucky_silver_samurai.sql +10 -0
- package/dist/wallet/drizzle/migrations/meta/0030_snapshot.json +2090 -0
- package/dist/wallet/drizzle/migrations/meta/0031_snapshot.json +2099 -0
- package/dist/wallet/drizzle/migrations/meta/0032_snapshot.json +2105 -0
- package/dist/wallet/drizzle/migrations/meta/0033_snapshot.json +2182 -0
- package/dist/wallet/drizzle/migrations/meta/_journal.json +28 -0
- package/dist/wallet/plugin.d.ts +1 -0
- package/dist/wallet/plugin.d.ts.map +1 -1
- package/dist/wallet/plugin.js +2 -1
- package/dist/wallet/plugin.js.map +1 -1
- package/dist/wallet/router/index.d.ts +27 -1
- package/dist/wallet/router/index.d.ts.map +1 -1
- package/dist/wallet/router/index.js +19 -3
- package/dist/wallet/router/index.js.map +1 -1
- package/dist/wallet/schema/index.d.ts +118 -8
- package/dist/wallet/schema/index.d.ts.map +1 -1
- package/dist/wallet/schema/index.js +17 -0
- package/dist/wallet/schema/index.js.map +1 -1
- package/dist/wallet/server.d.ts +1 -1
- package/dist/wallet/server.d.ts.map +1 -1
- package/dist/wallet/server.js +1 -1
- package/dist/wallet/server.js.map +1 -1
- package/dist/wallet/service/reconciliation-finding.service.d.ts +14 -0
- package/dist/wallet/service/reconciliation-finding.service.d.ts.map +1 -1
- package/dist/wallet/service/reconciliation-finding.service.js +60 -11
- package/dist/wallet/service/reconciliation-finding.service.js.map +1 -1
- package/dist/wallet/service/reconciliation.service.d.ts +56 -17
- package/dist/wallet/service/reconciliation.service.d.ts.map +1 -1
- package/dist/wallet/service/reconciliation.service.js +318 -76
- package/dist/wallet/service/reconciliation.service.js.map +1 -1
- package/dist/wallet/service/wallet.service.d.ts +95 -7
- package/dist/wallet/service/wallet.service.d.ts.map +1 -1
- package/dist/wallet/service/wallet.service.js +230 -9
- package/dist/wallet/service/wallet.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type EventBus, type DrizzleDb, DrizzleService } from '@openora/core/server';
|
|
2
|
-
import { type PaymentAdapter, type PaymentProviderRegistry, type PaymentWebhookEvent, type AdminUserDirectory, type PlatformConfig, type RateLimiterAdapter, type RateLimitKey, type WalletRail, type PlayerTags, type RgLimitsPort, type KycWithdrawalPolicy, type ExchangeRateReader, type AuditWritePort, type TagEvaluationCommands, type TagKey, type User, type IdentityReader, type ClientMeta, type Uuid, type PaginationOptions, type WalletProviderRef, type ActionExecutionContext, type BonusGrantLedgerReader } from '@openora/core/contracts';
|
|
1
|
+
import { type EventBus, type DrizzleDb, type DrizzleTx, DrizzleService } from '@openora/core/server';
|
|
2
|
+
import { type PaymentAdapter, type PaymentProviderRegistry, type PaymentWebhookEvent, type AdminUserDirectory, type PlatformConfig, type RateLimiterAdapter, type RateLimitKey, type WalletRail, type PlayerTags, type RgLimitsPort, type KycWithdrawalPolicy, type DepositHoldPolicy, type ExchangeRateReader, type AuditWritePort, type TagEvaluationCommands, type TagKey, type User, type IdentityReader, type ClientMeta, type Uuid, type PaginationOptions, type WalletProviderRef, type ActionExecutionContext, type BonusGrantLedgerReader } from '@openora/core/contracts';
|
|
3
3
|
import { type SQL } from 'drizzle-orm';
|
|
4
4
|
import { type Wallet, type WalletTransaction } from '../schema/index.js';
|
|
5
5
|
import type { TransactionResult, WithdrawalQueueFilter, WithdrawalQueueSummary, WithdrawalQueueSummaryFilter, AutoWithdrawalRule, WalletAutoWithdrawalConfig, WalletTransactionSortBy, WalletTransactionListQuery, WalletAsset, PublicWalletAsset, CreateWalletAssetInput, UpdateWalletAssetInput, ManualAdjustmentDirection, WithdrawalAddress, CreateWithdrawalAddressInput } from '../contract/index.js';
|
|
@@ -33,9 +33,21 @@ export declare const WithdrawalLockedError: new () => Error & {
|
|
|
33
33
|
export declare const WithdrawalAmountNotAboveFeeError: new (amount: string, fee: string, currency: string) => Error & {
|
|
34
34
|
data?: Record<string, string>;
|
|
35
35
|
};
|
|
36
|
+
export declare const WithdrawalPrecisionError: new (amount: string, currency: string, network: string, decimals: number) => Error & {
|
|
37
|
+
data?: Record<string, string>;
|
|
38
|
+
};
|
|
36
39
|
export declare const IdempotencyKeyReuseError: new () => Error & {
|
|
37
40
|
data?: Record<string, string>;
|
|
38
41
|
};
|
|
42
|
+
export declare const HeldDepositNotFoundError: new () => Error & {
|
|
43
|
+
data?: Record<string, string>;
|
|
44
|
+
};
|
|
45
|
+
export declare const DepositStillHeldError: new (reason: string) => Error & {
|
|
46
|
+
data?: Record<string, string>;
|
|
47
|
+
};
|
|
48
|
+
export declare const DepositAlreadyOnLedgerError: new () => Error & {
|
|
49
|
+
data?: Record<string, string>;
|
|
50
|
+
};
|
|
39
51
|
export declare const DepositAddressUnsupportedError: new () => Error & {
|
|
40
52
|
data?: Record<string, string>;
|
|
41
53
|
};
|
|
@@ -124,6 +136,12 @@ export declare function assertAboveMinimumWithdrawal(assets: readonly Withdrawal
|
|
|
124
136
|
* out `amount - fee`, so the operator never funds the fee. `null` when the network charges none.
|
|
125
137
|
*/
|
|
126
138
|
export declare function withdrawalFeeFor(assets: readonly WithdrawalAsset[], amount: string, currency: string, network: string | null): string | null;
|
|
139
|
+
/**
|
|
140
|
+
* Refuses a withdrawal the vendor could not pay out exactly: the payout is `amount - fee`, so
|
|
141
|
+
* both must fit the asset's on-chain precision. Rounding either would pay a different amount
|
|
142
|
+
* than the ledger debits.
|
|
143
|
+
*/
|
|
144
|
+
export declare function assertPayablePrecision(decimals: number | null, amounts: readonly (string | null)[], currency: string, network: string): void;
|
|
127
145
|
type DepositAsset = {
|
|
128
146
|
network: string;
|
|
129
147
|
minDeposit: string;
|
|
@@ -410,6 +428,23 @@ export declare function resolveWalletBalance(txn: DrizzleDb, userId: User['id'],
|
|
|
410
428
|
currency: string;
|
|
411
429
|
}>;
|
|
412
430
|
export declare function providerRefCondition(providerName: string, providerRefId: WalletProviderRef['providerRefId']): SQL<unknown> | undefined;
|
|
431
|
+
type DepositEvent = Extract<PaymentWebhookEvent, {
|
|
432
|
+
kind: 'deposit';
|
|
433
|
+
}>;
|
|
434
|
+
/** An on-chain deposit an admin settles by hand from a reconciliation finding. */
|
|
435
|
+
export type HandDeposit = {
|
|
436
|
+
userId: User['id'];
|
|
437
|
+
adminId: User['id'];
|
|
438
|
+
amount: string;
|
|
439
|
+
currency: string;
|
|
440
|
+
network: string | null;
|
|
441
|
+
providerName: string;
|
|
442
|
+
/** The vendor's deposit id, or null when another ledger row already carries it. */
|
|
443
|
+
providerRefId: string | null;
|
|
444
|
+
address: string | null;
|
|
445
|
+
tag: string | null;
|
|
446
|
+
txHash: string | null;
|
|
447
|
+
};
|
|
413
448
|
type DepositAddressResult = {
|
|
414
449
|
address: string;
|
|
415
450
|
currency: string;
|
|
@@ -431,6 +466,7 @@ export type WalletServiceDeps = {
|
|
|
431
466
|
rgLimits?: RgLimitsPort;
|
|
432
467
|
rates?: ExchangeRateReader;
|
|
433
468
|
kycPolicy?: KycWithdrawalPolicy;
|
|
469
|
+
depositHold?: DepositHoldPolicy;
|
|
434
470
|
grantLedger?: BonusGrantLedgerReader;
|
|
435
471
|
};
|
|
436
472
|
/**
|
|
@@ -456,8 +492,9 @@ export declare class WalletService {
|
|
|
456
492
|
private readonly rgLimits?;
|
|
457
493
|
private readonly rates?;
|
|
458
494
|
private readonly kycPolicy?;
|
|
495
|
+
private readonly depositHold?;
|
|
459
496
|
private readonly grantLedger?;
|
|
460
|
-
constructor({ drizzle, events, payment, paymentProviders, directory, identityReader, platformConfig, limiter, riskTags, tagEvaluationCommands, audit, rgLimits, rates, kycPolicy, grantLedger, }: WalletServiceDeps);
|
|
497
|
+
constructor({ drizzle, events, payment, paymentProviders, directory, identityReader, platformConfig, limiter, riskTags, tagEvaluationCommands, audit, rgLimits, rates, kycPolicy, depositHold, grantLedger, }: WalletServiceDeps);
|
|
461
498
|
private assetsForCurrency;
|
|
462
499
|
private depositAssetsForCurrency;
|
|
463
500
|
/**
|
|
@@ -520,7 +557,7 @@ export declare class WalletService {
|
|
|
520
557
|
withdrawalId: string;
|
|
521
558
|
amount: string;
|
|
522
559
|
currency: string;
|
|
523
|
-
status: "pending" | "rejected" | "processing" | "completed" | "failed" | "on_hold" | "cancelled";
|
|
560
|
+
status: "pending" | "rejected" | "processing" | "completed" | "failed" | "on_hold" | "cancelled" | "refunded";
|
|
524
561
|
}[];
|
|
525
562
|
}>;
|
|
526
563
|
private completedTotalsSince;
|
|
@@ -629,7 +666,7 @@ export declare class WalletService {
|
|
|
629
666
|
currency: string;
|
|
630
667
|
network: string | null;
|
|
631
668
|
rail: "crypto" | "fiat" | null;
|
|
632
|
-
status: "pending" | "rejected" | "processing" | "completed" | "failed" | "on_hold" | "cancelled";
|
|
669
|
+
status: "pending" | "rejected" | "processing" | "completed" | "failed" | "on_hold" | "cancelled" | "refunded";
|
|
633
670
|
kycStatus: "pending" | "not_started" | "approved" | "verified" | "rejected" | "resubmission_requested" | "manually_overridden" | null;
|
|
634
671
|
riskTags: string[];
|
|
635
672
|
withdrawalLocked: boolean;
|
|
@@ -694,7 +731,7 @@ export declare class WalletService {
|
|
|
694
731
|
getPlayerWithdrawalStatus({ userId, withdrawalId, }: {
|
|
695
732
|
userId: User['id'];
|
|
696
733
|
withdrawalId: WalletTransaction['id'];
|
|
697
|
-
}): Promise<"pending" | "rejected" | "processing" | "completed" | "failed" | "on_hold" | "cancelled">;
|
|
734
|
+
}): Promise<"pending" | "rejected" | "processing" | "completed" | "failed" | "on_hold" | "cancelled" | "refunded">;
|
|
698
735
|
/**
|
|
699
736
|
* Holds the player's pending withdrawal for manual review, on an agent proposal an admin
|
|
700
737
|
* approved. No money moves: the funds were held when the withdrawal was requested, and an admin
|
|
@@ -726,7 +763,7 @@ export declare class WalletService {
|
|
|
726
763
|
amount: string;
|
|
727
764
|
currency: string;
|
|
728
765
|
network: string | null;
|
|
729
|
-
status: "pending" | "rejected" | "processing" | "completed" | "failed" | "on_hold" | "cancelled";
|
|
766
|
+
status: "pending" | "rejected" | "processing" | "completed" | "failed" | "on_hold" | "cancelled" | "refunded";
|
|
730
767
|
direction: "credit" | "debit" | null;
|
|
731
768
|
fee: string | null;
|
|
732
769
|
createdAt: string;
|
|
@@ -754,6 +791,57 @@ export declare class WalletService {
|
|
|
754
791
|
creditDepositByAddress(event: Extract<PaymentWebhookEvent, {
|
|
755
792
|
kind: 'deposit';
|
|
756
793
|
}>, providerName?: string): Promise<void>;
|
|
794
|
+
/**
|
|
795
|
+
* Credits a held on-chain deposit to the player, in the caller's transaction, after asking
|
|
796
|
+
* the deposit policy again: the player must no longer be restricted and the deposit must fit
|
|
797
|
+
* their limit window now, and with no policy bound it is not released at all. The row itself turns `completed`, so the deposit window counts it
|
|
798
|
+
* from `reviewedAt` (the moment it reached the balance), not from when it landed on chain.
|
|
799
|
+
* The caller announces it with `announceDepositCompleted` once the transaction commits.
|
|
800
|
+
*/
|
|
801
|
+
releaseHeldDeposit(txn: DrizzleTx, depositId: WalletTransaction['id'], adminId: User['id']): Promise<{
|
|
802
|
+
userId: User['id'];
|
|
803
|
+
amount: string;
|
|
804
|
+
currency: string;
|
|
805
|
+
}>;
|
|
806
|
+
/**
|
|
807
|
+
* Credits an on-chain deposit an admin attributed from a reconciliation finding, in the
|
|
808
|
+
* caller's transaction. The deposit policy is asked BEFORE anything is written, so a player
|
|
809
|
+
* it would hold gets nothing and the caller's transaction rolls back clean. The row is a
|
|
810
|
+
* `deposit`, not a `manual_credit`: the player's deposit-limit window counts it, and when
|
|
811
|
+
* it is keyed on the vendor id a later webhook redelivery replays it instead of crediting.
|
|
812
|
+
* The caller announces it with `announceDepositCompleted` once the transaction commits.
|
|
813
|
+
*/
|
|
814
|
+
creditDepositByHand(txn: DrizzleTx, deposit: HandDeposit): Promise<{
|
|
815
|
+
transactionId: WalletTransaction['id'];
|
|
816
|
+
userId: User['id'];
|
|
817
|
+
amount: string;
|
|
818
|
+
currency: string;
|
|
819
|
+
}>;
|
|
820
|
+
/**
|
|
821
|
+
* Records a deposit an admin refunded on chain as a terminal `refunded` deposit row keyed on
|
|
822
|
+
* the vendor id, so a webhook redelivery of it replays instead of crediting. Moves no balance.
|
|
823
|
+
*/
|
|
824
|
+
recordRefundedDeposit(txn: DrizzleTx, deposit: HandDeposit & {
|
|
825
|
+
providerRefId: string;
|
|
826
|
+
}): Promise<WalletTransaction['id']>;
|
|
827
|
+
/** The player a deposit address was issued to, or undefined when it is nobody's. */
|
|
828
|
+
depositAddressOwner(target: Pick<DepositEvent, 'address' | 'network' | 'tag'>): Promise<User['id'] | undefined>;
|
|
829
|
+
private insertHandDeposit;
|
|
830
|
+
announceDepositCompleted(deposit: {
|
|
831
|
+
userId: User['id'];
|
|
832
|
+
amount: string;
|
|
833
|
+
currency: string;
|
|
834
|
+
transactionId: WalletTransaction['id'];
|
|
835
|
+
}): Promise<void>;
|
|
836
|
+
/**
|
|
837
|
+
* Why the deposit policy would hold a deposit of `deposit` for this player right now, or
|
|
838
|
+
* null. Taken under the player's deposit slot lock, so a concurrent deposit cannot spend
|
|
839
|
+
* the same limit headroom between the check and the caller's write.
|
|
840
|
+
*/
|
|
841
|
+
depositHoldReason(txn: DrizzleTx, userId: User['id'], deposit: {
|
|
842
|
+
amount: string;
|
|
843
|
+
currency: string;
|
|
844
|
+
}): Promise<string | null>;
|
|
757
845
|
private findDepositByProviderRef;
|
|
758
846
|
private userIdForWallet;
|
|
759
847
|
private findByIdempotencyKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.service.d.ts","sourceRoot":"","sources":["../../../src/wallet/service/wallet.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,EAMd,cAAc,EAaf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,UAAU,EAKf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EAEX,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,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3B,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GACzB,OAAO,CAAC,OAAO,CAAC;CAqBpB"}
|
|
1
|
+
{"version":3,"file":"wallet.service.d.ts","sourceRoot":"","sources":["../../../src/wallet/service/wallet.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,SAAS,EAKd,cAAc,EAaf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,UAAU,EAKf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EAEX,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAG3B,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAaL,KAAK,GAAG,EACT,MAAM,aAAa,CAAC;AAErB,OAAO,EASL,KAAK,MAAM,EAEX,KAAK,iBAAiB,EAKvB,MAAM,oBAAoB,CAAC;AAS5B,OAAO,KAAK,EACV,iBAAiB,EAEjB,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,kBAAkB,EAClB,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,4BAA4B,EAE7B,MAAM,sBAAsB,CAAC;AAgB9B,eAAO,MAAM,mBAAmB;QA9H3B,CAAC;CA8HwD,CAAC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M,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAC5C,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAUzB,OAAO,CAAC,wBAAwB;YAoBlB,eAAe;YAWf,oBAAoB;YAiBpB,kBAAkB;YAgBlB,2BAA2B;IAyBzC;;;;OAIG;IACG,uBAAuB,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IActF,uBAAuB,CAC3B,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,4BAA4B,EACnC,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GACzB,OAAO,CAAC,iBAAiB,CAAC;IAkE7B;;;;;;;;OAQG;YACW,0BAA0B;IAuBxC;;;;;OAKG;YACW,mBAAmB;IAwDjC,2FAA2F;YAC7E,4BAA4B;IAU1C;;;;;OAKG;YACW,0BAA0B;IAoBxC;4EACwE;IAClE,uBAAuB,CAC3B,MAAM,EAAE,IAAI,EACZ,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAC3B,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GACzB,OAAO,CAAC,OAAO,CAAC;CAqBpB"}
|
|
@@ -3,7 +3,7 @@ import { normalizeKycStatus, UuidSchema, RgLimitExceededError, DEFAULT_PAYMENT_P
|
|
|
3
3
|
import { eq, asc, desc, sql, and, gte, lte, count, inArray, notInArray, isNull, or, } from 'drizzle-orm';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
5
|
import { wallet, walletBalance, walletTransaction, autoWithdrawalRule, walletAutoWithdrawalConfig, walletDepositAddress, walletWithdrawalAddress, walletAsset, } from '../schema/index.js';
|
|
6
|
-
import { OUT_OF_CYCLE_RUN_ID, recordReconciliationFinding, rgDecisionForLandedCredit, } from './reconciliation-finding.service.js';
|
|
6
|
+
import { OUT_OF_CYCLE_RUN_ID, isRefundedDeposit, lockVendorDeposit, recordReconciliationFinding, recordReconciliationFindingInTransaction, rgDecisionForLandedCredit, } from './reconciliation-finding.service.js';
|
|
7
7
|
import { OPEN_WITHDRAWALS_LIMIT } from '../contract/index.js';
|
|
8
8
|
const logger = createLogger('wallet');
|
|
9
9
|
// Filed under the player so the player-scoped audit view finds it; `after.transactionId`
|
|
@@ -25,7 +25,15 @@ export const KycRequiredError = makeConflictError('KycRequiredError', 'KYC verif
|
|
|
25
25
|
// investigation. The player can still log in; only money leaving the platform is refused.
|
|
26
26
|
export const WithdrawalLockedError = makeConflictError('WithdrawalLockedError', 'Withdrawals are on hold for this account. Please contact support', { reason: 'withdrawal_locked' });
|
|
27
27
|
export const WithdrawalAmountNotAboveFeeError = createDomainError('WithdrawalAmountNotAboveFeeError', (amount, fee, currency) => `Withdrawal of ${amount} ${currency} does not exceed the ${fee} ${currency} network fee`);
|
|
28
|
+
export const WithdrawalPrecisionError = createDomainError('WithdrawalPrecisionError', (amount, currency, network, decimals) => `${amount} ${currency} has more than ${decimals} decimal places, the most ${network} can pay out`);
|
|
28
29
|
export const IdempotencyKeyReuseError = makeConflictError('IdempotencyKeyReuseError', 'Idempotency key was already used with a different amount');
|
|
30
|
+
export const HeldDepositNotFoundError = makeConflictError('HeldDepositNotFoundError', 'The deposit is not on hold and cannot be released or refunded');
|
|
31
|
+
// The policy that held the deposit still holds it: the player is restricted, or crediting it
|
|
32
|
+
// would breach their deposit limit. It can be refunded, or released once the reason lifts.
|
|
33
|
+
export const DepositStillHeldError = createDomainError('DepositStillHeldError', (reason) => `The deposit policy still holds this deposit: ${reason}`);
|
|
34
|
+
// The ledger already carries this vendor deposit (the webhook landed after all), so crediting
|
|
35
|
+
// or refunding it by hand now would move the same money twice.
|
|
36
|
+
export const DepositAlreadyOnLedgerError = makeConflictError('DepositAlreadyOnLedgerError', 'This deposit is already on the ledger and cannot be credited or refunded by hand');
|
|
29
37
|
export const DepositAddressUnsupportedError = makeConflictError('DepositAddressUnsupportedError', 'The bound payment adapter does not support address-based deposits');
|
|
30
38
|
export const DestinationAddressRequiredError = makeConflictError('DestinationAddressRequiredError', 'A destination address is required for a crypto-rail withdrawal');
|
|
31
39
|
export const DestinationAddressNotWhitelistedError = makeConflictError('DestinationAddressNotWhitelistedError', 'This payout address is not approved for withdrawals. Save it in your address book first');
|
|
@@ -131,6 +139,22 @@ export function withdrawalFeeFor(assets, amount, currency, network) {
|
|
|
131
139
|
}
|
|
132
140
|
return fee;
|
|
133
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Refuses a withdrawal the vendor could not pay out exactly: the payout is `amount - fee`, so
|
|
144
|
+
* both must fit the asset's on-chain precision. Rounding either would pay a different amount
|
|
145
|
+
* than the ledger debits.
|
|
146
|
+
*/
|
|
147
|
+
export function assertPayablePrecision(decimals, amounts, currency, network) {
|
|
148
|
+
if (decimals === null) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
for (const amount of amounts) {
|
|
152
|
+
const fraction = amount?.split('.')[1]?.replace(/0+$/, '') ?? '';
|
|
153
|
+
if (amount !== null && fraction.length > decimals) {
|
|
154
|
+
throw new WithdrawalPrecisionError(amount, currency, network, decimals);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
134
158
|
export function assertDepositAllowed(assets, currency, network) {
|
|
135
159
|
if (assets.length === 0) {
|
|
136
160
|
// No catalog row at all means the operator never configured this currency (a fiat
|
|
@@ -252,6 +276,7 @@ export function providerRefCondition(providerName, providerRefId) {
|
|
|
252
276
|
}
|
|
253
277
|
/** Serialises one player's PSP deposits, so an RG reservation cannot be spent twice. */
|
|
254
278
|
const depositSlotKey = (userId) => `wallet-deposit:${userId}`;
|
|
279
|
+
const heldReason = (deposit) => deposit.status === 'on_hold' ? (deposit.reviewReason ?? 'held for review') : null;
|
|
255
280
|
const MANUAL_ADJUSTMENT_TYPES = new Set(['manual_credit', 'manual_debit']);
|
|
256
281
|
const TX_SORT_COLUMNS = {
|
|
257
282
|
createdAt: 'created_at',
|
|
@@ -382,8 +407,9 @@ export class WalletService {
|
|
|
382
407
|
rgLimits;
|
|
383
408
|
rates;
|
|
384
409
|
kycPolicy;
|
|
410
|
+
depositHold;
|
|
385
411
|
grantLedger;
|
|
386
|
-
constructor({ drizzle, events, payment, paymentProviders, directory, identityReader, platformConfig, limiter, riskTags, tagEvaluationCommands, audit, rgLimits, rates, kycPolicy, grantLedger, }) {
|
|
412
|
+
constructor({ drizzle, events, payment, paymentProviders, directory, identityReader, platformConfig, limiter, riskTags, tagEvaluationCommands, audit, rgLimits, rates, kycPolicy, depositHold, grantLedger, }) {
|
|
387
413
|
this.drizzle = drizzle;
|
|
388
414
|
this.events = events;
|
|
389
415
|
this.payment = payment;
|
|
@@ -398,6 +424,7 @@ export class WalletService {
|
|
|
398
424
|
this.rgLimits = rgLimits;
|
|
399
425
|
this.rates = rates;
|
|
400
426
|
this.kycPolicy = kycPolicy;
|
|
427
|
+
this.depositHold = depositHold;
|
|
401
428
|
this.grantLedger = grantLedger;
|
|
402
429
|
}
|
|
403
430
|
// Every catalog row for the currency, enabled or not - resolveWithdrawalNetwork needs
|
|
@@ -953,6 +980,9 @@ export class WalletService {
|
|
|
953
980
|
const settlementNetwork = resolveWithdrawalNetwork(assets, currency, network);
|
|
954
981
|
assertAboveMinimumWithdrawal(assets, amount, currency, settlementNetwork);
|
|
955
982
|
const fee = withdrawalFeeFor(assets, amount, currency, settlementNetwork);
|
|
983
|
+
if (settlementNetwork !== null) {
|
|
984
|
+
assertPayablePrecision(this.payment.withdrawalDecimals?.(currency, settlementNetwork) ?? null, [amount, fee], currency, settlementNetwork);
|
|
985
|
+
}
|
|
956
986
|
const destinationWalletId = await this.requireWhitelistedWalletId(userId, currency, settlementNetwork, destinationAddress, destinationTag);
|
|
957
987
|
const { transactionId, status, replayed, walletId, rail } = await this.drizzle.db.transaction(async (txn) => {
|
|
958
988
|
// FOR UPDATE serializes concurrent withdrawals against a double-debit TOCTOU under READ COMMITTED.
|
|
@@ -2264,6 +2294,7 @@ export class WalletService {
|
|
|
2264
2294
|
address: event.address,
|
|
2265
2295
|
tag: event.tag ?? null,
|
|
2266
2296
|
txHash: event.txHash,
|
|
2297
|
+
sourceAddress: event.sourceAddress ?? null,
|
|
2267
2298
|
externalId: event.externalId,
|
|
2268
2299
|
detail: 'no wallet_deposit_address matched this address/network/tag',
|
|
2269
2300
|
}, this.audit);
|
|
@@ -2288,12 +2319,19 @@ export class WalletService {
|
|
|
2288
2319
|
address: event.address,
|
|
2289
2320
|
tag: event.tag ?? null,
|
|
2290
2321
|
txHash: event.txHash,
|
|
2322
|
+
sourceAddress: event.sourceAddress ?? null,
|
|
2291
2323
|
externalId: event.externalId,
|
|
2292
2324
|
detail: `currency mismatch: event reported ${event.currency}, address issued for ${depositAddress.currency}`,
|
|
2293
2325
|
}, this.audit);
|
|
2294
2326
|
return;
|
|
2295
2327
|
}
|
|
2296
|
-
const
|
|
2328
|
+
const credit = await this.drizzle.db.transaction(async (txn) => {
|
|
2329
|
+
await lockVendorDeposit(txn, depositAddress.providerName, event.externalId);
|
|
2330
|
+
// Refunded from a finding before this delivery: settled, never a credit. Read under the
|
|
2331
|
+
// lock, so a refund committing concurrently is either seen here or waits for this credit.
|
|
2332
|
+
if (await isRefundedDeposit(txn, depositAddress.providerName, event.externalId)) {
|
|
2333
|
+
return null;
|
|
2334
|
+
}
|
|
2297
2335
|
let [walletRecord] = await txn
|
|
2298
2336
|
.select()
|
|
2299
2337
|
.from(wallet)
|
|
@@ -2304,12 +2342,18 @@ export class WalletService {
|
|
|
2304
2342
|
// A redelivery of a credited deposit must not depend on a rate being available now.
|
|
2305
2343
|
const [credited] = await this.findDepositByProviderRef(txn, depositAddress.providerName, event.externalId);
|
|
2306
2344
|
if (credited) {
|
|
2307
|
-
return {
|
|
2345
|
+
return {
|
|
2346
|
+
transactionId: credited.id,
|
|
2347
|
+
replayed: true,
|
|
2348
|
+
holdReason: heldReason(credited),
|
|
2349
|
+
refunded: credited.status === 'refunded',
|
|
2350
|
+
};
|
|
2308
2351
|
}
|
|
2309
2352
|
// Throws when no fresh rate exists. The funds are on chain, so the deposit is not
|
|
2310
2353
|
// dropped: nothing commits, the webhook answers an error and the vendor redelivers it,
|
|
2311
2354
|
// and reconciliation files it as a missing deposit if the redeliveries run out.
|
|
2312
2355
|
const reference = await this.referenceSnapshot(txn, depositAddress.userId, event.amount, event.currency);
|
|
2356
|
+
const holdReason = await this.depositHoldReason(txn, depositAddress.userId, event);
|
|
2313
2357
|
const [inserted] = await txn
|
|
2314
2358
|
.insert(walletTransaction)
|
|
2315
2359
|
.values({
|
|
@@ -2318,7 +2362,8 @@ export class WalletService {
|
|
|
2318
2362
|
type: 'deposit',
|
|
2319
2363
|
amount: event.amount,
|
|
2320
2364
|
currency: event.currency,
|
|
2321
|
-
status: 'completed',
|
|
2365
|
+
status: holdReason === null ? 'completed' : 'on_hold',
|
|
2366
|
+
reviewReason: holdReason,
|
|
2322
2367
|
direction: 'credit',
|
|
2323
2368
|
rail: this.resolveRail(event.currency),
|
|
2324
2369
|
// Prefer the chain the vendor reported; fall back to the one the address was
|
|
@@ -2332,15 +2377,63 @@ export class WalletService {
|
|
|
2332
2377
|
.onConflictDoNothing()
|
|
2333
2378
|
.returning();
|
|
2334
2379
|
if (inserted) {
|
|
2335
|
-
|
|
2336
|
-
|
|
2380
|
+
if (holdReason === null) {
|
|
2381
|
+
await creditWalletBalance(txn, walletRecord.id, event.currency, event.amount);
|
|
2382
|
+
}
|
|
2383
|
+
else {
|
|
2384
|
+
await recordReconciliationFindingInTransaction(txn, {
|
|
2385
|
+
runId: OUT_OF_CYCLE_RUN_ID,
|
|
2386
|
+
providerName: depositAddress.providerName,
|
|
2387
|
+
kind: 'held_deposit',
|
|
2388
|
+
currency: event.currency,
|
|
2389
|
+
network: event.network ?? depositAddress.network,
|
|
2390
|
+
amount: event.amount,
|
|
2391
|
+
address: event.address,
|
|
2392
|
+
tag: event.tag ?? null,
|
|
2393
|
+
txHash: event.txHash,
|
|
2394
|
+
sourceAddress: event.sourceAddress ?? null,
|
|
2395
|
+
externalId: event.externalId,
|
|
2396
|
+
transactionId: inserted.id,
|
|
2397
|
+
detail: `held, not credited: ${holdReason}`,
|
|
2398
|
+
}, this.audit);
|
|
2399
|
+
}
|
|
2400
|
+
return { transactionId: inserted.id, replayed: false, holdReason, refunded: false };
|
|
2337
2401
|
}
|
|
2338
2402
|
const [winner] = await this.findDepositByProviderRef(txn, depositAddress.providerName, event.externalId);
|
|
2339
2403
|
if (!winner) {
|
|
2340
2404
|
throw new Error(`payment webhook: idempotency conflict but no row found (externalId=${event.externalId})`);
|
|
2341
2405
|
}
|
|
2342
|
-
return {
|
|
2406
|
+
return {
|
|
2407
|
+
transactionId: winner.id,
|
|
2408
|
+
replayed: true,
|
|
2409
|
+
holdReason: heldReason(winner),
|
|
2410
|
+
refunded: winner.status === 'refunded',
|
|
2411
|
+
};
|
|
2343
2412
|
});
|
|
2413
|
+
if (credit === null) {
|
|
2414
|
+
logger.warn({ userId: depositAddress.userId, externalId: event.externalId }, 'payment webhook: deposit was already refunded on chain, not credited');
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
const { transactionId, replayed, holdReason, refunded } = credit;
|
|
2418
|
+
// An admin refunded this deposit on chain from its finding; the redelivery is not money
|
|
2419
|
+
// the player still has coming, and not a credit the deposit limit should be asked about.
|
|
2420
|
+
if (refunded) {
|
|
2421
|
+
logger.warn({ userId: depositAddress.userId, transactionId, externalId: event.externalId }, 'payment webhook: redelivered deposit was already refunded, not credited');
|
|
2422
|
+
return;
|
|
2423
|
+
}
|
|
2424
|
+
if (holdReason !== null) {
|
|
2425
|
+
logger.warn({ userId: depositAddress.userId, transactionId, externalId: event.externalId }, 'payment webhook: on-chain deposit held for review, not credited');
|
|
2426
|
+
if (!replayed) {
|
|
2427
|
+
this.events.emit('wallet.deposit.held', {
|
|
2428
|
+
userId: depositAddress.userId,
|
|
2429
|
+
playerId: await this.identityReader.getPlayerIdByUserIdSafe(depositAddress.userId),
|
|
2430
|
+
amount: event.amount,
|
|
2431
|
+
currency: event.currency,
|
|
2432
|
+
transactionId,
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2435
|
+
return;
|
|
2436
|
+
}
|
|
2344
2437
|
if (!replayed) {
|
|
2345
2438
|
this.events.emit('wallet.deposit.completed', {
|
|
2346
2439
|
userId: depositAddress.userId,
|
|
@@ -2383,9 +2476,137 @@ export class WalletService {
|
|
|
2383
2476
|
}, this.audit);
|
|
2384
2477
|
}
|
|
2385
2478
|
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Credits a held on-chain deposit to the player, in the caller's transaction, after asking
|
|
2481
|
+
* the deposit policy again: the player must no longer be restricted and the deposit must fit
|
|
2482
|
+
* their limit window now, and with no policy bound it is not released at all. The row itself turns `completed`, so the deposit window counts it
|
|
2483
|
+
* from `reviewedAt` (the moment it reached the balance), not from when it landed on chain.
|
|
2484
|
+
* The caller announces it with `announceDepositCompleted` once the transaction commits.
|
|
2485
|
+
*/
|
|
2486
|
+
async releaseHeldDeposit(txn, depositId, adminId) {
|
|
2487
|
+
const [held] = await txn
|
|
2488
|
+
.select({
|
|
2489
|
+
walletId: walletTransaction.walletId,
|
|
2490
|
+
amount: walletTransaction.amount,
|
|
2491
|
+
currency: walletTransaction.currency,
|
|
2492
|
+
userId: wallet.userId,
|
|
2493
|
+
})
|
|
2494
|
+
.from(walletTransaction)
|
|
2495
|
+
.innerJoin(wallet, eq(wallet.id, walletTransaction.walletId))
|
|
2496
|
+
.where(and(eq(walletTransaction.id, depositId), eq(walletTransaction.type, 'deposit'), eq(walletTransaction.status, 'on_hold')))
|
|
2497
|
+
.for('update', { of: walletTransaction });
|
|
2498
|
+
if (!held) {
|
|
2499
|
+
throw new HeldDepositNotFoundError();
|
|
2500
|
+
}
|
|
2501
|
+
// Fails closed: with the policy that held it unbound, nothing can say the reason lifted.
|
|
2502
|
+
// The deposit stays refundable.
|
|
2503
|
+
if (!this.depositHold) {
|
|
2504
|
+
throw new DepositStillHeldError('no deposit hold policy is bound to re-check it');
|
|
2505
|
+
}
|
|
2506
|
+
const reason = await this.depositHoldReason(txn, held.userId, held);
|
|
2507
|
+
if (reason !== null) {
|
|
2508
|
+
throw new DepositStillHeldError(reason);
|
|
2509
|
+
}
|
|
2510
|
+
await txn
|
|
2511
|
+
.update(walletTransaction)
|
|
2512
|
+
// The database clock, the one the deposit window's upper bound reads: an app clock
|
|
2513
|
+
// running ahead would keep the released deposit out of the player's spend.
|
|
2514
|
+
.set({ status: 'completed', reviewedBy: adminId, reviewedAt: sql `now()` })
|
|
2515
|
+
.where(eq(walletTransaction.id, depositId));
|
|
2516
|
+
await creditWalletBalance(txn, held.walletId, held.currency, held.amount);
|
|
2517
|
+
return { userId: held.userId, amount: held.amount, currency: held.currency };
|
|
2518
|
+
}
|
|
2519
|
+
/**
|
|
2520
|
+
* Credits an on-chain deposit an admin attributed from a reconciliation finding, in the
|
|
2521
|
+
* caller's transaction. The deposit policy is asked BEFORE anything is written, so a player
|
|
2522
|
+
* it would hold gets nothing and the caller's transaction rolls back clean. The row is a
|
|
2523
|
+
* `deposit`, not a `manual_credit`: the player's deposit-limit window counts it, and when
|
|
2524
|
+
* it is keyed on the vendor id a later webhook redelivery replays it instead of crediting.
|
|
2525
|
+
* The caller announces it with `announceDepositCompleted` once the transaction commits.
|
|
2526
|
+
*/
|
|
2527
|
+
async creditDepositByHand(txn, deposit) {
|
|
2528
|
+
if (!(await this.identityReader.getPlayerIdByUserId(deposit.userId))) {
|
|
2529
|
+
throw new PlayerNotFoundError(deposit.userId);
|
|
2530
|
+
}
|
|
2531
|
+
const reason = await this.depositHoldReason(txn, deposit.userId, deposit);
|
|
2532
|
+
if (reason !== null) {
|
|
2533
|
+
throw new DepositStillHeldError(reason);
|
|
2534
|
+
}
|
|
2535
|
+
const reference = await this.referenceSnapshot(txn, deposit.userId, deposit.amount, deposit.currency);
|
|
2536
|
+
const row = await this.insertHandDeposit(txn, deposit, { ...reference, status: 'completed' });
|
|
2537
|
+
await creditWalletBalance(txn, row.walletId, deposit.currency, deposit.amount);
|
|
2538
|
+
return {
|
|
2539
|
+
transactionId: row.id,
|
|
2540
|
+
userId: deposit.userId,
|
|
2541
|
+
amount: deposit.amount,
|
|
2542
|
+
currency: deposit.currency,
|
|
2543
|
+
};
|
|
2544
|
+
}
|
|
2545
|
+
/**
|
|
2546
|
+
* Records a deposit an admin refunded on chain as a terminal `refunded` deposit row keyed on
|
|
2547
|
+
* the vendor id, so a webhook redelivery of it replays instead of crediting. Moves no balance.
|
|
2548
|
+
*/
|
|
2549
|
+
async recordRefundedDeposit(txn, deposit) {
|
|
2550
|
+
const row = await this.insertHandDeposit(txn, deposit, { status: 'refunded' });
|
|
2551
|
+
return row.id;
|
|
2552
|
+
}
|
|
2553
|
+
/** The player a deposit address was issued to, or undefined when it is nobody's. */
|
|
2554
|
+
async depositAddressOwner(target) {
|
|
2555
|
+
return (await this.findDepositAddressByAddress(target))?.userId;
|
|
2556
|
+
}
|
|
2557
|
+
async insertHandDeposit(txn, deposit, values) {
|
|
2558
|
+
const walletRecord = await openWallet(txn, deposit.userId, deposit.currency);
|
|
2559
|
+
const [row] = await txn
|
|
2560
|
+
.insert(walletTransaction)
|
|
2561
|
+
.values({
|
|
2562
|
+
...values,
|
|
2563
|
+
walletId: walletRecord.id,
|
|
2564
|
+
type: 'deposit',
|
|
2565
|
+
amount: deposit.amount,
|
|
2566
|
+
currency: deposit.currency,
|
|
2567
|
+
direction: 'credit',
|
|
2568
|
+
rail: this.resolveRail(deposit.currency),
|
|
2569
|
+
network: deposit.network,
|
|
2570
|
+
providerName: deposit.providerName,
|
|
2571
|
+
providerRefId: deposit.providerRefId,
|
|
2572
|
+
destinationAddress: deposit.address,
|
|
2573
|
+
destinationTag: deposit.tag,
|
|
2574
|
+
txHash: deposit.txHash,
|
|
2575
|
+
reviewedBy: deposit.adminId,
|
|
2576
|
+
reviewedAt: sql `now()`,
|
|
2577
|
+
})
|
|
2578
|
+
.onConflictDoNothing()
|
|
2579
|
+
.returning();
|
|
2580
|
+
if (!row) {
|
|
2581
|
+
throw new DepositAlreadyOnLedgerError();
|
|
2582
|
+
}
|
|
2583
|
+
return row;
|
|
2584
|
+
}
|
|
2585
|
+
async announceDepositCompleted(deposit) {
|
|
2586
|
+
this.events.emit('wallet.deposit.completed', {
|
|
2587
|
+
...deposit,
|
|
2588
|
+
playerId: await this.identityReader.getPlayerIdByUserIdSafe(deposit.userId),
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Why the deposit policy would hold a deposit of `deposit` for this player right now, or
|
|
2593
|
+
* null. Taken under the player's deposit slot lock, so a concurrent deposit cannot spend
|
|
2594
|
+
* the same limit headroom between the check and the caller's write.
|
|
2595
|
+
*/
|
|
2596
|
+
async depositHoldReason(txn, userId, deposit) {
|
|
2597
|
+
const policy = this.depositHold;
|
|
2598
|
+
if (!policy) {
|
|
2599
|
+
return null;
|
|
2600
|
+
}
|
|
2601
|
+
return withAdvisoryXactLock(txn, depositSlotKey(userId), () => policy.holdReason(txn, { userId, amount: deposit.amount, currency: deposit.currency }));
|
|
2602
|
+
}
|
|
2386
2603
|
findDepositByProviderRef(txn, providerName, externalId) {
|
|
2387
2604
|
return txn
|
|
2388
|
-
.select({
|
|
2605
|
+
.select({
|
|
2606
|
+
id: walletTransaction.id,
|
|
2607
|
+
status: walletTransaction.status,
|
|
2608
|
+
reviewReason: walletTransaction.reviewReason,
|
|
2609
|
+
})
|
|
2389
2610
|
.from(walletTransaction)
|
|
2390
2611
|
.where(and(eq(walletTransaction.providerName, providerName), eq(walletTransaction.providerRefId, externalId)));
|
|
2391
2612
|
}
|