@delopay/sdk 0.17.0 → 0.18.1

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
@@ -8,7 +8,7 @@ type CaptureMethod = 'automatic' | 'manual' | 'manual_multiple' | 'scheduled' |
8
8
  type AuthenticationType = 'three_ds' | 'no_three_ds';
9
9
  type RefundStatus = 'succeeded' | 'failed' | 'pending' | 'review';
10
10
  type RefundType = 'scheduled' | 'instant';
11
- type PaymentMethod = 'card' | 'card_redirect' | 'pay_later' | 'wallet' | 'bank_redirect' | 'bank_transfer' | 'crypto' | 'bank_debit' | 'reward' | 'real_time_payment' | 'upi' | 'voucher' | 'gift_card' | 'open_banking' | 'mobile_payment' | 'network_token' | string;
11
+ type PaymentMethod = 'card' | 'card_redirect' | 'pay_later' | 'wallet' | 'bank_redirect' | 'bank_transfer' | 'crypto' | 'bank_debit' | 'reward' | 'real_time_payment' | 'upi' | 'voucher' | 'gift_card' | 'open_banking' | 'mobile_payment' | 'network_token' | 'game_items' | string;
12
12
  type PaymentMethodType = string;
13
13
  type ConnectorType = 'payment_processor' | 'payment_vas' | 'fin_operations' | 'fiz_operations' | 'networks' | 'banking_entities' | 'non_banking_finance' | 'payout_processor' | 'payment_method_auth' | 'authentication_processor' | 'tax_processor' | 'billing_processor' | 'vault_processor';
14
14
  /**
@@ -3350,12 +3350,19 @@ declare class DelopayError extends Error {
3350
3350
  * still has something to go on.
3351
3351
  */
3352
3352
  readonly rawBody?: string;
3353
+ /**
3354
+ * Structured error context the API attaches under `error.data` for select
3355
+ * codes — e.g. `{ retry_after_secs: 248 }` on rate-limit / max-attempt
3356
+ * lockouts. Schema is per-code; consult the API reference for the shape.
3357
+ */
3358
+ readonly data?: Record<string, unknown>;
3353
3359
  constructor(message: string, options: {
3354
3360
  status: number;
3355
3361
  code: string;
3356
3362
  type: string;
3357
3363
  requestId?: string;
3358
3364
  rawBody?: string;
3365
+ data?: Record<string, unknown>;
3359
3366
  });
3360
3367
  }
3361
3368
  /**
@@ -3374,6 +3381,7 @@ declare class DelopayAuthenticationError extends DelopayError {
3374
3381
  type?: string;
3375
3382
  requestId?: string;
3376
3383
  rawBody?: string;
3384
+ data?: Record<string, unknown>;
3377
3385
  });
3378
3386
  }
3379
3387
 
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ type CaptureMethod = 'automatic' | 'manual' | 'manual_multiple' | 'scheduled' |
8
8
  type AuthenticationType = 'three_ds' | 'no_three_ds';
9
9
  type RefundStatus = 'succeeded' | 'failed' | 'pending' | 'review';
10
10
  type RefundType = 'scheduled' | 'instant';
11
- type PaymentMethod = 'card' | 'card_redirect' | 'pay_later' | 'wallet' | 'bank_redirect' | 'bank_transfer' | 'crypto' | 'bank_debit' | 'reward' | 'real_time_payment' | 'upi' | 'voucher' | 'gift_card' | 'open_banking' | 'mobile_payment' | 'network_token' | string;
11
+ type PaymentMethod = 'card' | 'card_redirect' | 'pay_later' | 'wallet' | 'bank_redirect' | 'bank_transfer' | 'crypto' | 'bank_debit' | 'reward' | 'real_time_payment' | 'upi' | 'voucher' | 'gift_card' | 'open_banking' | 'mobile_payment' | 'network_token' | 'game_items' | string;
12
12
  type PaymentMethodType = string;
13
13
  type ConnectorType = 'payment_processor' | 'payment_vas' | 'fin_operations' | 'fiz_operations' | 'networks' | 'banking_entities' | 'non_banking_finance' | 'payout_processor' | 'payment_method_auth' | 'authentication_processor' | 'tax_processor' | 'billing_processor' | 'vault_processor';
14
14
  /**
@@ -3350,12 +3350,19 @@ declare class DelopayError extends Error {
3350
3350
  * still has something to go on.
3351
3351
  */
