@mercurjs/core 2.3.9-canary.4 → 2.3.9-canary.6
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/.medusa/server/src/api/admin/middlewares.js +41 -39
- package/.medusa/server/src/api/admin/payout-accounts/[id]/refresh-link/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/payout-accounts/[id]/refresh-link/route.js +14 -0
- package/.medusa/server/src/api/admin/payout-accounts/[id]/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/payout-accounts/[id]/route.js +18 -0
- package/.medusa/server/src/api/admin/payout-accounts/[id]/sync/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/payout-accounts/[id]/sync/route.js +14 -0
- package/.medusa/server/src/api/admin/payout-accounts/helpers.d.ts +2 -0
- package/.medusa/server/src/api/admin/payout-accounts/helpers.js +7 -0
- package/.medusa/server/src/api/admin/payout-accounts/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/admin/payout-accounts/middlewares.js +45 -0
- package/.medusa/server/src/api/admin/payout-accounts/query-config.d.ts +11 -0
- package/.medusa/server/src/api/admin/payout-accounts/query-config.js +26 -0
- package/.medusa/server/src/api/admin/payout-accounts/route.d.ts +5 -0
- package/.medusa/server/src/api/admin/payout-accounts/route.js +31 -0
- package/.medusa/server/src/api/admin/payout-accounts/validators.d.ts +51 -0
- package/.medusa/server/src/api/admin/payout-accounts/validators.js +22 -0
- package/.medusa/server/src/api/admin/payouts/[id]/retry/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/payouts/[id]/retry/route.js +14 -0
- package/.medusa/server/src/api/admin/payouts/helpers.d.ts +2 -0
- package/.medusa/server/src/api/admin/payouts/helpers.js +7 -0
- package/.medusa/server/src/api/admin/payouts/middlewares.js +16 -1
- package/.medusa/server/src/api/admin/payouts/query-config.js +10 -1
- package/.medusa/server/src/api/admin/payouts/validators.d.ts +2 -0
- package/.medusa/server/src/api/admin/payouts/validators.js +3 -1
- package/.medusa/server/src/api/hooks/payout/route.js +4 -6
- package/.medusa/server/src/api/middlewares.js +5 -1
- package/.medusa/server/src/api/payout/onboarding/refresh/route.d.ts +6 -0
- package/.medusa/server/src/api/payout/onboarding/refresh/route.js +21 -0
- package/.medusa/server/src/api/store/carts/middlewares.js +11 -1
- package/.medusa/server/src/api/utils/ensure-seller-middleware.js +2 -2
- package/.medusa/server/src/api/vendor/payout-accounts/[id]/onboarding/route.js +2 -8
- package/.medusa/server/src/api/vendor/payout-accounts/helpers.d.ts +2 -0
- package/.medusa/server/src/api/vendor/payout-accounts/helpers.js +7 -2
- package/.medusa/server/src/api/vendor/payout-accounts/me/route.d.ts +3 -0
- package/.medusa/server/src/api/vendor/payout-accounts/me/route.js +15 -0
- package/.medusa/server/src/api/vendor/payout-accounts/middlewares.js +9 -1
- package/.medusa/server/src/api/vendor/payout-accounts/query-config.d.ts +11 -0
- package/.medusa/server/src/api/vendor/payout-accounts/query-config.js +30 -2
- package/.medusa/server/src/api/vendor/payout-accounts/route.js +4 -9
- package/.medusa/server/src/api/vendor/payout-accounts/validators.d.ts +3 -1
- package/.medusa/server/src/api/vendor/payout-accounts/validators.js +5 -2
- package/.medusa/server/src/api/vendor/payouts/query-config.d.ts +2 -0
- package/.medusa/server/src/api/vendor/payouts/query-config.js +12 -2
- package/.medusa/server/src/api/vendor/payouts/validators.d.ts +1 -0
- package/.medusa/server/src/api/vendor/payouts/validators.js +2 -1
- package/.medusa/server/src/api/vendor/sellers/select/route.js +2 -2
- package/.medusa/server/src/modules/payout/index.d.ts +1 -45
- package/.medusa/server/src/modules/payout/loaders/provider.js +7 -3
- package/.medusa/server/src/modules/payout/migrations/Migration20261028120000.d.ts +5 -0
- package/.medusa/server/src/modules/payout/migrations/Migration20261028120000.js +97 -0
- package/.medusa/server/src/modules/payout/models/index.d.ts +1 -0
- package/.medusa/server/src/modules/payout/models/index.js +4 -2
- package/.medusa/server/src/modules/payout/models/onboarding.d.ts +22 -1
- package/.medusa/server/src/modules/payout/models/payout-account.d.ts +23 -2
- package/.medusa/server/src/modules/payout/models/payout-account.js +33 -7
- package/.medusa/server/src/modules/payout/models/payout-reversal.d.ts +48 -0
- package/.medusa/server/src/modules/payout/models/payout-reversal.js +37 -0
- package/.medusa/server/src/modules/payout/models/payout.d.ts +22 -1
- package/.medusa/server/src/modules/payout/models/payout.js +18 -2
- package/.medusa/server/src/modules/payout/providers/system.d.ts +11 -5
- package/.medusa/server/src/modules/payout/providers/system.js +33 -14
- package/.medusa/server/src/modules/payout/services/payout-module-service.d.ts +94 -100
- package/.medusa/server/src/modules/payout/services/payout-module-service.js +316 -109
- package/.medusa/server/src/modules/payout/services/provider-service.d.ts +11 -7
- package/.medusa/server/src/modules/payout/services/provider-service.js +33 -13
- package/.medusa/server/src/modules/payout/utils/abstract-payout-provider.d.ts +20 -0
- package/.medusa/server/src/modules/payout/utils/abstract-payout-provider.js +19 -0
- package/.medusa/server/src/modules/payout/utils/index.d.ts +1 -0
- package/.medusa/server/src/modules/payout/utils/index.js +18 -0
- package/.medusa/server/src/modules/telemetry/index.d.ts +21 -0
- package/.medusa/server/src/modules/telemetry/index.js +12 -0
- package/.medusa/server/src/modules/telemetry/migrations/Migration20261029000000.d.ts +5 -0
- package/.medusa/server/src/modules/telemetry/migrations/Migration20261029000000.js +27 -0
- package/.medusa/server/src/modules/telemetry/models/index.d.ts +1 -0
- package/.medusa/server/src/modules/telemetry/models/index.js +10 -0
- package/.medusa/server/src/modules/telemetry/models/installation.d.ts +9 -0
- package/.medusa/server/src/modules/telemetry/models/installation.js +14 -0
- package/.medusa/server/src/modules/telemetry/repositories/index.d.ts +1 -0
- package/.medusa/server/src/modules/telemetry/repositories/index.js +18 -0
- package/.medusa/server/src/modules/telemetry/repositories/telemetry-heartbeat.d.ts +10 -0
- package/.medusa/server/src/modules/telemetry/repositories/telemetry-heartbeat.js +28 -0
- package/.medusa/server/src/modules/telemetry/service.d.ts +25 -0
- package/.medusa/server/src/modules/telemetry/service.js +54 -0
- package/.medusa/server/src/subscribers/payout-webhook.d.ts +2 -2
- package/.medusa/server/src/subscribers/payout-webhook.js +9 -5
- package/.medusa/server/src/subscribers/telemetry-first-member-invited.d.ts +3 -0
- package/.medusa/server/src/subscribers/telemetry-first-member-invited.js +14 -0
- package/.medusa/server/src/subscribers/telemetry-first-offer.d.ts +3 -0
- package/.medusa/server/src/subscribers/telemetry-first-offer.js +14 -0
- package/.medusa/server/src/subscribers/telemetry-first-order.d.ts +3 -0
- package/.medusa/server/src/subscribers/telemetry-first-order.js +14 -0
- package/.medusa/server/src/subscribers/telemetry-first-payout-account.d.ts +5 -0
- package/.medusa/server/src/subscribers/telemetry-first-payout-account.js +24 -0
- package/.medusa/server/src/subscribers/telemetry-first-product-published.d.ts +3 -0
- package/.medusa/server/src/subscribers/telemetry-first-product-published.js +14 -0
- package/.medusa/server/src/subscribers/telemetry-first-seller-approved.d.ts +3 -0
- package/.medusa/server/src/subscribers/telemetry-first-seller-approved.js +14 -0
- package/.medusa/server/src/subscribers/telemetry-first-seller.d.ts +3 -0
- package/.medusa/server/src/subscribers/telemetry-first-seller.js +14 -0
- package/.medusa/server/src/utils/telemetry/boot.d.ts +7 -0
- package/.medusa/server/src/utils/telemetry/boot.js +117 -0
- package/.medusa/server/src/utils/telemetry/buckets.d.ts +2 -0
- package/.medusa/server/src/utils/telemetry/buckets.js +22 -0
- package/.medusa/server/src/utils/telemetry/config.d.ts +19 -0
- package/.medusa/server/src/utils/telemetry/config.js +60 -0
- package/.medusa/server/src/utils/telemetry/first-party.d.ts +11 -0
- package/.medusa/server/src/utils/telemetry/first-party.js +33 -0
- package/.medusa/server/src/utils/telemetry/identity.d.ts +6 -0
- package/.medusa/server/src/utils/telemetry/identity.js +32 -0
- package/.medusa/server/src/utils/telemetry/index.d.ts +8 -0
- package/.medusa/server/src/utils/telemetry/index.js +27 -0
- package/.medusa/server/src/utils/telemetry/milestones.d.ts +20 -0
- package/.medusa/server/src/utils/telemetry/milestones.js +60 -0
- package/.medusa/server/src/utils/telemetry/sender.d.ts +17 -0
- package/.medusa/server/src/utils/telemetry/sender.js +48 -0
- package/.medusa/server/src/utils/telemetry/snapshot.d.ts +13 -0
- package/.medusa/server/src/utils/telemetry/snapshot.js +193 -0
- package/.medusa/server/src/with-mercur.d.ts +6 -0
- package/.medusa/server/src/with-mercur.js +1 -1
- package/.medusa/server/src/workflows/payment/utils/split-order-payment-group.js +11 -3
- package/.medusa/server/src/workflows/payment/workflows/process-payment.js +10 -5
- package/.medusa/server/src/workflows/payout/steps/create-onboarding.d.ts +8 -2
- package/.medusa/server/src/workflows/payout/steps/create-onboarding.js +10 -4
- package/.medusa/server/src/workflows/payout/steps/create-payout-account.d.ts +3 -2
- package/.medusa/server/src/workflows/payout/steps/create-payout-account.js +9 -3
- package/.medusa/server/src/workflows/payout/steps/create-payout-accounts.d.ts +11 -0
- package/.medusa/server/src/workflows/payout/steps/create-payout-accounts.js +22 -0
- package/.medusa/server/src/workflows/payout/steps/create-payout-reversals.d.ts +4 -0
- package/.medusa/server/src/workflows/payout/steps/create-payout-reversals.js +23 -0
- package/.medusa/server/src/workflows/payout/steps/create-payouts.d.ts +4 -0
- package/.medusa/server/src/workflows/payout/steps/create-payouts.js +23 -0
- package/.medusa/server/src/workflows/payout/steps/index.d.ts +12 -5
- package/.medusa/server/src/workflows/payout/steps/index.js +13 -6
- package/.medusa/server/src/workflows/payout/steps/process-payout-reversals.d.ts +6 -0
- package/.medusa/server/src/workflows/payout/steps/process-payout-reversals.js +17 -0
- package/.medusa/server/src/workflows/payout/steps/process-payouts.d.ts +6 -0
- package/.medusa/server/src/workflows/payout/steps/process-payouts.js +17 -0
- package/.medusa/server/src/workflows/payout/steps/sync-payout-account.d.ts +8 -0
- package/.medusa/server/src/workflows/payout/steps/sync-payout-account.js +33 -0
- package/.medusa/server/src/workflows/payout/steps/update-payout-reversals.d.ts +4 -0
- package/.medusa/server/src/workflows/payout/steps/update-payout-reversals.js +29 -0
- package/.medusa/server/src/workflows/payout/steps/update-payouts.d.ts +4 -0
- package/.medusa/server/src/workflows/payout/steps/update-payouts.js +34 -0
- package/.medusa/server/src/workflows/payout/steps/validate-onboarding-token.d.ts +12 -0
- package/.medusa/server/src/workflows/payout/steps/validate-onboarding-token.js +23 -0
- package/.medusa/server/src/workflows/payout/steps/validate-payout-retry.d.ts +10 -0
- package/.medusa/server/src/workflows/payout/steps/validate-payout-retry.js +15 -0
- package/.medusa/server/src/workflows/payout/steps/validate-seller-without-payout-account.d.ts +10 -0
- package/.medusa/server/src/workflows/payout/steps/validate-seller-without-payout-account.js +13 -0
- package/.medusa/server/src/workflows/payout/utils/fulfillment-status.d.ts +26 -0
- package/.medusa/server/src/workflows/payout/utils/fulfillment-status.js +64 -0
- package/.medusa/server/src/workflows/payout/utils/index.d.ts +3 -0
- package/.medusa/server/src/workflows/payout/utils/index.js +20 -0
- package/.medusa/server/src/workflows/payout/utils/payout-amounts.d.ts +173 -0
- package/.medusa/server/src/workflows/payout/utils/payout-amounts.js +304 -0
- package/.medusa/server/src/workflows/payout/utils/sent-to-provider.d.ts +11 -0
- package/.medusa/server/src/workflows/payout/utils/sent-to-provider.js +15 -0
- package/.medusa/server/src/workflows/payout/workflows/create-onboarding.d.ts +5 -0
- package/.medusa/server/src/workflows/payout/workflows/create-onboarding.js +8 -3
- package/.medusa/server/src/workflows/payout/workflows/create-or-refresh-seller-payout-account.d.ts +16 -0
- package/.medusa/server/src/workflows/payout/workflows/create-or-refresh-seller-payout-account.js +38 -0
- package/.medusa/server/src/workflows/payout/workflows/create-order-payouts.d.ts +28 -0
- package/.medusa/server/src/workflows/payout/workflows/create-order-payouts.js +82 -0
- package/.medusa/server/src/workflows/payout/workflows/create-payout-account.d.ts +11 -5
- package/.medusa/server/src/workflows/payout/workflows/create-payout-account.js +42 -17
- package/.medusa/server/src/workflows/payout/workflows/create-payout-reversals.d.ts +14 -0
- package/.medusa/server/src/workflows/payout/workflows/create-payout-reversals.js +61 -0
- package/.medusa/server/src/workflows/payout/workflows/index.d.ts +11 -2
- package/.medusa/server/src/workflows/payout/workflows/index.js +12 -3
- package/.medusa/server/src/workflows/payout/workflows/link-payout-account.d.ts +11 -0
- package/.medusa/server/src/workflows/payout/workflows/link-payout-account.js +35 -0
- package/.medusa/server/src/workflows/payout/workflows/process-payout-for-webhook.d.ts +7 -3
- package/.medusa/server/src/workflows/payout/workflows/process-payout-for-webhook.js +50 -57
- package/.medusa/server/src/workflows/payout/workflows/process-payout-reversal.d.ts +9 -0
- package/.medusa/server/src/workflows/payout/workflows/process-payout-reversal.js +19 -0
- package/.medusa/server/src/workflows/payout/workflows/process-payout.d.ts +13 -0
- package/.medusa/server/src/workflows/payout/workflows/process-payout.js +23 -0
- package/.medusa/server/src/workflows/payout/workflows/refresh-onboarding.d.ts +13 -0
- package/.medusa/server/src/workflows/payout/workflows/refresh-onboarding.js +26 -0
- package/.medusa/server/src/workflows/payout/workflows/refresh-payout-account-link.d.ts +9 -0
- package/.medusa/server/src/workflows/payout/workflows/refresh-payout-account-link.js +15 -0
- package/.medusa/server/src/workflows/payout/workflows/retry-payout.d.ts +10 -0
- package/.medusa/server/src/workflows/payout/workflows/retry-payout.js +36 -0
- package/.medusa/server/src/workflows/payout/workflows/sync-payout-account.d.ts +9 -0
- package/.medusa/server/src/workflows/payout/workflows/sync-payout-account.js +24 -0
- package/package.json +3 -3
- package/.medusa/server/src/workflows/payout/steps/create-payout.d.ts +0 -3
- package/.medusa/server/src/workflows/payout/steps/create-payout.js +0 -12
- package/.medusa/server/src/workflows/payout/steps/update-payout-account.d.ts +0 -35
- package/.medusa/server/src/workflows/payout/steps/update-payout-account.js +0 -27
- package/.medusa/server/src/workflows/payout/steps/update-payout.d.ts +0 -35
- package/.medusa/server/src/workflows/payout/steps/update-payout.js +0 -27
- package/.medusa/server/src/workflows/payout/steps/validate-seller-payout-account.d.ts +0 -5
- package/.medusa/server/src/workflows/payout/steps/validate-seller-payout-account.js +0 -21
- package/.medusa/server/src/workflows/payout/workflows/create-payout.d.ts +0 -9
- package/.medusa/server/src/workflows/payout/workflows/create-payout.js +0 -87
|
@@ -1,111 +1,105 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AccountOutput, CreateAccountInput, CreatePayoutAccountDTO, CreateOnboardingDTO, IPayoutModuleService, OnboardingDTO, PayoutAccountDTO, PayoutAccountRequirements, PayoutAccountStatus, PayoutDTO, PayoutKycStatus, PayoutModuleOptions, PayoutOutput, PayoutProviderErrorCode, PayoutReversalDTO, PayoutStatus, PayoutWebhookActionInput, PayoutWebhookResult, ResolvedPayoutModuleOptions } from "@mercurjs/types";
|
|
2
2
|
import PayoutProviderService from "./provider-service";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { EntityManager } from "@medusajs/framework/mikro-orm/knex";
|
|
3
|
+
import { Context, DAL } from "@medusajs/framework/types";
|
|
4
|
+
import { SqlEntityManager } from "@medusajs/framework/mikro-orm/postgresql";
|
|
6
5
|
type InjectedDependencies = {
|
|
7
6
|
payoutProviderService: PayoutProviderService;
|
|
8
7
|
baseRepository: DAL.RepositoryService;
|
|
9
8
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
amount: import("@medusajs/framework/utils").BigNumberProperty;
|
|
37
|
-
data: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
38
|
-
account: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
39
|
-
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
40
|
-
status: import("@medusajs/framework/utils").EnumProperty<typeof PayoutAccountStatus>;
|
|
41
|
-
data: import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>;
|
|
42
|
-
context: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
43
|
-
onboarding: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
44
|
-
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
45
|
-
data: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
46
|
-
context: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
47
|
-
account: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "payout_account">, undefined>;
|
|
48
|
-
}>, "onboarding">, import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
49
|
-
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
50
|
-
data: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
51
|
-
context: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
52
|
-
account: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "payout_account">, undefined>;
|
|
53
|
-
}>, "onboarding">>, false>;
|
|
54
|
-
payouts: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "payout">>;
|
|
55
|
-
}>, "payout_account">, undefined>;
|
|
56
|
-
status: import("@medusajs/framework/utils").EnumProperty<typeof PayoutStatus>;
|
|
57
|
-
}>, "payout">;
|
|
58
|
-
readonly PayoutAccount: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
59
|
-
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
60
|
-
status: import("@medusajs/framework/utils").EnumProperty<typeof PayoutAccountStatus>;
|
|
61
|
-
data: import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>;
|
|
62
|
-
context: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
63
|
-
onboarding: import("@medusajs/framework/utils").RelationNullableModifier<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
64
|
-
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
65
|
-
data: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
66
|
-
context: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
67
|
-
account: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "payout_account">, undefined>;
|
|
68
|
-
}>, "onboarding">, import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
69
|
-
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
70
|
-
data: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
71
|
-
context: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
72
|
-
account: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "payout_account">, undefined>;
|
|
73
|
-
}>, "onboarding">>, false>;
|
|
74
|
-
payouts: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
75
|
-
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
76
|
-
display_id: import("@medusajs/framework/utils").AutoIncrementProperty;
|
|
77
|
-
currency_code: import("@medusajs/framework/utils").TextProperty;
|
|
78
|
-
amount: import("@medusajs/framework/utils").BigNumberProperty;
|
|
79
|
-
data: import("@medusajs/framework/utils").NullableModifier<NoInfer<Record<string, unknown>>, import("@medusajs/framework/utils").JSONProperty<NoInfer<Record<string, unknown>>>>;
|
|
80
|
-
account: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "payout_account">, undefined>;
|
|
81
|
-
status: import("@medusajs/framework/utils").EnumProperty<typeof PayoutStatus>;
|
|
82
|
-
}>, "payout">>;
|
|
83
|
-
}>, "payout_account">;
|
|
84
|
-
}>>;
|
|
85
|
-
export default class PayoutModuleService extends PayoutModuleService_base {
|
|
9
|
+
type ProviderAccount = {
|
|
10
|
+
external_id?: string | null;
|
|
11
|
+
data?: Record<string, unknown> | null;
|
|
12
|
+
};
|
|
13
|
+
type ProviderResult = {
|
|
14
|
+
status: PayoutStatus;
|
|
15
|
+
status_reason: string | null;
|
|
16
|
+
data: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
declare const PayoutModuleService_base: import("@medusajs/framework/utils").MedusaServiceReturnType<{
|
|
19
|
+
Onboarding: {
|
|
20
|
+
dto: OnboardingDTO;
|
|
21
|
+
};
|
|
22
|
+
Payout: {
|
|
23
|
+
dto: PayoutDTO;
|
|
24
|
+
};
|
|
25
|
+
PayoutAccount: {
|
|
26
|
+
dto: PayoutAccountDTO;
|
|
27
|
+
};
|
|
28
|
+
PayoutReversal: {
|
|
29
|
+
dto: PayoutReversalDTO;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
export default class PayoutModuleService extends PayoutModuleService_base implements IPayoutModuleService {
|
|
33
|
+
protected static readonly PROCESSABLE_STATUSES: PayoutStatus[];
|
|
34
|
+
protected static readonly STATUS_DETAIL_MAX_LENGTH = 1024;
|
|
86
35
|
protected readonly payoutProviderService_: PayoutProviderService;
|
|
87
36
|
protected readonly baseRepository_: DAL.RepositoryService;
|
|
88
|
-
protected readonly options_:
|
|
37
|
+
protected readonly options_: ResolvedPayoutModuleOptions;
|
|
89
38
|
constructor({ payoutProviderService, baseRepository }: InjectedDependencies, options: PayoutModuleOptions);
|
|
90
|
-
getOptions():
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
authorizationWindowMs: number;
|
|
98
|
-
sellerActionWindowMs: number;
|
|
99
|
-
captureSafetyBufferMs: number;
|
|
100
|
-
requiredFulfillmentStatus: import("@mercurjs/types").FulfillmentStatus;
|
|
101
|
-
};
|
|
102
|
-
createPayoutAccount(input: CreatePayoutAccountDTO, sharedContext?: Context<EntityManager>): Promise<PayoutAccountDTO>;
|
|
103
|
-
createOnboarding(input: CreateOnboardingDTO, sharedContext?: Context<EntityManager>): Promise<OnboardingDTO>;
|
|
104
|
-
createPayouts(input: CreatePayoutDTO, sharedContext?: Context<EntityManager>): Promise<PayoutDTO>;
|
|
105
|
-
protected createPayouts_(input: CreatePayoutDTO, sharedContext?: Context<EntityManager>): Promise<{
|
|
106
|
-
payout: InferEntityType<typeof Payout>;
|
|
107
|
-
payoutAccount: InferEntityType<typeof PayoutAccount>;
|
|
108
|
-
}>;
|
|
39
|
+
getOptions(): ResolvedPayoutModuleOptions;
|
|
40
|
+
createPayoutAccount(input: CreatePayoutAccountDTO, sharedContext?: Context<SqlEntityManager>): Promise<PayoutAccountDTO>;
|
|
41
|
+
syncPayoutAccount(accountId: string, sharedContext?: Context<SqlEntityManager>): Promise<PayoutAccountDTO>;
|
|
42
|
+
deletePayoutAccount(accountId: string, sharedContext?: Context<SqlEntityManager>): Promise<void>;
|
|
43
|
+
createOnboarding(input: CreateOnboardingDTO, sharedContext?: Context<SqlEntityManager>): Promise<OnboardingDTO>;
|
|
44
|
+
processPayout(payoutId: string, sharedContext?: Context<SqlEntityManager>): Promise<PayoutDTO>;
|
|
45
|
+
processPayoutReversal(reversalId: string, sharedContext?: Context<SqlEntityManager>): Promise<PayoutReversalDTO>;
|
|
109
46
|
getWebhookActionAndData(input: PayoutWebhookActionInput): Promise<PayoutWebhookResult>;
|
|
47
|
+
protected processPayout_(payoutId: string, sharedContext?: Context<SqlEntityManager>): Promise<{
|
|
48
|
+
payout: PayoutDTO;
|
|
49
|
+
attempt: {
|
|
50
|
+
attempts: number;
|
|
51
|
+
idempotency_key: string;
|
|
52
|
+
} | null;
|
|
53
|
+
}>;
|
|
54
|
+
protected processPayoutReversal_(reversalId: string, sharedContext?: Context<SqlEntityManager>): Promise<{
|
|
55
|
+
reversal: PayoutReversalDTO;
|
|
56
|
+
attempt: {
|
|
57
|
+
attempts: number;
|
|
58
|
+
idempotency_key: string;
|
|
59
|
+
} | null;
|
|
60
|
+
}>;
|
|
61
|
+
protected processPayoutFromProvider_(payout: PayoutDTO, attempt: {
|
|
62
|
+
idempotency_key: string;
|
|
63
|
+
}): Promise<ProviderResult>;
|
|
64
|
+
protected processPayoutReversalFromProvider_(reversal: PayoutReversalDTO, attempt: {
|
|
65
|
+
idempotency_key: string;
|
|
66
|
+
}): Promise<ProviderResult>;
|
|
67
|
+
protected lockRow_(table: string, id: string, sharedContext: Context<SqlEntityManager>): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* The key of a request whose outcome is unknown is kept, so a retry after a
|
|
70
|
+
* timeout returns the payout the provider may already have made. Only a
|
|
71
|
+
* provider refusal clears it, and the next attempt gets a fresh key.
|
|
72
|
+
*/
|
|
73
|
+
protected nextAttempt_(id: string, data: Record<string, unknown> | null): {
|
|
74
|
+
attempts: number;
|
|
75
|
+
idempotency_key: string;
|
|
76
|
+
};
|
|
77
|
+
protected statusFromProvider_(response: PayoutOutput): ProviderResult;
|
|
78
|
+
protected statusFromError_(error: unknown): ProviderResult;
|
|
79
|
+
protected providerErrorCode_(error: unknown): PayoutProviderErrorCode;
|
|
80
|
+
protected isOnboardingTokenValid_(account: PayoutAccountDTO): boolean;
|
|
81
|
+
protected generateOnboardingToken_(): string;
|
|
82
|
+
protected providerAccountRef_(account: ProviderAccount): {
|
|
83
|
+
id: string;
|
|
84
|
+
data: Record<string, unknown>;
|
|
85
|
+
};
|
|
86
|
+
protected providerAccountInput_(accountId: string, input: CreatePayoutAccountDTO): CreateAccountInput;
|
|
87
|
+
protected accountFieldsFromProvider_(account: AccountOutput): {
|
|
88
|
+
external_id: string;
|
|
89
|
+
status: PayoutAccountStatus;
|
|
90
|
+
kyc_status: PayoutKycStatus;
|
|
91
|
+
payouts_enabled: boolean;
|
|
92
|
+
charges_enabled: boolean;
|
|
93
|
+
details_submitted: boolean;
|
|
94
|
+
disabled_reason: string | null;
|
|
95
|
+
data: Record<string, unknown>;
|
|
96
|
+
last_synced_at: Date;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Outstanding requirements beat pending verification, a `rejected.*`
|
|
100
|
+
* disabled reason is final, any other disabled reason is still under review.
|
|
101
|
+
*/
|
|
102
|
+
protected deriveKycStatus_(requirements: PayoutAccountRequirements | null | undefined, disabledReason: string | null | undefined): PayoutKycStatus;
|
|
103
|
+
protected deriveAccountStatus_(account: AccountOutput): PayoutAccountStatus;
|
|
110
104
|
}
|
|
111
105
|
export {};
|