@delopay/sdk 0.112.0 → 0.115.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.
@@ -1,4 +1,4 @@
1
- import { ProjectResponse, ShopResponse, PaymentResponse, VaultEnvironment, RequestFn, AuthResponse, SignUpWithMerchantIdRequest, PaymentAttemptsListResponse, PaymentStatusHistoryResponse, RefundListResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, ClientAnalyticsRequest, DevicesAnalyticsResponse, GeoAnalyticsResponse, GeoDrillRequest, DrillResponse, DeviceDrillRequest, ScopeDrillRequest, SubscriptionAnalyticsRequest, SubscriptionAnalyticsResponse, SubscriptionDrillRequest, MerchantAccountResponse, MerchantAccountUpdateRequest, ProfileResponse, PaymentsDeleteResponse, PaymentClientContextListResponse, SettlementStatementListParams, SettlementStatementListResponse, FeeStatementDetail, StatementPdfParams, SettlementOverviewParams, SettlementOverviewResponse, SettlementCurrentParams, SettlementCurrentResponse, BillingProfileResponse, PlatformFeeRuleInput, PlatformFeeRuleRecord, FeeRulePreviewRequest, FeeRulePreviewResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Delopay } from './index.cjs';
1
+ import { BillingProfileResponse, ProjectResponse, ShopResponse, PaymentResponse, VaultEnvironment, RequestFn, AuthResponse, SignUpWithMerchantIdRequest, PaymentAttemptsListResponse, PaymentStatusHistoryResponse, RefundListResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, ClientAnalyticsRequest, DevicesAnalyticsResponse, GeoAnalyticsResponse, GeoDrillRequest, DrillResponse, DeviceDrillRequest, ScopeDrillRequest, SubscriptionAnalyticsRequest, SubscriptionAnalyticsResponse, SubscriptionDrillRequest, MerchantAccountResponse, MerchantAccountUpdateRequest, ProfileResponse, PaymentsDeleteResponse, PaymentClientContextListResponse, SettlementStatementListParams, SettlementStatementListResponse, FeeStatementDetail, StatementPdfParams, SettlementOverviewParams, SettlementOverviewResponse, SettlementCurrentParams, SettlementCurrentResponse, PlatformFeeRuleInput, PlatformFeeRuleRecord, FeeRulePreviewRequest, FeeRulePreviewResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Delopay } from './index.cjs';
2
2
  export { ALL_CUSTOM_FIELD_CONDITION_SOURCES, ALL_CUSTOM_FIELD_OPERATORS, ALL_CUSTOM_FIELD_TYPES, AddUserRequest, AddUserResponse, Address, AddressDetails, AllocationListResponse, AllocationResponse, AllocationTransferRequest, AllocationTransferResponse, AmountFilter, AmountRange, Analytics, AnalyticsChannel, AnalyticsChild, AnalyticsConnectorDay, AnalyticsConnectorSeries, AnalyticsDashboard, AnalyticsDayBucket, AnalyticsGranularity, AnalyticsMethodSlice, AnalyticsOutcome, ApiKeyCreateRequest, ApiKeyCreateResponse, ApiKeyExpiration, ApiKeyListConstraints, ApiKeyResponse, ApiKeyRevokeResponse, ApiKeyUpdateRequest, ApplePayVerificationRequest, ApplePayVerificationResponse, ApplePayVerifiedDomainsResponse, AttemptStatus, Audit, AuthenticationCreateRequest, AuthenticationResponse, AuthenticationStatus, AuthenticationType, AutoRechargeConfig, AutoRechargeUpdateRequest, AvailabilityOverrideCreateRequest, AvailabilityOverrideResponse, AvailabilityOverrides, AvailabilityPreviewMethod, AvailabilityPreviewParams, AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, BankCodeResponse, BankDebitTypes, BankTransferTypes, BillingCompleteSetupRequest, BillingSetupRequest, BillingSetupResponse, BlockedAttempt, BlockedAttemptListParams, BlockedAttemptListResponse, BlocklistAddRequest, BlocklistDataKind, BlocklistResponse, BrandingExport, BrandingSource, BuiltInRegionGroupResponse, BusinessPaymentLinkConfig, CHECKBOX_CHECKED, CHECKBOX_UNCHECKED, CHECKOUT_EVENT_KINDS, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_CONDITIONS_MAX, CUSTOM_FIELD_KEY_PATTERN, CUSTOM_FIELD_OPERATORS_BY_SOURCE, CUSTOM_FIELD_VALUELESS_OPERATORS, CancelModeOutcome, CancelSubscriptionRequest, CancelSubscriptionResponse, CaptureMethod, CardDetail, CardDetailFromLocker, CardNetworkTypes, CardSpecificFeatures, Cards, ChangePasswordRequest, CheckoutBranding, CheckoutBrandingResponse, CheckoutBrandingUpdate, CheckoutCustomField, CheckoutEventKind, CheckoutSession, CheckoutSessionOptions, CheckoutThemeComparisonSide, CheckoutThemeConversionCaveat, CheckoutThemeConversionCell, CheckoutThemeConversionComparison, CheckoutThemeConversionQuery, CheckoutThemeConversionResponse, CheckoutThemeConversionSegment, CheckoutThemeDenominatorBasis, CheckoutThemeDimension, CheckoutThemeOutput, CheckoutThemeProgram, CheckoutThemeProgramRequest, CheckoutThemeProgramResponse, CheckoutThemeRule, CheckoutThemeSampleVerdict, ClientAnalyticsCaveat, ClientAnalyticsFilters, ClientDrillSortKey, ConditionNode, ConfirmSubscriptionPaymentDetails, ConfirmSubscriptionRequest, ConfirmSubscriptionResponse, Connector, ConnectorCloneRequest, ConnectorCreateRequest, ConnectorFeatureMatrixEntry, ConnectorIntegrationStatus, ConnectorListResponse, ConnectorOwnership, ConnectorResponse, ConnectorRisk, ConnectorSelection, ConnectorType, ConnectorUpdateRequest, ConnectorVolumeSplit, ConnectorWebhookEntry, ConnectorWebhookEventType, ConnectorWebhookListResponse, ConnectorWebhookRegisterRequest, ConnectorWebhookRegisterResponse, ConnectorWebhookSyncResponse, ConnectorWebhookSyncResult, CornerRadius, CreateAndConfirmSubscriptionRequest, CreateSubscriptionPaymentDetails, CreateSubscriptionRequest, Currency, CurrencyRevenue, CustomFieldCondition, CustomFieldConditionSource, CustomFieldContext, CustomFieldOperator, CustomFieldOption, CustomFieldTranslations, CustomFieldType, CustomFieldVisibility, CustomerCreateRequest, CustomerListParams, CustomerPaymentMethodsListParams, CustomerPaymentMethodsListResponse, CustomerResponse, CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, DecidePendingOperationRequest, DeleteAccountRequest, DeleteEvidenceRequest, DeleteUserRoleRequest, DelopayAuthenticationError, DelopayConnectorCategory, DelopayError, DelopayLogger, DelopayOptions, DeviceAnalyticsChild, DeviceAnalyticsTotals, DeviceBrowserSlice, DeviceChannelBucket, DeviceClassSlice, DeviceDrillBase, DeviceDrillTarget, DeviceModelSlice, DevicePlatformSlice, DeviceSessionBucket, DisputeEvidenceBlock, DisputeEvidenceRequest, DisputeEvidenceType, DisputeListParams, DisputeOutcomeReporting, DisputeResponse, DisputeStage, DisputeStatus, DrillListControls, DrillPayment, DrillSortKey, DrillSummary, EncodedBranding, EntityType, EpayoutsCatalogEntry, EpayoutsCatalogResponse, EpayoutsLocality, EpayoutsMethod, EpayoutsMethodsResponse, EpayoutsRail, EphemeralKeyCreateRequest, EphemeralKeyCreateResponse, EuclidComparison, EuclidComparisonType, EuclidIfStatement, EuclidValue, EventClass, EventDeliveryAttemptResponse, EventDetailResponse, EventListParams, EventListResponse, EventResponse, EventType, Export, FeatureMatrix, FeatureMatrixResponse, FeatureStatus, FeeOwner, FeeProgramBuilder, FeeRuleConditions, FeeRuleDefaultPrecedence, FeeRuleInput, FeeSpecInput, FeeStatementSummary, FeeType, Files, FocusedCheckoutUrlParams, FontFamily, FontWeight, Forex, ForgotPasswordRequest, FromEmailRequest, FutureUsage, GatewayConnectRequest, GatewayResponse, GeoAnalyticsChild, GeoAnalyticsTotals, GeoCitySlice, GeoCountrySlice, GeoLanguageSlice, GetSubscriptionItemsParams, GetSubscriptionItemsResponse, GlobalSearchRequest, GroupNode, ImpersonateEmployeeRequest, IntentStatus, InviteUsersRequest, InviteUsersResponse, InvoiceAmountState, InvoiceOutcomes, InvoiceStatus, LabelStyle, LayoutStyle, LeafNode, LedgerEntry, LedgerListParams, LedgerResponse, LimitedOperation, LinkedRoutingConfigRetrieveResponse, ListInvitableRolesParams, ListUsersInLineageParams, LoginHistoryEntry, LoginHistoryParams, LoginHistoryResponse, LogoShape, LogoSize, MandateListParams, MandateResponse, MandateRevokedResponse, MandateStatus, MandateType, MarginQuality, MerchantAccountCreateRequest, MerchantAccountType, MerchantAuditActorInfo, MerchantAuditActorKind, MerchantAuditImpersonationKind, MerchantAuditLogEntry, MerchantAuditLogListParams, MerchantAuditLogListResponse, MerchantAuditSessionInfo, MerchantConnectorWebhookDetailsUpdate, MerchantOverviewResponse, MerchantOverviewStat, MerchantRisk, MerchantRoutingAlgorithm, MethodSurcharge, MinimalRoleInfo, NATIVE_PANES_MAX, NATIVE_PANE_CATEGORY_KEYS, NATIVE_PANE_ICON_KEYS, NativePaneCapability, NativePaneMethodInfo, NativePaneOpenTarget, NativePaneRail, NativePaneView, NativePaneVisibility, NativePanesCatalogResponse, NativePanesConnectorCatalog, NonPillRadius, OperationLimitOnExceeded, OperationLimitRule, OperationLimitRuleDeleteResponse, OperationLimitRuleListParams, OperationLimitScope, OperationLimitSettings, OperationLimitWindowMode, OperationLimits, OverrideAction, OverrideScope, PANES_MAX, PANE_CATEGORY_KEYS, PANE_ICON_KEYS, Pane, PaneCapability, PaneDisplayDefaults, PaneIssue, PaneIssueCode, PaneMethodInfo, PaneOpenTarget, PaneRail, PaneView, PaneVisibility, PanesCatalogResponse, PanesConnectorCatalog, ParentGroup, ParentGroupInfo, PauseSubscriptionRequest, PauseSubscriptionResponse, PaymentAttemptResponse, PaymentCancelRequest, PaymentCaptureRequest, PaymentClientContextEntry, PaymentConfirmRequest, PaymentCreateRequest, PaymentErrorDetails, PaymentExperience, PaymentExperienceTypes, PaymentIdFormatConfig, PaymentIdStyle, PaymentIntentStateMetadata, PaymentLayout, PaymentLinkBackgroundImageConfig, PaymentLinkConfigRequest, PaymentLinkListParams, PaymentLinkListResponse, PaymentLinkResponse, PaymentLinkTransactionDetails, PaymentListFilterConstraints, PaymentListFilteredResponse, PaymentListOrder, PaymentListParams, PaymentListResponse, PaymentMethod, PaymentMethodAmountLimits, PaymentMethodCreateRequest, PaymentMethodDeleteResponse, PaymentMethodDisplayInfo, PaymentMethodListInstallmentAmountDetails, PaymentMethodListInstallmentOption, PaymentMethodListInstallmentPlan, PaymentMethodListIntentData, PaymentMethodListParams, PaymentMethodListResponse, PaymentMethodResponse, PaymentMethodType, PaymentMethodUpdateRequest, PaymentRetrieveOptions, PaymentStatusHistoryEntityType, PaymentStatusHistoryEvent, PaymentUpdateRequest, PaymentsDeletePolicyResponse, PayoutCreateRequest, PayoutListParams, PayoutListResponse, PayoutResponse, PayoutStatus, PayoutType, PayoutUpdateRequest, PayseproMethod, PayseproMethodsResponse, PendingApprovalErrorDetails, PendingOperation, PendingOperationLimitContext, PendingOperationListParams, PendingOperationListResponse, PendingOperationStatus, PendingOperationSummary, PerMethodSurchargeItem, PermissionScope, PhoneDetails, PhoneOtpRequest, PhoneOtpResponse, PhoneOtpVerifyRequest, PhoneOtpVerifyResponse, PlanSlice, PlatformFeeKind, PlatformFeeOutput, PlatformFeeProgram, PlatformFeeRule, PlatformFeeRuleOutput, PlatformFeeRuleRequest, PollStatus, PollStatusResponse, ProcessorCostBasis, ProcessorCostBucket, ProcessorCostSource, ProcessorSlice, ProfileAcquirerCreateRequest, ProfileAcquirerResponse, ProfileAcquirerUpdateRequest, ProfileCreateRequest, ProfileDefaultRoutingConfig, ProfileDeniedConnectorsResponse, ProfileLogoUploadResponse, ProfileUpdateRequest, ProgramConnectorSelection, ProjectCreateRequest, ProjectStats, ProjectStatsResponse, ProjectUpdateRequest, PublishableKey, RecordCheckoutEventRequest, RecordCheckoutEventResponse, RecoveryCodesResponse, RefundAggregateResponse, RefundCreateRequest, RefundListParams, RefundResponse, RefundStatus, RefundType, RefundUpdateRequest, RegionCountriesResponse, RegionCreateRequest, RegionResponse, RegionSetCountriesRequest, RegionUpdateRequest, Regions, RelayRequest, RelayResponse, RelayStatus, RelayType, RequestExtras, RequestOptions, RequiredFieldInfo, ResetPasswordRequest, ResponsePaymentMethodTypes, ResponsePaymentMethodsEnabled, ResumeSubscriptionRequest, ResumeSubscriptionResponse, Risk, RoleConnectorGrant, RoleConnectorGrantEntry, RoutableConnectorChoice, RoutingActivatePayload, RoutingAlgorithmKind, RoutingConfigCreateRequest, RoutingConfigHistoryResponse, RoutingConfigResponse, RoutingConfigUpdateRequest, RoutingConfigVersion, RoutingConnectorCap, RoutingConnectorCaps, RoutingDeactivateRequest, RoutingDictionary, RoutingDictionaryRecord, RoutingHistoryParams, RuleConnectorSelection, STRIPE_FALLBACK_PANE_CATALOG, STRIPE_FALLBACK_PANE_METHODS, STRIPE_NATIVE_PANE_METHODS, ScopeDrillBase, ScopeDrillSortKey, ScopeDrillTarget, Search, SearchGroupResponse, SearchIndex, SearchStatus, SearchTimeRange, Settlement, SettlementBackfillRequest, SettlementBackfillResponse, SettlementBucket, SettlementCostParams, SettlementCostPeriod, SettlementCostResponse, SettlementLine, SettlementLineBase, SettlementLineListParams, SettlementLineListResponse, SettlementLineWithProcessorCost, SettlementLineWithoutProcessorCost, SettlementPayoutStatus, ShopCreateRequest, ShopFeeConfigEntry, ShopFeeConfigParams, ShopFeeConfigResponse, ShopRisk, ShopSettlementOverview, ShopStats, ShopStatsResponse, ShopUpdateRequest, ShopVisibilityResponse, ShopVisibilityUpdateRequest, SignInRequest, SignUpRequest, SignUpWithMerchantRequest, SizeScale, SpacingScale, StatementAdjustment, StatementAdjustmentCreateRequest, StatementAdjustmentListResponse, StatementGenerateRequest, StatementPayoutUpdateRequest, StaticRoutingAlgorithm, StatsPeriod, StripeConnectAccountRequest, StripeConnectAccountResponse, StripeConnectLinkRequest, StripeConnectLinkResponse, StripeNativePane, StripePaymentMethodDomainResult, StripePaymentMethodDomainStatus, StripePaymentMethodDomainsRegisterRequest, StripePaymentMethodDomainsRegisterResponse, SubscriptionBillingProcessorResponse, SubscriptionBucket, SubscriptionCaveat, SubscriptionChild, SubscriptionDrillBase, SubscriptionDrillSortKey, SubscriptionDrillTarget, SubscriptionEstimateParams, SubscriptionEstimateResponse, SubscriptionFilters, SubscriptionInvoice, SubscriptionInvoiceListParams, SubscriptionInvoiceListResponse, SubscriptionItem, SubscriptionItemPrice, SubscriptionItemType, SubscriptionLineItem, SubscriptionListParams, SubscriptionMovement, SubscriptionPaymentData, SubscriptionPaymentDetails, SubscriptionPaymentLink, SubscriptionPaymentLookupRequest, SubscriptionPaymentLookupResponse, SubscriptionPeriodUnit, SubscriptionProcessors, SubscriptionResponse, SubscriptionStatus, SubscriptionTotals, Subscriptions, SummaryPosition, SupportedPaymentMethod, SurchargeDetailsResponse, SurchargeResponse, SurchargeRuleRequest, SurchargeRuleResponse, SurfaceStyle, SwitchMerchantRequest, SwitchProfileRequest, Terminate2faQueryParams, ThemeBrowserLanguage, ThemeCheckoutChannel, ThemeChoice, ThemeCondition, ThemeDeviceClass, ThemeEnumCondition, ThemeIfStatement, ThemeMetadataCondition, ThemeNumberCondition, ThemeTrafficSource, ThreeDSDecision, ThreeDsRuleExecuteRequest, ThreeDsRuleResponse, TierSummary, TimeToPayBucket, TimeToPayBucketLabel, TimeToPayStats, TokenPurpose, TokenResponse, TopupRequest, TopupResponse, TotpResponse, TransactionType, TrustBadge, UpdateMetadataRequest, UpdateOperationLimitSettingsRequest, UpdateRoleConnectorGrantParams, UpdateSubscriptionRequest, UpdateUserDetailsRequest, UpdateUserRoleRequest, UpsertOperationLimitRuleRequest, UpsertRefundLimitRuleRequest, UpsertSettlementAdjustmentLimitRuleRequest, UpsertSettlementPayoutLimitRuleRequest, UserInLineage, UserResponse, UserSessionEntry, UserSessionListResponse, UserSessionRevokeResponse, VaultCheck, VaultCheckId, VaultCheckStatus, VaultCollectSessionResponse, VaultPaymentMethodRequest, VaultPaymentMethodResponse, VaultRouteApplyVerification, VaultRouteChange, VaultRouteChangeKind, VaultRouteFieldChange, VaultRouteIds, VaultRoutePurpose, VaultRouteWarning, VaultRouteWarningCode, VaultRoutesApplyRequest, VaultRoutesApplyResponse, VaultRoutesFingerprint, VaultRoutesPreviewRequest, VaultRoutesPreviewResponse, VaultVerificationResponse, VaultVerifyRequest, VerifyTotpRequest, WCAG_AA_TEXT, WCAG_AA_UI, WebhookDeliveryAttempt, WebhookDeliveryTerminalReason, WebhookDetails, WebhookEvent, WebhookRefundStatus, WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, cloneNativePane, clonePane, contrastRatio, customFieldContextFromMetadata, customFieldIsTextLike, customFieldOperatorTakesValue, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, decodeNativePanes, decodePanes, defaultBranding, defaultCustomFieldVisibility, defaultNativePane, defaultOperatorForSource, defaultPane, emptyPaneCatalog, encodeBadges, encodeBranding, encodeCustomFields, encodeNativePanes, encodePanes, evaluateCustomFieldCondition, evaluateCustomFieldVisibility, feeProgram, focusedCheckoutUrl, fontStack, fontWeightValue, inputPadValue, isCheckboxChecked, isDarkSurface, isHexColor, leaf, logoDimensions, nativePaneMethodInfo, offerablePaneMethods, paneCatalogFor, paneDisplayDefaults, paneMethodInfo, paneRailAllowed, paneViewVisibility, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, validatePanes, verticalGapValue, visibleCustomFields } from './index.cjs';