3352
3352
  readonly rawBody?: string;
3353
+ /**
3354
+ * Structured error context the API attaches under `error.data` for select
3355
+ * codes — e.g. `{ retry_after_secs: 248 }` on rate-limit / max-attempt
3356
+ * lockouts. Schema is per-code; consult the API reference for the shape.
3357
+ */
3358
+ readonly data?: Record<string, unknown>;
3353
3359
  constructor(message: string, options: {
3354
3360
  status: number;
3355
3361
  code: string;
3356
3362
  type: string;
3357
3363
  requestId?: string;
3358
3364
  rawBody?: string;
3365
+ data?: Record<string, unknown>;
3359
3366
  });
3360
3367
  }
3361
3368
  /**
@@ -3374,6 +3381,7 @@ declare class DelopayAuthenticationError extends DelopayError {
3374
3381
  type?: string;
3375
3382
  requestId?: string;
3376
3383
  rawBody?: string;
3384
+ data?: Record<string, unknown>;
3377
3385
  });
3378
3386
  }
3379
3387
 
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  Regions,
13
13
  Subscriptions,
14
14
  Webhooks
15
- } from "./chunk-F6HWLDHA.js";
15
+ } from "./chunk-6UL5TW3X.js";
16
16
  export {
17
17
  Analytics,
18
18
  AnalyticsDashboard,
package/dist/internal.cjs CHANGED
@@ -58,6 +58,7 @@ var DelopayError = class extends Error {
58
58
  this.type = options.type;
59
59
  if (options.requestId !== void 0) this.requestId = options.requestId;
60
60
  if (options.rawBody !== void 0) this.rawBody = options.rawBody;
61
+ if (options.data !== void 0) this.data = options.data;
61
62
  }
62
63
  };
63
64
  var DelopayAuthenticationError = class extends DelopayError {
@@ -70,7 +71,8 @@ var DelopayAuthenticationError = class extends DelopayError {
70
71
  code: options?.code || "AUTH_01",
71
72
  type: options?.type || "authentication_error",
72
73
  requestId: options?.requestId,
73
- rawBody: options?.rawBody
74
+ rawBody: options?.rawBody,
75
+ data: options?.data
74
76
  });
75
77
  Object.setPrototypeOf(this, new.target.prototype);
76
78
  this.name = "DelopayAuthenticationError";
@@ -2817,13 +2819,15 @@ var Delopay = class {
2817
2819
  const message = err.message ?? `Request failed with status ${response.status}`;
2818
2820
  const code = err.code ?? "";
2819
2821
  const type = err.error_type ?? err.type ?? "";
2822
+ const data = err.data && typeof err.data === "object" && !Array.isArray(err.data) ? err.data : void 0;
2820
2823
  const truncatedRaw = truncateRawBody(rawBody);
2821
2824
  if (response.status === 401) {
2822
2825
  throw new DelopayAuthenticationError(message, {
2823
2826
  code,
2824
2827
  type,
2825
2828
  requestId,
2826
- rawBody: truncatedRaw
2829
+ rawBody: truncatedRaw,
2830
+ data
2827
2831
  });
2828
2832
  }
2829
2833
  const error = new DelopayError(message, {
@@ -2831,7 +2835,8 @@ var Delopay = class {
2831
2835
  code,
2832
2836
  type,
2833
2837
  requestId,
2834
- rawBody: truncatedRaw
2838
+ rawBody: truncatedRaw,
2839
+ data
2835
2840
  });
2836
2841
  const isTransientStatus = response.status >= 500 || response.status === 429;
2837
2842
  if (isTransientStatus && isRetryable && attempt < this.maxRetries) {