@paymos/sdk 1.0.0 → 2.0.3

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
@@ -19,126 +19,130 @@ declare class HttpClient {
19
19
 
20
20
  type InvoiceStatus = "awaiting_client" | "awaiting_payment" | "confirming" | "underpaid_waiting" | "paid" | "paid_over" | "underpaid" | "expired" | "cancelled";
21
21
  type WithdrawalStatus = "created" | "pending_review" | "signed" | "cancelling" | "completed" | "failed" | "cancelled";
22
+ type NetworkCode = "TRC20" | "ERC20" | "BEP20" | "POLYGON" | "ARBITRUM" | "OPTIMISM" | "BASE" | "TON" | "AVAX" | "SOL" | "NEAR" | "SUI" | "PLASMA" | (string & {});
23
+ type InvoiceEventType = "invoice.awaiting_payment" | "invoice.confirming" | "invoice.underpaid_waiting" | "invoice.paid" | "invoice.paid_over" | "invoice.underpaid" | "invoice.expired" | "invoice.cancelled";
24
+ type WithdrawalEventType = "withdrawal.created" | "withdrawal.processing" | "withdrawal.completed" | "withdrawal.failed" | "withdrawal.cancelled";
25
+ type WebhookEventType = InvoiceEventType | WithdrawalEventType | (string & {});
22
26
  interface CreateInvoiceParams {
23
- project_id: string;
27
+ projectId: string;
24
28
  amount: string;
25
29
  currency: string;
26
- external_order_id: string;
27
- network?: string | null;
28
- allow_multiple_payments?: boolean;
29
- customer_fee_percent?: number | null;
30
- client_id?: string | null;
30
+ externalOrderId: string;
31
+ network?: NetworkCode | null;
32
+ allowMultiplePayments?: boolean;
33
+ customerFeePercent?: number | null;
34
+ clientId?: string | null;
31
35
  }
32
36
  interface ConfirmPaymentParams {
33
37
  currency: string;
34
- network: string;
38
+ network: NetworkCode;
35
39
  }
36
40
  interface Order {
37
- external_id: string;
38
- client_id: string | null;
41
+ externalId: string;
42
+ clientId?: string;
39
43
  amount: string;
40
44
  currency: string;
41
- network: string | null;
45
+ network?: NetworkCode;
42
46
  }
43
47
  interface Transfer {
44
- tx_hash: string;
48
+ txHash: string;
45
49
  amount: string;
46
- status: string;
47
- created_at: string;
48
- confirmed_at: string | null;
49
- required_confirmations: number | null;
50
- estimated_confirmation_at: string | null;
51
- explorer_url: string | null;
50
+ status: "confirming" | "confirmed";
51
+ createdAt: number;
52
+ confirmedAt?: number;
53
+ requiredConfirmations?: number;
54
+ estimatedConfirmationAt?: number;
55
+ explorerUrl?: string;
52
56
  }
53
57
  interface Payment {
54
58
  currency: string;
55
- network: string;
56
- chain_id: number;
57
- contract_address: string | null;
59
+ network: NetworkCode;
60
+ chainId: number;
61
+ contractAddress?: string;
58
62
  expected: string;
59
- address: string | null;
60
- exchange_rate: string | null;
61
- paid: string | null;
62
- remaining: string | null;
63
- fee: string | null;
64
- net: string | null;
65
- transfers: Transfer[] | null;
63
+ address?: string;
64
+ exchangeRate?: string;
65
+ paid?: string;
66
+ remaining?: string;
67
+ fee?: string;
68
+ net?: string;
69
+ transfers?: Transfer[];
66
70
  }
67
71
  interface Invoice {
68
- invoice_id: string;
69
- project_id: string;
72
+ invoiceId: string;
73
+ projectId: string;
70
74
  status: InvoiceStatus;
71
- is_final: boolean;
72
- is_test: boolean;
73
- payment_url: string;
75
+ isFinal: boolean;
76
+ isTest: boolean;
77
+ paymentUrl: string;
74
78
  order: Order;
75
- payment: Payment | null;
76
- created_at: string;
77
- updated_at: string;
78
- expires_at: string | null;
79
- completed_at: string | null;
79
+ payment?: Payment;
80
+ createdAt: number;
81
+ updatedAt: number;
82
+ expiresAt?: number;
83
+ completedAt?: number;
80
84
  }
81
85
  interface InvoiceListItem {
82
- invoice_id: string;
83
- project_id: string;
84
- external_order_id: string;
85
- client_id: string | null;
86
+ invoiceId: string;
87
+ projectId: string;
88
+ externalOrderId: string;
89
+ clientId?: string;
86
90
  status: InvoiceStatus;
87
- is_final: boolean;
88
- is_test: boolean;
91
+ isFinal: boolean;
92
+ isTest: boolean;
89
93
  amount: string;
90
94
  currency: string;
91
- network: string | null;
92
- created_at: string;
93
- expires_at: string | null;
94
- completed_at: string | null;
95
+ network?: NetworkCode;
96
+ createdAt: number;
97
+ expiresAt?: number;
98
+ completedAt?: number;
95
99
  }
96
100
  interface ListInvoicesParams {
97
101
  limit?: number;
98
102
  cursor?: string;
99
103
  status?: InvoiceStatus[];
100
- external_order_id?: string;
101
- project_id?: string;
102
- created_from?: number;
103
- created_to?: number;
104
+ externalOrderId?: string;
105
+ projectId?: string;
106
+ createdFrom?: number;
107
+ createdTo?: number;
104
108
  }
105
109
  interface CreateWithdrawalParams {
106
- destination_address: string;
107
- network: string;
110
+ destinationAddress: string;
111
+ network: NetworkCode;
108
112
  currency: string;
109
113
  amount: string;
110
- external_order_id: string;
114
+ externalOrderId: string;
111
115
  }
112
116
  interface Withdrawal {
113
- withdrawal_id: string;
114
- external_order_id: string;
117
+ withdrawalId: string;
118
+ externalOrderId: string;
115
119
  status: WithdrawalStatus;
116
- is_final: boolean;
117
- is_test: boolean;
120
+ isFinal: boolean;
121
+ isTest: boolean;
118
122
  amount: string;
119
- fee: string | null;
123
+ fee?: string;
120
124
  currency: string;
121
- network: string;
122
- destination_address: string;
123
- tx_hash: string | null;
124
- explorer_url: string | null;
125
- created_at: string;
126
- completed_at: string | null;
127
- failed_at: string | null;
128
- cancelled_at: string | null;
129
- }
130
- type WithdrawalListItem = Omit<Withdrawal, "tx_hash" | "explorer_url">;
125
+ network: NetworkCode;
126
+ destinationAddress: string;
127
+ txHash?: string;
128
+ explorerUrl?: string;
129
+ createdAt: number;
130
+ completedAt?: number;
131
+ failedAt?: number;
132
+ cancelledAt?: number;
133
+ }
134
+ type WithdrawalListItem = Omit<Withdrawal, "txHash" | "explorerUrl">;
131
135
  interface ListWithdrawalsParams {
132
136
  limit?: number;
133
137
  cursor?: string;
134
138
  status?: WithdrawalStatus[];
135
- external_order_id?: string;
136
- created_from?: number;
137
- created_to?: number;
139
+ externalOrderId?: string;
140
+ createdFrom?: number;
141
+ createdTo?: number;
138
142
  }
