@scell/sdk 1.0.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/LICENSE +21 -0
- package/README.md +464 -0
- package/dist/index.d.mts +2292 -0
- package/dist/index.d.ts +2292 -0
- package/dist/index.js +1755 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1748 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +71 -0
- package/src/client.ts +297 -0
- package/src/errors.ts +256 -0
- package/src/index.ts +195 -0
- package/src/resources/api-keys.ts +141 -0
- package/src/resources/auth.ts +286 -0
- package/src/resources/balance.ts +157 -0
- package/src/resources/companies.ts +224 -0
- package/src/resources/invoices.ts +246 -0
- package/src/resources/signatures.ts +245 -0
- package/src/resources/webhooks.ts +258 -0
- package/src/types/api-keys.ts +35 -0
- package/src/types/auth.ts +58 -0
- package/src/types/balance.ts +87 -0
- package/src/types/common.ts +114 -0
- package/src/types/companies.ts +86 -0
- package/src/types/index.ts +115 -0
- package/src/types/invoices.ts +191 -0
- package/src/types/signatures.ts +153 -0
- package/src/types/webhooks.ts +146 -0
- package/src/utils/retry.ts +167 -0
- package/src/utils/webhook-verify.ts +290 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scell SDK Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Common types
|
|
8
|
+
export type {
|
|
9
|
+
Address,
|
|
10
|
+
ApiErrorResponse,
|
|
11
|
+
CurrencyCode,
|
|
12
|
+
DateRangeOptions,
|
|
13
|
+
DateString,
|
|
14
|
+
DateTimeString,
|
|
15
|
+
Environment,
|
|
16
|
+
MessageResponse,
|
|
17
|
+
MessageWithDataResponse,
|
|
18
|
+
PaginatedResponse,
|
|
19
|
+
PaginationMeta,
|
|
20
|
+
PaginationOptions,
|
|
21
|
+
SingleResponse,
|
|
22
|
+
Siren,
|
|
23
|
+
Siret,
|
|
24
|
+
UUID,
|
|
25
|
+
} from './common.js';
|
|
26
|
+
|
|
27
|
+
// Invoice types
|
|
28
|
+
export type {
|
|
29
|
+
AuditTrailEntry,
|
|
30
|
+
AuditTrailResponse,
|
|
31
|
+
ConvertInvoiceInput,
|
|
32
|
+
CreateInvoiceInput,
|
|
33
|
+
Invoice,
|
|
34
|
+
InvoiceDirection,
|
|
35
|
+
InvoiceDownloadResponse,
|
|
36
|
+
InvoiceDownloadType,
|
|
37
|
+
InvoiceFormat,
|
|
38
|
+
InvoiceLine,
|
|
39
|
+
InvoiceLineInput,
|
|
40
|
+
InvoiceListOptions,
|
|
41
|
+
InvoiceParty,
|
|
42
|
+
InvoiceStatus,
|
|
43
|
+
} from './invoices.js';
|
|
44
|
+
|
|
45
|
+
// Signature types
|
|
46
|
+
export type {
|
|
47
|
+
CreateSignatureInput,
|
|
48
|
+
Signature,
|
|
49
|
+
SignatureDownloadResponse,
|
|
50
|
+
SignatureDownloadType,
|
|
51
|
+
SignatureListOptions,
|
|
52
|
+
SignaturePosition,
|
|
53
|
+
SignatureRemindResponse,
|
|
54
|
+
SignatureStatus,
|
|
55
|
+
SignatureUIConfig,
|
|
56
|
+
Signer,
|
|
57
|
+
SignerAuthMethod,
|
|
58
|
+
SignerInput,
|
|
59
|
+
SignerStatus,
|
|
60
|
+
} from './signatures.js';
|
|
61
|
+
|
|
62
|
+
// Company types
|
|
63
|
+
export type {
|
|
64
|
+
Company,
|
|
65
|
+
CompanyStatus,
|
|
66
|
+
CreateCompanyInput,
|
|
67
|
+
KycInitiateResponse,
|
|
68
|
+
KycStatusResponse,
|
|
69
|
+
UpdateCompanyInput,
|
|
70
|
+
} from './companies.js';
|
|
71
|
+
|
|
72
|
+
// Balance types
|
|
73
|
+
export type {
|
|
74
|
+
Balance,
|
|
75
|
+
ReloadBalanceInput,
|
|
76
|
+
ReloadBalanceResponse,
|
|
77
|
+
Transaction,
|
|
78
|
+
TransactionListOptions,
|
|
79
|
+
TransactionService,
|
|
80
|
+
TransactionType,
|
|
81
|
+
UpdateBalanceSettingsInput,
|
|
82
|
+
} from './balance.js';
|
|
83
|
+
|
|
84
|
+
// Webhook types
|
|
85
|
+
export type {
|
|
86
|
+
BalanceWebhookData,
|
|
87
|
+
CreateWebhookInput,
|
|
88
|
+
InvoiceWebhookData,
|
|
89
|
+
SignatureWebhookData,
|
|
90
|
+
UpdateWebhookInput,
|
|
91
|
+
Webhook,
|
|
92
|
+
WebhookEvent,
|
|
93
|
+
WebhookListOptions,
|
|
94
|
+
WebhookLog,
|
|
95
|
+
WebhookPayload,
|
|
96
|
+
WebhookTestResponse,
|
|
97
|
+
WebhookWithSecret,
|
|
98
|
+
} from './webhooks.js';
|
|
99
|
+
|
|
100
|
+
// API Key types
|
|
101
|
+
export type {
|
|
102
|
+
ApiKey,
|
|
103
|
+
ApiKeyWithSecret,
|
|
104
|
+
CreateApiKeyInput,
|
|
105
|
+
} from './api-keys.js';
|
|
106
|
+
|
|
107
|
+
// Auth types
|
|
108
|
+
export type {
|
|
109
|
+
AuthResponse,
|
|
110
|
+
ForgotPasswordInput,
|
|
111
|
+
LoginCredentials,
|
|
112
|
+
RegisterInput,
|
|
113
|
+
ResetPasswordInput,
|
|
114
|
+
User,
|
|
115
|
+
} from './auth.js';
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Address,
|
|
3
|
+
CurrencyCode,
|
|
4
|
+
DateString,
|
|
5
|
+
DateTimeString,
|
|
6
|
+
Environment,
|
|
7
|
+
Siret,
|
|
8
|
+
UUID,
|
|
9
|
+
} from './common.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Invoice direction
|
|
13
|
+
*/
|
|
14
|
+
export type InvoiceDirection = 'outgoing' | 'incoming';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Invoice output format
|
|
18
|
+
*/
|
|
19
|
+
export type InvoiceFormat = 'facturx' | 'ubl' | 'cii';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Invoice status
|
|
23
|
+
*/
|
|
24
|
+
export type InvoiceStatus =
|
|
25
|
+
| 'draft'
|
|
26
|
+
| 'pending'
|
|
27
|
+
| 'validated'
|
|
28
|
+
| 'converted'
|
|
29
|
+
| 'transmitted'
|
|
30
|
+
| 'accepted'
|
|
31
|
+
| 'rejected'
|
|
32
|
+
| 'error';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Invoice download file type
|
|
36
|
+
*/
|
|
37
|
+
export type InvoiceDownloadType = 'original' | 'converted' | 'pdf';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Invoice line item
|
|
41
|
+
*/
|
|
42
|
+
export interface InvoiceLine {
|
|
43
|
+
line_number: number;
|
|
44
|
+
description: string;
|
|
45
|
+
quantity: number;
|
|
46
|
+
unit_price: number;
|
|
47
|
+
tax_rate: number;
|
|
48
|
+
total_ht: number;
|
|
49
|
+
total_tax: number;
|
|
50
|
+
total_ttc: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Invoice party (seller or buyer)
|
|
55
|
+
*/
|
|
56
|
+
export interface InvoiceParty {
|
|
57
|
+
siret: Siret;
|
|
58
|
+
name: string;
|
|
59
|
+
address: Address;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Invoice entity
|
|
64
|
+
*/
|
|
65
|
+
export interface Invoice {
|
|
66
|
+
id: UUID;
|
|
67
|
+
external_id: string | null;
|
|
68
|
+
invoice_number: string;
|
|
69
|
+
direction: InvoiceDirection;
|
|
70
|
+
output_format: InvoiceFormat;
|
|
71
|
+
issue_date: DateString;
|
|
72
|
+
due_date: DateString | null;
|
|
73
|
+
currency: CurrencyCode;
|
|
74
|
+
total_ht: number;
|
|
75
|
+
total_tax: number;
|
|
76
|
+
total_ttc: number;
|
|
77
|
+
seller: InvoiceParty;
|
|
78
|
+
buyer: InvoiceParty;
|
|
79
|
+
lines: InvoiceLine[] | null;
|
|
80
|
+
status: InvoiceStatus;
|
|
81
|
+
status_message: string | null;
|
|
82
|
+
environment: Environment;
|
|
83
|
+
archive_enabled: boolean;
|
|
84
|
+
amount_charged: number | null;
|
|
85
|
+
created_at: DateTimeString;
|
|
86
|
+
validated_at: DateTimeString | null;
|
|
87
|
+
transmitted_at: DateTimeString | null;
|
|
88
|
+
completed_at: DateTimeString | null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Invoice line input for creation
|
|
93
|
+
*/
|
|
94
|
+
export interface InvoiceLineInput {
|
|
95
|
+
description: string;
|
|
96
|
+
quantity: number;
|
|
97
|
+
unit_price: number;
|
|
98
|
+
tax_rate: number;
|
|
99
|
+
total_ht: number;
|
|
100
|
+
total_tax: number;
|
|
101
|
+
total_ttc: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Invoice creation input
|
|
106
|
+
*/
|
|
107
|
+
export interface CreateInvoiceInput {
|
|
108
|
+
/** Your external reference ID */
|
|
109
|
+
external_id?: string | undefined;
|
|
110
|
+
/** Invoice number (required) */
|
|
111
|
+
invoice_number: string;
|
|
112
|
+
/** Direction: outgoing (sale) or incoming (purchase) */
|
|
113
|
+
direction: InvoiceDirection;
|
|
114
|
+
/** Output format for electronic invoice */
|
|
115
|
+
output_format: InvoiceFormat;
|
|
116
|
+
/** Issue date (YYYY-MM-DD) */
|
|
117
|
+
issue_date: DateString;
|
|
118
|
+
/** Due date (YYYY-MM-DD) */
|
|
119
|
+
due_date?: DateString | undefined;
|
|
120
|
+
/** Currency code (default: EUR) */
|
|
121
|
+
currency?: CurrencyCode | undefined;
|
|
122
|
+
/** Total excluding tax */
|
|
123
|
+
total_ht: number;
|
|
124
|
+
/** Total tax amount */
|
|
125
|
+
total_tax: number;
|
|
126
|
+
/** Total including tax */
|
|
127
|
+
total_ttc: number;
|
|
128
|
+
/** Seller SIRET (14 digits) */
|
|
129
|
+
seller_siret: Siret;
|
|
130
|
+
/** Seller company name */
|
|
131
|
+
seller_name: string;
|
|
132
|
+
/** Seller address */
|
|
133
|
+
seller_address: Address;
|
|
134
|
+
/** Buyer SIRET (14 digits) */
|
|
135
|
+
buyer_siret: Siret;
|
|
136
|
+
/** Buyer company name */
|
|
137
|
+
buyer_name: string;
|
|
138
|
+
/** Buyer address */
|
|
139
|
+
buyer_address: Address;
|
|
140
|
+
/** Invoice line items */
|
|
141
|
+
lines: InvoiceLineInput[];
|
|
142
|
+
/** Enable 10-year archiving */
|
|
143
|
+
archive_enabled?: boolean | undefined;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Invoice list filter options
|
|
148
|
+
*/
|
|
149
|
+
export interface InvoiceListOptions {
|
|
150
|
+
company_id?: UUID | undefined;
|
|
151
|
+
direction?: InvoiceDirection | undefined;
|
|
152
|
+
status?: InvoiceStatus | undefined;
|
|
153
|
+
environment?: Environment | undefined;
|
|
154
|
+
from?: DateString | undefined;
|
|
155
|
+
to?: DateString | undefined;
|
|
156
|
+
per_page?: number | undefined;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Invoice conversion input
|
|
161
|
+
*/
|
|
162
|
+
export interface ConvertInvoiceInput {
|
|
163
|
+
invoice_id: UUID;
|
|
164
|
+
target_format: InvoiceFormat;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Invoice download response
|
|
169
|
+
*/
|
|
170
|
+
export interface InvoiceDownloadResponse {
|
|
171
|
+
url: string;
|
|
172
|
+
expires_at: DateTimeString;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Audit trail entry
|
|
177
|
+
*/
|
|
178
|
+
export interface AuditTrailEntry {
|
|
179
|
+
action: string;
|
|
180
|
+
details: string;
|
|
181
|
+
actor_ip: string | null;
|
|
182
|
+
created_at: DateTimeString;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Audit trail response
|
|
187
|
+
*/
|
|
188
|
+
export interface AuditTrailResponse {
|
|
189
|
+
data: AuditTrailEntry[];
|
|
190
|
+
integrity_valid: boolean;
|
|
191
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { DateTimeString, Environment, UUID } from './common.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Signer authentication method
|
|
5
|
+
*/
|
|
6
|
+
export type SignerAuthMethod = 'email' | 'sms' | 'both';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Signer status
|
|
10
|
+
*/
|
|
11
|
+
export type SignerStatus = 'pending' | 'signed' | 'refused';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Signature status
|
|
15
|
+
*/
|
|
16
|
+
export type SignatureStatus =
|
|
17
|
+
| 'pending'
|
|
18
|
+
| 'waiting_signers'
|
|
19
|
+
| 'partially_signed'
|
|
20
|
+
| 'completed'
|
|
21
|
+
| 'refused'
|
|
22
|
+
| 'expired'
|
|
23
|
+
| 'error';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Signature download file type
|
|
27
|
+
*/
|
|
28
|
+
export type SignatureDownloadType = 'original' | 'signed' | 'audit_trail';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Signature position on document
|
|
32
|
+
*/
|
|
33
|
+
export interface SignaturePosition {
|
|
34
|
+
page: number;
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
width?: number | undefined;
|
|
38
|
+
height?: number | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* UI customization for signature page (white-label)
|
|
43
|
+
*/
|
|
44
|
+
export interface SignatureUIConfig {
|
|
45
|
+
logo_url?: string | undefined;
|
|
46
|
+
primary_color?: string | undefined;
|
|
47
|
+
company_name?: string | undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Signer entity
|
|
52
|
+
*/
|
|
53
|
+
export interface Signer {
|
|
54
|
+
id: UUID;
|
|
55
|
+
first_name: string;
|
|
56
|
+
last_name: string;
|
|
57
|
+
full_name: string;
|
|
58
|
+
email: string | null;
|
|
59
|
+
phone: string | null;
|
|
60
|
+
auth_method: SignerAuthMethod;
|
|
61
|
+
status: SignerStatus;
|
|
62
|
+
signing_url: string | null;
|
|
63
|
+
signed_at: DateTimeString | null;
|
|
64
|
+
refused_at: DateTimeString | null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Signature entity
|
|
69
|
+
*/
|
|
70
|
+
export interface Signature {
|
|
71
|
+
id: UUID;
|
|
72
|
+
external_id: string | null;
|
|
73
|
+
title: string;
|
|
74
|
+
description: string | null;
|
|
75
|
+
document_name: string;
|
|
76
|
+
document_size: number;
|
|
77
|
+
signers: Signer[] | null;
|
|
78
|
+
status: SignatureStatus;
|
|
79
|
+
status_message: string | null;
|
|
80
|
+
environment: Environment;
|
|
81
|
+
archive_enabled: boolean;
|
|
82
|
+
amount_charged: number | null;
|
|
83
|
+
expires_at: DateTimeString | null;
|
|
84
|
+
created_at: DateTimeString;
|
|
85
|
+
completed_at: DateTimeString | null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Signer input for creation
|
|
90
|
+
*/
|
|
91
|
+
export interface SignerInput {
|
|
92
|
+
first_name: string;
|
|
93
|
+
last_name: string;
|
|
94
|
+
email?: string | undefined;
|
|
95
|
+
phone?: string | undefined;
|
|
96
|
+
auth_method: SignerAuthMethod;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Signature creation input
|
|
101
|
+
*/
|
|
102
|
+
export interface CreateSignatureInput {
|
|
103
|
+
/** Your external reference ID */
|
|
104
|
+
external_id?: string | undefined;
|
|
105
|
+
/** Document title */
|
|
106
|
+
title: string;
|
|
107
|
+
/** Document description */
|
|
108
|
+
description?: string | undefined;
|
|
109
|
+
/** Base64-encoded document content */
|
|
110
|
+
document: string;
|
|
111
|
+
/** Document filename */
|
|
112
|
+
document_name: string;
|
|
113
|
+
/** List of signers (1-10) */
|
|
114
|
+
signers: SignerInput[];
|
|
115
|
+
/** Signature positions on the document */
|
|
116
|
+
signature_positions?: SignaturePosition[] | undefined;
|
|
117
|
+
/** White-label UI customization */
|
|
118
|
+
ui_config?: SignatureUIConfig | undefined;
|
|
119
|
+
/** Redirect URL after completion */
|
|
120
|
+
redirect_complete_url?: string | undefined;
|
|
121
|
+
/** Redirect URL after cancellation */
|
|
122
|
+
redirect_cancel_url?: string | undefined;
|
|
123
|
+
/** Expiration date (default: 30 days) */
|
|
124
|
+
expires_at?: DateTimeString | undefined;
|
|
125
|
+
/** Enable 10-year archiving */
|
|
126
|
+
archive_enabled?: boolean | undefined;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Signature list filter options
|
|
131
|
+
*/
|
|
132
|
+
export interface SignatureListOptions {
|
|
133
|
+
company_id?: UUID | undefined;
|
|
134
|
+
status?: SignatureStatus | undefined;
|
|
135
|
+
environment?: Environment | undefined;
|
|
136
|
+
per_page?: number | undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Signature download response
|
|
141
|
+
*/
|
|
142
|
+
export interface SignatureDownloadResponse {
|
|
143
|
+
url: string;
|
|
144
|
+
expires_at: DateTimeString;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Signature reminder response
|
|
149
|
+
*/
|
|
150
|
+
export interface SignatureRemindResponse {
|
|
151
|
+
message: string;
|
|
152
|
+
signers_reminded: number;
|
|
153
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { DateTimeString, Environment, UUID } from './common.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Available webhook events
|
|
5
|
+
*/
|
|
6
|
+
export type WebhookEvent =
|
|
7
|
+
// Invoice events
|
|
8
|
+
| 'invoice.created'
|
|
9
|
+
| 'invoice.validated'
|
|
10
|
+
| 'invoice.transmitted'
|
|
11
|
+
| 'invoice.accepted'
|
|
12
|
+
| 'invoice.rejected'
|
|
13
|
+
| 'invoice.error'
|
|
14
|
+
// Signature events
|
|
15
|
+
| 'signature.created'
|
|
16
|
+
| 'signature.waiting'
|
|
17
|
+
| 'signature.signed'
|
|
18
|
+
| 'signature.completed'
|
|
19
|
+
| 'signature.refused'
|
|
20
|
+
| 'signature.expired'
|
|
21
|
+
| 'signature.error'
|
|
22
|
+
// Balance events
|
|
23
|
+
| 'balance.low'
|
|
24
|
+
| 'balance.critical';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Webhook entity
|
|
28
|
+
*/
|
|
29
|
+
export interface Webhook {
|
|
30
|
+
id: UUID;
|
|
31
|
+
company_id: UUID | null;
|
|
32
|
+
url: string;
|
|
33
|
+
events: WebhookEvent[];
|
|
34
|
+
is_active: boolean;
|
|
35
|
+
environment: Environment;
|
|
36
|
+
retry_count: number;
|
|
37
|
+
timeout_seconds: number;
|
|
38
|
+
failure_count: number;
|
|
39
|
+
last_triggered_at: DateTimeString | null;
|
|
40
|
+
last_success_at: DateTimeString | null;
|
|
41
|
+
last_failure_at: DateTimeString | null;
|
|
42
|
+
created_at: DateTimeString;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Webhook with secret (returned on creation)
|
|
47
|
+
*/
|
|
48
|
+
export interface WebhookWithSecret extends Webhook {
|
|
49
|
+
secret: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Webhook creation input
|
|
54
|
+
*/
|
|
55
|
+
export interface CreateWebhookInput {
|
|
56
|
+
url: string;
|
|
57
|
+
events: WebhookEvent[];
|
|
58
|
+
environment: Environment;
|
|
59
|
+
headers?: Record<string, string> | undefined;
|
|
60
|
+
retry_count?: number | undefined;
|
|
61
|
+
timeout_seconds?: number | undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Webhook update input
|
|
66
|
+
*/
|
|
67
|
+
export interface UpdateWebhookInput {
|
|
68
|
+
url?: string | undefined;
|
|
69
|
+
events?: WebhookEvent[] | undefined;
|
|
70
|
+
is_active?: boolean | undefined;
|
|
71
|
+
headers?: Record<string, string> | undefined;
|
|
72
|
+
retry_count?: number | undefined;
|
|
73
|
+
timeout_seconds?: number | undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Webhook list filter options
|
|
78
|
+
*/
|
|
79
|
+
export interface WebhookListOptions {
|
|
80
|
+
company_id?: UUID | undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Webhook test response
|
|
85
|
+
*/
|
|
86
|
+
export interface WebhookTestResponse {
|
|
87
|
+
success: boolean;
|
|
88
|
+
status_code?: number | undefined;
|
|
89
|
+
response_time_ms?: number | undefined;
|
|
90
|
+
error?: string | undefined;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Webhook log entry
|
|
95
|
+
*/
|
|
96
|
+
export interface WebhookLog {
|
|
97
|
+
id: UUID;
|
|
98
|
+
event: string;
|
|
99
|
+
payload: Record<string, unknown>;
|
|
100
|
+
response_status: number | null;
|
|
101
|
+
response_body: string | null;
|
|
102
|
+
response_time_ms: number | null;
|
|
103
|
+
success: boolean;
|
|
104
|
+
error_message: string | null;
|
|
105
|
+
created_at: DateTimeString;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Webhook payload structure (received by your endpoint)
|
|
110
|
+
*/
|
|
111
|
+
export interface WebhookPayload<T = unknown> {
|
|
112
|
+
event: WebhookEvent;
|
|
113
|
+
timestamp: DateTimeString;
|
|
114
|
+
data: T;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Invoice webhook payload data
|
|
119
|
+
*/
|
|
120
|
+
export interface InvoiceWebhookData {
|
|
121
|
+
id: UUID;
|
|
122
|
+
invoice_number: string;
|
|
123
|
+
status: string;
|
|
124
|
+
environment: Environment;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Signature webhook payload data
|
|
129
|
+
*/
|
|
130
|
+
export interface SignatureWebhookData {
|
|
131
|
+
id: UUID;
|
|
132
|
+
title: string;
|
|
133
|
+
status: string;
|
|
134
|
+
environment: Environment;
|
|
135
|
+
signer_id?: UUID | undefined;
|
|
136
|
+
signer_email?: string | undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Balance webhook payload data
|
|
141
|
+
*/
|
|
142
|
+
export interface BalanceWebhookData {
|
|
143
|
+
amount: number;
|
|
144
|
+
currency: string;
|
|
145
|
+
threshold: number;
|
|
146
|
+
}
|