flashpi 0.1.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +25 -0
- data/LICENSE +21 -0
- data/README.en.md +379 -0
- data/README.md +383 -0
- data/lib/flashpi/api_response.rb +33 -0
- data/lib/flashpi/client.rb +112 -0
- data/lib/flashpi/errors.rb +116 -0
- data/lib/flashpi/internal/engine.rb +355 -0
- data/lib/flashpi/internal/json_text.rb +108 -0
- data/lib/flashpi/internal/multipart.rb +141 -0
- data/lib/flashpi/internal/problems.rb +111 -0
- data/lib/flashpi/internal/request.rb +231 -0
- data/lib/flashpi/internal/resource.rb +125 -0
- data/lib/flashpi/internal/secret.rb +41 -0
- data/lib/flashpi/internal/settings.rb +88 -0
- data/lib/flashpi/internal/transport.rb +432 -0
- data/lib/flashpi/internal/validate.rb +122 -0
- data/lib/flashpi/page.rb +82 -0
- data/lib/flashpi/resources/documents.rb +136 -0
- data/lib/flashpi/resources/events.rb +36 -0
- data/lib/flashpi/resources/issuer_onboardings.rb +47 -0
- data/lib/flashpi/resources/issuers.rb +179 -0
- data/lib/flashpi/resources/webhook_endpoints.rb +110 -0
- data/lib/flashpi/version.rb +6 -0
- data/lib/flashpi/webhooks.rb +223 -0
- data/lib/flashpi.rb +42 -0
- data/sig/flashpi/internal.rbs +376 -0
- data/sig/flashpi/resources.rbs +712 -0
- data/sig/flashpi/sdk_types.rbs +114 -0
- data/sig/flashpi/types.rbs +2495 -0
- data/sig/flashpi.rbs +187 -0
- data/sig/manifest.yaml +8 -0
- metadata +80 -0
|
@@ -0,0 +1,2495 @@
|
|
|
1
|
+
# Types of the Flashpi API, generated from its public OpenAPI document.
|
|
2
|
+
#
|
|
3
|
+
# GENERATED by scripts/openapi.rb from openapi/openapi.json. Do not edit by hand: run
|
|
4
|
+
# `ruby scripts/openapi.rb sync` (or `generate`).
|
|
5
|
+
module Flashpi
|
|
6
|
+
module Types
|
|
7
|
+
# Whether the account's buyer emails of one mode go out. Flashpi pauses them when the last 7
|
|
8
|
+
# days have at least 3 hard bounces and 3 % of the emails sent, or at least 2 complaints and
|
|
9
|
+
# 0.05 % (they protect the email provider's reputation that every customer shares). While
|
|
10
|
+
# paused, documents are still issued and authorized; their emails fail with
|
|
11
|
+
# `email_sending_paused` and resends answer 409 `email_sending_paused`. Only Flashpi's staff
|
|
12
|
+
# resume them.
|
|
13
|
+
type account_email_sending = {
|
|
14
|
+
environment: account_email_sending_environment,
|
|
15
|
+
status: account_email_sending_status,
|
|
16
|
+
|
|
17
|
+
# Format: date-time.
|
|
18
|
+
pausedAt: String?,
|
|
19
|
+
|
|
20
|
+
# Set while paused: `bounce_rate` (hard bounces), `complaint_rate` (complaints) or `staff`
|
|
21
|
+
# (Flashpi's staff paused them).
|
|
22
|
+
pauseReason: account_email_sending_pause_reason?,
|
|
23
|
+
window: account_email_sending_window
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type account_email_sending_environment = "test" | "live"
|
|
27
|
+
|
|
28
|
+
# Set while paused: `bounce_rate` (hard bounces), `complaint_rate` (complaints) or `staff`
|
|
29
|
+
# (Flashpi's staff paused them).
|
|
30
|
+
type account_email_sending_pause_reason = "bounce_rate" | "complaint_rate" | "staff"
|
|
31
|
+
|
|
32
|
+
type account_email_sending_status = "active" | "paused"
|
|
33
|
+
|
|
34
|
+
# The buyer emails the account sent in the last 7 days in this mode (since Flashpi's staff last
|
|
35
|
+
# resumed them, when that is later).
|
|
36
|
+
type account_email_sending_window = {
|
|
37
|
+
# Where the counted period starts. Format: date-time.
|
|
38
|
+
since: String,
|
|
39
|
+
|
|
40
|
+
# Emails the email provider accepted.
|
|
41
|
+
sent: Integer | Float,
|
|
42
|
+
|
|
43
|
+
# Of those, hard bounces (`bounce_permanent`: the address or the domain does not exist).
|
|
44
|
+
hardBounces: Integer | Float,
|
|
45
|
+
|
|
46
|
+
# Of those, emails the recipient marked as spam.
|
|
47
|
+
complaints: Integer | Float
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# An event about the account's email sending: `data` is the AccountEmailSending as the API
|
|
51
|
+
# returned it when the event happened (texts in English).
|
|
52
|
+
type account_event = {
|
|
53
|
+
# Format: uuid.
|
|
54
|
+
id: String,
|
|
55
|
+
type: account_event_type,
|
|
56
|
+
|
|
57
|
+
# Mode of the resource.
|
|
58
|
+
environment: account_event_environment,
|
|
59
|
+
|
|
60
|
+
# Format: date-time.
|
|
61
|
+
createdAt: String,
|
|
62
|
+
data: account_email_sending
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
# Mode of the resource.
|
|
66
|
+
type account_event_environment = "test" | "live"
|
|
67
|
+
|
|
68
|
+
type account_event_type = "account.email_paused" | "account.email_resumed"
|
|
69
|
+
|
|
70
|
+
# An issuer's .p12 signing certificate. Flashpi checks the upload asynchronously (`processing`,
|
|
71
|
+
# then `accepted` or `rejected`); the file and its password are never returned.
|
|
72
|
+
type certificate = {
|
|
73
|
+
# Format: uuid.
|
|
74
|
+
id: String,
|
|
75
|
+
|
|
76
|
+
# Format: uuid.
|
|
77
|
+
issuerId: String,
|
|
78
|
+
|
|
79
|
+
# Mode of the API key that uploaded it. A certificate of the issuer onboarding serves every
|
|
80
|
+
# mode (`allModes`): it shows the mode of the API key that reads it.
|
|
81
|
+
environment: certificate_environment,
|
|
82
|
+
|
|
83
|
+
# Whether it serves every mode (test and live): a certificate uploaded through the issuer
|
|
84
|
+
# onboarding (POST /v1/issuer-onboardings). False for one uploaded for one mode.
|
|
85
|
+
allModes: bool,
|
|
86
|
+
status: certificate_status,
|
|
87
|
+
|
|
88
|
+
# Whether it signs documents now: accepted, within its validity and not blocked.
|
|
89
|
+
usable: bool,
|
|
90
|
+
|
|
91
|
+
# Subject distinguished name.
|
|
92
|
+
subject: String?,
|
|
93
|
+
|
|
94
|
+
# Distinguished name of the certification authority that issued it.
|
|
95
|
+
issuedBy: String?,
|
|
96
|
+
serialNumber: String?,
|
|
97
|
+
|
|
98
|
+
# Format: date-time.
|
|
99
|
+
validFrom: String?,
|
|
100
|
+
|
|
101
|
+
# Format: date-time.
|
|
102
|
+
validUntil: String?,
|
|
103
|
+
|
|
104
|
+
# SHA-256 of the certificate, hex.
|
|
105
|
+
sha256Fingerprint: String?,
|
|
106
|
+
|
|
107
|
+
# The RUC found in the certificate, when its authority writes one.
|
|
108
|
+
ruc: String?,
|
|
109
|
+
revocation: certificate_revocation?,
|
|
110
|
+
rejection: certificate_rejection?,
|
|
111
|
+
|
|
112
|
+
# Format: date-time.
|
|
113
|
+
createdAt: String,
|
|
114
|
+
|
|
115
|
+
# Format: date-time.
|
|
116
|
+
updatedAt: String
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# Mode of the API key that uploaded it. A certificate of the issuer onboarding serves every mode
|
|
120
|
+
# (`allModes`): it shows the mode of the API key that reads it.
|
|
121
|
+
type certificate_environment = "test" | "live"
|
|
122
|
+
|
|
123
|
+
# An event about a .p12 certificate: `data` is the Certificate as the API returned it when the
|
|
124
|
+
# event happened (texts in English).
|
|
125
|
+
type certificate_event = {
|
|
126
|
+
# Format: uuid.
|
|
127
|
+
id: String,
|
|
128
|
+
type: certificate_event_type,
|
|
129
|
+
|
|
130
|
+
# Mode of the resource.
|
|
131
|
+
environment: certificate_event_environment,
|
|
132
|
+
|
|
133
|
+
# Format: date-time.
|
|
134
|
+
createdAt: String,
|
|
135
|
+
data: certificate
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
# Mode of the resource.
|
|
139
|
+
type certificate_event_environment = "test" | "live"
|
|
140
|
+
|
|
141
|
+
type certificate_event_type = "certificate.verified"
|
|
142
|
+
| "certificate.pending"
|
|
143
|
+
| "certificate.blocked"
|
|
144
|
+
| "certificate.revoked"
|
|
145
|
+
| "certificate.reactivated"
|
|
146
|
+
|
|
147
|
+
# A page of certificates, newest first.
|
|
148
|
+
type certificate_list = {
|
|
149
|
+
data: Array[certificate],
|
|
150
|
+
pagination: pagination
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
# Why the upload was rejected.
|
|
154
|
+
type certificate_rejection = {
|
|
155
|
+
code: String,
|
|
156
|
+
message: String
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
# Whether the certification authority revoked the certificate. `good`: verified not revoked.
|
|
160
|
+
# `pending`: could not be verified yet; it still signs until `blockAt` and is checked again
|
|
161
|
+
# hourly. `blocked`: still unverified after 7 days, or its chain is no longer trusted
|
|
162
|
+
# (`blockedReason`); it does not sign. `revoked`: never signs again.
|
|
163
|
+
type certificate_revocation = {
|
|
164
|
+
status: certificate_revocation_status,
|
|
165
|
+
|
|
166
|
+
# Format: date-time.
|
|
167
|
+
checkedAt: String,
|
|
168
|
+
|
|
169
|
+
# Format: date-time.
|
|
170
|
+
nextCheckAt: String?,
|
|
171
|
+
|
|
172
|
+
# Pending only: when it stops signing if still unverified. Format: date-time.
|
|
173
|
+
blockAt: String?,
|
|
174
|
+
blockedReason: certificate_revocation_blocked_reason?
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
type certificate_revocation_blocked_reason = "revocation_status_unverified"
|
|
178
|
+
| "untrusted_certificate_chain"
|
|
179
|
+
|
|
180
|
+
type certificate_revocation_status = "good" | "pending" | "blocked" | "revoked"
|
|
181
|
+
|
|
182
|
+
type certificate_status = "processing" | "accepted" | "rejected"
|
|
183
|
+
|
|
184
|
+
# The query of `certificatesList` (GET /v1/issuers/{issuerId}/certificates).
|
|
185
|
+
type certificates_list_query = {
|
|
186
|
+
# Maximum number of items to return. Default: `20`.
|
|
187
|
+
?limit: Integer,
|
|
188
|
+
|
|
189
|
+
# The `pagination.nextCursor` of the previous page. Omit it for the first page.
|
|
190
|
+
?cursor: String
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
# The issuer to create, with the same fields as POST /v1/issuers (legalName, headOfficeAddress
|
|
194
|
+
# and taxProfile are required for a new issuer). For a renewal (`existingIssuer`) the body may
|
|
195
|
+
# be `{}`: the issuer is not changed (PATCH it if needed).
|
|
196
|
+
type complete_issuer_onboarding = {
|
|
197
|
+
# Required when the RUC did not come from the certificate (`rucNeedsConfirmation`): the
|
|
198
|
+
# proposed RUC or another one whose first 10 digits are the holder's cédula. Otherwise it may
|
|
199
|
+
# be left out, and must be the certificate's RUC when sent (422 `ruc_mismatch`).
|
|
200
|
+
?ruc: String,
|
|
201
|
+
|
|
202
|
+
# Razón social.
|
|
203
|
+
?legalName: String,
|
|
204
|
+
|
|
205
|
+
# Nombre comercial.
|
|
206
|
+
?tradeName: String?,
|
|
207
|
+
|
|
208
|
+
# Dirección matriz.
|
|
209
|
+
?headOfficeAddress: String,
|
|
210
|
+
?taxProfile: issuer_tax_profile_input,
|
|
211
|
+
?branding: issuer_branding_input,
|
|
212
|
+
|
|
213
|
+
# As in POST /v1/issuers. Default: `true`.
|
|
214
|
+
?sendEmailByDefault: bool
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
# The issuer (created, with establishment 001 and emission point 001, or the existing one for a
|
|
218
|
+
# renewal) and its new certificate, `processing` until Flashpi onboards it.
|
|
219
|
+
type completed_issuer_onboarding = {
|
|
220
|
+
issuer: issuer,
|
|
221
|
+
certificate: certificate
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
# A credit note (nota de crédito) that reduces the amount of a document, for example for
|
|
225
|
+
# returned goods. Flashpi computes the credited amount.
|
|
226
|
+
type create_credit_note = {
|
|
227
|
+
# The issuer (taxpayer) that issues the document. Format: uuid.
|
|
228
|
+
issuerId: String,
|
|
229
|
+
|
|
230
|
+
# Establishment code (3 digits) registered on the issuer.
|
|
231
|
+
establishment: String,
|
|
232
|
+
|
|
233
|
+
# Emission point code (3 digits) registered on the establishment.
|
|
234
|
+
emissionPoint: String,
|
|
235
|
+
|
|
236
|
+
# Issue date, YYYY-MM-DD. Defaults to today in Ecuador; it cannot be later. Format: date.
|
|
237
|
+
?issueDate: String,
|
|
238
|
+
|
|
239
|
+
# Sequential to use instead of the next one, for example when migrating from another system.
|
|
240
|
+
# It must not be used yet; later automatic sequentials continue after the highest one used.
|
|
241
|
+
# Not accepted with the shared demo issuer (422 demo_issuer_sequential_not_allowed).
|
|
242
|
+
?sequential: Integer,
|
|
243
|
+
|
|
244
|
+
# Additional information printed on the document (name → value, 1 to 300 characters each). A
|
|
245
|
+
# document carries at most 15 fields including the legends Flashpi adds (RUC Proveedor, and
|
|
246
|
+
# Gran Contribuyente for large taxpayers), so at most 13 or 14 of yours.
|
|
247
|
+
?additionalInfo: Hash[Symbol, String],
|
|
248
|
+
|
|
249
|
+
# Delivery options.
|
|
250
|
+
?options: document_options,
|
|
251
|
+
|
|
252
|
+
# The buyer of the modified document. It cannot be a final consumer.
|
|
253
|
+
customer: document_party,
|
|
254
|
+
|
|
255
|
+
# The document the note modifies.
|
|
256
|
+
modifiedDocument: modified_document,
|
|
257
|
+
|
|
258
|
+
# Reason for the note.
|
|
259
|
+
reason: String,
|
|
260
|
+
|
|
261
|
+
# The lines of the document.
|
|
262
|
+
items: Array[document_item],
|
|
263
|
+
|
|
264
|
+
# The total you expect. Flashpi computes every total; when it differs from this value the
|
|
265
|
+
# request is refused with 422 total_mismatch, which shows both values.
|
|
266
|
+
?expectedTotal: String
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
# A debit note (nota de débito) that increases the amount of a document, for example for
|
|
270
|
+
# interest or fees. Flashpi computes the taxes and the total.
|
|
271
|
+
type create_debit_note = {
|
|
272
|
+
# The issuer (taxpayer) that issues the document. Format: uuid.
|
|
273
|
+
issuerId: String,
|
|
274
|
+
|
|
275
|
+
# Establishment code (3 digits) registered on the issuer.
|
|
276
|
+
establishment: String,
|
|
277
|
+
|
|
278
|
+
# Emission point code (3 digits) registered on the establishment.
|
|
279
|
+
emissionPoint: String,
|
|
280
|
+
|
|
281
|
+
# Issue date, YYYY-MM-DD. Defaults to today in Ecuador; it cannot be later. Format: date.
|
|
282
|
+
?issueDate: String,
|
|
283
|
+
|
|
284
|
+
# Sequential to use instead of the next one, for example when migrating from another system.
|
|
285
|
+
# It must not be used yet; later automatic sequentials continue after the highest one used.
|
|
286
|
+
# Not accepted with the shared demo issuer (422 demo_issuer_sequential_not_allowed).
|
|
287
|
+
?sequential: Integer,
|
|
288
|
+
|
|
289
|
+
# Additional information printed on the document (name → value, 1 to 300 characters each). A
|
|
290
|
+
# document carries at most 15 fields including the legends Flashpi adds (RUC Proveedor, and
|
|
291
|
+
# Gran Contribuyente for large taxpayers), so at most 13 or 14 of yours.
|
|
292
|
+
?additionalInfo: Hash[Symbol, String],
|
|
293
|
+
|
|
294
|
+
# Delivery options.
|
|
295
|
+
?options: document_options,
|
|
296
|
+
|
|
297
|
+
# The buyer of the modified document. It cannot be a final consumer.
|
|
298
|
+
customer: document_party,
|
|
299
|
+
|
|
300
|
+
# The document the note modifies.
|
|
301
|
+
modifiedDocument: modified_document,
|
|
302
|
+
|
|
303
|
+
# The reasons and their amounts.
|
|
304
|
+
reasons: Array[debit_note_reason],
|
|
305
|
+
|
|
306
|
+
# How the debit is paid; the payments must add up to the total.
|
|
307
|
+
payments: Array[document_payment],
|
|
308
|
+
|
|
309
|
+
# The total you expect. Flashpi computes every total; when it differs from this value the
|
|
310
|
+
# request is refused with 422 total_mismatch, which shows both values.
|
|
311
|
+
?expectedTotal: String
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
type create_emission_point = {
|
|
315
|
+
# Emission point code (punto de emisión), 3 digits. It cannot be changed later.
|
|
316
|
+
code: String
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
type create_establishment = {
|
|
320
|
+
# Establishment code (estab), 3 digits, as registered in the RUC. It cannot be changed later.
|
|
321
|
+
code: String,
|
|
322
|
+
|
|
323
|
+
# Address of the establishment (dirección del establecimiento).
|
|
324
|
+
address: String
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
# An invoice (factura). Send quantities, prices and tax rates; Flashpi computes the line
|
|
328
|
+
# subtotals, the taxes per rate, the tip and the total with the SRI rounding rules.
|
|
329
|
+
type create_invoice = {
|
|
330
|
+
# The issuer (taxpayer) that issues the document. Format: uuid.
|
|
331
|
+
issuerId: String,
|
|
332
|
+
|
|
333
|
+
# Establishment code (3 digits) registered on the issuer.
|
|
334
|
+
establishment: String,
|
|
335
|
+
|
|
336
|
+
# Emission point code (3 digits) registered on the establishment.
|
|
337
|
+
emissionPoint: String,
|
|
338
|
+
|
|
339
|
+
# Issue date, YYYY-MM-DD. Defaults to today in Ecuador; it cannot be later. Format: date.
|
|
340
|
+
?issueDate: String,
|
|
341
|
+
|
|
342
|
+
# Sequential to use instead of the next one, for example when migrating from another system.
|
|
343
|
+
# It must not be used yet; later automatic sequentials continue after the highest one used.
|
|
344
|
+
# Not accepted with the shared demo issuer (422 demo_issuer_sequential_not_allowed).
|
|
345
|
+
?sequential: Integer,
|
|
346
|
+
|
|
347
|
+
# Additional information printed on the document (name → value, 1 to 300 characters each). A
|
|
348
|
+
# document carries at most 15 fields including the legends Flashpi adds (RUC Proveedor, and
|
|
349
|
+
# Gran Contribuyente for large taxpayers), so at most 13 or 14 of yours.
|
|
350
|
+
?additionalInfo: Hash[Symbol, String],
|
|
351
|
+
|
|
352
|
+
# Delivery options.
|
|
353
|
+
?options: document_options,
|
|
354
|
+
|
|
355
|
+
# The buyer. `final_consumer` may omit `id` and `name`; the maximum amount of a final consumer
|
|
356
|
+
# invoice is not enforced yet.
|
|
357
|
+
customer: document_party,
|
|
358
|
+
|
|
359
|
+
# The lines of the document.
|
|
360
|
+
items: Array[document_item],
|
|
361
|
+
|
|
362
|
+
# How the invoice is paid; the payments must add up to the total.
|
|
363
|
+
payments: Array[document_payment],
|
|
364
|
+
|
|
365
|
+
# Tip (propina). Defaults to 0.
|
|
366
|
+
?tip: String,
|
|
367
|
+
|
|
368
|
+
# Number of the waybill (guía de remisión) that carried the goods.
|
|
369
|
+
?waybillNumber: String,
|
|
370
|
+
|
|
371
|
+
# The total you expect. Flashpi computes every total; when it differs from this value the
|
|
372
|
+
# request is refused with 422 total_mismatch, which shows both values.
|
|
373
|
+
?expectedTotal: String
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
type create_issuer = {
|
|
377
|
+
# RUC: 13 digits ending in 001. Only the format is checked: newer RUCs fail the modulo-11
|
|
378
|
+
# check digit, so it is never verified. It cannot be changed later.
|
|
379
|
+
ruc: String,
|
|
380
|
+
|
|
381
|
+
# Legal name (razón social) as registered in the RUC.
|
|
382
|
+
legalName: String,
|
|
383
|
+
|
|
384
|
+
# Trade name (nombre comercial).
|
|
385
|
+
?tradeName: String?,
|
|
386
|
+
|
|
387
|
+
# Head office address (dirección matriz).
|
|
388
|
+
headOfficeAddress: String,
|
|
389
|
+
taxProfile: issuer_tax_profile_input,
|
|
390
|
+
?branding: issuer_branding_input,
|
|
391
|
+
|
|
392
|
+
# Default of a document request's `options.sendEmail`: true emails every authorized document
|
|
393
|
+
# (RIDE PDF and XML) to its buyer, false opts the issuer out. A request that sets
|
|
394
|
+
# `options.sendEmail` decides for itself. Default: `true`.
|
|
395
|
+
?sendEmailByDefault: bool
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
# A purchase settlement (liquidación de compra): the buyer documents a purchase from a supplier
|
|
399
|
+
# without a RUC or who cannot issue invoices. Lines take VAT only.
|
|
400
|
+
type create_purchase_settlement = {
|
|
401
|
+
# The issuer (taxpayer) that issues the document. Format: uuid.
|
|
402
|
+
issuerId: String,
|
|
403
|
+
|
|
404
|
+
# Establishment code (3 digits) registered on the issuer.
|
|
405
|
+
establishment: String,
|
|
406
|
+
|
|
407
|
+
# Emission point code (3 digits) registered on the establishment.
|
|
408
|
+
emissionPoint: String,
|
|
409
|
+
|
|
410
|
+
# Issue date, YYYY-MM-DD. Defaults to today in Ecuador; it cannot be later. Format: date.
|
|
411
|
+
?issueDate: String,
|
|
412
|
+
|
|
413
|
+
# Sequential to use instead of the next one, for example when migrating from another system.
|
|
414
|
+
# It must not be used yet; later automatic sequentials continue after the highest one used.
|
|
415
|
+
# Not accepted with the shared demo issuer (422 demo_issuer_sequential_not_allowed).
|
|
416
|
+
?sequential: Integer,
|
|
417
|
+
|
|
418
|
+
# Additional information printed on the document (name → value, 1 to 300 characters each). A
|
|
419
|
+
# document carries at most 15 fields including the legends Flashpi adds (RUC Proveedor, and
|
|
420
|
+
# Gran Contribuyente for large taxpayers), so at most 13 or 14 of yours.
|
|
421
|
+
?additionalInfo: Hash[Symbol, String],
|
|
422
|
+
|
|
423
|
+
# Delivery options.
|
|
424
|
+
?options: document_options,
|
|
425
|
+
|
|
426
|
+
# The supplier. It cannot be a final consumer.
|
|
427
|
+
supplier: document_party,
|
|
428
|
+
|
|
429
|
+
# The lines of the document.
|
|
430
|
+
items: Array[document_item],
|
|
431
|
+
|
|
432
|
+
# How the purchase is paid; the payments must add up to the total and each one needs a `term`.
|
|
433
|
+
payments: Array[document_payment],
|
|
434
|
+
|
|
435
|
+
# The total you expect. Flashpi computes every total; when it differs from this value the
|
|
436
|
+
# request is refused with 422 total_mismatch, which shows both values.
|
|
437
|
+
?expectedTotal: String
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
# A waybill (guía de remisión) that supports the transport of goods.
|
|
441
|
+
type create_waybill = {
|
|
442
|
+
# The issuer (taxpayer) that issues the document. Format: uuid.
|
|
443
|
+
issuerId: String,
|
|
444
|
+
|
|
445
|
+
# Establishment code (3 digits) registered on the issuer.
|
|
446
|
+
establishment: String,
|
|
447
|
+
|
|
448
|
+
# Emission point code (3 digits) registered on the establishment.
|
|
449
|
+
emissionPoint: String,
|
|
450
|
+
|
|
451
|
+
# Issue date, YYYY-MM-DD. Defaults to today in Ecuador; it cannot be later. Format: date.
|
|
452
|
+
?issueDate: String,
|
|
453
|
+
|
|
454
|
+
# Sequential to use instead of the next one, for example when migrating from another system.
|
|
455
|
+
# It must not be used yet; later automatic sequentials continue after the highest one used.
|
|
456
|
+
# Not accepted with the shared demo issuer (422 demo_issuer_sequential_not_allowed).
|
|
457
|
+
?sequential: Integer,
|
|
458
|
+
|
|
459
|
+
# Additional information printed on the document (name → value, 1 to 300 characters each). A
|
|
460
|
+
# document carries at most 15 fields including the legends Flashpi adds (RUC Proveedor, and
|
|
461
|
+
# Gran Contribuyente for large taxpayers), so at most 13 or 14 of yours.
|
|
462
|
+
?additionalInfo: Hash[Symbol, String],
|
|
463
|
+
|
|
464
|
+
# Delivery options.
|
|
465
|
+
?options: document_options,
|
|
466
|
+
|
|
467
|
+
# Where the transport starts.
|
|
468
|
+
departureAddress: String,
|
|
469
|
+
|
|
470
|
+
# The carrier.
|
|
471
|
+
carrier: waybill_carrier,
|
|
472
|
+
|
|
473
|
+
# License plate of the vehicle.
|
|
474
|
+
licensePlate: String,
|
|
475
|
+
|
|
476
|
+
# Start of the transport; not before the issue date. Format: date.
|
|
477
|
+
transportStartDate: String,
|
|
478
|
+
|
|
479
|
+
# End of the transport; not before its start. Format: date.
|
|
480
|
+
transportEndDate: String,
|
|
481
|
+
|
|
482
|
+
# The recipients and their goods.
|
|
483
|
+
recipients: Array[waybill_recipient]
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
type create_webhook_endpoint = {
|
|
487
|
+
# Where Flashpi POSTs the events: a public HTTPS URL without credentials or fragment. Changing
|
|
488
|
+
# it requires a new verification.
|
|
489
|
+
url: String,
|
|
490
|
+
|
|
491
|
+
# A label for your own reference.
|
|
492
|
+
?description: String?,
|
|
493
|
+
|
|
494
|
+
# Event types the endpoint receives; `*` receives every type, including future ones.
|
|
495
|
+
enabledEvents: Array[create_webhook_endpoint_enabled_events_item],
|
|
496
|
+
|
|
497
|
+
# `full` (default): the event with a snapshot of its resource in `data`. `thin`: the event
|
|
498
|
+
# without `data`, only `id`, `type`, `environment` and `createdAt` (read the snapshot with GET
|
|
499
|
+
# /v1/events/{id}). Default: `"full"`.
|
|
500
|
+
?payloadMode: create_webhook_endpoint_payload_mode
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
type create_webhook_endpoint_enabled_events_item = "invoice.authorized"
|
|
504
|
+
| "invoice.rejected"
|
|
505
|
+
| "purchase_settlement.authorized"
|
|
506
|
+
| "purchase_settlement.rejected"
|
|
507
|
+
| "credit_note.authorized"
|
|
508
|
+
| "credit_note.rejected"
|
|
509
|
+
| "debit_note.authorized"
|
|
510
|
+
| "debit_note.rejected"
|
|
511
|
+
| "waybill.authorized"
|
|
512
|
+
| "waybill.rejected"
|
|
513
|
+
| "withholding.authorized"
|
|
514
|
+
| "withholding.rejected"
|
|
515
|
+
| "certificate.verified"
|
|
516
|
+
| "certificate.pending"
|
|
517
|
+
| "certificate.blocked"
|
|
518
|
+
| "certificate.revoked"
|
|
519
|
+
| "certificate.reactivated"
|
|
520
|
+
| "document.ride.generated"
|
|
521
|
+
| "document.ride.failed"
|
|
522
|
+
| "document.email.sent"
|
|
523
|
+
| "document.email.delivered"
|
|
524
|
+
| "document.email.bounced"
|
|
525
|
+
| "document.email.complained"
|
|
526
|
+
| "document.email.failed"
|
|
527
|
+
| "account.email_paused"
|
|
528
|
+
| "account.email_resumed"
|
|
529
|
+
| "*"
|
|
530
|
+
|
|
531
|
+
# `full` (default): the event with a snapshot of its resource in `data`. `thin`: the event
|
|
532
|
+
# without `data`, only `id`, `type`, `environment` and `createdAt` (read the snapshot with GET
|
|
533
|
+
# /v1/events/{id}). Default: `"full"`.
|
|
534
|
+
type create_webhook_endpoint_payload_mode = "full" | "thin"
|
|
535
|
+
|
|
536
|
+
# A withholding receipt (comprobante de retención). Flashpi computes every withheld amount and
|
|
537
|
+
# the total withheld.
|
|
538
|
+
type create_withholding = {
|
|
539
|
+
# The issuer (taxpayer) that issues the document. Format: uuid.
|
|
540
|
+
issuerId: String,
|
|
541
|
+
|
|
542
|
+
# Establishment code (3 digits) registered on the issuer.
|
|
543
|
+
establishment: String,
|
|
544
|
+
|
|
545
|
+
# Emission point code (3 digits) registered on the establishment.
|
|
546
|
+
emissionPoint: String,
|
|
547
|
+
|
|
548
|
+
# Issue date, YYYY-MM-DD. Defaults to today in Ecuador; it cannot be later. Format: date.
|
|
549
|
+
?issueDate: String,
|
|
550
|
+
|
|
551
|
+
# Sequential to use instead of the next one, for example when migrating from another system.
|
|
552
|
+
# It must not be used yet; later automatic sequentials continue after the highest one used.
|
|
553
|
+
# Not accepted with the shared demo issuer (422 demo_issuer_sequential_not_allowed).
|
|
554
|
+
?sequential: Integer,
|
|
555
|
+
|
|
556
|
+
# Additional information printed on the document (name → value, 1 to 300 characters each). A
|
|
557
|
+
# document carries at most 15 fields including the legends Flashpi adds (RUC Proveedor, and
|
|
558
|
+
# Gran Contribuyente for large taxpayers), so at most 13 or 14 of yours.
|
|
559
|
+
?additionalInfo: Hash[Symbol, String],
|
|
560
|
+
|
|
561
|
+
# Delivery options.
|
|
562
|
+
?options: document_options,
|
|
563
|
+
|
|
564
|
+
# The withheld supplier.
|
|
565
|
+
subject: withheld_subject,
|
|
566
|
+
|
|
567
|
+
# Fiscal period, YYYY-MM. Defaults to the month of the issue date.
|
|
568
|
+
?fiscalPeriod: String,
|
|
569
|
+
|
|
570
|
+
# The supporting documents and their withholdings.
|
|
571
|
+
supportingDocuments: Array[supporting_document],
|
|
572
|
+
|
|
573
|
+
# The total withheld you expect; when it differs from the computed one the request is refused
|
|
574
|
+
# with 422 total_mismatch.
|
|
575
|
+
?expectedTotal: String
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
# A reason for a debit note and its amount before taxes.
|
|
579
|
+
type debit_note_reason = {
|
|
580
|
+
# Reason.
|
|
581
|
+
description: String,
|
|
582
|
+
|
|
583
|
+
# Amount before taxes.
|
|
584
|
+
amount: String,
|
|
585
|
+
|
|
586
|
+
# The VAT of this amount (exactly one `vat`).
|
|
587
|
+
taxes: Array[document_tax]
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
# An SRI document of any type.
|
|
591
|
+
type document = {
|
|
592
|
+
# Format: uuid.
|
|
593
|
+
id: String,
|
|
594
|
+
type: document_type,
|
|
595
|
+
|
|
596
|
+
# Mode of the API key that issued it: `test` (SRI pruebas) or `live`.
|
|
597
|
+
environment: document_environment,
|
|
598
|
+
|
|
599
|
+
# Tax status: `processing` (being signed and sent), `pending_sri` (waiting for the SRI),
|
|
600
|
+
# `authorized`, `rejected`, `failed` or `voided`.
|
|
601
|
+
status: document_status,
|
|
602
|
+
|
|
603
|
+
# Format: uuid.
|
|
604
|
+
issuerId: String,
|
|
605
|
+
establishment: String,
|
|
606
|
+
emissionPoint: String,
|
|
607
|
+
sequential: Integer | Float,
|
|
608
|
+
|
|
609
|
+
# Establishment-emission point-sequential.
|
|
610
|
+
number: String,
|
|
611
|
+
|
|
612
|
+
# The 49-digit access key, also the authorization number.
|
|
613
|
+
accessKey: String,
|
|
614
|
+
|
|
615
|
+
# Format: date.
|
|
616
|
+
issueDate: String,
|
|
617
|
+
|
|
618
|
+
# Version of the SRI XML.
|
|
619
|
+
xmlVersion: String,
|
|
620
|
+
counterparty: document_counterparty?,
|
|
621
|
+
|
|
622
|
+
# Null for waybills.
|
|
623
|
+
totals: document_totals?,
|
|
624
|
+
authorization: document_authorization,
|
|
625
|
+
ride: document_ride,
|
|
626
|
+
email: document_email,
|
|
627
|
+
|
|
628
|
+
# Messages of the last SRI answer, mapped to Flashpi codes (the reasons of a rejection, or
|
|
629
|
+
# warnings of an authorization). Texts follow Accept-Language (English or Spanish).
|
|
630
|
+
sriMessages: Array[document_sri_message],
|
|
631
|
+
|
|
632
|
+
# Set when `status` is `failed`.
|
|
633
|
+
failure: document_failure?,
|
|
634
|
+
|
|
635
|
+
# Format: date-time.
|
|
636
|
+
voidedAt: String?,
|
|
637
|
+
|
|
638
|
+
# Format: date-time.
|
|
639
|
+
createdAt: String,
|
|
640
|
+
|
|
641
|
+
# Format: date-time.
|
|
642
|
+
updatedAt: String
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
# The SRI authorization.
|
|
646
|
+
type document_authorization = {
|
|
647
|
+
# Authorization number (the access key), once authorized.
|
|
648
|
+
number: String?,
|
|
649
|
+
|
|
650
|
+
# Format: date-time.
|
|
651
|
+
authorizedAt: String?
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
# The buyer, supplier, withheld subject or carrier.
|
|
655
|
+
type document_counterparty = {
|
|
656
|
+
id: String,
|
|
657
|
+
name: String
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
# Email delivery, separate from the tax status: sent only once the document is authorized, when
|
|
661
|
+
# it was requested and there is a recipient.
|
|
662
|
+
type document_email = {
|
|
663
|
+
# Whether the email was requested.
|
|
664
|
+
requested: bool,
|
|
665
|
+
|
|
666
|
+
# `not_requested` (opted out), `skipped` (no recipient), `queued` (sent once authorized), then
|
|
667
|
+
# `sent`, `delivered`, `bounced`, `complained` or `failed`.
|
|
668
|
+
status: document_email_status,
|
|
669
|
+
deliveries: Array[document_email_delivery],
|
|
670
|
+
|
|
671
|
+
# Warnings about the recipient's address, computed when the document is read: empty when
|
|
672
|
+
# nothing looks wrong.
|
|
673
|
+
warnings: Array[document_email_warning]
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
# One email to one recipient.
|
|
677
|
+
type document_email_delivery = {
|
|
678
|
+
# Format: uuid.
|
|
679
|
+
id: String,
|
|
680
|
+
recipient: String,
|
|
681
|
+
status: document_email_delivery_status,
|
|
682
|
+
|
|
683
|
+
# Format: date-time.
|
|
684
|
+
sentAt: String?,
|
|
685
|
+
|
|
686
|
+
# Format: date-time.
|
|
687
|
+
lastEventAt: String?,
|
|
688
|
+
|
|
689
|
+
# Why the email failed or bounced, as a code: for example `rejected`, `timeout`,
|
|
690
|
+
# `invalid_address`, `bounce_permanent`, `bounce_suppressed` (the address is on the
|
|
691
|
+
# suppression list of Flashpi's email provider after an earlier bounce or complaint),
|
|
692
|
+
# `complaint`, `account_email_limit_reached` (the account's emails of the day were used up;
|
|
693
|
+
# nothing was sent), `platform_email_limit_reached` (Flashpi's emails of the day across all
|
|
694
|
+
# accounts were used up; nothing was sent), `email_sending_paused` (the account's emails of
|
|
695
|
+
# the mode are paused; nothing was sent), `platform_email_sending_paused` (Flashpi paused the
|
|
696
|
+
# emails of its email provider for every account after too many bounces or complaints; nothing
|
|
697
|
+
# was sent), `test_recipient_not_allowed` (a test document whose recipient is not a verified
|
|
698
|
+
# member of the account's team; nothing was sent: download the RIDE and the XML to send them)
|
|
699
|
+
# or `invalid_domain` (the recipient's domain does not exist or receives no mail: no MX, A or
|
|
700
|
+
# AAAA record, or a null MX; nothing was sent).
|
|
701
|
+
error: String?
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
type document_email_delivery_status = "queued"
|
|
705
|
+
| "sent"
|
|
706
|
+
| "delivered"
|
|
707
|
+
| "bounced"
|
|
708
|
+
| "complained"
|
|
709
|
+
| "failed"
|
|
710
|
+
|
|
711
|
+
# `not_requested` (opted out), `skipped` (no recipient), `queued` (sent once authorized), then
|
|
712
|
+
# `sent`, `delivered`, `bounced`, `complained` or `failed`.
|
|
713
|
+
type document_email_status = "not_requested"
|
|
714
|
+
| "skipped"
|
|
715
|
+
| "queued"
|
|
716
|
+
| "sent"
|
|
717
|
+
| "delivered"
|
|
718
|
+
| "bounced"
|
|
719
|
+
| "complained"
|
|
720
|
+
| "failed"
|
|
721
|
+
|
|
722
|
+
# Something about the email that looks wrong. A warning never stops or changes the email.
|
|
723
|
+
type document_email_warning = {
|
|
724
|
+
# `recipient_domain_typo`: the recipient's domain looks like a typo of a common mail domain
|
|
725
|
+
# (for example gmial.com for gmail.com). The email is still sent to the address as given;
|
|
726
|
+
# nothing changes it.
|
|
727
|
+
code: document_email_warning_code,
|
|
728
|
+
|
|
729
|
+
# Follows Accept-Language (English or Spanish).
|
|
730
|
+
message: String,
|
|
731
|
+
|
|
732
|
+
# The address with the suggested domain.
|
|
733
|
+
suggestedRecipient: String
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
# `recipient_domain_typo`: the recipient's domain looks like a typo of a common mail domain (for
|
|
737
|
+
# example gmial.com for gmail.com). The email is still sent to the address as given; nothing
|
|
738
|
+
# changes it.
|
|
739
|
+
type document_email_warning_code = "recipient_domain_typo"
|
|
740
|
+
|
|
741
|
+
# Mode of the API key that issued it: `test` (SRI pruebas) or `live`.
|
|
742
|
+
type document_environment = "test" | "live"
|
|
743
|
+
|
|
744
|
+
# An event about a document (its tax outcome, RIDE or email): `data` is the Document as the API
|
|
745
|
+
# returned it when the event happened (texts in English).
|
|
746
|
+
type document_event = {
|
|
747
|
+
# Format: uuid.
|
|
748
|
+
id: String,
|
|
749
|
+
type: document_event_type,
|
|
750
|
+
|
|
751
|
+
# Mode of the resource.
|
|
752
|
+
environment: document_event_environment,
|
|
753
|
+
|
|
754
|
+
# Format: date-time.
|
|
755
|
+
createdAt: String,
|
|
756
|
+
data: document
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
# Mode of the resource.
|
|
760
|
+
type document_event_environment = "test" | "live"
|
|
761
|
+
|
|
762
|
+
type document_event_type = "invoice.authorized"
|
|
763
|
+
| "invoice.rejected"
|
|
764
|
+
| "purchase_settlement.authorized"
|
|
765
|
+
| "purchase_settlement.rejected"
|
|
766
|
+
| "credit_note.authorized"
|
|
767
|
+
| "credit_note.rejected"
|
|
768
|
+
| "debit_note.authorized"
|
|
769
|
+
| "debit_note.rejected"
|
|
770
|
+
| "waybill.authorized"
|
|
771
|
+
| "waybill.rejected"
|
|
772
|
+
| "withholding.authorized"
|
|
773
|
+
| "withholding.rejected"
|
|
774
|
+
| "document.ride.generated"
|
|
775
|
+
| "document.ride.failed"
|
|
776
|
+
| "document.email.sent"
|
|
777
|
+
| "document.email.delivered"
|
|
778
|
+
| "document.email.bounced"
|
|
779
|
+
| "document.email.complained"
|
|
780
|
+
| "document.email.failed"
|
|
781
|
+
|
|
782
|
+
# Why a `failed` document could not reach an SRI answer.
|
|
783
|
+
type document_failure = {
|
|
784
|
+
code: document_failure_code,
|
|
785
|
+
message: String
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
type document_failure_code = "certificate_required"
|
|
789
|
+
| "certificate_expired"
|
|
790
|
+
| "certificate_not_yet_valid"
|
|
791
|
+
| "certificate_blocked"
|
|
792
|
+
| "certificate_revoked"
|
|
793
|
+
| "certificate_unusable"
|
|
794
|
+
| "document_too_large"
|
|
795
|
+
| "document_invalid"
|
|
796
|
+
| "signing_failed"
|
|
797
|
+
| "sri_unavailable"
|
|
798
|
+
| "sri_authorization_timeout"
|
|
799
|
+
| "sri_request_refused"
|
|
800
|
+
| "sri_environment_mismatch"
|
|
801
|
+
|
|
802
|
+
# A line of an invoice, credit note or purchase settlement. Flashpi computes its subtotal
|
|
803
|
+
# (quantity × unit price − discount, rounded to 2 decimals) and its taxes.
|
|
804
|
+
type document_item = {
|
|
805
|
+
# Your product code. Required on invoices and purchase settlements.
|
|
806
|
+
?code: String,
|
|
807
|
+
|
|
808
|
+
# A second code, for example the barcode.
|
|
809
|
+
?auxiliaryCode: String,
|
|
810
|
+
|
|
811
|
+
# Description.
|
|
812
|
+
description: String,
|
|
813
|
+
|
|
814
|
+
# Unit of measure (invoices and purchase settlements).
|
|
815
|
+
?unit: String,
|
|
816
|
+
|
|
817
|
+
# Quantity, up to 6 decimals.
|
|
818
|
+
quantity: String,
|
|
819
|
+
|
|
820
|
+
# Unit price without taxes, up to 6 decimals.
|
|
821
|
+
unitPrice: String,
|
|
822
|
+
|
|
823
|
+
# Discount amount of the line (not a percentage), up to 2 decimals. Defaults to 0.
|
|
824
|
+
?discount: String,
|
|
825
|
+
|
|
826
|
+
# The taxes of the line.
|
|
827
|
+
taxes: Array[document_tax],
|
|
828
|
+
|
|
829
|
+
# Up to 3 extra details printed with the line (name → value, 1 to 300 characters).
|
|
830
|
+
?additionalDetails: Hash[Symbol, String]
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
# A page of documents, newest first.
|
|
834
|
+
type document_list = {
|
|
835
|
+
data: Array[document],
|
|
836
|
+
pagination: pagination
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
# How Flashpi delivers the document once the SRI authorizes it.
|
|
840
|
+
type document_options = {
|
|
841
|
+
# Email the authorized document (PDF and XML) to the counterparty, when it has an email
|
|
842
|
+
# address. Defaults to the issuer's `sendEmailByDefault` (true unless the issuer opted out).
|
|
843
|
+
?sendEmail: bool,
|
|
844
|
+
|
|
845
|
+
# Sync mode: wait for the SRI before answering. The response is 200 with the document once it
|
|
846
|
+
# is authorized, rejected or failed, or 202 with its current status (usually `pending_sri`)
|
|
847
|
+
# when the wait ends first; the document then continues asynchronously. Defaults to false (202
|
|
848
|
+
# at once).
|
|
849
|
+
?waitForAuthorization: bool,
|
|
850
|
+
|
|
851
|
+
# Sync mode: the longest wait, in seconds, from 1 to 30. Defaults to 15. A longer wait is
|
|
852
|
+
# refused with `out_of_range`. Used only with `waitForAuthorization`.
|
|
853
|
+
?waitTimeoutSeconds: Integer
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
# The buyer of an invoice, credit or debit note, or the supplier of a purchase settlement.
|
|
857
|
+
type document_party = {
|
|
858
|
+
# Identification type: `ruc` (13 digits ending in 001, format only), `cedula` (10 digits,
|
|
859
|
+
# check digit verified), `passport`, `final_consumer` (no identification; only invoices accept
|
|
860
|
+
# it) or `foreign_id` (issued by the tax authority of another country).
|
|
861
|
+
idType: document_party_id_type,
|
|
862
|
+
|
|
863
|
+
# Identification number. Required unless `idType` is `final_consumer`, whose number is always
|
|
864
|
+
# 9999999999999.
|
|
865
|
+
?id: String,
|
|
866
|
+
|
|
867
|
+
# Legal name or full name. Required unless `idType` is `final_consumer` (printed as CONSUMIDOR
|
|
868
|
+
# FINAL).
|
|
869
|
+
?name: String,
|
|
870
|
+
|
|
871
|
+
# Address. Credit and debit notes do not print it.
|
|
872
|
+
?address: String,
|
|
873
|
+
|
|
874
|
+
# Where the authorized document is emailed (see `options.sendEmail`). Format: email.
|
|
875
|
+
?email: String
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
# Identification type: `ruc` (13 digits ending in 001, format only), `cedula` (10 digits, check
|
|
879
|
+
# digit verified), `passport`, `final_consumer` (no identification; only invoices accept it) or
|
|
880
|
+
# `foreign_id` (issued by the tax authority of another country).
|
|
881
|
+
type document_party_id_type = "ruc" | "cedula" | "passport" | "final_consumer" | "foreign_id"
|
|
882
|
+
|
|
883
|
+
# A payment. The payments must add up to the document total.
|
|
884
|
+
type document_payment = {
|
|
885
|
+
# Payment method: `cash` (without the financial system), `debt_offset`, `debit_card`,
|
|
886
|
+
# `electronic_money`, `prepaid_card`, `credit_card`, `other_financial_system` (bank transfers,
|
|
887
|
+
# checks and other payments through the financial system) or `securities_endorsement`.
|
|
888
|
+
method: document_payment_method,
|
|
889
|
+
|
|
890
|
+
# Amount paid with this method.
|
|
891
|
+
amount: String,
|
|
892
|
+
|
|
893
|
+
# Payment term in `termUnit` units. Required on purchase settlements.
|
|
894
|
+
?term: String,
|
|
895
|
+
|
|
896
|
+
# Unit of `term`: `days` or `months`.
|
|
897
|
+
?termUnit: document_payment_term_unit
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
# Payment method: `cash` (without the financial system), `debt_offset`, `debit_card`,
|
|
901
|
+
# `electronic_money`, `prepaid_card`, `credit_card`, `other_financial_system` (bank transfers,
|
|
902
|
+
# checks and other payments through the financial system) or `securities_endorsement`.
|
|
903
|
+
type document_payment_method = "cash"
|
|
904
|
+
| "debt_offset"
|
|
905
|
+
| "debit_card"
|
|
906
|
+
| "electronic_money"
|
|
907
|
+
| "prepaid_card"
|
|
908
|
+
| "credit_card"
|
|
909
|
+
| "other_financial_system"
|
|
910
|
+
| "securities_endorsement"
|
|
911
|
+
|
|
912
|
+
# Unit of `term`: `days` or `months`.
|
|
913
|
+
type document_payment_term_unit = "days" | "months"
|
|
914
|
+
|
|
915
|
+
# The RIDE (printed PDF), generated once the document is authorized.
|
|
916
|
+
type document_ride = {
|
|
917
|
+
status: document_ride_status,
|
|
918
|
+
template: document_ride_template?,
|
|
919
|
+
|
|
920
|
+
# Format: date-time.
|
|
921
|
+
generatedAt: String?
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
type document_ride_status = "pending" | "generated" | "failed"
|
|
925
|
+
|
|
926
|
+
type document_ride_template = "modern" | "classic" | "minimal"
|
|
927
|
+
|
|
928
|
+
# A message of the SRI, mapped by Flashpi.
|
|
929
|
+
type document_sri_message = {
|
|
930
|
+
# Flashpi error code.
|
|
931
|
+
code: String,
|
|
932
|
+
message: String,
|
|
933
|
+
severity: document_sri_message_severity
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
type document_sri_message_severity = "error" | "warning"
|
|
937
|
+
|
|
938
|
+
# Tax status: `processing` (being signed and sent), `pending_sri` (waiting for the SRI),
|
|
939
|
+
# `authorized`, `rejected`, `failed` or `voided`.
|
|
940
|
+
type document_status = "processing"
|
|
941
|
+
| "pending_sri"
|
|
942
|
+
| "authorized"
|
|
943
|
+
| "rejected"
|
|
944
|
+
| "failed"
|
|
945
|
+
| "voided"
|
|
946
|
+
|
|
947
|
+
# A tax of a line. Every line needs exactly one `vat`; invoices and credit notes accept one ad
|
|
948
|
+
# valorem `ice` too. Flashpi computes the bases and amounts.
|
|
949
|
+
type document_tax = {
|
|
950
|
+
# `vat` (IVA) or `ice` (ICE).
|
|
951
|
+
type: document_tax_type,
|
|
952
|
+
|
|
953
|
+
# For `vat`, the rate: `0`, `5`, `8` (differentiated, tourism), `12`, `13`, `14`, `15`,
|
|
954
|
+
# `exempt` or `not_subject`; it must be in force on the issue date (for credit and debit
|
|
955
|
+
# notes, on the modified document issue date). For `ice`, the ad valorem percentage with up to
|
|
956
|
+
# 2 decimals (for example `75`).
|
|
957
|
+
rate: String,
|
|
958
|
+
|
|
959
|
+
# For `ice` only (required): the 4-digit ICE code of TABLA 18.
|
|
960
|
+
?code: String
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
# A tax total, grouped per tax and rate.
|
|
964
|
+
type document_tax_total = {
|
|
965
|
+
type: document_tax_total_type,
|
|
966
|
+
|
|
967
|
+
# VAT: the rate (`15`, `0`, `exempt`, ...). ICE: the percentage.
|
|
968
|
+
rate: String,
|
|
969
|
+
|
|
970
|
+
# ICE: the TABLA 18 code.
|
|
971
|
+
?code: String,
|
|
972
|
+
|
|
973
|
+
# Taxable base.
|
|
974
|
+
taxableBase: String,
|
|
975
|
+
|
|
976
|
+
# Tax amount.
|
|
977
|
+
amount: String
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
type document_tax_total_type = "vat" | "ice"
|
|
981
|
+
|
|
982
|
+
# `vat` (IVA) or `ice` (ICE).
|
|
983
|
+
type document_tax_type = "vat" | "ice"
|
|
984
|
+
|
|
985
|
+
# Totals computed by Flashpi. Invoices have every field but `withheld`; purchase settlements and
|
|
986
|
+
# credit notes have no `tip`; debit notes have no `discount` nor `tip`; withholding receipts
|
|
987
|
+
# only have `withheld`.
|
|
988
|
+
type document_totals = {
|
|
989
|
+
# Sum of the line subtotals.
|
|
990
|
+
?subtotal: String,
|
|
991
|
+
|
|
992
|
+
# Sum of the line discounts.
|
|
993
|
+
?discount: String,
|
|
994
|
+
?taxes: Array[document_tax_total],
|
|
995
|
+
|
|
996
|
+
# Tip.
|
|
997
|
+
?tip: String,
|
|
998
|
+
|
|
999
|
+
# Total (credited amount of a credit note, total of a debit note).
|
|
1000
|
+
?total: String,
|
|
1001
|
+
|
|
1002
|
+
# Total withheld.
|
|
1003
|
+
?withheld: String
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
type document_type = "invoice"
|
|
1007
|
+
| "purchase_settlement"
|
|
1008
|
+
| "credit_note"
|
|
1009
|
+
| "debit_note"
|
|
1010
|
+
| "waybill"
|
|
1011
|
+
| "withholding"
|
|
1012
|
+
|
|
1013
|
+
# The query of `documentsList` (GET /v1/documents).
|
|
1014
|
+
type documents_list_query = {
|
|
1015
|
+
# Maximum number of items to return. Default: `20`.
|
|
1016
|
+
?limit: Integer,
|
|
1017
|
+
|
|
1018
|
+
# The `pagination.nextCursor` of the previous page. Omit it for the first page.
|
|
1019
|
+
?cursor: String,
|
|
1020
|
+
|
|
1021
|
+
# Only documents of this issuer. Format: uuid.
|
|
1022
|
+
?issuerId: String,
|
|
1023
|
+
|
|
1024
|
+
# Only this document type.
|
|
1025
|
+
?type: documents_list_query_type,
|
|
1026
|
+
|
|
1027
|
+
# Only this tax status.
|
|
1028
|
+
?status: documents_list_query_status,
|
|
1029
|
+
|
|
1030
|
+
# Only documents issued on or after this date. Format: date.
|
|
1031
|
+
?issueDateFrom: String,
|
|
1032
|
+
|
|
1033
|
+
# Only documents issued on or before this date. Format: date.
|
|
1034
|
+
?issueDateTo: String,
|
|
1035
|
+
|
|
1036
|
+
# Only documents of this buyer, supplier, withheld subject or carrier.
|
|
1037
|
+
?counterpartyId: String,
|
|
1038
|
+
|
|
1039
|
+
# The document with this access key.
|
|
1040
|
+
?accessKey: String
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
type documents_list_query_status = "processing"
|
|
1044
|
+
| "pending_sri"
|
|
1045
|
+
| "authorized"
|
|
1046
|
+
| "rejected"
|
|
1047
|
+
| "failed"
|
|
1048
|
+
| "voided"
|
|
1049
|
+
|
|
1050
|
+
type documents_list_query_type = "invoice"
|
|
1051
|
+
| "purchase_settlement"
|
|
1052
|
+
| "credit_note"
|
|
1053
|
+
| "debit_note"
|
|
1054
|
+
| "waybill"
|
|
1055
|
+
| "withholding"
|
|
1056
|
+
|
|
1057
|
+
# An emission point of an establishment.
|
|
1058
|
+
type emission_point = {
|
|
1059
|
+
# Format: uuid.
|
|
1060
|
+
id: String,
|
|
1061
|
+
|
|
1062
|
+
# Format: uuid.
|
|
1063
|
+
issuerId: String,
|
|
1064
|
+
|
|
1065
|
+
# Format: uuid.
|
|
1066
|
+
establishmentId: String,
|
|
1067
|
+
|
|
1068
|
+
# Emission point code (punto de emisión), 3 digits.
|
|
1069
|
+
code: String,
|
|
1070
|
+
|
|
1071
|
+
# Format: date-time.
|
|
1072
|
+
createdAt: String,
|
|
1073
|
+
|
|
1074
|
+
# Format: date-time.
|
|
1075
|
+
updatedAt: String
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
# A page of emission points, by code.
|
|
1079
|
+
type emission_point_list = {
|
|
1080
|
+
data: Array[emission_point],
|
|
1081
|
+
pagination: pagination
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
# The query of `emissionPointsList` (GET
|
|
1085
|
+
# /v1/issuers/{issuerId}/establishments/{establishmentId}/emission-points).
|
|
1086
|
+
type emission_points_list_query = {
|
|
1087
|
+
# Maximum number of items to return. Default: `20`.
|
|
1088
|
+
?limit: Integer,
|
|
1089
|
+
|
|
1090
|
+
# The `pagination.nextCursor` of the previous page. Omit it for the first page.
|
|
1091
|
+
?cursor: String
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
# Stable machine-readable error code, the same in every language. Branch on it, never on `type`,
|
|
1095
|
+
# `title` or `detail`. New codes may be added: handle an unknown one by its HTTP status.
|
|
1096
|
+
type error_code = "bad_request"
|
|
1097
|
+
| "malformed_json"
|
|
1098
|
+
| "invalid_correlation_id"
|
|
1099
|
+
| "validation_failed"
|
|
1100
|
+
| "authentication_required"
|
|
1101
|
+
| "forbidden"
|
|
1102
|
+
| "not_found"
|
|
1103
|
+
| "method_not_allowed"
|
|
1104
|
+
| "not_acceptable"
|
|
1105
|
+
| "conflict"
|
|
1106
|
+
| "payload_too_large"
|
|
1107
|
+
| "unsupported_media_type"
|
|
1108
|
+
| "rate_limited"
|
|
1109
|
+
| "internal_error"
|
|
1110
|
+
| "service_unavailable"
|
|
1111
|
+
| "invalid_api_key"
|
|
1112
|
+
| "key_scope_mismatch"
|
|
1113
|
+
| "key_read_only"
|
|
1114
|
+
| "ip_not_allowed"
|
|
1115
|
+
| "invalid_idempotency_key"
|
|
1116
|
+
| "idempotency_key_reused"
|
|
1117
|
+
| "idempotency_key_in_progress"
|
|
1118
|
+
| "issuer_already_exists"
|
|
1119
|
+
| "establishment_already_exists"
|
|
1120
|
+
| "emission_point_already_exists"
|
|
1121
|
+
| "resource_in_use"
|
|
1122
|
+
| "issuer_onboarding_not_ready"
|
|
1123
|
+
| "issuer_onboarding_expired"
|
|
1124
|
+
| "issuer_onboarding_completed"
|
|
1125
|
+
| "issuer_onboarding_rejected"
|
|
1126
|
+
| "total_mismatch"
|
|
1127
|
+
| "sequential_already_used"
|
|
1128
|
+
| "sequentials_exhausted"
|
|
1129
|
+
| "document_schema_invalid"
|
|
1130
|
+
| "document_too_large"
|
|
1131
|
+
| "document_not_authorized"
|
|
1132
|
+
| "ride_not_available"
|
|
1133
|
+
| "email_recipient_missing"
|
|
1134
|
+
| "email_already_queued"
|
|
1135
|
+
| "email_resend_limit_reached"
|
|
1136
|
+
| "account_email_limit_reached"
|
|
1137
|
+
| "email_sending_paused"
|
|
1138
|
+
| "test_recipient_not_allowed"
|
|
1139
|
+
| "platform_email_limit_reached"
|
|
1140
|
+
| "webhook_endpoint_disabled"
|
|
1141
|
+
| "webhook_endpoint_already_verified"
|
|
1142
|
+
| "webhook_endpoint_not_verified"
|
|
1143
|
+
| "webhook_delivery_in_progress"
|
|
1144
|
+
| "sandbox_not_enabled"
|
|
1145
|
+
| "demo_issuer_quota_exceeded"
|
|
1146
|
+
| "demo_issuer_unavailable"
|
|
1147
|
+
| "account_suspended"
|
|
1148
|
+
|
|
1149
|
+
# An establishment of an issuer.
|
|
1150
|
+
type establishment = {
|
|
1151
|
+
# Format: uuid.
|
|
1152
|
+
id: String,
|
|
1153
|
+
|
|
1154
|
+
# Format: uuid.
|
|
1155
|
+
issuerId: String,
|
|
1156
|
+
|
|
1157
|
+
# Establishment code (estab), 3 digits.
|
|
1158
|
+
code: String,
|
|
1159
|
+
|
|
1160
|
+
# Address of the establishment (dirección del establecimiento).
|
|
1161
|
+
address: String,
|
|
1162
|
+
|
|
1163
|
+
# Format: date-time.
|
|
1164
|
+
createdAt: String,
|
|
1165
|
+
|
|
1166
|
+
# Format: date-time.
|
|
1167
|
+
updatedAt: String
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
# A page of establishments, by code.
|
|
1171
|
+
type establishment_list = {
|
|
1172
|
+
data: Array[establishment],
|
|
1173
|
+
pagination: pagination
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
# The query of `establishmentsList` (GET /v1/issuers/{issuerId}/establishments).
|
|
1177
|
+
type establishments_list_query = {
|
|
1178
|
+
# Maximum number of items to return. Default: `20`.
|
|
1179
|
+
?limit: Integer,
|
|
1180
|
+
|
|
1181
|
+
# The `pagination.nextCursor` of the previous page. Omit it for the first page.
|
|
1182
|
+
?cursor: String
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
# Something that happened to a resource. The webhook body is this same object (without `data`
|
|
1186
|
+
# for thin endpoints), and `id` is its webhook-id header.
|
|
1187
|
+
type event = document_event | certificate_event | account_event
|
|
1188
|
+
|
|
1189
|
+
# A page of events, newest first.
|
|
1190
|
+
type event_list = {
|
|
1191
|
+
data: Array[event],
|
|
1192
|
+
pagination: pagination
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
# The body sent to `thin` endpoints: the event without its snapshot. Read it with GET
|
|
1196
|
+
# /v1/events/{id}.
|
|
1197
|
+
type event_thin = {
|
|
1198
|
+
# Format: uuid.
|
|
1199
|
+
id: String,
|
|
1200
|
+
type: event_thin_type,
|
|
1201
|
+
environment: event_thin_environment,
|
|
1202
|
+
|
|
1203
|
+
# Format: date-time.
|
|
1204
|
+
createdAt: String
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
type event_thin_environment = "test" | "live"
|
|
1208
|
+
|
|
1209
|
+
type event_thin_type = "invoice.authorized"
|
|
1210
|
+
| "invoice.rejected"
|
|
1211
|
+
| "purchase_settlement.authorized"
|
|
1212
|
+
| "purchase_settlement.rejected"
|
|
1213
|
+
| "credit_note.authorized"
|
|
1214
|
+
| "credit_note.rejected"
|
|
1215
|
+
| "debit_note.authorized"
|
|
1216
|
+
| "debit_note.rejected"
|
|
1217
|
+
| "waybill.authorized"
|
|
1218
|
+
| "waybill.rejected"
|
|
1219
|
+
| "withholding.authorized"
|
|
1220
|
+
| "withholding.rejected"
|
|
1221
|
+
| "certificate.verified"
|
|
1222
|
+
| "certificate.pending"
|
|
1223
|
+
| "certificate.blocked"
|
|
1224
|
+
| "certificate.revoked"
|
|
1225
|
+
| "certificate.reactivated"
|
|
1226
|
+
| "document.ride.generated"
|
|
1227
|
+
| "document.ride.failed"
|
|
1228
|
+
| "document.email.sent"
|
|
1229
|
+
| "document.email.delivered"
|
|
1230
|
+
| "document.email.bounced"
|
|
1231
|
+
| "document.email.complained"
|
|
1232
|
+
| "document.email.failed"
|
|
1233
|
+
| "account.email_paused"
|
|
1234
|
+
| "account.email_resumed"
|
|
1235
|
+
|
|
1236
|
+
# The query of `eventsList` (GET /v1/events).
|
|
1237
|
+
type events_list_query = {
|
|
1238
|
+
# Maximum number of items to return. Default: `20`.
|
|
1239
|
+
?limit: Integer,
|
|
1240
|
+
|
|
1241
|
+
# The `pagination.nextCursor` of the previous page. Omit it for the first page.
|
|
1242
|
+
?cursor: String,
|
|
1243
|
+
|
|
1244
|
+
# Only events of this type.
|
|
1245
|
+
?type: events_list_query_type,
|
|
1246
|
+
|
|
1247
|
+
# Only events of this issuer. Format: uuid.
|
|
1248
|
+
?issuerId: String,
|
|
1249
|
+
|
|
1250
|
+
# Only events of this document. Format: uuid.
|
|
1251
|
+
?documentId: String,
|
|
1252
|
+
|
|
1253
|
+
# Only events of this certificate. Format: uuid.
|
|
1254
|
+
?certificateId: String
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
type events_list_query_type = "invoice.authorized"
|
|
1258
|
+
| "invoice.rejected"
|
|
1259
|
+
| "purchase_settlement.authorized"
|
|
1260
|
+
| "purchase_settlement.rejected"
|
|
1261
|
+
| "credit_note.authorized"
|
|
1262
|
+
| "credit_note.rejected"
|
|
1263
|
+
| "debit_note.authorized"
|
|
1264
|
+
| "debit_note.rejected"
|
|
1265
|
+
| "waybill.authorized"
|
|
1266
|
+
| "waybill.rejected"
|
|
1267
|
+
| "withholding.authorized"
|
|
1268
|
+
| "withholding.rejected"
|
|
1269
|
+
| "certificate.verified"
|
|
1270
|
+
| "certificate.pending"
|
|
1271
|
+
| "certificate.blocked"
|
|
1272
|
+
| "certificate.revoked"
|
|
1273
|
+
| "certificate.reactivated"
|
|
1274
|
+
| "document.ride.generated"
|
|
1275
|
+
| "document.ride.failed"
|
|
1276
|
+
| "document.email.sent"
|
|
1277
|
+
| "document.email.delivered"
|
|
1278
|
+
| "document.email.bounced"
|
|
1279
|
+
| "document.email.complained"
|
|
1280
|
+
| "document.email.failed"
|
|
1281
|
+
| "account.email_paused"
|
|
1282
|
+
| "account.email_resumed"
|
|
1283
|
+
|
|
1284
|
+
type field_error = {
|
|
1285
|
+
# Path of the invalid field.
|
|
1286
|
+
field: String,
|
|
1287
|
+
|
|
1288
|
+
# Stable machine-readable reason. New codes may be added: treat an unknown one like
|
|
1289
|
+
# `invalid_value`.
|
|
1290
|
+
code: field_error_code,
|
|
1291
|
+
|
|
1292
|
+
# Localized message.
|
|
1293
|
+
message: String
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
# Stable machine-readable reason. New codes may be added: treat an unknown one like
|
|
1297
|
+
# `invalid_value`.
|
|
1298
|
+
type field_error_code = "required"
|
|
1299
|
+
| "unknown_field"
|
|
1300
|
+
| "invalid_type"
|
|
1301
|
+
| "invalid_format"
|
|
1302
|
+
| "invalid_option"
|
|
1303
|
+
| "too_short"
|
|
1304
|
+
| "too_long"
|
|
1305
|
+
| "out_of_range"
|
|
1306
|
+
| "invalid_value"
|
|
1307
|
+
| "unsupported_character"
|
|
1308
|
+
| "not_found"
|
|
1309
|
+
| "invalid_decimal"
|
|
1310
|
+
| "invalid_identification"
|
|
1311
|
+
| "invalid_check_digit"
|
|
1312
|
+
| "final_consumer_not_allowed"
|
|
1313
|
+
| "not_in_force"
|
|
1314
|
+
| "too_many_additional_fields"
|
|
1315
|
+
| "reserved_name"
|
|
1316
|
+
| "amount_mismatch"
|
|
1317
|
+
| "future_date"
|
|
1318
|
+
| "date_too_early"
|
|
1319
|
+
| "date_too_late"
|
|
1320
|
+
| "discount_exceeds_amount"
|
|
1321
|
+
| "duplicate"
|
|
1322
|
+
| "vat_required"
|
|
1323
|
+
| "unsupported_tax"
|
|
1324
|
+
| "rate_mismatch"
|
|
1325
|
+
| "incompatible_issuer_profile"
|
|
1326
|
+
| "url_not_allowed"
|
|
1327
|
+
| "demo_issuer_test_only"
|
|
1328
|
+
| "demo_issuer_sequential_not_allowed"
|
|
1329
|
+
| "ruc_mismatch"
|
|
1330
|
+
|
|
1331
|
+
# A taxpayer (RUC) that issues documents.
|
|
1332
|
+
type issuer = {
|
|
1333
|
+
# Format: uuid.
|
|
1334
|
+
id: String,
|
|
1335
|
+
|
|
1336
|
+
# RUC: 13 digits ending in 001 (format only; the check digit is not verified).
|
|
1337
|
+
ruc: String,
|
|
1338
|
+
|
|
1339
|
+
# Legal name (razón social) as registered in the RUC.
|
|
1340
|
+
legalName: String,
|
|
1341
|
+
|
|
1342
|
+
# Trade name (nombre comercial).
|
|
1343
|
+
tradeName: String?,
|
|
1344
|
+
|
|
1345
|
+
# Head office address (dirección matriz).
|
|
1346
|
+
headOfficeAddress: String,
|
|
1347
|
+
taxProfile: issuer_tax_profile,
|
|
1348
|
+
branding: issuer_branding,
|
|
1349
|
+
|
|
1350
|
+
# Default of a document request's `options.sendEmail`: true emails every authorized document
|
|
1351
|
+
# (RIDE PDF and XML) to its buyer, false opts the issuer out. A request that sets
|
|
1352
|
+
# `options.sendEmail` decides for itself.
|
|
1353
|
+
sendEmailByDefault: bool,
|
|
1354
|
+
|
|
1355
|
+
# Format: date-time.
|
|
1356
|
+
createdAt: String,
|
|
1357
|
+
|
|
1358
|
+
# Format: date-time.
|
|
1359
|
+
updatedAt: String
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
# RIDE branding of the issuer.
|
|
1363
|
+
type issuer_branding = {
|
|
1364
|
+
# Brand color of the RIDE PDF, #RRGGBB (returned in lowercase).
|
|
1365
|
+
brandColor: String?
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
type issuer_branding_input = {
|
|
1369
|
+
# Brand color of the RIDE PDF, #RRGGBB (returned in lowercase).
|
|
1370
|
+
?brandColor: String?
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
# A page of issuers, newest first.
|
|
1374
|
+
type issuer_list = {
|
|
1375
|
+
data: Array[issuer],
|
|
1376
|
+
pagination: pagination
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
# An issuer onboarding from a .p12: Flashpi verifies the certificate (`verifying`), then it is
|
|
1380
|
+
# `ready` with the certificate's facts, the RUC and, when the registry lookup is on, the SRI's
|
|
1381
|
+
# profile, or `rejected`. Completing it creates the issuer (or renews an existing one) with the
|
|
1382
|
+
# certificate, which serves test and live. It `expired` if not completed within 6 days, and it
|
|
1383
|
+
# is deleted 30 days after it ends.
|
|
1384
|
+
type issuer_onboarding = {
|
|
1385
|
+
# Format: uuid.
|
|
1386
|
+
id: String,
|
|
1387
|
+
status: issuer_onboarding_status,
|
|
1388
|
+
|
|
1389
|
+
# When it expires unless completed. Format: date-time.
|
|
1390
|
+
expiresAt: String,
|
|
1391
|
+
rejection: issuer_onboarding_rejection?,
|
|
1392
|
+
certificate: issuer_onboarding_certificate?,
|
|
1393
|
+
|
|
1394
|
+
# The RUC to complete with: the certificate's, or the holder's cédula followed by 001.
|
|
1395
|
+
proposedRuc: String?,
|
|
1396
|
+
|
|
1397
|
+
# Whether the customer must confirm (or type) the RUC: it did not come from the certificate
|
|
1398
|
+
# itself. Then complete must send `ruc`.
|
|
1399
|
+
rucNeedsConfirmation: bool,
|
|
1400
|
+
existingIssuer: issuer_onboarding_existing_issuer?,
|
|
1401
|
+
sri: issuer_onboarding_sri?,
|
|
1402
|
+
prefill: issuer_onboarding_prefill?,
|
|
1403
|
+
completed: issuer_onboarding_completion?,
|
|
1404
|
+
|
|
1405
|
+
# Format: date-time.
|
|
1406
|
+
createdAt: String,
|
|
1407
|
+
|
|
1408
|
+
# Format: date-time.
|
|
1409
|
+
updatedAt: String
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
# Public facts of the verified certificate (no key material).
|
|
1413
|
+
type issuer_onboarding_certificate = {
|
|
1414
|
+
serialNumber: String,
|
|
1415
|
+
|
|
1416
|
+
# Format: date-time.
|
|
1417
|
+
validFrom: String,
|
|
1418
|
+
|
|
1419
|
+
# Format: date-time.
|
|
1420
|
+
validTo: String,
|
|
1421
|
+
issuingCa: issuer_onboarding_issuing_ca?,
|
|
1422
|
+
holder: issuer_onboarding_holder,
|
|
1423
|
+
identification: issuer_onboarding_identification
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
# What completing it produced.
|
|
1427
|
+
type issuer_onboarding_completion = {
|
|
1428
|
+
# Format: uuid.
|
|
1429
|
+
issuerId: String,
|
|
1430
|
+
|
|
1431
|
+
# Format: uuid.
|
|
1432
|
+
certificateId: String
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
# The account's issuer that already has this RUC: completing renews its certificate instead of
|
|
1436
|
+
# creating an issuer.
|
|
1437
|
+
type issuer_onboarding_existing_issuer = {
|
|
1438
|
+
# Format: uuid.
|
|
1439
|
+
id: String,
|
|
1440
|
+
legalName: String
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
# The certificate holder's names.
|
|
1444
|
+
type issuer_onboarding_holder = {
|
|
1445
|
+
# Common name (CN): the holder's name.
|
|
1446
|
+
commonName: String?,
|
|
1447
|
+
|
|
1448
|
+
# Organization (O): usually the company of a legal representative.
|
|
1449
|
+
organization: String?
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
# The identification the certificate carries: its RUC (`rucSource` certificate), or the holder's
|
|
1453
|
+
# cédula, from which Flashpi proposes the RUC cédula + 001 (`rucSource` cedula).
|
|
1454
|
+
type issuer_onboarding_identification = {
|
|
1455
|
+
ruc: String?,
|
|
1456
|
+
rucSource: issuer_onboarding_identification_ruc_source?,
|
|
1457
|
+
cedula: String?
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
type issuer_onboarding_identification_ruc_source = "certificate" | "cedula"
|
|
1461
|
+
|
|
1462
|
+
# The Ecuadorian certification authority that issued the certificate.
|
|
1463
|
+
type issuer_onboarding_issuing_ca = {
|
|
1464
|
+
code: String?,
|
|
1465
|
+
displayName: String?
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
# Values for the issuer's tax profile: the SRI's legal name first, else the certificate's
|
|
1469
|
+
# organization (companies) or common name (persons); the trade name, the head office address and
|
|
1470
|
+
# the tax profile from the SRI when it answered (`sri.status` `found`), otherwise null. They are
|
|
1471
|
+
# the customer's to check and edit.
|
|
1472
|
+
type issuer_onboarding_prefill = {
|
|
1473
|
+
ruc: String?,
|
|
1474
|
+
legalName: String?,
|
|
1475
|
+
tradeName: String?,
|
|
1476
|
+
headOfficeAddress: String?,
|
|
1477
|
+
taxProfile: issuer_onboarding_prefill_tax_profile
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
# The tax profile to start from; null where nothing is known.
|
|
1481
|
+
type issuer_onboarding_prefill_tax_profile = {
|
|
1482
|
+
keepsAccounting: bool?,
|
|
1483
|
+
|
|
1484
|
+
# `general` means not in RIMPE (complete with `rimpeRegime: null`); null means unknown.
|
|
1485
|
+
rimpeRegime: issuer_onboarding_prefill_tax_profile_rimpe_regime?,
|
|
1486
|
+
|
|
1487
|
+
# The SRI says special taxpayer: ask for the resolution number.
|
|
1488
|
+
specialTaxpayer: bool?,
|
|
1489
|
+
|
|
1490
|
+
# The SRI says withholding agent: ask for the resolution number.
|
|
1491
|
+
withholdingAgent: bool?
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
# `general` means not in RIMPE (complete with `rimpeRegime: null`); null means unknown.
|
|
1495
|
+
type issuer_onboarding_prefill_tax_profile_rimpe_regime = "entrepreneur"
|
|
1496
|
+
| "popular_business"
|
|
1497
|
+
| "general"
|
|
1498
|
+
|
|
1499
|
+
# Why the certificate was rejected (the certificate rejection codes).
|
|
1500
|
+
type issuer_onboarding_rejection = {
|
|
1501
|
+
code: String,
|
|
1502
|
+
|
|
1503
|
+
# In the language of Accept-Language (Spanish or English).
|
|
1504
|
+
message: String
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
# What the SRI's public RUC registry said about the RUC (best effort). `unavailable`: it did not
|
|
1508
|
+
# answer. `disabled`: Flashpi did not ask it (the lookup is off). In both cases `profile` is
|
|
1509
|
+
# null and the customer fills in the tax profile. Warnings never block.
|
|
1510
|
+
type issuer_onboarding_sri = {
|
|
1511
|
+
status: issuer_onboarding_sri_status,
|
|
1512
|
+
|
|
1513
|
+
# Format: date-time.
|
|
1514
|
+
fetchedAt: String?,
|
|
1515
|
+
profile: issuer_onboarding_sri_profile?,
|
|
1516
|
+
|
|
1517
|
+
# `inactive`: the RUC is not ACTIVO; `ghost` and `nonexistent_transactions`: the SRI flags the
|
|
1518
|
+
# taxpayer; `head_office_closed`: its head office establishment is closed.
|
|
1519
|
+
warnings: Array[issuer_onboarding_sri_warnings_item]
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
# The taxpayer's profile in the SRI's public RUC registry, normalized. The registry gives flags
|
|
1523
|
+
# only for special taxpayer and withholding agent: the resolution numbers are the customer's to
|
|
1524
|
+
# type.
|
|
1525
|
+
type issuer_onboarding_sri_profile = {
|
|
1526
|
+
# Razón social.
|
|
1527
|
+
legalName: String?,
|
|
1528
|
+
|
|
1529
|
+
# Nombre comercial.
|
|
1530
|
+
tradeName: String?,
|
|
1531
|
+
|
|
1532
|
+
# The RUC status as the SRI writes it.
|
|
1533
|
+
taxpayerStatus: String?,
|
|
1534
|
+
keepsAccounting: bool?,
|
|
1535
|
+
specialTaxpayer: bool?,
|
|
1536
|
+
withholdingAgent: bool?,
|
|
1537
|
+
|
|
1538
|
+
# `general`: not in RIMPE. `unknown`: the SRI answer could not be mapped; the customer
|
|
1539
|
+
# chooses.
|
|
1540
|
+
rimpeRegime: issuer_onboarding_sri_profile_rimpe_regime,
|
|
1541
|
+
|
|
1542
|
+
# The head office address.
|
|
1543
|
+
headOfficeAddress: String?
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
# `general`: not in RIMPE. `unknown`: the SRI answer could not be mapped; the customer chooses.
|
|
1547
|
+
type issuer_onboarding_sri_profile_rimpe_regime = "entrepreneur"
|
|
1548
|
+
| "popular_business"
|
|
1549
|
+
| "general"
|
|
1550
|
+
| "unknown"
|
|
1551
|
+
|
|
1552
|
+
type issuer_onboarding_sri_status = "found" | "not_found" | "unavailable" | "disabled"
|
|
1553
|
+
|
|
1554
|
+
type issuer_onboarding_sri_warnings_item = "inactive"
|
|
1555
|
+
| "ghost"
|
|
1556
|
+
| "nonexistent_transactions"
|
|
1557
|
+
| "head_office_closed"
|
|
1558
|
+
|
|
1559
|
+
type issuer_onboarding_status = "verifying" | "ready" | "rejected" | "completed" | "expired"
|
|
1560
|
+
|
|
1561
|
+
# Tax profile; Flashpi adds the mandatory tags and legends from it.
|
|
1562
|
+
type issuer_tax_profile = {
|
|
1563
|
+
# Whether the taxpayer is required to keep accounting (obligado a llevar contabilidad).
|
|
1564
|
+
keepsAccounting: bool,
|
|
1565
|
+
|
|
1566
|
+
# Special taxpayer (contribuyente especial) resolution number: 3 to 13 letters or digits.
|
|
1567
|
+
specialTaxpayerNumber: String?,
|
|
1568
|
+
|
|
1569
|
+
# Withholding agent (agente de retención) designation resolution number, digits only. Stored
|
|
1570
|
+
# without leading zeros (at most 8 digits).
|
|
1571
|
+
withholdingAgentResolution: String?,
|
|
1572
|
+
|
|
1573
|
+
# RIMPE regime: `entrepreneur` (CONTRIBUYENTE RÉGIMEN RIMPE) or `popular_business`
|
|
1574
|
+
# (CONTRIBUYENTE NEGOCIO POPULAR - RÉGIMEN RIMPE). Null when not in RIMPE.
|
|
1575
|
+
rimpeRegime: issuer_tax_profile_rimpe_regime?,
|
|
1576
|
+
|
|
1577
|
+
# Large taxpayer (gran contribuyente) designation resolution number.
|
|
1578
|
+
largeTaxpayerResolution: String?
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
type issuer_tax_profile_input = {
|
|
1582
|
+
# Whether the taxpayer is required to keep accounting (obligado a llevar contabilidad).
|
|
1583
|
+
keepsAccounting: bool,
|
|
1584
|
+
|
|
1585
|
+
# Special taxpayer (contribuyente especial) resolution number: 3 to 13 letters or digits.
|
|
1586
|
+
?specialTaxpayerNumber: String?,
|
|
1587
|
+
|
|
1588
|
+
# Withholding agent (agente de retención) designation resolution number, digits only. Stored
|
|
1589
|
+
# without leading zeros (at most 8 digits).
|
|
1590
|
+
?withholdingAgentResolution: String?,
|
|
1591
|
+
|
|
1592
|
+
# RIMPE regime: `entrepreneur` (CONTRIBUYENTE RÉGIMEN RIMPE) or `popular_business`
|
|
1593
|
+
# (CONTRIBUYENTE NEGOCIO POPULAR - RÉGIMEN RIMPE). Null when not in RIMPE.
|
|
1594
|
+
?rimpeRegime: issuer_tax_profile_input_rimpe_regime?,
|
|
1595
|
+
|
|
1596
|
+
# Large taxpayer (gran contribuyente) designation resolution number.
|
|
1597
|
+
?largeTaxpayerResolution: String?
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
# RIMPE regime: `entrepreneur` (CONTRIBUYENTE RÉGIMEN RIMPE) or `popular_business`
|
|
1601
|
+
# (CONTRIBUYENTE NEGOCIO POPULAR - RÉGIMEN RIMPE). Null when not in RIMPE.
|
|
1602
|
+
type issuer_tax_profile_input_rimpe_regime = "entrepreneur" | "popular_business"
|
|
1603
|
+
|
|
1604
|
+
# Fields to change; null clears one.
|
|
1605
|
+
type issuer_tax_profile_patch = {
|
|
1606
|
+
# Whether the taxpayer is required to keep accounting (obligado a llevar contabilidad).
|
|
1607
|
+
?keepsAccounting: bool,
|
|
1608
|
+
|
|
1609
|
+
# Special taxpayer (contribuyente especial) resolution number: 3 to 13 letters or digits.
|
|
1610
|
+
?specialTaxpayerNumber: String?,
|
|
1611
|
+
|
|
1612
|
+
# Withholding agent (agente de retención) designation resolution number, digits only. Stored
|
|
1613
|
+
# without leading zeros (at most 8 digits).
|
|
1614
|
+
?withholdingAgentResolution: String?,
|
|
1615
|
+
|
|
1616
|
+
# RIMPE regime: `entrepreneur` (CONTRIBUYENTE RÉGIMEN RIMPE) or `popular_business`
|
|
1617
|
+
# (CONTRIBUYENTE NEGOCIO POPULAR - RÉGIMEN RIMPE). Null when not in RIMPE.
|
|
1618
|
+
?rimpeRegime: issuer_tax_profile_patch_rimpe_regime?,
|
|
1619
|
+
|
|
1620
|
+
# Large taxpayer (gran contribuyente) designation resolution number.
|
|
1621
|
+
?largeTaxpayerResolution: String?
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
# RIMPE regime: `entrepreneur` (CONTRIBUYENTE RÉGIMEN RIMPE) or `popular_business`
|
|
1625
|
+
# (CONTRIBUYENTE NEGOCIO POPULAR - RÉGIMEN RIMPE). Null when not in RIMPE.
|
|
1626
|
+
type issuer_tax_profile_patch_rimpe_regime = "entrepreneur" | "popular_business"
|
|
1627
|
+
|
|
1628
|
+
# RIMPE regime: `entrepreneur` (CONTRIBUYENTE RÉGIMEN RIMPE) or `popular_business`
|
|
1629
|
+
# (CONTRIBUYENTE NEGOCIO POPULAR - RÉGIMEN RIMPE). Null when not in RIMPE.
|
|
1630
|
+
type issuer_tax_profile_rimpe_regime = "entrepreneur" | "popular_business"
|
|
1631
|
+
|
|
1632
|
+
# The query of `issuersList` (GET /v1/issuers).
|
|
1633
|
+
type issuers_list_query = {
|
|
1634
|
+
# Maximum number of items to return. Default: `20`.
|
|
1635
|
+
?limit: Integer,
|
|
1636
|
+
|
|
1637
|
+
# The `pagination.nextCursor` of the previous page. Omit it for the first page.
|
|
1638
|
+
?cursor: String
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
# The document a credit or debit note modifies.
|
|
1642
|
+
type modified_document = {
|
|
1643
|
+
# Type of the modified document. Defaults to `invoice`.
|
|
1644
|
+
?type: modified_document_type,
|
|
1645
|
+
|
|
1646
|
+
# Number of the modified document: establishment-emission point-sequential.
|
|
1647
|
+
number: String,
|
|
1648
|
+
|
|
1649
|
+
# Issue date of the modified document (on or before the note). Its VAT rates are the ones in
|
|
1650
|
+
# force on this date. Format: date.
|
|
1651
|
+
issueDate: String
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
# Type of the modified document. Defaults to `invoice`.
|
|
1655
|
+
type modified_document_type = "invoice"
|
|
1656
|
+
|
|
1657
|
+
# Position of a page in a list.
|
|
1658
|
+
type pagination = {
|
|
1659
|
+
# Cursor of the next page (send it as `cursor`), or null on the last page.
|
|
1660
|
+
nextCursor: String?,
|
|
1661
|
+
|
|
1662
|
+
# Whether there are more items after this page.
|
|
1663
|
+
hasMore: bool
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
# RFC 9457 problem details, in the language of Content-Language (`en`, or `es` with
|
|
1667
|
+
# Accept-Language: es). Some codes add extension members, listed below; others may appear.
|
|
1668
|
+
type problem_details = {
|
|
1669
|
+
# URI of the problem type: the page that documents `code`, in the language of the response
|
|
1670
|
+
# (`https://flashpi.com.ec/docs/en/errors/{code}` in English,
|
|
1671
|
+
# `https://flashpi.com.ec/docs/errors/{code}` with Accept-Language: es). It changes with the
|
|
1672
|
+
# language, so branch on `code`, never on `type`. Format: uri.
|
|
1673
|
+
type: String,
|
|
1674
|
+
|
|
1675
|
+
# Localized summary of the type.
|
|
1676
|
+
title: String,
|
|
1677
|
+
|
|
1678
|
+
# HTTP status code.
|
|
1679
|
+
status: Integer | Float,
|
|
1680
|
+
|
|
1681
|
+
# Localized explanation of this occurrence.
|
|
1682
|
+
detail: String,
|
|
1683
|
+
|
|
1684
|
+
# Path of the request.
|
|
1685
|
+
instance: String,
|
|
1686
|
+
|
|
1687
|
+
# Stable machine-readable error code, the same in every language. Branch on it, never on
|
|
1688
|
+
# `type`, `title` or `detail`. New codes may be added: handle an unknown one by its HTTP
|
|
1689
|
+
# status.
|
|
1690
|
+
code: error_code,
|
|
1691
|
+
|
|
1692
|
+
# Field-level errors (may be empty).
|
|
1693
|
+
errors: Array[field_error],
|
|
1694
|
+
|
|
1695
|
+
# Request ID (UUIDv7); include it when contacting support.
|
|
1696
|
+
requestId: String,
|
|
1697
|
+
|
|
1698
|
+
# `idempotency_key_reused`: the document the Idempotency-Key already created. Format: uuid.
|
|
1699
|
+
?documentId: String,
|
|
1700
|
+
|
|
1701
|
+
# The daily limit that was reached (`email_resend_limit_reached`,
|
|
1702
|
+
# `account_email_limit_reached`, `demo_issuer_quota_exceeded`).
|
|
1703
|
+
?limit: Integer,
|
|
1704
|
+
|
|
1705
|
+
# When the daily limit resets: the next midnight in Ecuador (the three codes above and
|
|
1706
|
+
# `platform_email_limit_reached`). Retry-After gives the same in seconds. Format: date-time.
|
|
1707
|
+
?resetsAt: String,
|
|
1708
|
+
|
|
1709
|
+
# `ride_not_available`: the status of the RIDE.
|
|
1710
|
+
?rideStatus: problem_details_ride_status,
|
|
1711
|
+
|
|
1712
|
+
# `document_not_authorized`: the status of the document.
|
|
1713
|
+
?documentStatus: problem_details_document_status,
|
|
1714
|
+
|
|
1715
|
+
# `email_sending_paused`: the mode whose email sending is paused.
|
|
1716
|
+
?environment: problem_details_environment,
|
|
1717
|
+
|
|
1718
|
+
# `total_mismatch`: the `expectedTotal` you sent.
|
|
1719
|
+
?expectedTotal: String,
|
|
1720
|
+
|
|
1721
|
+
# `total_mismatch`: the total Flashpi computed.
|
|
1722
|
+
?computedTotal: String
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
# `document_not_authorized`: the status of the document.
|
|
1726
|
+
type problem_details_document_status = "processing"
|
|
1727
|
+
| "pending_sri"
|
|
1728
|
+
| "authorized"
|
|
1729
|
+
| "rejected"
|
|
1730
|
+
| "failed"
|
|
1731
|
+
| "voided"
|
|
1732
|
+
|
|
1733
|
+
# `email_sending_paused`: the mode whose email sending is paused.
|
|
1734
|
+
type problem_details_environment = "test" | "live"
|
|
1735
|
+
|
|
1736
|
+
# `ride_not_available`: the status of the RIDE.
|
|
1737
|
+
type problem_details_ride_status = "pending" | "generated" | "failed"
|
|
1738
|
+
|
|
1739
|
+
type rotate_webhook_endpoint_secret = {
|
|
1740
|
+
# Hours the previous secret keeps signing deliveries next to the new one (default 24, at most
|
|
1741
|
+
# 168); 0 drops it at once.
|
|
1742
|
+
?previousSecretExpiresInHours: Integer
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
# No options yet: send an empty object or no body.
|
|
1746
|
+
type send_document_email = {}
|
|
1747
|
+
|
|
1748
|
+
# Public status of Flashpi. Placeholder until the status monitors exist.
|
|
1749
|
+
type status = {
|
|
1750
|
+
# Overall status of Flashpi.
|
|
1751
|
+
status: status_status
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
# Overall status of Flashpi.
|
|
1755
|
+
type status_status = "operational"
|
|
1756
|
+
|
|
1757
|
+
# The supplier document whose taxes are withheld, usually an invoice.
|
|
1758
|
+
type supporting_document = {
|
|
1759
|
+
# Tax support code (Catálogo ATS tabla 5), for example `01`.
|
|
1760
|
+
taxSupportCode: String,
|
|
1761
|
+
|
|
1762
|
+
# Document type code (Catálogo ATS tabla 4), for example `01` for an invoice.
|
|
1763
|
+
documentTypeCode: String,
|
|
1764
|
+
|
|
1765
|
+
# Its number.
|
|
1766
|
+
number: String,
|
|
1767
|
+
|
|
1768
|
+
# Its issue date, on or before the withholding. Format: date.
|
|
1769
|
+
issueDate: String,
|
|
1770
|
+
|
|
1771
|
+
# Accounting record date. Format: date.
|
|
1772
|
+
?accountingDate: String,
|
|
1773
|
+
|
|
1774
|
+
# Its authorization number (10, 37 or 49 digits).
|
|
1775
|
+
?authorizationNumber: String,
|
|
1776
|
+
|
|
1777
|
+
# Whether the payment is `local` or `foreign`. Defaults to `local`.
|
|
1778
|
+
?paymentResidence: supporting_document_payment_residence,
|
|
1779
|
+
|
|
1780
|
+
# Foreign payment details; required for a `foreign` payment.
|
|
1781
|
+
?foreignPayment: withholding_foreign_payment,
|
|
1782
|
+
|
|
1783
|
+
# Its subtotal before taxes.
|
|
1784
|
+
subtotal: String,
|
|
1785
|
+
|
|
1786
|
+
# Its total.
|
|
1787
|
+
total: String,
|
|
1788
|
+
|
|
1789
|
+
# Its taxes.
|
|
1790
|
+
taxes: Array[supporting_document_tax],
|
|
1791
|
+
|
|
1792
|
+
# What is withheld from it.
|
|
1793
|
+
withholdings: Array[withholding],
|
|
1794
|
+
|
|
1795
|
+
# How it is paid; the payments must add up to its total.
|
|
1796
|
+
payments: Array[withholding_payment]
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
# Whether the payment is `local` or `foreign`. Defaults to `local`.
|
|
1800
|
+
type supporting_document_payment_residence = "local" | "foreign"
|
|
1801
|
+
|
|
1802
|
+
# A VAT of the supporting document.
|
|
1803
|
+
type supporting_document_tax = {
|
|
1804
|
+
# Tax type: `vat`.
|
|
1805
|
+
type: supporting_document_tax_type,
|
|
1806
|
+
|
|
1807
|
+
# VAT rate in force on the supporting document issue date.
|
|
1808
|
+
rate: supporting_document_tax_rate,
|
|
1809
|
+
|
|
1810
|
+
# Taxable base.
|
|
1811
|
+
taxableBase: String,
|
|
1812
|
+
|
|
1813
|
+
# The supporting document's VAT amount. Defaults to base × rate, rounded.
|
|
1814
|
+
?amount: String
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
# VAT rate in force on the supporting document issue date.
|
|
1818
|
+
type supporting_document_tax_rate = "0"
|
|
1819
|
+
| "5"
|
|
1820
|
+
| "8"
|
|
1821
|
+
| "12"
|
|
1822
|
+
| "13"
|
|
1823
|
+
| "14"
|
|
1824
|
+
| "15"
|
|
1825
|
+
| "exempt"
|
|
1826
|
+
| "not_subject"
|
|
1827
|
+
|
|
1828
|
+
# Tax type: `vat`.
|
|
1829
|
+
type supporting_document_tax_type = "vat"
|
|
1830
|
+
|
|
1831
|
+
# Fields to change. The code cannot be changed.
|
|
1832
|
+
type update_establishment = {
|
|
1833
|
+
# Address of the establishment (dirección del establecimiento).
|
|
1834
|
+
?address: String
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
# Fields to change; null clears an optional field. The RUC cannot be changed.
|
|
1838
|
+
type update_issuer = {
|
|
1839
|
+
# Legal name (razón social) as registered in the RUC.
|
|
1840
|
+
?legalName: String,
|
|
1841
|
+
|
|
1842
|
+
# Trade name (nombre comercial).
|
|
1843
|
+
?tradeName: String?,
|
|
1844
|
+
|
|
1845
|
+
# Head office address (dirección matriz).
|
|
1846
|
+
?headOfficeAddress: String,
|
|
1847
|
+
?taxProfile: issuer_tax_profile_patch,
|
|
1848
|
+
?branding: issuer_branding_input,
|
|
1849
|
+
|
|
1850
|
+
# Default of a document request's `options.sendEmail`: true emails every authorized document
|
|
1851
|
+
# (RIDE PDF and XML) to its buyer, false opts the issuer out. A request that sets
|
|
1852
|
+
# `options.sendEmail` decides for itself.
|
|
1853
|
+
?sendEmailByDefault: bool
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
# Fields to change; null clears the description.
|
|
1857
|
+
type update_webhook_endpoint = {
|
|
1858
|
+
# Where Flashpi POSTs the events: a public HTTPS URL without credentials or fragment. Changing
|
|
1859
|
+
# it requires a new verification.
|
|
1860
|
+
?url: String,
|
|
1861
|
+
|
|
1862
|
+
# A label for your own reference.
|
|
1863
|
+
?description: String?,
|
|
1864
|
+
|
|
1865
|
+
# Event types the endpoint receives; `*` receives every type, including future ones.
|
|
1866
|
+
?enabledEvents: Array[update_webhook_endpoint_enabled_events_item],
|
|
1867
|
+
|
|
1868
|
+
# `full` (default): the event with a snapshot of its resource in `data`. `thin`: the event
|
|
1869
|
+
# without `data`, only `id`, `type`, `environment` and `createdAt` (read the snapshot with GET
|
|
1870
|
+
# /v1/events/{id}).
|
|
1871
|
+
?payloadMode: update_webhook_endpoint_payload_mode,
|
|
1872
|
+
|
|
1873
|
+
# true disables the endpoint (pending deliveries end); false enables it again (a new
|
|
1874
|
+
# verification is sent when it was never verified).
|
|
1875
|
+
?disabled: bool
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
type update_webhook_endpoint_enabled_events_item = "invoice.authorized"
|
|
1879
|
+
| "invoice.rejected"
|
|
1880
|
+
| "purchase_settlement.authorized"
|
|
1881
|
+
| "purchase_settlement.rejected"
|
|
1882
|
+
| "credit_note.authorized"
|
|
1883
|
+
| "credit_note.rejected"
|
|
1884
|
+
| "debit_note.authorized"
|
|
1885
|
+
| "debit_note.rejected"
|
|
1886
|
+
| "waybill.authorized"
|
|
1887
|
+
| "waybill.rejected"
|
|
1888
|
+
| "withholding.authorized"
|
|
1889
|
+
| "withholding.rejected"
|
|
1890
|
+
| "certificate.verified"
|
|
1891
|
+
| "certificate.pending"
|
|
1892
|
+
| "certificate.blocked"
|
|
1893
|
+
| "certificate.revoked"
|
|
1894
|
+
| "certificate.reactivated"
|
|
1895
|
+
| "document.ride.generated"
|
|
1896
|
+
| "document.ride.failed"
|
|
1897
|
+
| "document.email.sent"
|
|
1898
|
+
| "document.email.delivered"
|
|
1899
|
+
| "document.email.bounced"
|
|
1900
|
+
| "document.email.complained"
|
|
1901
|
+
| "document.email.failed"
|
|
1902
|
+
| "account.email_paused"
|
|
1903
|
+
| "account.email_resumed"
|
|
1904
|
+
| "*"
|
|
1905
|
+
|
|
1906
|
+
# `full` (default): the event with a snapshot of its resource in `data`. `thin`: the event
|
|
1907
|
+
# without `data`, only `id`, `type`, `environment` and `createdAt` (read the snapshot with GET
|
|
1908
|
+
# /v1/events/{id}).
|
|
1909
|
+
type update_webhook_endpoint_payload_mode = "full" | "thin"
|
|
1910
|
+
|
|
1911
|
+
# Who carries the goods.
|
|
1912
|
+
type waybill_carrier = {
|
|
1913
|
+
# Identification type of the carrier (not `final_consumer`).
|
|
1914
|
+
idType: waybill_carrier_id_type,
|
|
1915
|
+
|
|
1916
|
+
# Identification number.
|
|
1917
|
+
id: String,
|
|
1918
|
+
|
|
1919
|
+
# Legal name.
|
|
1920
|
+
name: String
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
# Identification type of the carrier (not `final_consumer`).
|
|
1924
|
+
type waybill_carrier_id_type = "ruc" | "cedula" | "passport" | "final_consumer" | "foreign_id"
|
|
1925
|
+
|
|
1926
|
+
# Goods carried for a recipient.
|
|
1927
|
+
type waybill_item = {
|
|
1928
|
+
# Your product code.
|
|
1929
|
+
?code: String,
|
|
1930
|
+
|
|
1931
|
+
# A second code.
|
|
1932
|
+
?auxiliaryCode: String,
|
|
1933
|
+
|
|
1934
|
+
# Description.
|
|
1935
|
+
description: String,
|
|
1936
|
+
|
|
1937
|
+
# Quantity, up to 6 decimals.
|
|
1938
|
+
quantity: String,
|
|
1939
|
+
|
|
1940
|
+
# Up to 3 extra details (name → value).
|
|
1941
|
+
?additionalDetails: Hash[Symbol, String]
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
# Who receives the goods, and what.
|
|
1945
|
+
type waybill_recipient = {
|
|
1946
|
+
# Identification number.
|
|
1947
|
+
id: String,
|
|
1948
|
+
|
|
1949
|
+
# Legal name.
|
|
1950
|
+
name: String,
|
|
1951
|
+
|
|
1952
|
+
# Delivery address.
|
|
1953
|
+
address: String,
|
|
1954
|
+
|
|
1955
|
+
# Reason for the transfer.
|
|
1956
|
+
transferReason: String,
|
|
1957
|
+
|
|
1958
|
+
# Single customs document (DAU), for imports and exports.
|
|
1959
|
+
?customsDocument: String,
|
|
1960
|
+
|
|
1961
|
+
# Destination establishment code of the recipient.
|
|
1962
|
+
?destinationEstablishment: String,
|
|
1963
|
+
|
|
1964
|
+
# Route.
|
|
1965
|
+
?route: String,
|
|
1966
|
+
|
|
1967
|
+
# The supporting document.
|
|
1968
|
+
?supportingDocument: waybill_supporting_document,
|
|
1969
|
+
|
|
1970
|
+
# The goods carried for this recipient.
|
|
1971
|
+
items: Array[waybill_item]
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
# The document that supports the transfer, usually the sales invoice.
|
|
1975
|
+
type waybill_supporting_document = {
|
|
1976
|
+
# Type of the supporting document.
|
|
1977
|
+
?type: waybill_supporting_document_type,
|
|
1978
|
+
|
|
1979
|
+
# Its number.
|
|
1980
|
+
?number: String,
|
|
1981
|
+
|
|
1982
|
+
# Its authorization number (the 49-digit access key of electronic documents).
|
|
1983
|
+
?authorizationNumber: String,
|
|
1984
|
+
|
|
1985
|
+
# Its issue date. Format: date.
|
|
1986
|
+
?issueDate: String
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
# Type of the supporting document.
|
|
1990
|
+
type waybill_supporting_document_type = "invoice"
|
|
1991
|
+
| "purchase_settlement"
|
|
1992
|
+
| "credit_note"
|
|
1993
|
+
| "debit_note"
|
|
1994
|
+
| "waybill"
|
|
1995
|
+
| "withholding"
|
|
1996
|
+
|
|
1997
|
+
# One event sent to one endpoint, retried with backoff for 72 hours until it gets a 2xx.
|
|
1998
|
+
type webhook_delivery = {
|
|
1999
|
+
# Format: uuid.
|
|
2000
|
+
id: String,
|
|
2001
|
+
|
|
2002
|
+
# Format: uuid.
|
|
2003
|
+
webhookEndpointId: String,
|
|
2004
|
+
|
|
2005
|
+
# The event, also the webhook-id header. Format: uuid.
|
|
2006
|
+
eventId: String,
|
|
2007
|
+
eventType: webhook_delivery_event_type,
|
|
2008
|
+
payloadMode: webhook_delivery_payload_mode,
|
|
2009
|
+
|
|
2010
|
+
# `pending` (an attempt is scheduled or running), `succeeded` or `failed`.
|
|
2011
|
+
status: webhook_delivery_status,
|
|
2012
|
+
attemptCount: Integer | Float,
|
|
2013
|
+
|
|
2014
|
+
# Format: date-time.
|
|
2015
|
+
nextAttemptAt: String?,
|
|
2016
|
+
|
|
2017
|
+
# Format: date-time.
|
|
2018
|
+
lastAttemptAt: String?,
|
|
2019
|
+
lastResponseStatus: Integer?,
|
|
2020
|
+
|
|
2021
|
+
# Why it failed: `unexpected_status` (an answer other than 2xx, see the status), `timeout`,
|
|
2022
|
+
# `connection_failed`, `dns_resolution_failed`, `tls_error`, `address_not_allowed`,
|
|
2023
|
+
# `invalid_url`, or without an attempt `endpoint_disabled` and `endpoint_not_verified`.
|
|
2024
|
+
lastError: String?,
|
|
2025
|
+
|
|
2026
|
+
# Format: date-time.
|
|
2027
|
+
succeededAt: String?,
|
|
2028
|
+
|
|
2029
|
+
# No automatic attempt after this time. Format: date-time.
|
|
2030
|
+
retryUntil: String,
|
|
2031
|
+
|
|
2032
|
+
# Format: date-time.
|
|
2033
|
+
createdAt: String,
|
|
2034
|
+
|
|
2035
|
+
# Format: date-time.
|
|
2036
|
+
updatedAt: String
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
# One HTTP attempt of a delivery.
|
|
2040
|
+
type webhook_delivery_attempt = {
|
|
2041
|
+
# 1 for the first attempt.
|
|
2042
|
+
number: Integer | Float,
|
|
2043
|
+
trigger: webhook_delivery_attempt_trigger,
|
|
2044
|
+
|
|
2045
|
+
# Format: date-time.
|
|
2046
|
+
startedAt: String,
|
|
2047
|
+
durationMs: Integer | Float,
|
|
2048
|
+
responseStatus: Integer?,
|
|
2049
|
+
|
|
2050
|
+
# Why it failed: `unexpected_status` (an answer other than 2xx, see the status), `timeout`,
|
|
2051
|
+
# `connection_failed`, `dns_resolution_failed`, `tls_error`, `address_not_allowed`,
|
|
2052
|
+
# `invalid_url`, or without an attempt `endpoint_disabled` and `endpoint_not_verified`.
|
|
2053
|
+
error: String?,
|
|
2054
|
+
succeeded: bool
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
type webhook_delivery_attempt_trigger = "automatic" | "replay"
|
|
2058
|
+
|
|
2059
|
+
# A delivery with its attempts.
|
|
2060
|
+
type webhook_delivery_detail = {
|
|
2061
|
+
# Format: uuid.
|
|
2062
|
+
id: String,
|
|
2063
|
+
|
|
2064
|
+
# Format: uuid.
|
|
2065
|
+
webhookEndpointId: String,
|
|
2066
|
+
|
|
2067
|
+
# The event, also the webhook-id header. Format: uuid.
|
|
2068
|
+
eventId: String,
|
|
2069
|
+
eventType: webhook_delivery_detail_event_type,
|
|
2070
|
+
payloadMode: webhook_delivery_detail_payload_mode,
|
|
2071
|
+
|
|
2072
|
+
# `pending` (an attempt is scheduled or running), `succeeded` or `failed`.
|
|
2073
|
+
status: webhook_delivery_detail_status,
|
|
2074
|
+
attemptCount: Integer | Float,
|
|
2075
|
+
|
|
2076
|
+
# Format: date-time.
|
|
2077
|
+
nextAttemptAt: String?,
|
|
2078
|
+
|
|
2079
|
+
# Format: date-time.
|
|
2080
|
+
lastAttemptAt: String?,
|
|
2081
|
+
lastResponseStatus: Integer?,
|
|
2082
|
+
|
|
2083
|
+
# Why it failed: `unexpected_status` (an answer other than 2xx, see the status), `timeout`,
|
|
2084
|
+
# `connection_failed`, `dns_resolution_failed`, `tls_error`, `address_not_allowed`,
|
|
2085
|
+
# `invalid_url`, or without an attempt `endpoint_disabled` and `endpoint_not_verified`.
|
|
2086
|
+
lastError: String?,
|
|
2087
|
+
|
|
2088
|
+
# Format: date-time.
|
|
2089
|
+
succeededAt: String?,
|
|
2090
|
+
|
|
2091
|
+
# No automatic attempt after this time. Format: date-time.
|
|
2092
|
+
retryUntil: String,
|
|
2093
|
+
|
|
2094
|
+
# Format: date-time.
|
|
2095
|
+
createdAt: String,
|
|
2096
|
+
|
|
2097
|
+
# Format: date-time.
|
|
2098
|
+
updatedAt: String,
|
|
2099
|
+
|
|
2100
|
+
# Oldest first.
|
|
2101
|
+
attempts: Array[webhook_delivery_attempt]
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
type webhook_delivery_detail_event_type = "invoice.authorized"
|
|
2105
|
+
| "invoice.rejected"
|
|
2106
|
+
| "purchase_settlement.authorized"
|
|
2107
|
+
| "purchase_settlement.rejected"
|
|
2108
|
+
| "credit_note.authorized"
|
|
2109
|
+
| "credit_note.rejected"
|
|
2110
|
+
| "debit_note.authorized"
|
|
2111
|
+
| "debit_note.rejected"
|
|
2112
|
+
| "waybill.authorized"
|
|
2113
|
+
| "waybill.rejected"
|
|
2114
|
+
| "withholding.authorized"
|
|
2115
|
+
| "withholding.rejected"
|
|
2116
|
+
| "certificate.verified"
|
|
2117
|
+
| "certificate.pending"
|
|
2118
|
+
| "certificate.blocked"
|
|
2119
|
+
| "certificate.revoked"
|
|
2120
|
+
| "certificate.reactivated"
|
|
2121
|
+
| "document.ride.generated"
|
|
2122
|
+
| "document.ride.failed"
|
|
2123
|
+
| "document.email.sent"
|
|
2124
|
+
| "document.email.delivered"
|
|
2125
|
+
| "document.email.bounced"
|
|
2126
|
+
| "document.email.complained"
|
|
2127
|
+
| "document.email.failed"
|
|
2128
|
+
| "account.email_paused"
|
|
2129
|
+
| "account.email_resumed"
|
|
2130
|
+
|
|
2131
|
+
type webhook_delivery_detail_payload_mode = "full" | "thin"
|
|
2132
|
+
|
|
2133
|
+
# `pending` (an attempt is scheduled or running), `succeeded` or `failed`.
|
|
2134
|
+
type webhook_delivery_detail_status = "pending" | "succeeded" | "failed"
|
|
2135
|
+
|
|
2136
|
+
type webhook_delivery_event_type = "invoice.authorized"
|
|
2137
|
+
| "invoice.rejected"
|
|
2138
|
+
| "purchase_settlement.authorized"
|
|
2139
|
+
| "purchase_settlement.rejected"
|
|
2140
|
+
| "credit_note.authorized"
|
|
2141
|
+
| "credit_note.rejected"
|
|
2142
|
+
| "debit_note.authorized"
|
|
2143
|
+
| "debit_note.rejected"
|
|
2144
|
+
| "waybill.authorized"
|
|
2145
|
+
| "waybill.rejected"
|
|
2146
|
+
| "withholding.authorized"
|
|
2147
|
+
| "withholding.rejected"
|
|
2148
|
+
| "certificate.verified"
|
|
2149
|
+
| "certificate.pending"
|
|
2150
|
+
| "certificate.blocked"
|
|
2151
|
+
| "certificate.revoked"
|
|
2152
|
+
| "certificate.reactivated"
|
|
2153
|
+
| "document.ride.generated"
|
|
2154
|
+
| "document.ride.failed"
|
|
2155
|
+
| "document.email.sent"
|
|
2156
|
+
| "document.email.delivered"
|
|
2157
|
+
| "document.email.bounced"
|
|
2158
|
+
| "document.email.complained"
|
|
2159
|
+
| "document.email.failed"
|
|
2160
|
+
| "account.email_paused"
|
|
2161
|
+
| "account.email_resumed"
|
|
2162
|
+
|
|
2163
|
+
# A page of deliveries, newest first.
|
|
2164
|
+
type webhook_delivery_list = {
|
|
2165
|
+
data: Array[webhook_delivery],
|
|
2166
|
+
pagination: pagination
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
type webhook_delivery_payload_mode = "full" | "thin"
|
|
2170
|
+
|
|
2171
|
+
# `pending` (an attempt is scheduled or running), `succeeded` or `failed`.
|
|
2172
|
+
type webhook_delivery_status = "pending" | "succeeded" | "failed"
|
|
2173
|
+
|
|
2174
|
+
# A URL that receives Standard Webhooks, signed with a whsec_ secret (read it with GET
|
|
2175
|
+
# .../secret). It receives the events of the mode of the API key that created it (test or live).
|
|
2176
|
+
type webhook_endpoint = {
|
|
2177
|
+
# Format: uuid.
|
|
2178
|
+
id: String,
|
|
2179
|
+
|
|
2180
|
+
# Where Flashpi POSTs the events: a public HTTPS URL without credentials or fragment. Changing
|
|
2181
|
+
# it requires a new verification.
|
|
2182
|
+
url: String,
|
|
2183
|
+
|
|
2184
|
+
# A label for your own reference.
|
|
2185
|
+
description: String?,
|
|
2186
|
+
|
|
2187
|
+
# Event types the endpoint receives; `*` receives every type, including future ones.
|
|
2188
|
+
enabledEvents: Array[webhook_endpoint_enabled_events_item],
|
|
2189
|
+
|
|
2190
|
+
# `full` (default): the event with a snapshot of its resource in `data`. `thin`: the event
|
|
2191
|
+
# without `data`, only `id`, `type`, `environment` and `createdAt` (read the snapshot with GET
|
|
2192
|
+
# /v1/events/{id}).
|
|
2193
|
+
payloadMode: webhook_endpoint_payload_mode,
|
|
2194
|
+
|
|
2195
|
+
# `pending_verification` (receives nothing until it echoes the challenge), `active` or
|
|
2196
|
+
# `disabled`.
|
|
2197
|
+
status: webhook_endpoint_status,
|
|
2198
|
+
|
|
2199
|
+
# Mode of the events it receives.
|
|
2200
|
+
environment: webhook_endpoint_environment,
|
|
2201
|
+
verification: webhook_endpoint_verification,
|
|
2202
|
+
|
|
2203
|
+
# After a rotation: until when deliveries are also signed with the previous secret. Format:
|
|
2204
|
+
# date-time.
|
|
2205
|
+
previousSecretExpiresAt: String?,
|
|
2206
|
+
|
|
2207
|
+
# Format: date-time.
|
|
2208
|
+
disabledAt: String?,
|
|
2209
|
+
|
|
2210
|
+
# Format: date-time.
|
|
2211
|
+
createdAt: String,
|
|
2212
|
+
|
|
2213
|
+
# Format: date-time.
|
|
2214
|
+
updatedAt: String
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2217
|
+
type webhook_endpoint_enabled_events_item = "invoice.authorized"
|
|
2218
|
+
| "invoice.rejected"
|
|
2219
|
+
| "purchase_settlement.authorized"
|
|
2220
|
+
| "purchase_settlement.rejected"
|
|
2221
|
+
| "credit_note.authorized"
|
|
2222
|
+
| "credit_note.rejected"
|
|
2223
|
+
| "debit_note.authorized"
|
|
2224
|
+
| "debit_note.rejected"
|
|
2225
|
+
| "waybill.authorized"
|
|
2226
|
+
| "waybill.rejected"
|
|
2227
|
+
| "withholding.authorized"
|
|
2228
|
+
| "withholding.rejected"
|
|
2229
|
+
| "certificate.verified"
|
|
2230
|
+
| "certificate.pending"
|
|
2231
|
+
| "certificate.blocked"
|
|
2232
|
+
| "certificate.revoked"
|
|
2233
|
+
| "certificate.reactivated"
|
|
2234
|
+
| "document.ride.generated"
|
|
2235
|
+
| "document.ride.failed"
|
|
2236
|
+
| "document.email.sent"
|
|
2237
|
+
| "document.email.delivered"
|
|
2238
|
+
| "document.email.bounced"
|
|
2239
|
+
| "document.email.complained"
|
|
2240
|
+
| "document.email.failed"
|
|
2241
|
+
| "account.email_paused"
|
|
2242
|
+
| "account.email_resumed"
|
|
2243
|
+
| "*"
|
|
2244
|
+
|
|
2245
|
+
# Mode of the events it receives.
|
|
2246
|
+
type webhook_endpoint_environment = "test" | "live"
|
|
2247
|
+
|
|
2248
|
+
# A page of webhook endpoints, newest first.
|
|
2249
|
+
type webhook_endpoint_list = {
|
|
2250
|
+
data: Array[webhook_endpoint],
|
|
2251
|
+
pagination: pagination
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
# `full` (default): the event with a snapshot of its resource in `data`. `thin`: the event
|
|
2255
|
+
# without `data`, only `id`, `type`, `environment` and `createdAt` (read the snapshot with GET
|
|
2256
|
+
# /v1/events/{id}).
|
|
2257
|
+
type webhook_endpoint_payload_mode = "full" | "thin"
|
|
2258
|
+
|
|
2259
|
+
# The signing secret of an endpoint.
|
|
2260
|
+
type webhook_endpoint_secret = {
|
|
2261
|
+
# The current whsec_ secret (Standard Webhooks): base64 of the HMAC-SHA256 key after the
|
|
2262
|
+
# prefix.
|
|
2263
|
+
secret: String,
|
|
2264
|
+
|
|
2265
|
+
# After a rotation: until when the previous secret also signs. Format: date-time.
|
|
2266
|
+
previousSecretExpiresAt: String?
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
# `pending_verification` (receives nothing until it echoes the challenge), `active` or
|
|
2270
|
+
# `disabled`.
|
|
2271
|
+
type webhook_endpoint_status = "pending_verification" | "active" | "disabled"
|
|
2272
|
+
|
|
2273
|
+
# The activation handshake: Flashpi POSTs a signed `webhook_endpoint.verification` body with a
|
|
2274
|
+
# `challenge`, and the endpoint must answer 2xx echoing it.
|
|
2275
|
+
type webhook_endpoint_verification = {
|
|
2276
|
+
# Format: date-time.
|
|
2277
|
+
verifiedAt: String?,
|
|
2278
|
+
|
|
2279
|
+
# Whether a handshake attempt is scheduled or running.
|
|
2280
|
+
inProgress: bool,
|
|
2281
|
+
|
|
2282
|
+
# Attempts of the current handshake.
|
|
2283
|
+
attempts: Integer | Float,
|
|
2284
|
+
|
|
2285
|
+
# Format: date-time.
|
|
2286
|
+
lastAttemptAt: String?,
|
|
2287
|
+
|
|
2288
|
+
# Why the last attempt failed: `challenge_mismatch`, `unexpected_status`, `timeout`,
|
|
2289
|
+
# `connection_failed`, `dns_resolution_failed`, `tls_error`, `address_not_allowed` or
|
|
2290
|
+
# `invalid_url`.
|
|
2291
|
+
lastError: String?,
|
|
2292
|
+
lastResponseStatus: Integer?
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
# The activation handshake of an endpoint, sent when it is created, when its URL changes and on
|
|
2296
|
+
# POST /v1/webhook-endpoints/{id}/verify; every attempt has a new id and challenge. It is signed
|
|
2297
|
+
# like every webhook; answer 2xx with `{"challenge": "<data.challenge>"}` (or the challenge as
|
|
2298
|
+
# plain text).
|
|
2299
|
+
type webhook_endpoint_verification_event = {
|
|
2300
|
+
# This attempt's id, also its webhook-id header: new on every attempt. Format: uuid.
|
|
2301
|
+
id: String,
|
|
2302
|
+
type: "webhook_endpoint.verification",
|
|
2303
|
+
environment: webhook_endpoint_verification_event_environment,
|
|
2304
|
+
|
|
2305
|
+
# When this attempt was sent. Format: date-time.
|
|
2306
|
+
createdAt: String,
|
|
2307
|
+
data: webhook_endpoint_verification_event_data
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
type webhook_endpoint_verification_event_data = {
|
|
2311
|
+
# Format: uuid.
|
|
2312
|
+
webhookEndpointId: String,
|
|
2313
|
+
|
|
2314
|
+
# Random value to echo back, new on every attempt: echo the one of this request.
|
|
2315
|
+
challenge: String
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
type webhook_endpoint_verification_event_environment = "test" | "live"
|
|
2319
|
+
|
|
2320
|
+
# The query of `webhookEndpointsDeliveriesList` (GET
|
|
2321
|
+
# /v1/webhook-endpoints/{endpointId}/deliveries).
|
|
2322
|
+
type webhook_endpoints_deliveries_list_query = {
|
|
2323
|
+
# Maximum number of items to return. Default: `20`.
|
|
2324
|
+
?limit: Integer,
|
|
2325
|
+
|
|
2326
|
+
# The `pagination.nextCursor` of the previous page. Omit it for the first page.
|
|
2327
|
+
?cursor: String,
|
|
2328
|
+
|
|
2329
|
+
# Only deliveries in this status.
|
|
2330
|
+
?status: webhook_endpoints_deliveries_list_query_status,
|
|
2331
|
+
|
|
2332
|
+
# Only deliveries of this event type.
|
|
2333
|
+
?eventType: webhook_endpoints_deliveries_list_query_event_type,
|
|
2334
|
+
|
|
2335
|
+
# Only the delivery of this event. Format: uuid.
|
|
2336
|
+
?eventId: String
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
type webhook_endpoints_deliveries_list_query_event_type = "invoice.authorized"
|
|
2340
|
+
| "invoice.rejected"
|
|
2341
|
+
| "purchase_settlement.authorized"
|
|
2342
|
+
| "purchase_settlement.rejected"
|
|
2343
|
+
| "credit_note.authorized"
|
|
2344
|
+
| "credit_note.rejected"
|
|
2345
|
+
| "debit_note.authorized"
|
|
2346
|
+
| "debit_note.rejected"
|
|
2347
|
+
| "waybill.authorized"
|
|
2348
|
+
| "waybill.rejected"
|
|
2349
|
+
| "withholding.authorized"
|
|
2350
|
+
| "withholding.rejected"
|
|
2351
|
+
| "certificate.verified"
|
|
2352
|
+
| "certificate.pending"
|
|
2353
|
+
| "certificate.blocked"
|
|
2354
|
+
| "certificate.revoked"
|
|
2355
|
+
| "certificate.reactivated"
|
|
2356
|
+
| "document.ride.generated"
|
|
2357
|
+
| "document.ride.failed"
|
|
2358
|
+
| "document.email.sent"
|
|
2359
|
+
| "document.email.delivered"
|
|
2360
|
+
| "document.email.bounced"
|
|
2361
|
+
| "document.email.complained"
|
|
2362
|
+
| "document.email.failed"
|
|
2363
|
+
| "account.email_paused"
|
|
2364
|
+
| "account.email_resumed"
|
|
2365
|
+
|
|
2366
|
+
type webhook_endpoints_deliveries_list_query_status = "pending" | "succeeded" | "failed"
|
|
2367
|
+
|
|
2368
|
+
# The query of `webhookEndpointsList` (GET /v1/webhook-endpoints).
|
|
2369
|
+
type webhook_endpoints_list_query = {
|
|
2370
|
+
# Maximum number of items to return. Default: `20`.
|
|
2371
|
+
?limit: Integer,
|
|
2372
|
+
|
|
2373
|
+
# The `pagination.nextCursor` of the previous page. Omit it for the first page.
|
|
2374
|
+
?cursor: String
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
# The supplier whose taxes are withheld.
|
|
2378
|
+
type withheld_subject = {
|
|
2379
|
+
# Identification type (not `final_consumer`).
|
|
2380
|
+
idType: withheld_subject_id_type,
|
|
2381
|
+
|
|
2382
|
+
# Identification number.
|
|
2383
|
+
id: String,
|
|
2384
|
+
|
|
2385
|
+
# Legal name.
|
|
2386
|
+
name: String,
|
|
2387
|
+
|
|
2388
|
+
# Whether the supplier is a related party.
|
|
2389
|
+
relatedParty: bool,
|
|
2390
|
+
|
|
2391
|
+
# Required when `idType` is `foreign_id`: `individual` or `company`.
|
|
2392
|
+
?subjectType: withheld_subject_subject_type,
|
|
2393
|
+
|
|
2394
|
+
# Where the authorized receipt is emailed (see `options.sendEmail`). Format: email.
|
|
2395
|
+
?email: String
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
# Identification type (not `final_consumer`).
|
|
2399
|
+
type withheld_subject_id_type = "ruc" | "cedula" | "passport" | "final_consumer" | "foreign_id"
|
|
2400
|
+
|
|
2401
|
+
# Required when `idType` is `foreign_id`: `individual` or `company`.
|
|
2402
|
+
type withheld_subject_subject_type = "individual" | "company"
|
|
2403
|
+
|
|
2404
|
+
# A withholding. Flashpi computes the withheld amount: taxable base × percentage, rounded to 2
|
|
2405
|
+
# decimals.
|
|
2406
|
+
type withholding = {
|
|
2407
|
+
# Tax withheld: `income_tax`, `vat` or `isd`.
|
|
2408
|
+
tax: withholding_tax,
|
|
2409
|
+
|
|
2410
|
+
# Withholding code: TABLA 20 for `vat` (for example `1` = 30%, `2` = 70%, `3` = 100%) and
|
|
2411
|
+
# `isd`, the Catálogo ATS for `income_tax` (for example `312`).
|
|
2412
|
+
code: String,
|
|
2413
|
+
|
|
2414
|
+
# Taxable base of the withholding.
|
|
2415
|
+
taxableBase: String,
|
|
2416
|
+
|
|
2417
|
+
# Percentage. Required for `income_tax`; for `vat` and `isd` Flashpi takes it from the code,
|
|
2418
|
+
# and a different value is refused.
|
|
2419
|
+
?rate: String,
|
|
2420
|
+
|
|
2421
|
+
# Dividend details.
|
|
2422
|
+
?dividends: withholding_dividends,
|
|
2423
|
+
|
|
2424
|
+
# Banana box purchase.
|
|
2425
|
+
?bananaBoxes: withholding_banana_boxes
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
# Required for the banana box income tax codes (338, 340, 341, 342, 342A, 342B).
|
|
2429
|
+
type withholding_banana_boxes = {
|
|
2430
|
+
# Number of boxes.
|
|
2431
|
+
count: Integer,
|
|
2432
|
+
|
|
2433
|
+
# Price per box.
|
|
2434
|
+
pricePerBox: String
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
# Required when `taxSupportCode` is 10.
|
|
2438
|
+
type withholding_dividends = {
|
|
2439
|
+
# Dividend payment date. Format: date.
|
|
2440
|
+
paymentDate: String,
|
|
2441
|
+
|
|
2442
|
+
# Corporate income tax attributable to the dividends.
|
|
2443
|
+
corporateIncomeTax: String,
|
|
2444
|
+
|
|
2445
|
+
# Fiscal year of the distributed profits.
|
|
2446
|
+
profitFiscalYear: String
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
# Required when the payment goes abroad (`paymentResidence` is `foreign`).
|
|
2450
|
+
type withholding_foreign_payment = {
|
|
2451
|
+
# Tax regime of the country of payment: `general`, `tax_haven` or `preferential` (preferential
|
|
2452
|
+
# regime or lower-tax jurisdiction).
|
|
2453
|
+
regime: withholding_foreign_payment_regime,
|
|
2454
|
+
|
|
2455
|
+
# Country of payment, as the SRI country code (3 or 4 digits).
|
|
2456
|
+
country: String,
|
|
2457
|
+
|
|
2458
|
+
# Whether a double taxation treaty applies.
|
|
2459
|
+
doubleTaxationTreatyApplies: bool,
|
|
2460
|
+
|
|
2461
|
+
# Whether the payment is subject to withholding under the law. Required when no double
|
|
2462
|
+
# taxation treaty applies.
|
|
2463
|
+
?subjectToWithholdingUnderLaw: bool,
|
|
2464
|
+
|
|
2465
|
+
# Whether it is a payment to a preferential tax regime.
|
|
2466
|
+
preferentialTaxRegime: bool
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
# Tax regime of the country of payment: `general`, `tax_haven` or `preferential` (preferential
|
|
2470
|
+
# regime or lower-tax jurisdiction).
|
|
2471
|
+
type withholding_foreign_payment_regime = "general" | "tax_haven" | "preferential"
|
|
2472
|
+
|
|
2473
|
+
# A payment of the supporting document.
|
|
2474
|
+
type withholding_payment = {
|
|
2475
|
+
# Payment method (same values as `DocumentPayment.method`).
|
|
2476
|
+
method: withholding_payment_method,
|
|
2477
|
+
|
|
2478
|
+
# Amount.
|
|
2479
|
+
amount: String
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
# Payment method (same values as `DocumentPayment.method`).
|
|
2483
|
+
type withholding_payment_method = "cash"
|
|
2484
|
+
| "debt_offset"
|
|
2485
|
+
| "debit_card"
|
|
2486
|
+
| "electronic_money"
|
|
2487
|
+
| "prepaid_card"
|
|
2488
|
+
| "credit_card"
|
|
2489
|
+
| "other_financial_system"
|
|
2490
|
+
| "securities_endorsement"
|
|
2491
|
+
|
|
2492
|
+
# Tax withheld: `income_tax`, `vat` or `isd`.
|
|
2493
|
+
type withholding_tax = "income_tax" | "vat" | "isd"
|
|
2494
|
+
end
|
|
2495
|
+
end
|