139
143
  interface CursorPage<T> {
140
144
  items: T[];
141
- next_cursor: string | null;
145
+ nextCursor: string | null;
142
146
  }
143
147
  interface Balance {
144
148
  currency: string;
@@ -146,23 +150,24 @@ interface Balance {
146
150
  }
147
151
  interface ProblemError {
148
152
  code: string;
149
- field: string | null;
153
+ field?: string | null;
150
154
  message: string;
151
155
  }
152
156
  interface ProblemDetails {
153
- type?: string;
154
- title?: string;
155
- status?: number;
156
- detail?: string;
157
- code?: string;
157
+ type: string;
158
+ title: string;
159
+ status: number;
160
+ detail: string;
161
+ code: string;
158
162
  field?: string | null;
159
163
  errors?: ProblemError[];
160
- trace_id?: string;
164
+ traceId?: string;
161
165
  }
162
166
  interface WebhookEvent<T = unknown> {
163
- event_id: string;
164
- event_type: string;
165
- created_at: string;
167
+ eventId: string;
168
+ eventType: WebhookEventType;
169
+ version: number;
170
+ occurredAt: number;
166
171
  data: T;
167
172
  }
168
173
 
@@ -196,7 +201,7 @@ declare class SystemResource {
196
201
  private readonly http;
197
202
  constructor(http: HttpClient);
198
203
  time(): Promise<{
199
- server_time: number;
204
+ serverTime: number;
200
205
  }>;
201
206
  }
202
207
 
@@ -253,7 +258,7 @@ declare class WebhookVerifier {
253
258
  constructEvent<T = unknown>(signatureHeader: string, rawBody: string | Buffer, now?: number): WebhookEvent<T>;
254
259
  }
255
260
 
256
- declare const SDK_VERSION = "1.0.0";
261
+ declare const SDK_VERSION = "2.0.3";
257
262
 
258
263
  declare class Paymos {
259
264
  readonly invoices: InvoicesResource;
@@ -264,4 +269,4 @@ declare class Paymos {
264
269
  }
265
270
  declare function externalOrderId(prefix?: string): string;
266
271
 
267
- export { ApiError, AuthenticationError, type Balance, type ClientOptions, ConfigurationError, type ConfirmPaymentParams, ConflictError, type CreateInvoiceParams, type CreateWithdrawalParams, type CursorPage, GoneError, type Invoice, type InvoiceListItem, type InvoiceStatus, type ListInvoicesParams, type ListWithdrawalsParams, NotFoundError, type Order, type Payment, Paymos, PaymosError, type ProblemDetails, type ProblemError, RateLimitError, type RetryOptions, SDK_VERSION, ServerError, SignatureMismatchError, TimestampSkewError, type Transfer, UnavailableError, ValidationError, type WebhookEvent, WebhookVerifier, type Withdrawal, type WithdrawalListItem, type WithdrawalStatus, apiErrorFromResponse, authorizationHeader, buildQuery, encodePathSegment, externalOrderId, sign, stringToSign };
272
+ export { ApiError, AuthenticationError, type Balance, type ClientOptions, ConfigurationError, type ConfirmPaymentParams, ConflictError, type CreateInvoiceParams, type CreateWithdrawalParams, type CursorPage, GoneError, type Invoice, type InvoiceEventType, type InvoiceListItem, type InvoiceStatus, type ListInvoicesParams, type ListWithdrawalsParams, type NetworkCode, NotFoundError, type Order, type Payment, Paymos, PaymosError, type ProblemDetails, type ProblemError, RateLimitError, type RetryOptions, SDK_VERSION, ServerError, SignatureMismatchError, TimestampSkewError, type Transfer, UnavailableError, ValidationError, type WebhookEvent, type WebhookEventType, WebhookVerifier, type Withdrawal, type WithdrawalEventType, type WithdrawalListItem, type WithdrawalStatus, apiErrorFromResponse, authorizationHeader, buildQuery, encodePathSegment, externalOrderId, sign, stringToSign };
package/dist/index.d.ts CHANGED
@@ -19,126 +19,130 @@ declare class HttpClient {
19
19
 
20
20
  type InvoiceStatus = "awaiting_client" | "awaiting_payment" | "confirming" | "underpaid_waiting" | "paid" | "paid_over" | "underpaid" | "expired" | "cancelled";
21
21
  type WithdrawalStatus = "created" | "pending_review" | "signed" | "cancelling" | "completed" | "failed" | "cancelled";
22
+ type NetworkCode = "TRC20" | "ERC20" | "BEP20" | "POLYGON" | "ARBITRUM" | "OPTIMISM" | "BASE" | "TON" | "AVAX" | "SOL" | "NEAR" | "SUI" | "PLASMA" | (string & {});
23
+ type InvoiceEventType = "invoice.awaiting_payment" | "invoice.confirming" | "invoice.underpaid_waiting" | "invoice.paid" | "invoice.paid_over" | "invoice.underpaid" | "invoice.expired" | "invoice.cancelled";
24
+ type WithdrawalEventType = "withdrawal.created" | "withdrawal.processing" | "withdrawal.completed" | "withdrawal.failed" | "withdrawal.cancelled";
25
+ type WebhookEventType = InvoiceEventType | WithdrawalEventType | (string & {});
22
26
  interface CreateInvoiceParams {
23
- project_id: string;
27
+ projectId: string;
24
28
  amount: string;
25
29
  currency: string;
26
- external_order_id: string;
27
- network?: string | null;
28
- allow_multiple_payments?: boolean;
29
- customer_fee_percent?: number | null;
30
- client_id?: string | null;
30
+ externalOrderId: string;
31
+ network?: NetworkCode | null;
32
+ allowMultiplePayments?: boolean;
33
+ customerFeePercent?: number | null;
34
+ clientId?: string | null;
31
35
  }
32
36
  interface ConfirmPaymentParams {
33
37
  currency: string;
34
- network: string;
38
+ network: NetworkCode;
35
39
  }
36
40
  interface Order {
37
- external_id: string;
38
- client_id: string | null;
41
+ externalId: string;
42
+ clientId?: string;
39
43
  amount: string;
40
44
  currency: string;
41
- network: string | null;
45
+ network?: NetworkCode;
42
46
  }
43
47
  interface Transfer {
44
- tx_hash: string;
48
+ txHash: string;
45
49
  amount: string;
46
- status: string;
47
- created_at: string;
48
- confirmed_at: string | null;
49
- required_confirmations: number | null;
50
- estimated_confirmation_at: string | null;
51
- explorer_url: string | null;
50
+ status: "confirming" | "confirmed";
51
+ createdAt: number;
52
+ confirmedAt?: number;
53
+ requiredConfirmations?: number;
54
+ estimatedConfirmationAt?: number;
55
+ explorerUrl?: string;
52
56
  }
53
57
  interface Payment {
54
58
  currency: string;
55
- network: string;
56
- chain_id: number;
57
- contract_address: string | null;
59
+ network: NetworkCode;
60
+ chainId: number;
61
+ contractAddress?: string;
58
62
  expected: string;
59
- address: string | null;
60
- exchange_rate: string | null;
61
- paid: string | null;
62
- remaining: string | null;
63
- fee: string | null;
64
- net: string | null;
65
- transfers: Transfer[] | null;
63
+ address?: string;
64
+ exchangeRate?: string;
65
+ paid?: string;
66
+ remaining?: string;
67
+ fee?: string;
68
+ net?: string;
69
+ transfers?: Transfer[];
66
70
  }
67
71
  interface Invoice {
68
- invoice_id: string;
69
- project_id: string;
72
+ invoiceId: string;
73
+ projectId: string;
70
74
  status: InvoiceStatus;
71
- is_final: boolean;
72
- is_test: boolean;
73
- payment_url: string;
75
+ isFinal: boolean;
76
+ isTest: boolean;
77
+ paymentUrl: string;
74
78
  order: Order;
75
- payment: Payment | null;
76
- created_at: string;
77
- updated_at: string;
78
- expires_at: string | null;
79
- completed_at: string | null;
79
+ payment?: Payment;
80
+ createdAt: number;
81
+ updatedAt: number;
82
+ expiresAt?: number;
83
+ completedAt?: number;
80
84
  }
81
85
  interface InvoiceListItem {
82
- invoice_id: string;
83
- project_id: string;
84
- external_order_id: string;
85
- client_id: string | null;
86
+ invoiceId: string;
87
+ projectId: string;
88
+ externalOrderId: string;
89
+ clientId?: string;
86
90
  status: InvoiceStatus;
87
- is_final: boolean;
88
- is_test: boolean;
91
+ isFinal: boolean;
92
+ isTest: boolean;
89
93
  amount: string;
90
94
  currency: string;
91
- network: string | null;
92
- created_at: string;
93
- expires_at: string | null;
94
- completed_at: string | null;
95
+ network?: NetworkCode;
96
+ createdAt: number;
97
+ expiresAt?: number;
98
+ completedAt?: number;
95
99
  }
96
100
  interface ListInvoicesParams {
97
101
  limit?: number;
98
102
  cursor?: string;
99
103
  status?: InvoiceStatus[];
100
- external_order_id?: string;
101
- project_id?: string;
102
- created_from?: number;
103
- created_to?: number;
104
+ externalOrderId?: string;
105
+ projectId?: string;
106
+ createdFrom?: number;
107
+ createdTo?: number;
104
108
  }
105
109
  interface CreateWithdrawalParams {
106
- destination_address: string;
107
- network: string;
110
+ destinationAddress: string;
111
+ network: NetworkCode;
108
112
  currency: string;
109
113
  amount: string;
110
- external_order_id: string;
114
+ externalOrderId: string;
111
115
  }
112
116
  interface Withdrawal {
113
- withdrawal_id: string;
114
- external_order_id: string;
117
+ withdrawalId: string;
118
+ externalOrderId: string;
115
119
  status: WithdrawalStatus;
116
- is_final: boolean;
117
- is_test: boolean;
120
+ isFinal: boolean;
121
+ isTest: boolean;
118
122
  amount: string;
119
- fee: string | null;
123
+ fee?: string;
120
124
  currency: string;
121
- network: string;
122
- destination_address: string;
123
- tx_hash: string | null;
124
- explorer_url: string | null;
125
- created_at: string;
126
- completed_at: string | null;
127
- failed_at: string | null;
128
- cancelled_at: string | null;
129
- }
130
- type WithdrawalListItem = Omit<Withdrawal, "tx_hash" | "explorer_url">;
125
+ network: NetworkCode;
126
+ destinationAddress: string;
127
+ txHash?: string;
128
+ explorerUrl?: string;
129
+ createdAt: number;
130
+ completedAt?: number;
131
+ failedAt?: number;
132
+ cancelledAt?: number;
133
+ }
134
+ type WithdrawalListItem = Omit<Withdrawal, "txHash" | "explorerUrl">;
131
135
  interface ListWithdrawalsParams {
132
136
  limit?: number;
133
137
  cursor?: string;
134
138
  status?: WithdrawalStatus[];
135
- external_order_id?: string;
136
- created_from?: number;
137
- created_to?: number;
139
+ externalOrderId?: string;
140
+ createdFrom?: number;
141
+ createdTo?: number;
138
142
  }
139
143
  interface CursorPage<T> {
140
144
  items: T[];
141
- next_cursor: string | null;
145
+ nextCursor: string | null;
142
146
  }
143
147
  interface Balance {
144
148
  currency: string;
@@ -146,23 +150,24 @@ interface Balance {
146
150
  }
147
151
  interface ProblemError {
148
152
  code: string;
149
- field: string | null;
153
+ field?: string | null;
150
154
  message: string;
151
155
  }
152
156
  interface ProblemDetails {
153
- type?: string;
154
- title?: string;
155
- status?: number;
156
- detail?: string;
157
- code?: string;
157
+ type: string;
158
+ title: string;
159
+ status: number;
160
+ detail: string;
161
+ code: string;
158
162
  field?: string | null;
159
163
  errors?: ProblemError[];
160
- trace_id?: string;
164
+ traceId?: string;
161
165
  }
162
166
  interface WebhookEvent<T = unknown> {
163
- event_id: string;
164
- event_type: string;
165
- created_at: string;
167
+ eventId: string;
168
+ eventType: WebhookEventType;
169
+ version: number;
170
+ occurredAt: number;
166
171
  data: T;
167
172
  }
168
173
 
@@ -196,7 +201,7 @@ declare class SystemResource {
196
201
  private readonly http;
197
202
  constructor(http: HttpClient);
198
203
  time(): Promise<{
199
- server_time: number;
204
+ serverTime: number;
200
205
  }>;
201
206
  }
202
207
 
@@ -253,7 +258,7 @@ declare class WebhookVerifier {
253
258
  constructEvent<T = unknown>(signatureHeader: string, rawBody: string | Buffer, now?: number): WebhookEvent<T>;
254
259
  }
255
260
 
256
- declare const SDK_VERSION = "1.0.0";
261
+ declare const SDK_VERSION = "2.0.3";
257
262
 
258
263
  declare class Paymos {
259
264
  readonly invoices: InvoicesResource;
@@ -264,4 +269,4 @@ declare class Paymos {
264
269
  }
265
270
  declare function externalOrderId(prefix?: string): string;
266
271
 
267
- export { ApiError, AuthenticationError, type Balance, type ClientOptions, ConfigurationError, type ConfirmPaymentParams, ConflictError, type CreateInvoiceParams, type CreateWithdrawalParams, type CursorPage, GoneError, type Invoice, type InvoiceListItem, type InvoiceStatus, type ListInvoicesParams, type ListWithdrawalsParams, NotFoundError, type Order, type Payment, Paymos, PaymosError, type ProblemDetails, type ProblemError, RateLimitError, type RetryOptions, SDK_VERSION, ServerError, SignatureMismatchError, TimestampSkewError, type Transfer, UnavailableError, ValidationError, type WebhookEvent, WebhookVerifier, type Withdrawal, type WithdrawalListItem, type WithdrawalStatus, apiErrorFromResponse, authorizationHeader, buildQuery, encodePathSegment, externalOrderId, sign, stringToSign };
272
+ export { ApiError, AuthenticationError, type Balance, type ClientOptions, ConfigurationError, type ConfirmPaymentParams, ConflictError, type CreateInvoiceParams, type CreateWithdrawalParams, type CursorPage, GoneError, type Invoice, type InvoiceEventType, type InvoiceListItem, type InvoiceStatus, type ListInvoicesParams, type ListWithdrawalsParams, type NetworkCode, NotFoundError, type Order, type Payment, Paymos, PaymosError, type ProblemDetails, type ProblemError, RateLimitError, type RetryOptions, SDK_VERSION, ServerError, SignatureMismatchError, TimestampSkewError, type Transfer, UnavailableError, ValidationError, type WebhookEvent, type WebhookEventType, WebhookVerifier, type Withdrawal, type WithdrawalEventType, type WithdrawalListItem, type WithdrawalStatus, apiErrorFromResponse, authorizationHeader, buildQuery, encodePathSegment, externalOrderId, sign, stringToSign };