@delopay/sdk 0.64.0 → 0.66.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
@@ -508,6 +508,12 @@ interface RefundResponse {
508
508
  issuer_error_message?: string | null;
509
509
  /** Raw connector response payload (debugging). */
510
510
  raw_connector_response?: string | null;
511
+ /**
512
+ * Whether the refund ran in test mode, inherited from the parent payment's
513
+ * environment (a live payment always refunds live). Null when unknown/legacy
514
+ * (treated as live).
515
+ */
516
+ test_mode?: boolean | null;
511
517
  }
512
518
  interface RefundListParams {
513
519
  payment_id?: string | null;
@@ -520,6 +526,8 @@ interface RefundListParams {
520
526
  connector?: string[] | null;
521
527
  currency?: Currency[] | null;
522
528
  refund_status?: RefundStatus[] | null;
529
+ /** Filter by environment: true = test only, false = live only, omit for all. */
530
+ test_mode?: boolean;
523
531
  }
524
532
  interface RefundListResponse {
525
533
  count: number;
@@ -689,6 +697,11 @@ interface DisputeResponse {
689
697
  updated_at?: string | null;
690
698
  profile_id?: string | null;
691
699
  merchant_connector_id?: string | null;
700
+ /**
701
+ * Whether the dispute is in test mode, inherited from the disputed payment's
702
+ * environment. Null when unknown/legacy (treated as live).
703
+ */
704
+ test_mode?: boolean | null;
692
705
  }
693
706
  interface DisputeListParams {
694
707
  limit?: number | null;
@@ -706,6 +719,8 @@ interface DisputeListParams {
706
719
  start_time?: string | null;
707
720
  /** ISO 8601 creation-time range end; defaults to now. */
708
721
  end_time?: string | null;
722
+ /** Filter by environment: true = test only, false = live only, omit for all. */
723
+ test_mode?: boolean;
709
724
  }
710
725
  interface DisputeEvidenceRequest {
711
726
  cancel_dispute?: boolean | null;
@@ -950,11 +965,34 @@ interface PaymentLinkBackgroundImageConfig {
950
965
  position?: 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | null;
951
966
  size?: 'cover' | 'contain' | 'auto' | null;
952
967
  }
968
+ /** Revenue taken in one currency. Amounts are in that currency's minor units. */
969
+ interface CurrencyRevenue {
970
+ /** ISO 4217 code, e.g. `EUR`. */
971
+ currency: string;
972
+ amount_minor: number;
973
+ orders: number;
974
+ }
953
975
  interface ShopStats {
954
976
  shop_id: string;
955
977
  shop_name: string;
978
+ /** Project the shop is grouped under, or `null` when unassigned. */
979
+ project_id: string | null;
956
980
  orders: number;
981
+ /**
982
+ * @deprecated Raw sum of minor units across every currency, with no FX
983
+ * conversion — meaningless for a multi-currency shop. Use `revenue_usd`
984
+ * (FX-converted, USD **major** units) or `revenue_by_currency`.
985
+ */
957
986
  revenue: number;
987
+ /** FX-converted revenue in USD major units. Excludes `unconverted_orders`. */
988
+ revenue_usd: number;
989
+ /** Revenue split by the currency it was taken in, sorted by currency code. */
990
+ revenue_by_currency: CurrencyRevenue[];
991
+ /**
992
+ * Orders left out of `revenue_usd` because their currency had no fresh USD
993
+ * rate. Non-zero means the USD figure understates reality.
994
+ */
995
+ unconverted_orders: number;
958
996
  }
959
997
  interface GatewayConnectRequest {
960
998
  connector_type: ConnectorType;
@@ -1334,15 +1372,41 @@ interface ProjectStats {
1334
1372
  project_id: string;
1335
1373
  project_name: string;
1336
1374
  orders: number;
1375
+ /** @deprecated Cross-currency raw sum. Use `revenue_usd` / `revenue_by_currency`. */
1337
1376
  revenue: number;
1377
+ revenue_usd: number;
1378
+ revenue_by_currency: CurrencyRevenue[];
1379
+ unconverted_orders: number;
1338
1380
  shops: ShopStats[];
1339
1381
  }
1340
1382
  interface ProjectStatsResponse {
1341
1383
  projects: ProjectStats[];
1384
+ /**
1385
+ * Every shop of the merchant, including shops that belong to no project —
1386
+ * those never appear under `projects[].shops[]`, since projects are an
1387
+ * optional grouping layer. Look a single shop up here rather than walking
1388
+ * the project tree.
1389
+ */
1390
+ shops: ShopStats[];
1342
1391
  total_orders: number;
1392
+ /** @deprecated Cross-currency raw sum. Use `total_revenue_usd`. */
1343
1393
  total_revenue: number;
1344
- period_days: number;
1394
+ total_revenue_usd: number;
1395
+ total_revenue_by_currency: CurrencyRevenue[];
1396
+ unconverted_orders: number;
1397
+ /** Window the figures cover, in days. `null` when `period: 'all'` was asked for. */
1398
+ period_days: number | null;
1399
+ }
1400
+ /** Stats for one shop, addressed by shop id. Loadable by a shop-scoped user. */
1401
+ interface ShopStatsResponse extends ShopStats {
1402
+ /** Window the figures cover, in days. `null` for an all-time total. */
1403
+ period_days: number | null;
1345
1404
  }
1405
+ /**
1406
+ * Window for a stats query: a number of days (clamped 1..=365 server-side) or
1407
+ * `'all'` for an all-time total. Omitted means the server default, 30 days.
1408
+ */
1409
+ type StatsPeriod = number | 'all';
1346
1410
  interface MerchantOverviewStat {
1347
1411
  label: string;
1348
1412
  value: number;
@@ -2585,6 +2649,8 @@ interface CancelSubscriptionRequest {
2585
2649
  interface SubscriptionListParams {
2586
2650
  limit?: number;
2587
2651
  offset?: number;
2652
+ /** Filter by environment: true = test only, false = live only, omit for all. */
2653
+ test_mode?: boolean;
2588
2654
  }
2589
2655
  /** Query for `GET /subscriptions/items`. */
2590
2656
  interface GetSubscriptionItemsParams {
@@ -2619,6 +2685,11 @@ interface SubscriptionResponse {
2619
2685
  customer_id: string;
2620
2686
  payment?: SubscriptionPaymentData | null;
2621
2687
  invoice?: SubscriptionInvoice | null;
2688
+ /**
2689
+ * Whether the subscription runs against a sandbox/test billing connector.
2690
+ * Null for legacy subscriptions (treated as live).
2691
+ */
2692
+ test_mode?: boolean | null;
2622
2693
  }
2623
2694
  /**
2624
2695
  * Returned by `POST /subscriptions` (create + confirm) and
@@ -3973,10 +4044,23 @@ declare class Projects {
3973
4044
  /**
3974
4045
  * Get aggregate payment statistics across all projects for a merchant.
3975
4046
  *
4047
+ * The response's flat `shops[]` array holds every shop, including shops that
4048
+ * belong to no project — those are absent from `projects[].shops[]`, so look
4049
+ * a single shop up in `shops[]`. Requires `MerchantAccountRead`; a
4050
+ * shop-scoped user should call {@link Shops.stats} instead.
4051
+ *
3976
4052
  * @param merchantId - The merchant account ID.
4053
+ * @param period - Window in days, or `'all'` for an all-time total.
4054
+ * Omitted means the server default of 30 days.
3977
4055
  * @returns Project statistics.
4056
+ *
4057
+ * @example
4058
+ * ```typescript
4059
+ * const stats = await delopay.projects.stats('merch_123', 'all');
4060
+ * const shop = stats.shops.find((s) => s.shop_id === 'pro_1');
4061
+ * ```
3978
4062
  */
3979
- stats(merchantId: string): Promise<ProjectStatsResponse>;
4063
+ stats(merchantId: string, period?: StatsPeriod): Promise<ProjectStatsResponse>;
3980
4064
  /**
3981
4065
  * Get a high-level overview (volume, counts, top connectors) for a merchant.
3982
4066
  *
@@ -4363,6 +4447,30 @@ declare class Shops {
4363
4447
  * @returns Array of shops.
4364
4448
  */
4365
4449
  list(merchantId: string): Promise<ShopResponse[]>;
4450
+ /**
4451
+ * Successful-order count and revenue for one shop.
4452
+ *
4453
+ * Unlike `projects.stats()` this needs only `ProfileAccountRead`, so a
4454
+ * shop-scoped user can load it for their own shop; merchant-level users can
4455
+ * load any shop of their merchant.
4456
+ *
4457
+ * Revenue comes back FX-converted as `revenue_usd` (USD major units) plus a
4458
+ * `revenue_by_currency` breakdown. The legacy `revenue` field is a raw
4459
+ * cross-currency minor-unit sum and should not be displayed.
4460
+ *
4461
+ * @param merchantId - The merchant account ID.
4462
+ * @param shopId - The shop (business profile) ID.
4463
+ * @param period - Window in days, or `'all'` for an all-time total.
4464
+ * Omitted means the server default of 30 days.
4465
+ * @returns The shop's stats over the requested window.
4466
+ *
4467
+ * @example
4468
+ * ```typescript
4469
+ * const stats = await delopay.shops.stats('merch_123', 'pro_1', 'all');
4470
+ * console.log(stats.orders, stats.revenue_usd);
4471
+ * ```
4472
+ */
4473
+ stats(merchantId: string, shopId: string, period?: StatsPeriod): Promise<ShopStatsResponse>;
4366
4474
  /**
4367
4475
  * Upload a logo file for a shop. The file is stored in Delopay's configured
4368
4476
  * object store and a public HTTPS URL is returned. This method does NOT write
@@ -5497,4 +5605,4 @@ declare function parseImportedBranding(raw: unknown): CheckoutBranding;
5497
5605
  declare function applyBrandingVariables(el: HTMLElement, b: CheckoutBranding): void;
5498
5606
  declare function shadowFor(style: SurfaceStyle): string;
5499
5607
 
5500
- export { 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 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, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, 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 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 DisputeEvidenceRequest, 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 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 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 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 ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, 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, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue };
5608
+ export { 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 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, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, 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 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 DisputeEvidenceRequest, 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 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 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 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, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue };
package/dist/index.d.ts CHANGED
@@ -508,6 +508,12 @@ interface RefundResponse {
508
508
  issuer_error_message?: string | null;
509
509
  /** Raw connector response payload (debugging). */
510
510
  raw_connector_response?: string | null;
511
+ /**
512
+ * Whether the refund ran in test mode, inherited from the parent payment's
513
+ * environment (a live payment always refunds live). Null when unknown/legacy
514
+ * (treated as live).
515
+ */
516
+ test_mode?: boolean | null;
511
517
  }
512
518
  interface RefundListParams {
513
519
  payment_id?: string | null;
@@ -520,6 +526,8 @@ interface RefundListParams {
520
526
  connector?: string[] | null;
521
527
  currency?: Currency[] | null;
522
528
  refund_status?: RefundStatus[] | null;
529
+ /** Filter by environment: true = test only, false = live only, omit for all. */
530
+ test_mode?: boolean;
523
531
  }
524
532
  interface RefundListResponse {
525
533
  count: number;
@@ -689,6 +697,11 @@ interface DisputeResponse {
689
697
  updated_at?: string | null;
690
698
  profile_id?: string | null;
691
699
  merchant_connector_id?: string | null;
700
+ /**
701
+ * Whether the dispute is in test mode, inherited from the disputed payment's
702
+ * environment. Null when unknown/legacy (treated as live).
703
+ */
704
+ test_mode?: boolean | null;
692
705
  }
693
706
  interface DisputeListParams {
694
707
  limit?: number | null;
@@ -706,6 +719,8 @@ interface DisputeListParams {
706
719
  start_time?: string | null;
707
720
  /** ISO 8601 creation-time range end; defaults to now. */
708
721
  end_time?: string | null;
722
+ /** Filter by environment: true = test only, false = live only, omit for all. */
723
+ test_mode?: boolean;
709
724
  }
710
725
  interface DisputeEvidenceRequest {
711
726
  cancel_dispute?: boolean | null;
@@ -950,11 +965,34 @@ interface PaymentLinkBackgroundImageConfig {
950
965
  position?: 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | null;
951
966
  size?: 'cover' | 'contain' | 'auto' | null;
952
967
  }
968
+ /** Revenue taken in one currency. Amounts are in that currency's minor units. */
969
+ interface CurrencyRevenue {
970
+ /** ISO 4217 code, e.g. `EUR`. */
971
+ currency: string;
972
+ amount_minor: number;
973
+ orders: number;
974
+ }
953
975
  interface ShopStats {
954
976
  shop_id: string;
955
977
  shop_name: string;
978
+ /** Project the shop is grouped under, or `null` when unassigned. */
979
+ project_id: string | null;
956
980
  orders: number;
981
+ /**
982
+ * @deprecated Raw sum of minor units across every currency, with no FX
983
+ * conversion — meaningless for a multi-currency shop. Use `revenue_usd`
984
+ * (FX-converted, USD **major** units) or `revenue_by_currency`.
985
+ */
957
986
  revenue: number;
987
+ /** FX-converted revenue in USD major units. Excludes `unconverted_orders`. */
988
+ revenue_usd: number;
989
+ /** Revenue split by the currency it was taken in, sorted by currency code. */
990
+ revenue_by_currency: CurrencyRevenue[];
991
+ /**
992
+ * Orders left out of `revenue_usd` because their currency had no fresh USD
993
+ * rate. Non-zero means the USD figure understates reality.
994
+ */
995
+ unconverted_orders: number;
958
996
  }
959
997
  interface GatewayConnectRequest {
960
998
  connector_type: ConnectorType;
@@ -1334,15 +1372,41 @@ interface ProjectStats {
1334
1372
  project_id: string;
1335
1373
  project_name: string;
1336
1374
  orders: number;
1375
+ /** @deprecated Cross-currency raw sum. Use `revenue_usd` / `revenue_by_currency`. */
1337
1376
  revenue: number;
1377
+ revenue_usd: number;
1378
+ revenue_by_currency: CurrencyRevenue[];
1379
+ unconverted_orders: number;
1338
1380
  shops: ShopStats[];
1339
1381
  }
1340
1382
  interface ProjectStatsResponse {
1341
1383
  projects: ProjectStats[];
1384
+ /**
1385
+ * Every shop of the merchant, including shops that belong to no project —
1386
+ * those never appear under `projects[].shops[]`, since projects are an
1387
+ * optional grouping layer. Look a single shop up here rather than walking
1388
+ * the project tree.
1389
+ */
1390
+ shops: ShopStats[];
1342
1391
  total_orders: number;
1392
+ /** @deprecated Cross-currency raw sum. Use `total_revenue_usd`. */
1343
1393
  total_revenue: number;
1344
- period_days: number;
1394
+ total_revenue_usd: number;
1395
+ total_revenue_by_currency: CurrencyRevenue[];
1396
+ unconverted_orders: number;
1397
+ /** Window the figures cover, in days. `null` when `period: 'all'` was asked for. */
1398
+ period_days: number | null;
1399
+ }
1400
+ /** Stats for one shop, addressed by shop id. Loadable by a shop-scoped user. */
1401
+ interface ShopStatsResponse extends ShopStats {
1402
+ /** Window the figures cover, in days. `null` for an all-time total. */
1403
+ period_days: number | null;
1345
1404
  }
1405
+ /**
1406
+ * Window for a stats query: a number of days (clamped 1..=365 server-side) or
1407
+ * `'all'` for an all-time total. Omitted means the server default, 30 days.
1408
+ */
1409
+ type StatsPeriod = number | 'all';
1346
1410
  interface MerchantOverviewStat {
1347
1411
  label: string;
1348
1412
  value: number;
@@ -2585,6 +2649,8 @@ interface CancelSubscriptionRequest {
2585
2649
  interface SubscriptionListParams {
2586
2650
  limit?: number;
2587
2651
  offset?: number;
2652
+ /** Filter by environment: true = test only, false = live only, omit for all. */
2653
+ test_mode?: boolean;
2588
2654
  }
2589
2655
  /** Query for `GET /subscriptions/items`. */
2590
2656
  interface GetSubscriptionItemsParams {
@@ -2619,6 +2685,11 @@ interface SubscriptionResponse {
2619
2685
  customer_id: string;
2620
2686
  payment?: SubscriptionPaymentData | null;
2621
2687
  invoice?: SubscriptionInvoice | null;
2688
+ /**
2689
+ * Whether the subscription runs against a sandbox/test billing connector.
2690
+ * Null for legacy subscriptions (treated as live).
2691
+ */
2692
+ test_mode?: boolean | null;
2622
2693
  }
2623
2694
  /**
2624
2695
  * Returned by `POST /subscriptions` (create + confirm) and
@@ -3973,10 +4044,23 @@ declare class Projects {
3973
4044
  /**
3974
4045
  * Get aggregate payment statistics across all projects for a merchant.
3975
4046
  *
4047
+ * The response's flat `shops[]` array holds every shop, including shops that
4048
+ * belong to no project — those are absent from `projects[].shops[]`, so look
4049
+ * a single shop up in `shops[]`. Requires `MerchantAccountRead`; a
4050
+ * shop-scoped user should call {@link Shops.stats} instead.
4051
+ *
3976
4052
  * @param merchantId - The merchant account ID.
4053
+ * @param period - Window in days, or `'all'` for an all-time total.
4054
+ * Omitted means the server default of 30 days.
3977
4055
  * @returns Project statistics.
4056
+ *
4057
+ * @example
4058
+ * ```typescript
4059
+ * const stats = await delopay.projects.stats('merch_123', 'all');
4060
+ * const shop = stats.shops.find((s) => s.shop_id === 'pro_1');
4061
+ * ```
3978
4062
  */
3979
- stats(merchantId: string): Promise<ProjectStatsResponse>;
4063
+ stats(merchantId: string, period?: StatsPeriod): Promise<ProjectStatsResponse>;
3980
4064
  /**
3981
4065
  * Get a high-level overview (volume, counts, top connectors) for a merchant.
3982
4066
  *
@@ -4363,6 +4447,30 @@ declare class Shops {
4363
4447
  * @returns Array of shops.
4364
4448
  */
4365
4449
  list(merchantId: string): Promise<ShopResponse[]>;
4450
+ /**
4451
+ * Successful-order count and revenue for one shop.
4452
+ *
4453
+ * Unlike `projects.stats()` this needs only `ProfileAccountRead`, so a
4454
+ * shop-scoped user can load it for their own shop; merchant-level users can
4455
+ * load any shop of their merchant.
4456
+ *
4457
+ * Revenue comes back FX-converted as `revenue_usd` (USD major units) plus a
4458
+ * `revenue_by_currency` breakdown. The legacy `revenue` field is a raw
4459
+ * cross-currency minor-unit sum and should not be displayed.
4460
+ *
4461
+ * @param merchantId - The merchant account ID.
4462
+ * @param shopId - The shop (business profile) ID.
4463
+ * @param period - Window in days, or `'all'` for an all-time total.
4464
+ * Omitted means the server default of 30 days.
4465
+ * @returns The shop's stats over the requested window.
4466
+ *
4467
+ * @example
4468
+ * ```typescript
4469
+ * const stats = await delopay.shops.stats('merch_123', 'pro_1', 'all');
4470
+ * console.log(stats.orders, stats.revenue_usd);
4471
+ * ```
4472
+ */
4473
+ stats(merchantId: string, shopId: string, period?: StatsPeriod): Promise<ShopStatsResponse>;
4366
4474
  /**
4367
4475
  * Upload a logo file for a shop. The file is stored in Delopay's configured
4368
4476
  * object store and a public HTTPS URL is returned. This method does NOT write
@@ -5497,4 +5605,4 @@ declare function parseImportedBranding(raw: unknown): CheckoutBranding;
5497
5605
  declare function applyBrandingVariables(el: HTMLElement, b: CheckoutBranding): void;
5498
5606
  declare function shadowFor(style: SurfaceStyle): string;
5499
5607
 
5500
- export { 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 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, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, 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 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 DisputeEvidenceRequest, 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 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 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 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 ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, 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, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue };
5608
+ export { 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 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, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, 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 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 DisputeEvidenceRequest, 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 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 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 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, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue };
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  shadowFor,
50
50
  surfacePadValue,
51
51
  verticalGapValue
52
- } from "./chunk-UQ47CRAI.js";
52
+ } from "./chunk-2DNFEA5T.js";
53
53
  export {
54
54
  Analytics,
55
55
  AnalyticsDashboard,
package/dist/internal.cjs CHANGED
@@ -1757,13 +1757,26 @@ var Projects = class {
1757
1757
  /**
1758
1758
  * Get aggregate payment statistics across all projects for a merchant.
1759
1759
  *
1760
+ * The response's flat `shops[]` array holds every shop, including shops that
1761
+ * belong to no project — those are absent from `projects[].shops[]`, so look
1762
+ * a single shop up in `shops[]`. Requires `MerchantAccountRead`; a
1763
+ * shop-scoped user should call {@link Shops.stats} instead.
1764
+ *
1760
1765
  * @param merchantId - The merchant account ID.
1766
+ * @param period - Window in days, or `'all'` for an all-time total.
1767
+ * Omitted means the server default of 30 days.
1761
1768
  * @returns Project statistics.
1769
+ *
1770
+ * @example
1771
+ * ```typescript
1772
+ * const stats = await delopay.projects.stats('merch_123', 'all');
1773
+ * const shop = stats.shops.find((s) => s.shop_id === 'pro_1');
1774
+ * ```
1762
1775
  */
1763
- async stats(merchantId) {
1764
- return this.request("GET", "/projects/stats", {
1765
- query: { merchant_id: merchantId }
1766
- });
1776
+ async stats(merchantId, period) {
1777
+ const query = { merchant_id: merchantId };
1778
+ if (period !== void 0) query["period"] = String(period);
1779
+ return this.request("GET", "/projects/stats", { query });
1767
1780
  }
1768
1781
  /**
1769
1782
  * Get a high-level overview (volume, counts, top connectors) for a merchant.
@@ -2247,6 +2260,34 @@ var Shops = class {
2247
2260
  async list(merchantId) {
2248
2261
  return this.request("GET", `/shops/${encodeURIComponent(merchantId)}`);
2249
2262
  }
2263
+ /**
2264
+ * Successful-order count and revenue for one shop.
2265
+ *
2266
+ * Unlike `projects.stats()` this needs only `ProfileAccountRead`, so a
2267
+ * shop-scoped user can load it for their own shop; merchant-level users can
2268
+ * load any shop of their merchant.
2269
+ *
2270
+ * Revenue comes back FX-converted as `revenue_usd` (USD major units) plus a
2271
+ * `revenue_by_currency` breakdown. The legacy `revenue` field is a raw
2272
+ * cross-currency minor-unit sum and should not be displayed.
2273
+ *
2274
+ * @param merchantId - The merchant account ID.
2275
+ * @param shopId - The shop (business profile) ID.
2276
+ * @param period - Window in days, or `'all'` for an all-time total.
2277
+ * Omitted means the server default of 30 days.
2278
+ * @returns The shop's stats over the requested window.
2279
+ *
2280
+ * @example
2281
+ * ```typescript
2282
+ * const stats = await delopay.shops.stats('merch_123', 'pro_1', 'all');
2283
+ * console.log(stats.orders, stats.revenue_usd);
2284
+ * ```
2285
+ */
2286
+ async stats(merchantId, shopId, period) {
2287
+ const path = `/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/stats`;
2288
+ if (period === void 0) return this.request("GET", path);
2289
+ return this.request("GET", path, { query: { period: String(period) } });
2290
+ }
2250
2291
  /**
2251
2292
  * Upload a logo file for a shop. The file is stored in Delopay's configured
2252
2293
  * object store and a public HTTPS URL is returned. This method does NOT write