@delopay/sdk 0.75.0 → 0.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -187,6 +187,26 @@ interface PaymentCreateRequest {
187
187
  browser_info?: Record<string, unknown> | null;
188
188
  /** Set to `true` to generate a hosted payment link for this payment. */
189
189
  payment_link?: boolean | null;
190
+ /**
191
+ * Whether this is a test payment. The environment belongs to the payment, not to
192
+ * the processor.
193
+ *
194
+ * - `true` — run against the processor's sandbox and record the transaction as a
195
+ * test, keeping it out of live transaction lists and analytics. A processor with
196
+ * no sandbox credentials stored is called with the only credentials it has, so a
197
+ * live-only processor will charge for real.
198
+ * - `false` — run live, even if the processor still carries the deprecated
199
+ * account-level test-mode toggle.
200
+ * - omit — the processor's toggle decides, as it did before this field existed.
201
+ *
202
+ * Create-only: `confirm` and `update` can be called from the browser with a client
203
+ * secret, so the environment is fixed when you create the payment on your server.
204
+ *
205
+ * Requires a DeloPay backend that knows this field. The payments API rejects
206
+ * unknown fields, so sending it to an older deployment fails the whole create
207
+ * with `IR_06` rather than ignoring it.
208
+ */
209
+ test_mode?: boolean | null;
190
210
  }