3
3
 
4
4
  /**
@@ -158,6 +158,46 @@ interface AdminUserResponse {
158
158
  is_verified: boolean;
159
159
  is_active: boolean;
160
160
  }
161
+ /**
162
+ * Which requested change the last-administrator guard refused.
163
+ *
164
+ * Rides in `error.data.route` of a `UR_66` so the caller can say *what* was
165
+ * refused from its own translations — the message is generic on purpose and
166
+ * should not be displayed.
167
+ */
168
+ type LastAdministratorRoute =
169
+ /** `is_active: false` on the last administrator. */
170
+ 'deactivate'
171
+ /**
172
+ * `role_id` moving the last administrator onto a role that cannot manage
173
+ * the merchant's users.
174
+ */
175
+ | 'demote'
176
+ /**
177
+ * `is_verified: false` on the last administrator. Not an immediate lockout
178
+ * — the sign-in flow allows a grace window after `created_at` — but one that
179
+ * has long since closed for an established account.
180
+ */
181
+ | 'unverify'
182
+ /** `DELETE` on the last administrator. */
183
+ | 'delete';
184
+ /**
185
+ * `error.data` of a `UR_66`: `updateUser` / `deleteUser` refused a change
186
+ * because it would leave `merchant_id` with nobody who can manage its users.
187
+ *
188
+ * "Administrator" means an active account whose active role binding at the
189
+ * merchant resolves to a role holding user-write permission at merchant scope
190
+ * — resolved through the role's permission groups, so a custom role counts the
191
+ * same as `merchant_admin`. A user who is inactive, or whose role binding is
192
+ * still a pending invitation, is not one.
193
+ *
194
+ * Narrow a caught `DelopayError` onto this by checking `code === 'UR_66'`;
195
+ * `data` is absent against a router that predates the guard.
196
+ */
197
+ interface LastAdministratorRefusal {
198
+ merchant_id: string;
199
+ route: LastAdministratorRoute;
200
+ }
161
201
  interface AdminCustomerDetail {
162
202
  customer_id: string;
163
203
  organization_id: string;
@@ -542,6 +582,69 @@ interface AdminUnsuspendRequest {
542
582
  interface AdminSetTrustedRequest {
543
583
  trusted: boolean;
544
584
  }
585
+ /**
586
+ * Admin-only: mark a merchant free (not billed), or put it back on the
587
+ * prepaid model (delopay-backend#378).
588
+ *
589
+ * A union rather than an optional `reason`, on the `SettlementCostPeriod`
590
+ * precedent: `free: true` without a reason can only earn a 412, so that shape
591
+ * must not typecheck. Marking free normalises a billing-caused status — `pending_setup`, `delinquent`, or an
592
+ * `auto_recharge` suspension — to `active`. A sticky `admin` suspension is
593
+ * refused with 412 until lifted explicitly: the flag must never quietly
594
+ * unblock a merchant that was stopped for fraud. `free: false` re-derives the
595
+ * status from the balance the way an unsuspend does.
596
+ */
597
+ type AdminSetFreeRequest = {
598
+ free: true;
599
+ /** Why the merchant is not billed. Required: the router refuses `free: true` without one (412). */
600
+ reason: string;
601
+ } | {
602
+ free: false;
603
+ /** Ignored when clearing the flag; accepted so a caller can carry one through. */
604
+ reason?: string;
605
+ };
606
+ /**
607
+ * Admin-only: delete a merchant's **entire** ledger (delopay-backend#378).
608
+ * Every live entry is soft-deleted (kept for replay protection), the balance
609
+ * is set to zero and the status re-derived. Refused with 412 while the
610
+ * merchant has shop allocations.
611
+ */
612
+ interface AdminResetLedgerRequest {
613
+ /** Human-readable reason, required for audit. */
614
+ reason: string;
615
+ }
616
+ interface AdminResetLedgerResponse {
617
+ /** Live entries removed from the ledger. */
618
+ deleted_count: number;
619
+ /** Signed sum of the removed entries' amounts, in the balance currency. */
620
+ deleted_amount: number;
621
+ /** The balance before the reset; after it the balance is always zero. */
622
+ balance_before: number;
623
+ /** The profile as it stands after the reset. */
624
+ profile: BillingProfileResponse;
625
+ }
626
+ /**
627
+ * Admin-only: (re)create a merchant's ledger, optionally seeded with an
628
+ * opening balance (delopay-backend#378). Ensures the billing profile exists
629
+ * (created without the welcome promo credit) and, when `opening_balance` is
630
+ * set, writes one `opening_balance` entry. Refused with 412 while the
631
+ * merchant still has live ledger entries, or a non-zero balance with none.
632
+ * Does not clear the free flag.
633
+ */
634
+ interface AdminCreateLedgerRequest {
635
+ /** Opening balance in minor units of the balance currency. Omit or `0` for an empty ledger. */
636
+ opening_balance?: number;
637
+ /** ISO-4217 currency for a profile that does not exist yet; must match an existing profile's. */
638
+ balance_currency?: string;
639
+ /** Human-readable reason, required for audit; also the opening entry's description. */
640
+ reason: string;
641
+ }
642
+ interface AdminCreateLedgerResponse {
643
+ /** The opening-balance entry, when one was written. */
644
+ ledger_entry_id?: string | null;
645
+ /** The profile as it stands after the call. */
646
+ profile: BillingProfileResponse;
647
+ }
545
648
  interface CardIssuerCreateRequest {
546
649
  issuer_name: string;
547
650
  }
@@ -1036,12 +1139,22 @@ declare class AdminPortal {
1036
1139
  * against signup policy + JWT blacklist). `reset_2fa` clears TOTP state
1037
1140
  * so the user re-enrolls on next login. `is_active` supports both
1038
1141
  * directions: false soft-disables, true reactivates a soft-disabled user.
1142
+ *
1143
+ * Throws a `400` with `code === 'UR_66'` when the change would leave a
1144
+ * merchant with no administrator — `is_active: false` or `is_verified:
1145
+ * false` on, or a `role_id` demoting, the only active user whose role can
1146
+ * manage that merchant's users. Nothing is written. `error.data` carries a
1147
+ * {@link LastAdministratorRefusal} naming the merchant and which change was
1148
+ * refused; render that rather than the generic message.
1039
1149
  */
1040
1150
  updateUser(userId: string, body: AdminUpdateUserRequest): Promise<AdminUserResponse>;
1041
1151
  /**
1042
1152
  * Soft-delete a user globally: deactivates the row, blacklists existing
1043
1153
  * JWTs, and wipes credentials. Distinct from `deleteUserRole`, which
1044
1154
  * removes a single role binding while leaving the user signed-in elsewhere.
1155
+ *
1156
+ * Throws the same `UR_66` as {@link updateUser} when the user is the last
1157
+ * administrator of any merchant they belong to, with `route: 'delete'`.
1045
1158
  */
1046
1159
  deleteUser(userId: string): Promise<void>;
1047
1160
  /**
@@ -1368,6 +1481,50 @@ declare class PlatformBilling {
1368
1481
  * @returns The updated billing profile.
1369
1482
  */
1370
1483
  setTrusted(merchantId: string, params: AdminSetTrustedRequest): Promise<BillingProfileResponse>;
1484
+ /**
1485
+ * Mark a merchant free (not billed), or put it back on the prepaid model
1486
+ * (delopay-backend#378). While free, no platform fee is deducted, the
1487
+ * payment gate never blocks on billing status, top-ups are refused and
1488
+ * auto-recharge is inert. Marking free needs a `reason` and is refused
1489
+ * (412) while an admin suspension is in force — lift that first.
1490
+ *
1491
+ * Requires a router with delopay-backend#378; older routers answer `404`.
1492
+ *
1493
+ * @param merchantId - The merchant account ID.
1494
+ * @param params - The desired free state and, when marking free, the reason.
1495
+ * @returns The updated billing profile.
1496
+ */
1497
+ setFree(merchantId: string, params: AdminSetFreeRequest): Promise<BillingProfileResponse>;
1498
+ /**
1499
+ * Delete a merchant's **entire** ledger (delopay-backend#378). Every live
1500
+ * entry is soft-deleted — kept, so a replayed fee deduction or top-up
1501
+ * webhook still no-ops — the balance is set to zero and the status
1502
+ * re-derived (`active` for a free merchant; an active paying merchant
1503
+ * lands in `delinquent`). Refused (412) while the merchant has shop
1504
+ * allocations. Audited.
1505
+ *
1506
+ * Requires a router with delopay-backend#378; older routers answer `404`.
1507
+ *
1508
+ * @param merchantId - The merchant account ID.
1509
+ * @param params - The reason, required for audit.
1510
+ * @returns What was removed and the post-reset profile.
1511
+ */
1512
+ resetLedger(merchantId: string, params: AdminResetLedgerRequest): Promise<AdminResetLedgerResponse>;
1513
+ /**
1514
+ * (Re)create a merchant's ledger, optionally seeded with an opening balance
1515
+ * (delopay-backend#378). Ensures the billing profile exists (created
1516
+ * without the welcome promo credit) and, when `opening_balance` is set,
1517
+ * writes one `opening_balance` entry through the same atomic helper an
1518
+ * admin credit uses. Refused (412) while live entries or a non-zero balance
1519
+ * remain — reset first. Does not clear the free flag. Audited.
1520
+ *
1521
+ * Requires a router with delopay-backend#378; older routers answer `404`.
1522
+ *
1523
+ * @param merchantId - The merchant account ID.
1524
+ * @param params - Opening balance (minor units), currency for a new profile, and the reason.
1525
+ * @returns The opening entry id (if one was written) and the profile.
1526
+ */
1527
+ createLedger(merchantId: string, params: AdminCreateLedgerRequest): Promise<AdminCreateLedgerResponse>;
1371
1528
  }
1372
1529
 
1373
1530
  /**
@@ -1460,4 +1617,4 @@ declare class DelopayInternal extends Delopay {
1460
1617
  constructor(...args: ConstructorParameters<typeof Delopay>);
1461
1618
  }
1462
1619
 
1463
- export { Admin, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminAttachVaultRequest, type AdminAttachVaultResponse, type AdminCreateUserForMerchantRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminLedgerAnalyticsRequest, type AdminLedgerAnalyticsResponse, AdminPortal, type AdminSetTrustedRequest, type AdminShopVaultState, type AdminSignInRequest, type AdminSuspendRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AdminUnsuspendRequest, type AdminUpdateUserRequest, type AdminUserResponse, type AdminVaultEntitlementState, type AdminVaultEnvironmentState, type AdminVaultStateResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, type AuditActorInfo, type AuditActorKind, type AuditImpersonationKind, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, AuditLogs, type AuditSessionInfo, AuthResponse, type AuthorizeResponse, BillingProfileResponse, Cache, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, CardIssuers, ClientAnalyticsRequest, Configs, type ConnectorRestrictionResponse, type ConnectorRestrictionRuleAction, type ConnectorRestrictionRuleResponse, ConnectorRestrictionRules, type ConnectorRestrictionScope, ConnectorRestrictions, type ConnectorVisibility, type CreateConnectorRestrictionRuleRequest, type CreateInternalUserRequest, type CreateTenantUserRequest, type CustomerSummary, type CustomerUser, Delopay, DelopayInternal, DeviceDrillRequest, DevicesAnalyticsResponse, DrillResponse, FeeRulePreviewRequest, FeeRulePreviewResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, FeeStatementDetail, type FeeTotalBound, GeoAnalyticsResponse, GeoDrillRequest, Gsm, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type LedgerDayBucket, type LedgerMerchant, type ListConnectorRestrictionRulesQuery, MerchantAccountResponse, MerchantAccountUpdateRequest, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, PaymentAttemptsListResponse, type PaymentAutoCloseConfigResponse, type PaymentAutoCloseOverrideResponse, PaymentClientContextListResponse, type PaymentPeriodStats, PaymentResponse, PaymentStatusHistoryResponse, PaymentsDeleteResponse, type PlatformAnalyticsResponse, PlatformBilling, PlatformFeeRuleInput, PlatformFeeRuleRecord, PlatformFees, ProfileResponse, ProjectResponse, type PromoConfigResponse, RefundListResponse, RequestFn, ScopeDrillRequest, SettlementCurrentParams, SettlementCurrentResponse, SettlementOverviewParams, SettlementOverviewResponse, SettlementStatementListParams, SettlementStatementListResponse, ShopResponse, SignUpWithMerchantIdRequest, type SignupToggleRequest, type SignupToggleResponse, StatementPdfParams, SubscriptionAnalyticsRequest, SubscriptionAnalyticsResponse, SubscriptionDrillRequest, type TransactionDeleteConfigResponse, type TransactionDeleteOverrideResponse, type UpdateConnectorRestrictionRuleRequest, type UpdateLedgerEntryRequest, type UpdatePaymentAutoCloseConfigRequest, type UpdatePaymentAutoCloseOverrideRequest, type UpdatePromoConfigRequest, type UpdateTransactionDeleteConfigRequest, type UpdateTransactionDeleteOverrideRequest, type UpsertConnectorRestrictionRequest, VaultEnvironment };
1620
+ export { Admin, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminAttachVaultRequest, type AdminAttachVaultResponse, type AdminCreateLedgerRequest, type AdminCreateLedgerResponse, type AdminCreateUserForMerchantRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminLedgerAnalyticsRequest, type AdminLedgerAnalyticsResponse, AdminPortal, type AdminResetLedgerRequest, type AdminResetLedgerResponse, type AdminSetFreeRequest, type AdminSetTrustedRequest, type AdminShopVaultState, type AdminSignInRequest, type AdminSuspendRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AdminUnsuspendRequest, type AdminUpdateUserRequest, type AdminUserResponse, type AdminVaultEntitlementState, type AdminVaultEnvironmentState, type AdminVaultStateResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, type AuditActorInfo, type AuditActorKind, type AuditImpersonationKind, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, AuditLogs, type AuditSessionInfo, AuthResponse, type AuthorizeResponse, BillingProfileResponse, Cache, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, CardIssuers, ClientAnalyticsRequest, Configs, type ConnectorRestrictionResponse, type ConnectorRestrictionRuleAction, type ConnectorRestrictionRuleResponse, ConnectorRestrictionRules, type ConnectorRestrictionScope, ConnectorRestrictions, type ConnectorVisibility, type CreateConnectorRestrictionRuleRequest, type CreateInternalUserRequest, type CreateTenantUserRequest, type CustomerSummary, type CustomerUser, Delopay, DelopayInternal, DeviceDrillRequest, DevicesAnalyticsResponse, DrillResponse, FeeRulePreviewRequest, FeeRulePreviewResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, FeeStatementDetail, type FeeTotalBound, GeoAnalyticsResponse, GeoDrillRequest, Gsm, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type LastAdministratorRefusal, type LastAdministratorRoute, type LedgerDayBucket, type LedgerMerchant, type ListConnectorRestrictionRulesQuery, MerchantAccountResponse, MerchantAccountUpdateRequest, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, PaymentAttemptsListResponse, type PaymentAutoCloseConfigResponse, type PaymentAutoCloseOverrideResponse, PaymentClientContextListResponse, type PaymentPeriodStats, PaymentResponse, PaymentStatusHistoryResponse, PaymentsDeleteResponse, type PlatformAnalyticsResponse, PlatformBilling, PlatformFeeRuleInput, PlatformFeeRuleRecord, PlatformFees, ProfileResponse, ProjectResponse, type PromoConfigResponse, RefundListResponse, RequestFn, ScopeDrillRequest, SettlementCurrentParams, SettlementCurrentResponse, SettlementOverviewParams, SettlementOverviewResponse, SettlementStatementListParams, SettlementStatementListResponse, ShopResponse, SignUpWithMerchantIdRequest, type SignupToggleRequest, type SignupToggleResponse, StatementPdfParams, SubscriptionAnalyticsRequest, SubscriptionAnalyticsResponse, SubscriptionDrillRequest, type TransactionDeleteConfigResponse, type TransactionDeleteOverrideResponse, type UpdateConnectorRestrictionRuleRequest, type UpdateLedgerEntryRequest, type UpdatePaymentAutoCloseConfigRequest, type UpdatePaymentAutoCloseOverrideRequest, type UpdatePromoConfigRequest, type UpdateTransactionDeleteConfigRequest, type UpdateTransactionDeleteOverrideRequest, type UpsertConnectorRestrictionRequest, VaultEnvironment };
@@ -1,4 +1,4 @@
1
- import { ProjectResponse, ShopResponse, PaymentResponse, VaultEnvironment, RequestFn, AuthResponse, SignUpWithMerchantIdRequest, PaymentAttemptsListResponse, PaymentStatusHistoryResponse, RefundListResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, ClientAnalyticsRequest, DevicesAnalyticsResponse, GeoAnalyticsResponse, GeoDrillRequest, DrillResponse, DeviceDrillRequest, ScopeDrillRequest, SubscriptionAnalyticsRequest, SubscriptionAnalyticsResponse, SubscriptionDrillRequest, MerchantAccountResponse, MerchantAccountUpdateRequest, ProfileResponse, PaymentsDeleteResponse, PaymentClientContextListResponse, SettlementStatementListParams, SettlementStatementListResponse, FeeStatementDetail, StatementPdfParams, SettlementOverviewParams, SettlementOverviewResponse, SettlementCurrentParams, SettlementCurrentResponse, BillingProfileResponse, PlatformFeeRuleInput, PlatformFeeRuleRecord, FeeRulePreviewRequest, FeeRulePreviewResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Delopay } from './index.js';
1
+ import { BillingProfileResponse, ProjectResponse, ShopResponse, PaymentResponse, VaultEnvironment, RequestFn, AuthResponse, SignUpWithMerchantIdRequest, PaymentAttemptsListResponse, PaymentStatusHistoryResponse, RefundListResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, ClientAnalyticsRequest, DevicesAnalyticsResponse, GeoAnalyticsResponse, GeoDrillRequest, DrillResponse, DeviceDrillRequest, ScopeDrillRequest, SubscriptionAnalyticsRequest, SubscriptionAnalyticsResponse, SubscriptionDrillRequest, MerchantAccountResponse, MerchantAccountUpdateRequest, ProfileResponse, PaymentsDeleteResponse, PaymentClientContextListResponse, SettlementStatementListParams, SettlementStatementListResponse, FeeStatementDetail, StatementPdfParams, SettlementOverviewParams, SettlementOverviewResponse, SettlementCurrentParams, SettlementCurrentResponse, PlatformFeeRuleInput, PlatformFeeRuleRecord, FeeRulePreviewRequest, FeeRulePreviewResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Delopay } from './index.js';
2
2
  export { ALL_CUSTOM_FIELD_CONDITION_SOURCES, ALL_CUSTOM_FIELD_OPERATORS, ALL_CUSTOM_FIELD_TYPES, AddUserRequest, AddUserResponse, Address, AddressDetails, AllocationListResponse, AllocationResponse, AllocationTransferRequest, AllocationTransferResponse, AmountFilter, AmountRange, Analytics, AnalyticsChannel, AnalyticsChild, AnalyticsConnectorDay, AnalyticsConnectorSeries, AnalyticsDashboard, AnalyticsDayBucket, AnalyticsGranularity, AnalyticsMethodSlice, AnalyticsOutcome, ApiKeyCreateRequest, ApiKeyCreateResponse, ApiKeyExpiration, ApiKeyListConstraints, ApiKeyResponse, ApiKeyRevokeResponse, ApiKeyUpdateRequest, ApplePayVerificationRequest, ApplePayVerificationResponse, ApplePayVerifiedDomainsResponse, AttemptStatus, Audit, AuthenticationCreateRequest, AuthenticationResponse, AuthenticationStatus, AuthenticationType, AutoRechargeConfig, AutoRechargeUpdateRequest, AvailabilityOverrideCreateRequest, AvailabilityOverrideResponse, AvailabilityOverrides, AvailabilityPreviewMethod, AvailabilityPreviewParams, AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, BankCodeResponse, BankDebitTypes, BankTransferTypes, BillingCompleteSetupRequest, BillingSetupRequest, BillingSetupResponse, BlockedAttempt, BlockedAttemptListParams, BlockedAttemptListResponse, BlocklistAddRequest, BlocklistDataKind, BlocklistResponse, BrandingExport, BrandingSource, BuiltInRegionGroupResponse, BusinessPaymentLinkConfig, CHECKBOX_CHECKED, CHECKBOX_UNCHECKED, CHECKOUT_EVENT_KINDS, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_CONDITIONS_MAX, CUSTOM_FIELD_KEY_PATTERN, CUSTOM_FIELD_OPERATORS_BY_SOURCE, CUSTOM_FIELD_VALUELESS_OPERATORS, CancelModeOutcome, CancelSubscriptionRequest, CancelSubscriptionResponse, CaptureMethod, CardDetail, CardDetailFromLocker, CardNetworkTypes, CardSpecificFeatures, Cards, ChangePasswordRequest, CheckoutBranding, CheckoutBrandingResponse, CheckoutBrandingUpdate, CheckoutCustomField, CheckoutEventKind, CheckoutSession, CheckoutSessionOptions, CheckoutThemeComparisonSide, CheckoutThemeConversionCaveat, CheckoutThemeConversionCell, CheckoutThemeConversionComparison, CheckoutThemeConversionQuery, CheckoutThemeConversionResponse, CheckoutThemeConversionSegment, CheckoutThemeDenominatorBasis, CheckoutThemeDimension, CheckoutThemeOutput, CheckoutThemeProgram, CheckoutThemeProgramRequest, CheckoutThemeProgramResponse, CheckoutThemeRule, CheckoutThemeSampleVerdict, ClientAnalyticsCaveat, ClientAnalyticsFilters, ClientDrillSortKey, ConditionNode, ConfirmSubscriptionPaymentDetails, ConfirmSubscriptionRequest, ConfirmSubscriptionResponse, Connector, ConnectorCloneRequest, ConnectorCreateRequest, ConnectorFeatureMatrixEntry, ConnectorIntegrationStatus, ConnectorListResponse, ConnectorOwnership, ConnectorResponse, ConnectorRisk, ConnectorSelection, ConnectorType, ConnectorUpdateRequest, ConnectorVolumeSplit, ConnectorWebhookEntry, ConnectorWebhookEventType, ConnectorWebhookListResponse, ConnectorWebhookRegisterRequest, ConnectorWebhookRegisterResponse, ConnectorWebhookSyncResponse, ConnectorWebhookSyncResult, CornerRadius, CreateAndConfirmSubscriptionRequest, CreateSubscriptionPaymentDetails, CreateSubscriptionRequest, Currency, CurrencyRevenue, CustomFieldCondition, CustomFieldConditionSource, CustomFieldContext, CustomFieldOperator, CustomFieldOption, CustomFieldTranslations, CustomFieldType, CustomFieldVisibility, CustomerCreateRequest, CustomerListParams, CustomerPaymentMethodsListParams, CustomerPaymentMethodsListResponse, CustomerResponse, CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, DecidePendingOperationRequest, DeleteAccountRequest, DeleteEvidenceRequest, DeleteUserRoleRequest, DelopayAuthenticationError, DelopayConnectorCategory, DelopayError, DelopayLogger, DelopayOptions, DeviceAnalyticsChild, DeviceAnalyticsTotals, DeviceBrowserSlice, DeviceChannelBucket, DeviceClassSlice, DeviceDrillBase, DeviceDrillTarget, DeviceModelSlice, DevicePlatformSlice, DeviceSessionBucket, DisputeEvidenceBlock, DisputeEvidenceRequest, DisputeEvidenceType, DisputeListParams, DisputeOutcomeReporting, DisputeResponse, DisputeStage, DisputeStatus, DrillListControls, DrillPayment, DrillSortKey, DrillSummary, EncodedBranding, EntityType, EpayoutsCatalogEntry, EpayoutsCatalogResponse, EpayoutsLocality, EpayoutsMethod, EpayoutsMethodsResponse, EpayoutsRail, EphemeralKeyCreateRequest, EphemeralKeyCreateResponse, EuclidComparison, EuclidComparisonType, EuclidIfStatement, EuclidValue, EventClass, EventDeliveryAttemptResponse, EventDetailResponse, EventListParams, EventListResponse, EventResponse, EventType, Export, FeatureMatrix, FeatureMatrixResponse, FeatureStatus, FeeOwner, FeeProgramBuilder, FeeRuleConditions, FeeRuleDefaultPrecedence, FeeRuleInput, FeeSpecInput, FeeStatementSummary, FeeType, Files, FocusedCheckoutUrlParams, FontFamily, FontWeight, Forex, ForgotPasswordRequest, FromEmailRequest, FutureUsage, GatewayConnectRequest, GatewayResponse, GeoAnalyticsChild, GeoAnalyticsTotals, GeoCitySlice, GeoCountrySlice, GeoLanguageSlice, GetSubscriptionItemsParams, GetSubscriptionItemsResponse, GlobalSearchRequest, GroupNode, ImpersonateEmployeeRequest, IntentStatus, InviteUsersRequest, InviteUsersResponse, InvoiceAmountState, InvoiceOutcomes, InvoiceStatus, LabelStyle, LayoutStyle, LeafNode, LedgerEntry, LedgerListParams, LedgerResponse, LimitedOperation, LinkedRoutingConfigRetrieveResponse, ListInvitableRolesParams, ListUsersInLineageParams, LoginHistoryEntry, LoginHistoryParams, LoginHistoryResponse, LogoShape, LogoSize, MandateListParams, MandateResponse, MandateRevokedResponse, MandateStatus, MandateType, MarginQuality, MerchantAccountCreateRequest, MerchantAccountType, MerchantAuditActorInfo, MerchantAuditActorKind, MerchantAuditImpersonationKind, MerchantAuditLogEntry, MerchantAuditLogListParams, MerchantAuditLogListResponse, MerchantAuditSessionInfo, MerchantConnectorWebhookDetailsUpdate, MerchantOverviewResponse, MerchantOverviewStat, MerchantRisk, MerchantRoutingAlgorithm, MethodSurcharge, MinimalRoleInfo, NATIVE_PANES_MAX, NATIVE_PANE_CATEGORY_KEYS, NATIVE_PANE_ICON_KEYS, NativePaneCapability, NativePaneMethodInfo, NativePaneOpenTarget, NativePaneRail, NativePaneView, NativePaneVisibility, NativePanesCatalogResponse, NativePanesConnectorCatalog, NonPillRadius, OperationLimitOnExceeded, OperationLimitRule, OperationLimitRuleDeleteResponse, OperationLimitRuleListParams, OperationLimitScope, OperationLimitSettings, OperationLimitWindowMode, OperationLimits, OverrideAction, OverrideScope, PANES_MAX, PANE_CATEGORY_KEYS, PANE_ICON_KEYS, Pane, PaneCapability, PaneDisplayDefaults, PaneIssue, PaneIssueCode, PaneMethodInfo, PaneOpenTarget, PaneRail, PaneView, PaneVisibility, PanesCatalogResponse, PanesConnectorCatalog, ParentGroup, ParentGroupInfo, PauseSubscriptionRequest, PauseSubscriptionResponse, PaymentAttemptResponse, PaymentCancelRequest, PaymentCaptureRequest, PaymentClientContextEntry, PaymentConfirmRequest, PaymentCreateRequest, PaymentErrorDetails, PaymentExperience, PaymentExperienceTypes, PaymentIdFormatConfig, PaymentIdStyle, PaymentIntentStateMetadata, PaymentLayout, PaymentLinkBackgroundImageConfig, PaymentLinkConfigRequest, PaymentLinkListParams, PaymentLinkListResponse, PaymentLinkResponse, PaymentLinkTransactionDetails, PaymentListFilterConstraints, PaymentListFilteredResponse, PaymentListOrder, PaymentListParams, PaymentListResponse, PaymentMethod, PaymentMethodAmountLimits, PaymentMethodCreateRequest, PaymentMethodDeleteResponse, PaymentMethodDisplayInfo, PaymentMethodListInstallmentAmountDetails, PaymentMethodListInstallmentOption, PaymentMethodListInstallmentPlan, PaymentMethodListIntentData, PaymentMethodListParams, PaymentMethodListResponse, PaymentMethodResponse, PaymentMethodType, PaymentMethodUpdateRequest, PaymentRetrieveOptions, PaymentStatusHistoryEntityType, PaymentStatusHistoryEvent, PaymentUpdateRequest, PaymentsDeletePolicyResponse, PayoutCreateRequest, PayoutListParams, PayoutListResponse, PayoutResponse, PayoutStatus, PayoutType, PayoutUpdateRequest, PayseproMethod, PayseproMethodsResponse, PendingApprovalErrorDetails, PendingOperation, PendingOperationLimitContext, PendingOperationListParams, PendingOperationListResponse, PendingOperationStatus, PendingOperationSummary, PerMethodSurchargeItem, PermissionScope, PhoneDetails, PhoneOtpRequest, PhoneOtpResponse, PhoneOtpVerifyRequest, PhoneOtpVerifyResponse, PlanSlice, PlatformFeeKind, PlatformFeeOutput, PlatformFeeProgram, PlatformFeeRule, PlatformFeeRuleOutput, PlatformFeeRuleRequest, PollStatus, PollStatusResponse, ProcessorCostBasis, ProcessorCostBucket, ProcessorCostSource, ProcessorSlice, ProfileAcquirerCreateRequest, ProfileAcquirerResponse, ProfileAcquirerUpdateRequest, ProfileCreateRequest, ProfileDefaultRoutingConfig, ProfileDeniedConnectorsResponse, ProfileLogoUploadResponse, ProfileUpdateRequest, ProgramConnectorSelection, ProjectCreateRequest, ProjectStats, ProjectStatsResponse, ProjectUpdateRequest, PublishableKey, RecordCheckoutEventRequest, RecordCheckoutEventResponse, RecoveryCodesResponse, RefundAggregateResponse, RefundCreateRequest, RefundListParams, RefundResponse, RefundStatus, RefundType, RefundUpdateRequest, RegionCountriesResponse, RegionCreateRequest, RegionResponse, RegionSetCountriesRequest, RegionUpdateRequest, Regions, RelayRequest, RelayResponse, RelayStatus, RelayType, RequestExtras, RequestOptions, RequiredFieldInfo, ResetPasswordRequest, ResponsePaymentMethodTypes, ResponsePaymentMethodsEnabled, ResumeSubscriptionRequest, ResumeSubscriptionResponse, Risk, RoleConnectorGrant, RoleConnectorGrantEntry, RoutableConnectorChoice, RoutingActivatePayload, RoutingAlgorithmKind, RoutingConfigCreateRequest, RoutingConfigHistoryResponse, RoutingConfigResponse, RoutingConfigUpdateRequest, RoutingConfigVersion, RoutingConnectorCap, RoutingConnectorCaps, RoutingDeactivateRequest, RoutingDictionary, RoutingDictionaryRecord, RoutingHistoryParams, RuleConnectorSelection, STRIPE_FALLBACK_PANE_CATALOG, STRIPE_FALLBACK_PANE_METHODS, STRIPE_NATIVE_PANE_METHODS, ScopeDrillBase, ScopeDrillSortKey, ScopeDrillTarget, Search, SearchGroupResponse, SearchIndex, SearchStatus, SearchTimeRange, Settlement, SettlementBackfillRequest, SettlementBackfillResponse, SettlementBucket, SettlementCostParams, SettlementCostPeriod, SettlementCostResponse, SettlementLine, SettlementLineBase, SettlementLineListParams, SettlementLineListResponse, SettlementLineWithProcessorCost, SettlementLineWithoutProcessorCost, SettlementPayoutStatus, ShopCreateRequest, ShopFeeConfigEntry, ShopFeeConfigParams, ShopFeeConfigResponse, ShopRisk, ShopSettlementOverview, ShopStats, ShopStatsResponse, ShopUpdateRequest, ShopVisibilityResponse, ShopVisibilityUpdateRequest, SignInRequest, SignUpRequest, SignUpWithMerchantRequest, SizeScale, SpacingScale, StatementAdjustment, StatementAdjustmentCreateRequest, StatementAdjustmentListResponse, StatementGenerateRequest, StatementPayoutUpdateRequest, StaticRoutingAlgorithm, StatsPeriod, StripeConnectAccountRequest, StripeConnectAccountResponse, StripeConnectLinkRequest, StripeConnectLinkResponse, StripeNativePane, StripePaymentMethodDomainResult, StripePaymentMethodDomainStatus, StripePaymentMethodDomainsRegisterRequest, StripePaymentMethodDomainsRegisterResponse, SubscriptionBillingProcessorResponse, SubscriptionBucket, SubscriptionCaveat, SubscriptionChild, SubscriptionDrillBase, SubscriptionDrillSortKey, SubscriptionDrillTarget, SubscriptionEstimateParams, SubscriptionEstimateResponse, SubscriptionFilters, SubscriptionInvoice, SubscriptionInvoiceListParams, SubscriptionInvoiceListResponse, SubscriptionItem, SubscriptionItemPrice, SubscriptionItemType, SubscriptionLineItem, SubscriptionListParams, SubscriptionMovement, SubscriptionPaymentData, SubscriptionPaymentDetails, SubscriptionPaymentLink, SubscriptionPaymentLookupRequest, SubscriptionPaymentLookupResponse, SubscriptionPeriodUnit, SubscriptionProcessors, SubscriptionResponse, SubscriptionStatus, SubscriptionTotals, Subscriptions, SummaryPosition, SupportedPaymentMethod, SurchargeDetailsResponse, SurchargeResponse, SurchargeRuleRequest, SurchargeRuleResponse, SurfaceStyle, SwitchMerchantRequest, SwitchProfileRequest, Terminate2faQueryParams, ThemeBrowserLanguage, ThemeCheckoutChannel, ThemeChoice, ThemeCondition, ThemeDeviceClass, ThemeEnumCondition, ThemeIfStatement, ThemeMetadataCondition, ThemeNumberCondition, ThemeTrafficSource, ThreeDSDecision, ThreeDsRuleExecuteRequest, ThreeDsRuleResponse, TierSummary, TimeToPayBucket, TimeToPayBucketLabel, TimeToPayStats, TokenPurpose, TokenResponse, TopupRequest, TopupResponse, TotpResponse, TransactionType, TrustBadge, UpdateMetadataRequest, UpdateOperationLimitSettingsRequest, UpdateRoleConnectorGrantParams, UpdateSubscriptionRequest, UpdateUserDetailsRequest, UpdateUserRoleRequest, UpsertOperationLimitRuleRequest, UpsertRefundLimitRuleRequest, UpsertSettlementAdjustmentLimitRuleRequest, UpsertSettlementPayoutLimitRuleRequest, UserInLineage, UserResponse, UserSessionEntry, UserSessionListResponse, UserSessionRevokeResponse, VaultCheck, VaultCheckId, VaultCheckStatus, VaultCollectSessionResponse, VaultPaymentMethodRequest, VaultPaymentMethodResponse, VaultRouteApplyVerification, VaultRouteChange, VaultRouteChangeKind, VaultRouteFieldChange, VaultRouteIds, VaultRoutePurpose, VaultRouteWarning, VaultRouteWarningCode, VaultRoutesApplyRequest, VaultRoutesApplyResponse, VaultRoutesFingerprint, VaultRoutesPreviewRequest, VaultRoutesPreviewResponse, VaultVerificationResponse, VaultVerifyRequest, VerifyTotpRequest, WCAG_AA_TEXT, WCAG_AA_UI, WebhookDeliveryAttempt, WebhookDeliveryTerminalReason, WebhookDetails, WebhookEvent, WebhookRefundStatus, WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, cloneNativePane, clonePane, contrastRatio, customFieldContextFromMetadata, customFieldIsTextLike, customFieldOperatorTakesValue, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, decodeNativePanes, decodePanes, defaultBranding, defaultCustomFieldVisibility, defaultNativePane, defaultOperatorForSource, defaultPane, emptyPaneCatalog, encodeBadges, encodeBranding, encodeCustomFields, encodeNativePanes, encodePanes, evaluateCustomFieldCondition, evaluateCustomFieldVisibility, feeProgram, focusedCheckoutUrl, fontStack, fontWeightValue, inputPadValue, isCheckboxChecked, isDarkSurface, isHexColor, leaf, logoDimensions, nativePaneMethodInfo, offerablePaneMethods, paneCatalogFor, paneDisplayDefaults, paneMethodInfo, paneRailAllowed, paneViewVisibility, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, validatePanes, verticalGapValue, visibleCustomFields } from './index.js';
3
3
 
4
4
  /**
@@ -158,6 +158,46 @@ interface AdminUserResponse {
158
158
  is_verified: boolean;
159
159
  is_active: boolean;
160
160
  }
161
+ /**
162
+ * Which requested change the last-administrator guard refused.
163
+ *
164
+ * Rides in `error.data.route` of a `UR_66` so the caller can say *what* was
165
+ * refused from its own translations — the message is generic on purpose and
166
+ * should not be displayed.
167
+ */
168
+ type LastAdministratorRoute =
169
+ /** `is_active: false` on the last administrator. */
170
+ 'deactivate'
171
+ /**
172
+ * `role_id` moving the last administrator onto a role that cannot manage
173
+ * the merchant's users.
174
+ */
175
+ | 'demote'
176
+ /**
177
+ * `is_verified: false` on the last administrator. Not an immediate lockout
178
+ * — the sign-in flow allows a grace window after `created_at` — but one that
179
+ * has long since closed for an established account.
180
+ */
181
+ | 'unverify'
182
+ /** `DELETE` on the last administrator. */
183
+ | 'delete';
184
+ /**
185
+ * `error.data` of a `UR_66`: `updateUser` / `deleteUser` refused a change
186
+ * because it would leave `merchant_id` with nobody who can manage its users.
187
+ *
188
+ * "Administrator" means an active account whose active role binding at the
189
+ * merchant resolves to a role holding user-write permission at merchant scope
190
+ * — resolved through the role's permission groups, so a custom role counts the
191
+ * same as `merchant_admin`. A user who is inactive, or whose role binding is
192
+ * still a pending invitation, is not one.
193
+ *
194
+ * Narrow a caught `DelopayError` onto this by checking `code === 'UR_66'`;
195
+ * `data` is absent against a router that predates the guard.
196
+ */
197
+ interface LastAdministratorRefusal {
198
+ merchant_id: string;
199
+ route: LastAdministratorRoute;
200
+ }
161
201
  interface AdminCustomerDetail {
162
202
  customer_id: string;
163
203
  organization_id: string;
@@ -542,6 +582,69 @@ interface AdminUnsuspendRequest {
542
582
  interface AdminSetTrustedRequest {
543
583
  trusted: boolean;
544
584
  }
585
+ /**
586
+ * Admin-only: mark a merchant free (not billed), or put it back on the
587
+ * prepaid model (delopay-backend#378).
588
+ *
589
+ * A union rather than an optional `reason`, on the `SettlementCostPeriod`
590
+ * precedent: `free: true` without a reason can only earn a 412, so that shape
591
+ * must not typecheck. Marking free normalises a billing-caused status — `pending_setup`, `delinquent`, or an
592
+ * `auto_recharge` suspension — to `active`. A sticky `admin` suspension is
593
+ * refused with 412 until lifted explicitly: the flag must never quietly
594
+ * unblock a merchant that was stopped for fraud. `free: false` re-derives the
595
+ * status from the balance the way an unsuspend does.
596
+ */
597
+ type AdminSetFreeRequest = {
598
+ free: true;
599
+ /** Why the merchant is not billed. Required: the router refuses `free: true` without one (412). */
600
+ reason: string;
601
+ } | {
602
+ free: false;
603
+ /** Ignored when clearing the flag; accepted so a caller can carry one through. */
604
+ reason?: string;
605
+ };
606
+ /**
607
+ * Admin-only: delete a merchant's **entire** ledger (delopay-backend#378).
608
+ * Every live entry is soft-deleted (kept for replay protection), the balance
609
+ * is set to zero and the status re-derived. Refused with 412 while the
610
+ * merchant has shop allocations.
611
+ */
612
+ interface AdminResetLedgerRequest {
613
+ /** Human-readable reason, required for audit. */
614
+ reason: string;
615
+ }
616
+ interface AdminResetLedgerResponse {
617
+ /** Live entries removed from the ledger. */
618
+ deleted_count: number;
619
+ /** Signed sum of the removed entries' amounts, in the balance currency. */
620
+ deleted_amount: number;
621
+ /** The balance before the reset; after it the balance is always zero. */
622
+ balance_before: number;
623
+ /** The profile as it stands after the reset. */
624
+ profile: BillingProfileResponse;
625
+ }
626
+ /**
627
+ * Admin-only: (re)create a merchant's ledger, optionally seeded with an
628
+ * opening balance (delopay-backend#378). Ensures the billing profile exists
629
+ * (created without the welcome promo credit) and, when `opening_balance` is
630
+ * set, writes one `opening_balance` entry. Refused with 412 while the
631
+ * merchant still has live ledger entries, or a non-zero balance with none.
632
+ * Does not clear the free flag.
633
+ */
634
+ interface AdminCreateLedgerRequest {
635
+ /** Opening balance in minor units of the balance currency. Omit or `0` for an empty ledger. */
636
+ opening_balance?: number;
637
+ /** ISO-4217 currency for a profile that does not exist yet; must match an existing profile's. */
638
+ balance_currency?: string;
639
+ /** Human-readable reason, required for audit; also the opening entry's description. */
640
+ reason: string;
641
+ }
642
+ interface AdminCreateLedgerResponse {
643
+ /** The opening-balance entry, when one was written. */
644
+ ledger_entry_id?: string | null;
645
+ /** The profile as it stands after the call. */
646
+ profile: BillingProfileResponse;
647
+ }
545
648
  interface CardIssuerCreateRequest {
546
649
  issuer_name: string;
547
650
  }
@@ -1036,12 +1139,22 @@ declare class AdminPortal {
1036
1139
  * against signup policy + JWT blacklist). `reset_2fa` clears TOTP state
1037
1140
  * so the user re-enrolls on next login. `is_active` supports both
1038
1141
  * directions: false soft-disables, true reactivates a soft-disabled user.
1142
+ *
1143
+ * Throws a `400` with `code === 'UR_66'` when the change would leave a
1144
+ * merchant with no administrator — `is_active: false` or `is_verified:
1145
+ * false` on, or a `role_id` demoting, the only active user whose role can
1146
+ * manage that merchant's users. Nothing is written. `error.data` carries a
1147
+ * {@link LastAdministratorRefusal} naming the merchant and which change was
1148
+ * refused; render that rather than the generic message.
1039
1149
  */
1040
1150
  updateUser(userId: string, body: AdminUpdateUserRequest): Promise<AdminUserResponse>;
1041
1151
  /**
1042
1152
  * Soft-delete a user globally: deactivates the row, blacklists existing
1043
1153
  * JWTs, and wipes credentials. Distinct from `deleteUserRole`, which
1044
1154
  * removes a single role binding while leaving the user signed-in elsewhere.
1155
+ *
1156
+ * Throws the same `UR_66` as {@link updateUser} when the user is the last
1157
+ * administrator of any merchant they belong to, with `route: 'delete'`.
1045
1158
  */
1046
1159
  deleteUser(userId: string): Promise<void>;
1047
1160
  /**
@@ -1368,6 +1481,50 @@ declare class PlatformBilling {
1368
1481
  * @returns The updated billing profile.
1369
1482
  */
1370
1483
  setTrusted(merchantId: string, params: AdminSetTrustedRequest): Promise<BillingProfileResponse>;
1484
+ /**
1485
+ * Mark a merchant free (not billed), or put it back on the prepaid model
1486
+ * (delopay-backend#378). While free, no platform fee is deducted, the
1487
+ * payment gate never blocks on billing status, top-ups are refused and
1488
+ * auto-recharge is inert. Marking free needs a `reason` and is refused
1489
+ * (412) while an admin suspension is in force — lift that first.
1490
+ *
1491
+ * Requires a router with delopay-backend#378; older routers answer `404`.
1492
+ *
1493
+ * @param merchantId - The merchant account ID.
1494
+ * @param params - The desired free state and, when marking free, the reason.
1495
+ * @returns The updated billing profile.
1496
+ */
1497
+ setFree(merchantId: string, params: AdminSetFreeRequest): Promise<BillingProfileResponse>;
1498
+ /**
1499
+ * Delete a merchant's **entire** ledger (delopay-backend#378). Every live
1500
+ * entry is soft-deleted — kept, so a replayed fee deduction or top-up
1501
+ * webhook still no-ops — the balance is set to zero and the status
1502
+ * re-derived (`active` for a free merchant; an active paying merchant
1503
+ * lands in `delinquent`). Refused (412) while the merchant has shop
1504
+ * allocations. Audited.
1505
+ *
1506
+ * Requires a router with delopay-backend#378; older routers answer `404`.
1507
+ *
1508
+ * @param merchantId - The merchant account ID.
1509
+ * @param params - The reason, required for audit.
1510
+ * @returns What was removed and the post-reset profile.
1511
+ */
1512
+ resetLedger(merchantId: string, params: AdminResetLedgerRequest): Promise<AdminResetLedgerResponse>;
1513
+ /**
1514
+ * (Re)create a merchant's ledger, optionally seeded with an opening balance
1515
+ * (delopay-backend#378). Ensures the billing profile exists (created
1516
+ * without the welcome promo credit) and, when `opening_balance` is set,
1517
+ * writes one `opening_balance` entry through the same atomic helper an
1518
+ * admin credit uses. Refused (412) while live entries or a non-zero balance
1519
+ * remain — reset first. Does not clear the free flag. Audited.
1520
+ *
1521
+ * Requires a router with delopay-backend#378; older routers answer `404`.
1522
+ *
1523
+ * @param merchantId - The merchant account ID.
1524
+ * @param params - Opening balance (minor units), currency for a new profile, and the reason.
1525
+ * @returns The opening entry id (if one was written) and the profile.
1526
+ */
1527
+ createLedger(merchantId: string, params: AdminCreateLedgerRequest): Promise<AdminCreateLedgerResponse>;
1371
1528
  }
1372
1529
 
1373
1530
  /**
@@ -1460,4 +1617,4 @@ declare class DelopayInternal extends Delopay {
1460
1617
  constructor(...args: ConstructorParameters<typeof Delopay>);
1461
1618
  }
1462
1619
 
1463
- export { Admin, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminAttachVaultRequest, type AdminAttachVaultResponse, type AdminCreateUserForMerchantRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminLedgerAnalyticsRequest, type AdminLedgerAnalyticsResponse, AdminPortal, type AdminSetTrustedRequest, type AdminShopVaultState, type AdminSignInRequest, type AdminSuspendRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AdminUnsuspendRequest, type AdminUpdateUserRequest, type AdminUserResponse, type AdminVaultEntitlementState, type AdminVaultEnvironmentState, type AdminVaultStateResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, type AuditActorInfo, type AuditActorKind, type AuditImpersonationKind, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, AuditLogs, type AuditSessionInfo, AuthResponse, type AuthorizeResponse, BillingProfileResponse, Cache, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, CardIssuers, ClientAnalyticsRequest, Configs, type ConnectorRestrictionResponse, type ConnectorRestrictionRuleAction, type ConnectorRestrictionRuleResponse, ConnectorRestrictionRules, type ConnectorRestrictionScope, ConnectorRestrictions, type ConnectorVisibility, type CreateConnectorRestrictionRuleRequest, type CreateInternalUserRequest, type CreateTenantUserRequest, type CustomerSummary, type CustomerUser, Delopay, DelopayInternal, DeviceDrillRequest, DevicesAnalyticsResponse, DrillResponse, FeeRulePreviewRequest, FeeRulePreviewResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, FeeStatementDetail, type FeeTotalBound, GeoAnalyticsResponse, GeoDrillRequest, Gsm, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type LedgerDayBucket, type LedgerMerchant, type ListConnectorRestrictionRulesQuery, MerchantAccountResponse, MerchantAccountUpdateRequest, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, PaymentAttemptsListResponse, type PaymentAutoCloseConfigResponse, type PaymentAutoCloseOverrideResponse, PaymentClientContextListResponse, type PaymentPeriodStats, PaymentResponse, PaymentStatusHistoryResponse, PaymentsDeleteResponse, type PlatformAnalyticsResponse, PlatformBilling, PlatformFeeRuleInput, PlatformFeeRuleRecord, PlatformFees, ProfileResponse, ProjectResponse, type PromoConfigResponse, RefundListResponse, RequestFn, ScopeDrillRequest, SettlementCurrentParams, SettlementCurrentResponse, SettlementOverviewParams, SettlementOverviewResponse, SettlementStatementListParams, SettlementStatementListResponse, ShopResponse, SignUpWithMerchantIdRequest, type SignupToggleRequest, type SignupToggleResponse, StatementPdfParams, SubscriptionAnalyticsRequest, SubscriptionAnalyticsResponse, SubscriptionDrillRequest, type TransactionDeleteConfigResponse, type TransactionDeleteOverrideResponse, type UpdateConnectorRestrictionRuleRequest, type UpdateLedgerEntryRequest, type UpdatePaymentAutoCloseConfigRequest, type UpdatePaymentAutoCloseOverrideRequest, type UpdatePromoConfigRequest, type UpdateTransactionDeleteConfigRequest, type UpdateTransactionDeleteOverrideRequest, type UpsertConnectorRestrictionRequest, VaultEnvironment };
1620
+ export { Admin, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminAttachVaultRequest, type AdminAttachVaultResponse, type AdminCreateLedgerRequest, type AdminCreateLedgerResponse, type AdminCreateUserForMerchantRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminLedgerAnalyticsRequest, type AdminLedgerAnalyticsResponse, AdminPortal, type AdminResetLedgerRequest, type AdminResetLedgerResponse, type AdminSetFreeRequest, type AdminSetTrustedRequest, type AdminShopVaultState, type AdminSignInRequest, type AdminSuspendRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AdminUnsuspendRequest, type AdminUpdateUserRequest, type AdminUserResponse, type AdminVaultEntitlementState, type AdminVaultEnvironmentState, type AdminVaultStateResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, type AuditActorInfo, type AuditActorKind, type AuditImpersonationKind, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, AuditLogs, type AuditSessionInfo, AuthResponse, type AuthorizeResponse, BillingProfileResponse, Cache, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, CardIssuers, ClientAnalyticsRequest, Configs, type ConnectorRestrictionResponse, type ConnectorRestrictionRuleAction, type ConnectorRestrictionRuleResponse, ConnectorRestrictionRules, type ConnectorRestrictionScope, ConnectorRestrictions, type ConnectorVisibility, type CreateConnectorRestrictionRuleRequest, type CreateInternalUserRequest, type CreateTenantUserRequest, type CustomerSummary, type CustomerUser, Delopay, DelopayInternal, DeviceDrillRequest, DevicesAnalyticsResponse, DrillResponse, FeeRulePreviewRequest, FeeRulePreviewResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, FeeStatementDetail, type FeeTotalBound, GeoAnalyticsResponse, GeoDrillRequest, Gsm, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type LastAdministratorRefusal, type LastAdministratorRoute, type LedgerDayBucket, type LedgerMerchant, type ListConnectorRestrictionRulesQuery, MerchantAccountResponse, MerchantAccountUpdateRequest, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, PaymentAttemptsListResponse, type PaymentAutoCloseConfigResponse, type PaymentAutoCloseOverrideResponse, PaymentClientContextListResponse, type PaymentPeriodStats, PaymentResponse, PaymentStatusHistoryResponse, PaymentsDeleteResponse, type PlatformAnalyticsResponse, PlatformBilling, PlatformFeeRuleInput, PlatformFeeRuleRecord, PlatformFees, ProfileResponse, ProjectResponse, type PromoConfigResponse, RefundListResponse, RequestFn, ScopeDrillRequest, SettlementCurrentParams, SettlementCurrentResponse, SettlementOverviewParams, SettlementOverviewResponse, SettlementStatementListParams, SettlementStatementListResponse, ShopResponse, SignUpWithMerchantIdRequest, type SignupToggleRequest, type SignupToggleResponse, StatementPdfParams, SubscriptionAnalyticsRequest, SubscriptionAnalyticsResponse, SubscriptionDrillRequest, type TransactionDeleteConfigResponse, type TransactionDeleteOverrideResponse, type UpdateConnectorRestrictionRuleRequest, type UpdateLedgerEntryRequest, type UpdatePaymentAutoCloseConfigRequest, type UpdatePaymentAutoCloseOverrideRequest, type UpdatePromoConfigRequest, type UpdateTransactionDeleteConfigRequest, type UpdateTransactionDeleteOverrideRequest, type UpsertConnectorRestrictionRequest, VaultEnvironment };
package/dist/internal.js CHANGED
@@ -110,7 +110,7 @@ import {
110
110
  validatePanes,
111
111
  verticalGapValue,
112
112
  visibleCustomFields
113
- } from "./chunk-3O5MU6FP.js";
113
+ } from "./chunk-VH5NCMH6.js";
114
114
 
115
115
  // src/internal/resources/admin.ts
116
116
  var Admin = class {
@@ -373,6 +373,13 @@ var AdminPortal = class {
373
373
  * against signup policy + JWT blacklist). `reset_2fa` clears TOTP state
374
374
  * so the user re-enrolls on next login. `is_active` supports both
375
375
  * directions: false soft-disables, true reactivates a soft-disabled user.
376
+ *
377
+ * Throws a `400` with `code === 'UR_66'` when the change would leave a
378
+ * merchant with no administrator — `is_active: false` or `is_verified:
379
+ * false` on, or a `role_id` demoting, the only active user whose role can
380
+ * manage that merchant's users. Nothing is written. `error.data` carries a
381
+ * {@link LastAdministratorRefusal} naming the merchant and which change was
382
+ * refused; render that rather than the generic message.
376
383
  */
377
384
  async updateUser(userId, body) {
378
385
  return this.request("PATCH", `/admin-portal/users/${encodeURIComponent(userId)}`, { body });
@@ -381,6 +388,9 @@ var AdminPortal = class {
381
388
  * Soft-delete a user globally: deactivates the row, blacklists existing
382
389
  * JWTs, and wipes credentials. Distinct from `deleteUserRole`, which
383
390
  * removes a single role binding while leaving the user signed-in elsewhere.
391
+ *
392
+ * Throws the same `UR_66` as {@link updateUser} when the user is the last
393
+ * administrator of any merchant they belong to, with `route: 'delete'`.
384
394
  */
385
395
  async deleteUser(userId) {
386
396
  return this.request("DELETE", `/admin-portal/users/${encodeURIComponent(userId)}`);
@@ -888,6 +898,62 @@ var PlatformBilling = class {
888
898
  body: params
889
899
  });
890
900
  }
901
+ /**
902
+ * Mark a merchant free (not billed), or put it back on the prepaid model
903
+ * (delopay-backend#378). While free, no platform fee is deducted, the
904
+ * payment gate never blocks on billing status, top-ups are refused and
905
+ * auto-recharge is inert. Marking free needs a `reason` and is refused
906
+ * (412) while an admin suspension is in force — lift that first.
907
+ *
908
+ * Requires a router with delopay-backend#378; older routers answer `404`.
909
+ *
910
+ * @param merchantId - The merchant account ID.
911
+ * @param params - The desired free state and, when marking free, the reason.
912
+ * @returns The updated billing profile.
913
+ */
914
+ async setFree(merchantId, params) {
915
+ return this.request("PATCH", `/billing/${encodeURIComponent(merchantId)}/admin/free`, {
916
+ body: params
917
+ });
918
+ }
919
+ /**
920
+ * Delete a merchant's **entire** ledger (delopay-backend#378). Every live
921
+ * entry is soft-deleted — kept, so a replayed fee deduction or top-up
922
+ * webhook still no-ops — the balance is set to zero and the status
923
+ * re-derived (`active` for a free merchant; an active paying merchant
924
+ * lands in `delinquent`). Refused (412) while the merchant has shop
925
+ * allocations. Audited.
926
+ *
927
+ * Requires a router with delopay-backend#378; older routers answer `404`.
928
+ *
929
+ * @param merchantId - The merchant account ID.
930
+ * @param params - The reason, required for audit.
931
+ * @returns What was removed and the post-reset profile.
932
+ */
933
+ async resetLedger(merchantId, params) {
934
+ return this.request("DELETE", `/billing/${encodeURIComponent(merchantId)}/admin/ledger`, {
935
+ body: params
936
+ });
937
+ }
938
+ /**
939
+ * (Re)create a merchant's ledger, optionally seeded with an opening balance
940
+ * (delopay-backend#378). Ensures the billing profile exists (created
941
+ * without the welcome promo credit) and, when `opening_balance` is set,
942
+ * writes one `opening_balance` entry through the same atomic helper an
943
+ * admin credit uses. Refused (412) while live entries or a non-zero balance
944
+ * remain — reset first. Does not clear the free flag. Audited.
945
+ *
946
+ * Requires a router with delopay-backend#378; older routers answer `404`.
947
+ *
948
+ * @param merchantId - The merchant account ID.
949
+ * @param params - Opening balance (minor units), currency for a new profile, and the reason.
950
+ * @returns The opening entry id (if one was written) and the profile.
951
+ */
952
+ async createLedger(merchantId, params) {
953
+ return this.request("POST", `/billing/${encodeURIComponent(merchantId)}/admin/ledger`, {
954
+ body: params
955
+ });
956
+ }
891
957
  };
892
958
 
893
959
  // src/internal/resources/platformFees.ts