191
211
  interface PaymentUpdateRequest {
192
212
  amount?: number | null;
@@ -349,9 +369,10 @@ interface PaymentResponse {
349
369
  /** Bank statement descriptor (suffix portion). */
350
370
  statement_descriptor_suffix?: string | null;
351
371
  /**
352
- * Whether this payment ran in test mode (against a sandbox/test connector).
353
- * Set at confirm from the connector account's test mode; `null` for payments
354
- * created but never confirmed against a connector.
372
+ * Which environment this payment ran in. Reflects the `test_mode` you sent at
373
+ * create; when you sent nothing it is filled in from the processor's own toggle
374
+ * once a processor is picked, and stays `null` for a payment that never reached
375
+ * one. `null` counts as live everywhere it is filtered on.
355
376
  */
356
377
  test_mode?: boolean | null;
357
378
  [key: string]: unknown;
@@ -3958,6 +3979,17 @@ declare class Payments {
3958
3979
  * { headers: { 'Idempotency-Key': 'order_1001' } },
3959
3980
  * );
3960
3981
  * ```
3982
+ *
3983
+ * @example Send `test_mode` to pick the environment per payment, so a staging
3984
+ * deploy cannot charge real cards and a forgotten processor toggle cannot
3985
+ * swallow production traffic:
3986
+ * ```typescript
3987
+ * const payment = await delopay.payments.create({
3988
+ * amount: 5000,
3989
+ * currency: 'EUR',
3990
+ * test_mode: process.env.NODE_ENV !== 'production',
3991
+ * });
3992
+ * ```
3961
3993
  */
3962
3994
  create(params: PaymentCreateRequest, options?: RequestExtras): Promise<PaymentResponse>;
3963
3995
  /**
@@ -5717,7 +5749,7 @@ interface TrustBadge {
5717
5749
  backgroundColor: string;
5718
5750
  borderColor: string | null;
5719
5751
  }
5720
- type CustomFieldType = 'text' | 'textarea' | 'password' | 'email' | 'select';
5752
+ type CustomFieldType = 'text' | 'textarea' | 'password' | 'email' | 'select' | 'checkbox';
5721
5753
  type CustomFieldTranslations = Record<string, string>;
5722
5754
  interface CustomFieldOption {
5723
5755
  value: string;
@@ -5849,6 +5881,15 @@ declare function encodeBadges(badges: TrustBadge[]): string;
5849
5881
  declare const CUSTOM_FIELDS_MAX = 20;
5850
5882
  declare const CUSTOM_FIELD_KEY_PATTERN: RegExp;
5851
5883
  declare const ALL_CUSTOM_FIELD_TYPES: readonly CustomFieldType[];
5884
+ declare const CHECKBOX_CHECKED = "true";
5885
+ declare const CHECKBOX_UNCHECKED = "false";
5886
+ /** Whether a stored/submitted checkbox value counts as ticked. Tolerant of
5887
+ * case and padding so a value round-tripped through a shop integration
5888
+ * ('True', ' true ') still reads correctly. */
5889
+ declare function isCheckboxChecked(value: string | null | undefined): boolean;
5890
+ /** Types whose value is free text, so length bounds and a placeholder apply.
5891
+ * `select` and `checkbox` are choice controls and have neither. */
5892
+ declare function customFieldIsTextLike(type: CustomFieldType): boolean;
5852
5893
  declare const CUSTOM_FIELD_CONDITIONS_MAX = 10;
5853
5894
  declare const ALL_CUSTOM_FIELD_CONDITION_SOURCES: readonly CustomFieldConditionSource[];
5854
5895
  declare const ALL_CUSTOM_FIELD_OPERATORS: readonly CustomFieldOperator[];
@@ -5919,4 +5960,4 @@ declare function parseImportedBranding(raw: unknown): CheckoutBranding;
5919
5960
  declare function applyBrandingVariables(el: HTMLElement, b: CheckoutBranding): void;
5920
5961
  declare function shadowFor(style: SurfaceStyle): string;
5921
5962
 
5922
- export { ALL_CUSTOM_FIELD_CONDITION_SOURCES, ALL_CUSTOM_FIELD_OPERATORS, ALL_CUSTOM_FIELD_TYPES, type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_CONDITIONS_MAX, CUSTOM_FIELD_KEY_PATTERN, CUSTOM_FIELD_OPERATORS_BY_SOURCE, CUSTOM_FIELD_VALUELESS_OPERATORS, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type CheckoutCustomField, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomFieldCondition, type CustomFieldConditionSource, type CustomFieldContext, type CustomFieldOperator, type CustomFieldOption, type CustomFieldTranslations, type CustomFieldType, type CustomFieldVisibility, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, type NonPillRadius, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type ResetPasswordRequest, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, customFieldContextFromMetadata, customFieldOperatorTakesValue, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, defaultBranding, defaultCustomFieldVisibility, defaultOperatorForSource, encodeBadges, encodeBranding, encodeCustomFields, evaluateCustomFieldCondition, evaluateCustomFieldVisibility, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue, visibleCustomFields };
5963
+ export { ALL_CUSTOM_FIELD_CONDITION_SOURCES, ALL_CUSTOM_FIELD_OPERATORS, ALL_CUSTOM_FIELD_TYPES, type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CHECKBOX_CHECKED, CHECKBOX_UNCHECKED, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_CONDITIONS_MAX, CUSTOM_FIELD_KEY_PATTERN, CUSTOM_FIELD_OPERATORS_BY_SOURCE, CUSTOM_FIELD_VALUELESS_OPERATORS, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type CheckoutCustomField, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomFieldCondition, type CustomFieldConditionSource, type CustomFieldContext, type CustomFieldOperator, type CustomFieldOption, type CustomFieldTranslations, type CustomFieldType, type CustomFieldVisibility, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, type NonPillRadius, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type ResetPasswordRequest, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, customFieldContextFromMetadata, customFieldIsTextLike, customFieldOperatorTakesValue, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, defaultBranding, defaultCustomFieldVisibility, defaultOperatorForSource, encodeBadges, encodeBranding, encodeCustomFields, evaluateCustomFieldCondition, evaluateCustomFieldVisibility, feeProgram, fontStack, fontWeightValue, inputPadValue, isCheckboxChecked, isDarkSurface, isHexColor, leaf, logoDimensions, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue, visibleCustomFields };
package/dist/index.d.ts CHANGED
@@ -187,6 +187,26 @@ interface PaymentCreateRequest {
187
187
  browser_info?: Record<string, unknown> | null;
188
188
  /** Set to `true` to generate a hosted payment link for this payment. */
189
189
  payment_link?: boolean | null;
190
+ /**
191
+ * Whether this is a test payment. The environment belongs to the payment, not to
192
+ * the processor.
193
+ *
194
+ * - `true` — run against the processor's sandbox and record the transaction as a
195
+ * test, keeping it out of live transaction lists and analytics. A processor with
196
+ * no sandbox credentials stored is called with the only credentials it has, so a
197
+ * live-only processor will charge for real.
198
+ * - `false` — run live, even if the processor still carries the deprecated
199
+ * account-level test-mode toggle.
200
+ * - omit — the processor's toggle decides, as it did before this field existed.
201
+ *
202
+ * Create-only: `confirm` and `update` can be called from the browser with a client
203
+ * secret, so the environment is fixed when you create the payment on your server.
204
+ *
205
+ * Requires a DeloPay backend that knows this field. The payments API rejects
206
+ * unknown fields, so sending it to an older deployment fails the whole create
207
+ * with `IR_06` rather than ignoring it.
208
+ */
209
+ test_mode?: boolean | null;
190
210
  }
191
211
  interface PaymentUpdateRequest {
192
212
  amount?: number | null;
@@ -349,9 +369,10 @@ interface PaymentResponse {
349
369
  /** Bank statement descriptor (suffix portion). */
350
370
  statement_descriptor_suffix?: string | null;
351
371
  /**
352
- * Whether this payment ran in test mode (against a sandbox/test connector).
353
- * Set at confirm from the connector account's test mode; `null` for payments
354
- * created but never confirmed against a connector.
372
+ * Which environment this payment ran in. Reflects the `test_mode` you sent at
373
+ * create; when you sent nothing it is filled in from the processor's own toggle
374
+ * once a processor is picked, and stays `null` for a payment that never reached
375
+ * one. `null` counts as live everywhere it is filtered on.
355
376
  */
356
377
  test_mode?: boolean | null;
357
378
  [key: string]: unknown;
@@ -3958,6 +3979,17 @@ declare class Payments {
3958
3979
  * { headers: { 'Idempotency-Key': 'order_1001' } },
3959
3980
  * );
3960
3981
  * ```
3982
+ *
3983
+ * @example Send `test_mode` to pick the environment per payment, so a staging
3984
+ * deploy cannot charge real cards and a forgotten processor toggle cannot
3985
+ * swallow production traffic:
3986
+ * ```typescript
3987
+ * const payment = await delopay.payments.create({
3988
+ * amount: 5000,
3989
+ * currency: 'EUR',
3990
+ * test_mode: process.env.NODE_ENV !== 'production',
3991
+ * });
3992
+ * ```
3961
3993
  */
3962
3994
  create(params: PaymentCreateRequest, options?: RequestExtras): Promise<PaymentResponse>;
3963
3995
  /**
@@ -5717,7 +5749,7 @@ interface TrustBadge {
5717
5749
  backgroundColor: string;
5718
5750
  borderColor: string | null;
5719
5751
  }
5720
- type CustomFieldType = 'text' | 'textarea' | 'password' | 'email' | 'select';
5752
+ type CustomFieldType = 'text' | 'textarea' | 'password' | 'email' | 'select' | 'checkbox';
5721
5753
  type CustomFieldTranslations = Record<string, string>;
5722
5754
  interface CustomFieldOption {
5723
5755
  value: string;
@@ -5849,6 +5881,15 @@ declare function encodeBadges(badges: TrustBadge[]): string;
5849
5881
  declare const CUSTOM_FIELDS_MAX = 20;
5850
5882
  declare const CUSTOM_FIELD_KEY_PATTERN: RegExp;
5851
5883
  declare const ALL_CUSTOM_FIELD_TYPES: readonly CustomFieldType[];
5884
+ declare const CHECKBOX_CHECKED = "true";
5885
+ declare const CHECKBOX_UNCHECKED = "false";
5886
+ /** Whether a stored/submitted checkbox value counts as ticked. Tolerant of
5887
+ * case and padding so a value round-tripped through a shop integration
5888
+ * ('True', ' true ') still reads correctly. */
5889
+ declare function isCheckboxChecked(value: string | null | undefined): boolean;
5890
+ /** Types whose value is free text, so length bounds and a placeholder apply.
5891
+ * `select` and `checkbox` are choice controls and have neither. */
5892
+ declare function customFieldIsTextLike(type: CustomFieldType): boolean;
5852
5893
  declare const CUSTOM_FIELD_CONDITIONS_MAX = 10;
5853
5894
  declare const ALL_CUSTOM_FIELD_CONDITION_SOURCES: readonly CustomFieldConditionSource[];
5854
5895
  declare const ALL_CUSTOM_FIELD_OPERATORS: readonly CustomFieldOperator[];
@@ -5919,4 +5960,4 @@ declare function parseImportedBranding(raw: unknown): CheckoutBranding;
5919
5960
  declare function applyBrandingVariables(el: HTMLElement, b: CheckoutBranding): void;
5920
5961
  declare function shadowFor(style: SurfaceStyle): string;
5921
5962
 
5922
- export { ALL_CUSTOM_FIELD_CONDITION_SOURCES, ALL_CUSTOM_FIELD_OPERATORS, ALL_CUSTOM_FIELD_TYPES, type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_CONDITIONS_MAX, CUSTOM_FIELD_KEY_PATTERN, CUSTOM_FIELD_OPERATORS_BY_SOURCE, CUSTOM_FIELD_VALUELESS_OPERATORS, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type CheckoutCustomField, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomFieldCondition, type CustomFieldConditionSource, type CustomFieldContext, type CustomFieldOperator, type CustomFieldOption, type CustomFieldTranslations, type CustomFieldType, type CustomFieldVisibility, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, type NonPillRadius, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type ResetPasswordRequest, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, customFieldContextFromMetadata, customFieldOperatorTakesValue, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, defaultBranding, defaultCustomFieldVisibility, defaultOperatorForSource, encodeBadges, encodeBranding, encodeCustomFields, evaluateCustomFieldCondition, evaluateCustomFieldVisibility, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue, visibleCustomFields };
5963
+ export { ALL_CUSTOM_FIELD_CONDITION_SOURCES, ALL_CUSTOM_FIELD_OPERATORS, ALL_CUSTOM_FIELD_TYPES, type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CHECKBOX_CHECKED, CHECKBOX_UNCHECKED, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_CONDITIONS_MAX, CUSTOM_FIELD_KEY_PATTERN, CUSTOM_FIELD_OPERATORS_BY_SOURCE, CUSTOM_FIELD_VALUELESS_OPERATORS, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type CheckoutCustomField, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomFieldCondition, type CustomFieldConditionSource, type CustomFieldContext, type CustomFieldOperator, type CustomFieldOption, type CustomFieldTranslations, type CustomFieldType, type CustomFieldVisibility, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, type NonPillRadius, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type ResetPasswordRequest, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, customFieldContextFromMetadata, customFieldIsTextLike, customFieldOperatorTakesValue, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, defaultBranding, defaultCustomFieldVisibility, defaultOperatorForSource, encodeBadges, encodeBranding, encodeCustomFields, evaluateCustomFieldCondition, evaluateCustomFieldVisibility, feeProgram, fontStack, fontWeightValue, inputPadValue, isCheckboxChecked, isDarkSurface, isHexColor, leaf, logoDimensions, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue, visibleCustomFields };
package/dist/index.js CHANGED
@@ -7,6 +7,8 @@ import {
7
7
  AvailabilityOverrides,
8
8
  BRANDING_EXPORT_FORMAT,
9
9
  BRANDING_EXPORT_VERSION,
10
+ CHECKBOX_CHECKED,
11
+ CHECKBOX_UNCHECKED,
10
12
  CUSTOM_CSS_MAX_LENGTH,
11
13
  CUSTOM_FIELDS_MAX,
12
14
  CUSTOM_FIELD_CONDITIONS_MAX,
@@ -38,6 +40,7 @@ import {
38
40
  cloneBranding,
39
41
  cloneCustomField,
40
42
  customFieldContextFromMetadata,
43
+ customFieldIsTextLike,
41
44
  customFieldOperatorTakesValue,
42
45
  customFieldOptionLabel,
43
46
  customFieldText,
@@ -56,6 +59,7 @@ import {
56
59
  fontStack,
57
60
  fontWeightValue,
58
61
  inputPadValue,
62
+ isCheckboxChecked,
59
63
  isDarkSurface,
60
64
  isHexColor,
61
65
  leaf,
@@ -70,7 +74,7 @@ import {
70
74
  surfacePadValue,
71
75
  verticalGapValue,
72
76
  visibleCustomFields
73
- } from "./chunk-5J763YMV.js";
77
+ } from "./chunk-RODMYISN.js";
74
78
  export {
75
79
  ALL_CUSTOM_FIELD_CONDITION_SOURCES,
76
80
  ALL_CUSTOM_FIELD_OPERATORS,
@@ -80,6 +84,8 @@ export {
80
84
  AvailabilityOverrides,
81
85
  BRANDING_EXPORT_FORMAT,
82
86
  BRANDING_EXPORT_VERSION,
87
+ CHECKBOX_CHECKED,
88
+ CHECKBOX_UNCHECKED,
83
89
  CUSTOM_CSS_MAX_LENGTH,
84
90
  CUSTOM_FIELDS_MAX,
85
91
  CUSTOM_FIELD_CONDITIONS_MAX,
@@ -111,6 +117,7 @@ export {
111
117
  cloneBranding,
112
118
  cloneCustomField,
113
119
  customFieldContextFromMetadata,
120
+ customFieldIsTextLike,
114
121
  customFieldOperatorTakesValue,
115
122
  customFieldOptionLabel,
116
123
  customFieldText,
@@ -129,6 +136,7 @@ export {
129
136
  fontStack,
130
137
  fontWeightValue,
131
138
  inputPadValue,
139
+ isCheckboxChecked,
132
140
  isDarkSurface,
133
141
  isHexColor,
134
142
  leaf,
package/dist/internal.cjs CHANGED
@@ -31,6 +31,8 @@ __export(internal_exports, {
31
31
  AvailabilityOverrides: () => AvailabilityOverrides,
32
32
  BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
33
33
  BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
34
+ CHECKBOX_CHECKED: () => CHECKBOX_CHECKED,
35
+ CHECKBOX_UNCHECKED: () => CHECKBOX_UNCHECKED,
34
36
  CUSTOM_CSS_MAX_LENGTH: () => CUSTOM_CSS_MAX_LENGTH,
35
37
  CUSTOM_FIELDS_MAX: () => CUSTOM_FIELDS_MAX,
36
38
  CUSTOM_FIELD_CONDITIONS_MAX: () => CUSTOM_FIELD_CONDITIONS_MAX,
@@ -71,6 +73,7 @@ __export(internal_exports, {
71
73
  cloneBranding: () => cloneBranding,
72
74
  cloneCustomField: () => cloneCustomField,
73
75
  customFieldContextFromMetadata: () => customFieldContextFromMetadata,
76
+ customFieldIsTextLike: () => customFieldIsTextLike,
74
77
  customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
75
78
  customFieldOptionLabel: () => customFieldOptionLabel,
76
79
  customFieldText: () => customFieldText,
@@ -89,6 +92,7 @@ __export(internal_exports, {
89
92
  fontStack: () => fontStack,
90
93
  fontWeightValue: () => fontWeightValue,
91
94
  inputPadValue: () => inputPadValue,
95
+ isCheckboxChecked: () => isCheckboxChecked,
92
96
  isDarkSurface: () => isDarkSurface,
93
97
  isHexColor: () => isHexColor,
94
98
  leaf: () => leaf,
@@ -1277,6 +1281,17 @@ var Payments = class {
1277
1281
  * { headers: { 'Idempotency-Key': 'order_1001' } },
1278
1282
  * );
1279
1283
  * ```
1284
+ *
1285
+ * @example Send `test_mode` to pick the environment per payment, so a staging
1286
+ * deploy cannot charge real cards and a forgotten processor toggle cannot
1287
+ * swallow production traffic:
1288
+ * ```typescript
1289
+ * const payment = await delopay.payments.create({
1290
+ * amount: 5000,
1291
+ * currency: 'EUR',
1292
+ * test_mode: process.env.NODE_ENV !== 'production',
1293
+ * });
1294
+ * ```
1280
1295
  */
1281
1296
  async create(params, options) {
1282
1297
  return this.request("POST", "/payments", { body: params, ...options });
@@ -4109,8 +4124,17 @@ var ALL_CUSTOM_FIELD_TYPES = [
4109
4124
  "textarea",
4110
4125
  "password",
4111
4126
  "email",
4112
- "select"
4127
+ "select",
4128
+ "checkbox"
4113
4129
  ];
4130
+ var CHECKBOX_CHECKED = "true";
4131
+ var CHECKBOX_UNCHECKED = "false";
4132
+ function isCheckboxChecked(value) {
4133
+ return typeof value === "string" && value.trim().toLowerCase() === CHECKBOX_CHECKED;
4134
+ }
4135
+ function customFieldIsTextLike(type) {
4136
+ return type !== "select" && type !== "checkbox";
4137
+ }
4114
4138
  var CUSTOM_FIELD_CONDITIONS_MAX = 10;
4115
4139
  var ALL_CUSTOM_FIELD_CONDITION_SOURCES = [
4116
4140
  "metadata",
@@ -4213,8 +4237,11 @@ function normalizeCustomField(raw, index) {
4213
4237
  labelTranslations: parseTranslations(o["labelTranslations"])
4214
4238
  };
4215
4239
  }).filter((o) => o.value.length > 0) : [];
4216
- const minLength = parseBoundedInt(f["minLength"]);
4217
- const maxLength = parseBoundedInt(f["maxLength"]);
4240
+ const textLike = customFieldIsTextLike(type);
4241
+ const minLength = textLike ? parseBoundedInt(f["minLength"]) : null;
4242
+ const maxLength = textLike ? parseBoundedInt(f["maxLength"]) : null;
4243
+ const rawDefault = typeof f["defaultValue"] === "string" ? f["defaultValue"] : "";
4244
+ const defaultValue = type === "checkbox" ? isCheckboxChecked(rawDefault) ? CHECKBOX_CHECKED : CHECKBOX_UNCHECKED : rawDefault;
4218
4245
  return {
4219
4246
  id: typeof f["id"] === "string" && f["id"] ? f["id"] : `field-${index}`,
4220
4247
  key,
@@ -4230,7 +4257,7 @@ function normalizeCustomField(raw, index) {
4230
4257
  minLength,
4231
4258
  // Guard inverted bounds at decode so consumers never see min > max.
4232
4259
  maxLength: maxLength !== null && minLength !== null && maxLength < minLength ? null : maxLength,
4233
- defaultValue: typeof f["defaultValue"] === "string" ? f["defaultValue"] : "",
4260
+ defaultValue,
4234
4261
  options,
4235
4262
  visibility: normalizeVisibility(f["visibility"])
4236
4263
  };
@@ -4273,9 +4300,13 @@ function encodeCustomFields(fields) {
4273
4300
  ...nonEmpty(f.helpTextTranslations) ? { helpTextTranslations: nonEmpty(f.helpTextTranslations) } : {},
4274
4301
  ...f.required ? { required: true } : {},
4275
4302
  ...f.enabled ? {} : { enabled: false },
4276
- ...f.minLength !== null ? { minLength: f.minLength } : {},
4277
- ...f.maxLength !== null ? { maxLength: f.maxLength } : {},
4278
- ...f.defaultValue ? { defaultValue: f.defaultValue } : {},
4303
+ // Length bounds only exist for free-text types; a choice control that
4304
+ // still carries them is stale state the decoder would drop anyway.
4305
+ ...customFieldIsTextLike(f.type) && f.minLength !== null ? { minLength: f.minLength } : {},
4306
+ ...customFieldIsTextLike(f.type) && f.maxLength !== null ? { maxLength: f.maxLength } : {},
4307
+ // A checkbox persists only "starts ticked"; unticked is the decoder's
4308
+ // default, so writing 'false' would be noise on every such field.
4309
+ ...f.type === "checkbox" ? isCheckboxChecked(f.defaultValue) ? { defaultValue: CHECKBOX_CHECKED } : {} : f.defaultValue ? { defaultValue: f.defaultValue } : {},
4279
4310
  ...f.type === "select" ? { options: f.options } : {},
4280
4311
  // Omitted for unconditional fields so the stored blob (and every
4281
4312
  // pre-feature payload) stays byte-identical to what it was.
@@ -5339,6 +5370,8 @@ var DelopayInternal = class extends Delopay {
5339
5370
  AvailabilityOverrides,
5340
5371
  BRANDING_EXPORT_FORMAT,
5341
5372
  BRANDING_EXPORT_VERSION,
5373
+ CHECKBOX_CHECKED,
5374
+ CHECKBOX_UNCHECKED,
5342
5375
  CUSTOM_CSS_MAX_LENGTH,
5343
5376
  CUSTOM_FIELDS_MAX,
5344
5377
  CUSTOM_FIELD_CONDITIONS_MAX,
@@ -5379,6 +5412,7 @@ var DelopayInternal = class extends Delopay {
5379
5412
  cloneBranding,
5380
5413
  cloneCustomField,
5381
5414
  customFieldContextFromMetadata,
5415
+ customFieldIsTextLike,
5382
5416
  customFieldOperatorTakesValue,
5383
5417
  customFieldOptionLabel,
5384
5418
  customFieldText,
@@ -5397,6 +5431,7 @@ var DelopayInternal = class extends Delopay {
5397
5431
  fontStack,
5398
5432
  fontWeightValue,
5399
5433
  inputPadValue,
5434
+ isCheckboxChecked,
5400
5435
  isDarkSurface,
5401
5436
  isHexColor,
5402
5437
  leaf,