flashpi 0.2.1__tar.gz → 0.2.2__tar.gz

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.
Files changed (99) hide show
  1. {flashpi-0.2.1 → flashpi-0.2.2}/CHANGELOG.md +8 -0
  2. {flashpi-0.2.1 → flashpi-0.2.2}/PKG-INFO +3 -2
  3. {flashpi-0.2.1 → flashpi-0.2.2}/README.en.md +2 -1
  4. {flashpi-0.2.1 → flashpi-0.2.2}/README.md +2 -1
  5. {flashpi-0.2.1 → flashpi-0.2.2}/openapi/openapi.json +98 -6
  6. {flashpi-0.2.1 → flashpi-0.2.2}/pyproject.toml +1 -1
  7. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_version.py +1 -1
  8. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/resources/issuer_onboardings.py +5 -0
  9. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/resources/status.py +9 -5
  10. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/types/__init__.py +4 -0
  11. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/types/_generated.py +57 -5
  12. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_02.py +2 -1
  13. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_02.py +2 -1
  14. {flashpi-0.2.1 → flashpi-0.2.2}/tests/live/test_live.py +11 -3
  15. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_resources.py +56 -3
  16. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_types.py +72 -1
  17. {flashpi-0.2.1 → flashpi-0.2.2}/.gitignore +0 -0
  18. {flashpi-0.2.1 → flashpi-0.2.2}/LICENSE +0 -0
  19. {flashpi-0.2.1 → flashpi-0.2.2}/scripts/__init__.py +0 -0
  20. {flashpi-0.2.1 → flashpi-0.2.2}/scripts/installed_check.py +0 -0
  21. {flashpi-0.2.1 → flashpi-0.2.2}/scripts/openapi.py +0 -0
  22. {flashpi-0.2.1 → flashpi-0.2.2}/scripts/package_check.py +0 -0
  23. {flashpi-0.2.1 → flashpi-0.2.2}/scripts/readme.py +0 -0
  24. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/__init__.py +0 -0
  25. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_client.py +0 -0
  26. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_errors.py +0 -0
  27. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_http.py +0 -0
  28. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_network.py +0 -0
  29. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_pagination.py +0 -0
  30. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_resource.py +0 -0
  31. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_response.py +0 -0
  32. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_validate.py +0 -0
  33. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/_webhooks.py +0 -0
  34. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/py.typed +0 -0
  35. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/resources/__init__.py +0 -0
  36. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/resources/documents.py +0 -0
  37. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/resources/events.py +0 -0
  38. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/resources/issuers.py +0 -0
  39. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/resources/uploads.py +0 -0
  40. {flashpi-0.2.1 → flashpi-0.2.2}/src/flashpi/resources/webhook_endpoints.py +0 -0
  41. {flashpi-0.2.1 → flashpi-0.2.2}/tests/__init__.py +0 -0
  42. {flashpi-0.2.1 → flashpi-0.2.2}/tests/conftest.py +0 -0
  43. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/_context.py +0 -0
  44. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_01.py +0 -0
  45. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_03.py +0 -0
  46. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_04.py +0 -0
  47. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_05.py +0 -0
  48. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_06.py +0 -0
  49. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_07.py +0 -0
  50. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_08.py +0 -0
  51. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_09.py +0 -0
  52. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_10.py +0 -0
  53. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_11.py +0 -0
  54. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_12.py +0 -0
  55. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_13.py +0 -0
  56. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_14.py +0 -0
  57. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/en_15.py +0 -0
  58. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_01.py +0 -0
  59. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_03.py +0 -0
  60. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_04.py +0 -0
  61. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_05.py +0 -0
  62. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_06.py +0 -0
  63. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_07.py +0 -0
  64. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_08.py +0 -0
  65. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_09.py +0 -0
  66. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_10.py +0 -0
  67. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_11.py +0 -0
  68. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_12.py +0 -0
  69. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_13.py +0 -0
  70. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_14.py +0 -0
  71. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/readme/es_15.py +0 -0
  72. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/typings/django/__init__.pyi +0 -0
  73. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/typings/django/http/__init__.pyi +0 -0
  74. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/typings/django/views/__init__.pyi +0 -0
  75. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/typings/django/views/decorators/__init__.pyi +0 -0
  76. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/typings/django/views/decorators/csrf.pyi +0 -0
  77. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/typings/django/views/decorators/http.pyi +0 -0
  78. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/typings/fastapi/__init__.pyi +0 -0
  79. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/typings/fastapi/responses.pyi +0 -0
  80. {flashpi-0.2.1 → flashpi-0.2.2}/tests/examples/typings/flask/__init__.pyi +0 -0
  81. {flashpi-0.2.1 → flashpi-0.2.2}/tests/live/__init__.py +0 -0
  82. {flashpi-0.2.1 → flashpi-0.2.2}/tests/support.py +0 -0
  83. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_cancellation.py +0 -0
  84. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_client.py +0 -0
  85. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_deadline.py +0 -0
  86. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_errors.py +0 -0
  87. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_headers.py +0 -0
  88. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_http.py +0 -0
  89. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_network.py +0 -0
  90. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_openapi.py +0 -0
  91. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_operations.py +0 -0
  92. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_package_check.py +0 -0
  93. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_pagination.py +0 -0
  94. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_readme.py +0 -0
  95. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_resource_types.py +0 -0
  96. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_retries.py +0 -0
  97. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_review_fixes.py +0 -0
  98. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_version.py +0 -0
  99. {flashpi-0.2.1 → flashpi-0.2.2}/tests/test_webhooks.py +0 -0
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.2](https://github.com/flashpi1/flashpi-python/compare/v0.2.1...v0.2.2) (2026-12-01)
4
+
5
+
6
+ ### Bug fixes
7
+
8
+ * **types:** export SriStatus and SriEnvironmentStatus from flashpi.types ([18824ce](https://github.com/flashpi1/flashpi-python/commit/18824cea08c1683d4270bbb7d45c61790a9daf34))
9
+ * **types:** sync the API contract of 2026-12-01 ([44e373f](https://github.com/flashpi1/flashpi-python/commit/44e373f9107f41cf66e4527281db56aecf963c1d))
10
+
3
11
  ## [0.2.1](https://github.com/flashpi1/flashpi-python/compare/v0.2.0...v0.2.1) (2026-11-25)
4
12
 
5
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: flashpi
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: The official Python SDK for Flashpi, the electronic invoicing API for Ecuador's SRI.
5
5
  Project-URL: Homepage, https://flashpi.com.ec
6
6
  Project-URL: Documentation, https://flashpi.com.ec/docs/sdks/
@@ -127,7 +127,8 @@ from flashpi import AsyncFlashpi
127
127
  async def main() -> None:
128
128
  async with AsyncFlashpi() as flashpi:
129
129
  status = await flashpi.status.get()
130
- print(status["status"])
130
+ # "operational", y el SRI de producción: operational, degraded, outage o unknown
131
+ print(status["status"], status["sri"]["production"]["status"])
131
132
 
132
133
  async for document in flashpi.documents.list({"status": "authorized"}):
133
134
  print(document["accessKey"])
@@ -94,7 +94,8 @@ from flashpi import AsyncFlashpi
94
94
  async def main() -> None:
95
95
  async with AsyncFlashpi() as flashpi:
96
96
  status = await flashpi.status.get()
97
- print(status["status"])
97
+ # "operational", and the production SRI: operational, degraded, outage or unknown
98
+ print(status["status"], status["sri"]["production"]["status"])
98
99
 
99
100
  async for document in flashpi.documents.list({"status": "authorized"}):
100
101
  print(document["accessKey"])
@@ -96,7 +96,8 @@ from flashpi import AsyncFlashpi
96
96
  async def main() -> None:
97
97
  async with AsyncFlashpi() as flashpi:
98
98
  status = await flashpi.status.get()
99
- print(status["status"])
99
+ # "operational", y el SRI de producción: operational, degraded, outage o unknown
100
+ print(status["status"], status["sri"]["production"]["status"])
100
101
 
101
102
  async for document in flashpi.documents.list({"status": "authorized"}):
102
103
  print(document["accessKey"])
@@ -3,7 +3,7 @@
3
3
  "paths": {
4
4
  "/v1/status": {
5
5
  "get": {
6
- "description": "Public status of the Flashpi API: `operational` whenever the API answers. It reports no components and no SRI availability. Flashpi's status page, https://flashpi.com.ec/status, shows each component and the notices about incidents, maintenance and the SRI.",
6
+ "description": "Public status of the Flashpi API, `operational` whenever the API answers, and the availability of the SRI's web services per environment, which Flashpi checks every minute from its servers. Flashpi's status page, https://flashpi.com.ec/status, also shows the console, the docs and the notices about incidents and maintenance.",
7
7
  "operationId": "statusGet",
8
8
  "parameters": [
9
9
  {
@@ -6302,6 +6302,71 @@
6302
6302
  }
6303
6303
  },
6304
6304
  "schemas": {
6305
+ "SriEnvironmentStatus": {
6306
+ "type": "object",
6307
+ "properties": {
6308
+ "status": {
6309
+ "type": "string",
6310
+ "enum": [
6311
+ "operational",
6312
+ "degraded",
6313
+ "outage",
6314
+ "unknown"
6315
+ ],
6316
+ "example": "operational",
6317
+ "description": "`operational`: both web services answered in the latest check. `degraded`: they answered, the slower one in 3 seconds or more. `outage`: two checks in a row failed (no answer within 10 seconds, an HTTP error or an unexpected answer); while the SRI does not answer, Flashpi keeps the documents and retries them. `unknown`: no recent check (none answered yet, or the latest is more than 5 minutes old)."
6318
+ },
6319
+ "since": {
6320
+ "type": [
6321
+ "string",
6322
+ "null"
6323
+ ],
6324
+ "format": "date-time",
6325
+ "example": "2026-11-27T19:02:11.000Z",
6326
+ "description": "Since when `status` holds; null while it is `unknown`."
6327
+ },
6328
+ "checkedAt": {
6329
+ "type": [
6330
+ "string",
6331
+ "null"
6332
+ ],
6333
+ "format": "date-time",
6334
+ "example": "2026-11-27T19:30:05.000Z",
6335
+ "description": "When the latest check finished; null before the first one."
6336
+ },
6337
+ "latencyMs": {
6338
+ "type": [
6339
+ "integer",
6340
+ "null"
6341
+ ],
6342
+ "example": 140,
6343
+ "description": "The slower web service's answer time in the latest check, in milliseconds; null when the status is `outage` or `unknown`, or when the latest check failed."
6344
+ }
6345
+ },
6346
+ "description": "Availability of one SRI environment's web services, as Flashpi checks them every minute from its servers: the reception service's WSDL and a query of the authorization service that creates nothing.",
6347
+ "required": [
6348
+ "status",
6349
+ "since",
6350
+ "checkedAt",
6351
+ "latencyMs"
6352
+ ]
6353
+ },
6354
+ "SriStatus": {
6355
+ "type": "object",
6356
+ "properties": {
6357
+ "test": {
6358
+ "$ref": "#/components/schemas/SriEnvironmentStatus"
6359
+ },
6360
+ "production": {
6361
+ "$ref": "#/components/schemas/SriEnvironmentStatus"
6362
+ }
6363
+ },
6364
+ "description": "Availability of the SRI per environment: `test` is the pruebas environment (documents of test keys), `production` the production one (documents of live keys).",
6365
+ "required": [
6366
+ "test",
6367
+ "production"
6368
+ ]
6369
+ },
6305
6370
  "Status": {
6306
6371
  "type": "object",
6307
6372
  "properties": {
@@ -6311,12 +6376,21 @@
6311
6376
  "operational"
6312
6377
  ],
6313
6378
  "example": "operational",
6314
- "description": "Overall status of Flashpi."
6379
+ "description": "Overall status of Flashpi: `operational` whenever the API answers."
6380
+ },
6381
+ "sri": {
6382
+ "description": "Availability of the SRI's web services per environment.",
6383
+ "allOf": [
6384
+ {
6385
+ "$ref": "#/components/schemas/SriStatus"
6386
+ }
6387
+ ]
6315
6388
  }
6316
6389
  },
6317
- "description": "Public status of the Flashpi API. Components and SRI notices are on the status page, https://flashpi.com.ec/status.",
6390
+ "description": "Public status of the Flashpi API and of the SRI. The status page, https://flashpi.com.ec/status, also shows the console, the docs and the notices.",
6318
6391
  "required": [
6319
- "status"
6392
+ "status",
6393
+ "sri"
6320
6394
  ]
6321
6395
  },
6322
6396
  "ErrorCode": {
@@ -7450,13 +7524,31 @@
7450
7524
  "null"
7451
7525
  ],
7452
7526
  "example": "SUPERMERCADOS LA PRADERA S.A.",
7453
- "description": "Organization (O): usually the company of a legal representative."
7527
+ "description": "Organization (O) as the certificate's subject states it. Some CAs put their own name there: show companyName as the company."
7528
+ },
7529
+ "companyName": {
7530
+ "type": [
7531
+ "string",
7532
+ "null"
7533
+ ],
7534
+ "example": "SUPERMERCADOS LA PRADERA S.A.",
7535
+ "description": "The company (razón social) the certificate states: where the issuing CA keeps it (its own field on older certificates, else the subject's O), never the CA's own name. Null for a natural person or when it is not known."
7536
+ },
7537
+ "jobTitle": {
7538
+ "type": [
7539
+ "string",
7540
+ "null"
7541
+ ],
7542
+ "example": "REPRESENTANTE LEGAL",
7543
+ "description": "The holder's job title (cargo), when the certificate states it."
7454
7544
  }
7455
7545
  },
7456
7546
  "description": "The certificate holder's names.",
7457
7547
  "required": [
7458
7548
  "commonName",
7459
- "organization"
7549
+ "organization",
7550
+ "companyName",
7551
+ "jobTitle"
7460
7552
  ]
7461
7553
  },
7462
7554
  "IssuerOnboardingIdentification": {
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flashpi"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "The official Python SDK for Flashpi, the electronic invoicing API for Ecuador's SRI."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,3 +1,3 @@
1
1
  """The version of this package, updated by release-please on every release."""
2
2
 
3
- VERSION = "0.2.1" # x-release-please-version
3
+ VERSION = "0.2.2" # x-release-please-version
@@ -43,6 +43,11 @@ class IssuerOnboardings(SyncAPIResource):
43
43
  `verifying` until it is `ready` (Flashpi reads the holder, RUC and SRI data) or `rejected`,
44
44
  review the prefill, then complete it.
45
45
 
46
+ `onboarding["certificate"]["holder"]` has the holder's name (`commonName`), the company the
47
+ certificate states (`companyName`) and the holder's job title (`jobTitle`). Show
48
+ `companyName` as the company: `organization` is the subject's raw O, which some CAs fill with
49
+ their own name.
50
+
46
51
  Needs an account-scoped API key with read_write access.
47
52
  """
48
53
 
@@ -1,4 +1,4 @@
1
- """The API's own status. It needs no API key."""
1
+ """The status of the API and of the SRI. It needs no API key."""
2
2
 
3
3
  from functools import cached_property
4
4
  from typing import Unpack
@@ -10,10 +10,12 @@ from flashpi.types import Status
10
10
 
11
11
 
12
12
  class StatusResource(SyncAPIResource):
13
- """The API's own status (Node: `Status`, exported as `StatusResource`)."""
13
+ """The status of the API and of the SRI (Node: `Status`, exported as `StatusResource`)."""
14
14
 
15
15
  def get(self, **options: Unpack[RequestOptions]) -> Status:
16
- """Whether Flashpi is operational."""
16
+ """Whether Flashpi is operational, and the availability of the SRI's web services in each
17
+ environment (`sri["test"]` for test keys, `sri["production"]` for live keys), which Flashpi
18
+ checks every minute: `operational`, `degraded`, `outage` or `unknown`."""
17
19
  return self._request(RequestSpec[Status](method="GET", path="/v1/status", options=options))
18
20
 
19
21
  @cached_property
@@ -28,10 +30,12 @@ class StatusResourceWithResponse:
28
30
 
29
31
 
30
32
  class AsyncStatusResource(AsyncAPIResource):
31
- """The API's own status, for `AsyncFlashpi`."""
33
+ """The status of the API and of the SRI, for `AsyncFlashpi`."""
32
34
 
33
35
  async def get(self, **options: Unpack[RequestOptions]) -> Status:
34
- """Whether Flashpi is operational."""
36
+ """Whether Flashpi is operational, and the availability of the SRI's web services in each
37
+ environment (`sri["test"]` for test keys, `sri["production"]` for live keys), which Flashpi
38
+ checks every minute: `operational`, `degraded`, `outage` or `unknown`."""
35
39
  return await self._request(
36
40
  RequestSpec[Status](method="GET", path="/v1/status", options=options)
37
41
  )
@@ -89,6 +89,8 @@ from ._generated import (
89
89
  ProblemDetails,
90
90
  RotateWebhookEndpointSecret,
91
91
  SendDocumentEmail,
92
+ SriEnvironmentStatus,
93
+ SriStatus,
92
94
  Status,
93
95
  SupportingDocument,
94
96
  SupportingDocumentTax,
@@ -306,6 +308,8 @@ __all__ = [
306
308
  "ProblemDetails",
307
309
  "RotateWebhookEndpointSecret",
308
310
  "SendDocumentEmail",
311
+ "SriEnvironmentStatus",
312
+ "SriStatus",
309
313
  "Status",
310
314
  "SupportingDocument",
311
315
  "SupportingDocumentTax",
@@ -2007,7 +2007,16 @@ class IssuerOnboardingHolder(TypedDict):
2007
2007
  """Common name (CN): the holder's name."""
2008
2008
 
2009
2009
  organization: str | None
2010
- """Organization (O): usually the company of a legal representative."""
2010
+ """Organization (O) as the certificate's subject states it. Some CAs put their own name
2011
+ there: show companyName as the company."""
2012
+
2013
+ companyName: str | None
2014
+ """The company (razón social) the certificate states: where the issuing CA keeps it (its own
2015
+ field on older certificates, else the subject's O), never the CA's own name. Null for a
2016
+ natural person or when it is not known."""
2017
+
2018
+ jobTitle: str | None
2019
+ """The holder's job title (cargo), when the certificate states it."""
2011
2020
 
2012
2021
 
2013
2022
  IssuerOnboardingIdentificationRucSource: TypeAlias = Literal["certificate", "cedula"]
@@ -2360,16 +2369,59 @@ class SendDocumentEmail(TypedDict):
2360
2369
  """No options yet: send an empty object or no body."""
2361
2370
 
2362
2371
 
2372
+ SriEnvironmentStatusStatus: TypeAlias = Literal["operational", "degraded", "outage", "unknown"]
2373
+ """`operational`: both web services answered in the latest check. `degraded`: they answered, the
2374
+ slower one in 3 seconds or more. `outage`: two checks in a row failed (no answer within 10
2375
+ seconds, an HTTP error or an unexpected answer); while the SRI does not answer, Flashpi keeps
2376
+ the documents and retries them. `unknown`: no recent check (none answered yet, or the latest
2377
+ is more than 5 minutes old)."""
2378
+
2379
+
2380
+ class SriEnvironmentStatus(TypedDict):
2381
+ """Availability of one SRI environment's web services, as Flashpi checks them every minute
2382
+ from its servers: the reception service's WSDL and a query of the authorization service
2383
+ that creates nothing."""
2384
+
2385
+ status: SriEnvironmentStatusStatus
2386
+ """`operational`: both web services answered in the latest check. `degraded`: they answered,
2387
+ the slower one in 3 seconds or more. `outage`: two checks in a row failed (no answer
2388
+ within 10 seconds, an HTTP error or an unexpected answer); while the SRI does not answer,
2389
+ Flashpi keeps the documents and retries them. `unknown`: no recent check (none answered
2390
+ yet, or the latest is more than 5 minutes old)."""
2391
+
2392
+ since: str | None
2393
+ """Since when `status` holds; null while it is `unknown`. Format: date-time."""
2394
+
2395
+ checkedAt: str | None
2396
+ """When the latest check finished; null before the first one. Format: date-time."""
2397
+
2398
+ latencyMs: int | None
2399
+ """The slower web service's answer time in the latest check, in milliseconds; null when the
2400
+ status is `outage` or `unknown`, or when the latest check failed."""
2401
+
2402
+
2403
+ class SriStatus(TypedDict):
2404
+ """Availability of the SRI per environment: `test` is the pruebas environment (documents of
2405
+ test keys), `production` the production one (documents of live keys)."""
2406
+
2407
+ test: SriEnvironmentStatus
2408
+
2409
+ production: SriEnvironmentStatus
2410
+
2411
+
2363
2412
  StatusStatus: TypeAlias = Literal["operational"]
2364
- """Overall status of Flashpi."""
2413
+ """Overall status of Flashpi: `operational` whenever the API answers."""
2365
2414
 
2366
2415
 
2367
2416
  class Status(TypedDict):
2368
- """Public status of the Flashpi API. Components and SRI notices are on the status page,
2369
- https://flashpi.com.ec/status."""
2417
+ """Public status of the Flashpi API and of the SRI. The status page,
2418
+ https://flashpi.com.ec/status, also shows the console, the docs and the notices."""
2370
2419
 
2371
2420
  status: StatusStatus
2372
- """Overall status of Flashpi."""
2421
+ """Overall status of Flashpi: `operational` whenever the API answers."""
2422
+
2423
+ sri: SriStatus
2424
+ """Availability of the SRI's web services per environment."""
2373
2425
 
2374
2426
 
2375
2427
  class UpdateEstablishment(TypedDict):
@@ -13,7 +13,8 @@ from flashpi import AsyncFlashpi
13
13
  async def main() -> None:
14
14
  async with AsyncFlashpi() as flashpi:
15
15
  status = await flashpi.status.get()
16
- print(status["status"])
16
+ # "operational", and the production SRI: operational, degraded, outage or unknown
17
+ print(status["status"], status["sri"]["production"]["status"])
17
18
 
18
19
  async for document in flashpi.documents.list({"status": "authorized"}):
19
20
  print(document["accessKey"])
@@ -13,7 +13,8 @@ from flashpi import AsyncFlashpi
13
13
  async def main() -> None:
14
14
  async with AsyncFlashpi() as flashpi:
15
15
  status = await flashpi.status.get()
16
- print(status["status"])
16
+ # "operational", y el SRI de producción: operational, degraded, outage o unknown
17
+ print(status["status"], status["sri"]["production"]["status"])
17
18
 
18
19
  async for document in flashpi.documents.list({"status": "authorized"}):
19
20
  print(document["accessKey"])
@@ -22,7 +22,7 @@ from collections.abc import Iterator, Mapping
22
22
  import pytest
23
23
 
24
24
  from flashpi import AsyncFlashpi, ConflictError, Flashpi, NotFoundError, UnprocessableEntityError
25
- from flashpi.types import CreateInvoice, Document
25
+ from flashpi.types import CreateInvoice, Document, Status
26
26
 
27
27
  API_KEY = os.environ.get("FLASHPI_TEST_API_KEY", "")
28
28
  ISSUER_ID = os.environ.get("FLASHPI_DEMO_ISSUER_ID", "")
@@ -92,13 +92,21 @@ def invoice() -> Document:
92
92
  return issued[0]
93
93
 
94
94
 
95
+ def check_status(status: Status) -> None:
96
+ """Flashpi is operational, and it reports the SRI of both environments."""
97
+ assert status["status"] == "operational"
98
+ assert set(status["sri"]) == {"test", "production"}
99
+ for sri in (status["sri"]["test"], status["sri"]["production"]):
100
+ assert sri["status"] in ("operational", "degraded", "outage", "unknown")
101
+
102
+
95
103
  def test_reads_the_api_status(flashpi: Flashpi) -> None:
96
- assert flashpi.status.get() == {"status": "operational"}
104
+ check_status(flashpi.status.get())
97
105
 
98
106
 
99
107
  async def test_reads_the_api_status_on_the_async_client() -> None:
100
108
  async with AsyncFlashpi(checked_key(), base_url=BASE_URL) as client:
101
- assert await client.status.get() == {"status": "operational"}
109
+ check_status(await client.status.get())
102
110
 
103
111
 
104
112
  def test_rejects_an_invalid_invoice_with_field_errors_in_spanish(flashpi: Flashpi) -> None:
@@ -302,9 +302,24 @@ async def test_sends_its_operation(make: MakeApi, case: Case) -> None:
302
302
  assert ("idempotency-key" in request.headers) == (case.method == "POST")
303
303
 
304
304
 
305
- async def test_returns_the_api_status(make: MakeApi) -> None:
306
- api = make(json_response({"status": "operational"}))
307
- assert await api.op("status.get") == {"status": "operational"}
305
+ async def test_returns_the_api_status_with_the_sri_of_each_environment(make: MakeApi) -> None:
306
+ test = {
307
+ "status": "operational",
308
+ "since": "2026-11-27T19:02:11.000Z",
309
+ "checkedAt": "2026-11-27T19:30:05.000Z",
310
+ "latencyMs": 140,
311
+ }
312
+ production = {"status": "unknown", "since": None, "checkedAt": None, "latencyMs": None}
313
+ api = make(
314
+ json_response({"status": "operational", "sri": {"test": test, "production": production}})
315
+ )
316
+ status = await api.op("status.get")
317
+ assert status["sri"] == {"test": test, "production": production}
318
+ assert (status["sri"]["test"]["latencyMs"], status["sri"]["production"]["status"]) == (
319
+ 140,
320
+ "unknown",
321
+ )
322
+ assert api.sent[0].url.path == "/v1/status"
308
323
 
309
324
 
310
325
  async def test_walks_every_event_across_pages_with_the_same_filters(make: MakeApi) -> None:
@@ -897,6 +912,44 @@ class TestIssuerOnboardings:
897
912
  await api.op("issuer_onboardings.create", {"file": P12})
898
913
  assert api.sent == []
899
914
 
915
+ @pytest.mark.parametrize(
916
+ ("name", "args", "status_code"),
917
+ [
918
+ ("create", ({"file": P12, "password": "x"},), 202),
919
+ ("get", (ONBOARDING,), 200),
920
+ ],
921
+ )
922
+ async def test_reads_the_company_and_job_title_of_the_holder(
923
+ self, make: MakeApi, name: str, args: tuple[Any, ...], status_code: int
924
+ ) -> None:
925
+ holder = {
926
+ "commonName": "MARIA PEREZ",
927
+ "organization": "SECURITY DATA S.A.",
928
+ "companyName": "SUPERMERCADOS LA PRADERA S.A.",
929
+ "jobTitle": "REPRESENTANTE LEGAL",
930
+ }
931
+ api = make(
932
+ json_response({"id": ONBOARDING, "certificate": {"holder": holder}}, status_code)
933
+ )
934
+ onboarding = await api.op(f"issuer_onboardings.{name}", *args)
935
+ read = onboarding["certificate"]["holder"]
936
+ assert (read["companyName"], read["jobTitle"]) == (
937
+ "SUPERMERCADOS LA PRADERA S.A.",
938
+ "REPRESENTANTE LEGAL",
939
+ )
940
+ assert read["organization"] == "SECURITY DATA S.A."
941
+
942
+ async def test_reads_a_holder_with_no_company_or_job_title(self, make: MakeApi) -> None:
943
+ holder = {
944
+ "commonName": "MARIA PEREZ",
945
+ "organization": None,
946
+ "companyName": None,
947
+ "jobTitle": None,
948
+ }
949
+ api = make(json_response({"id": ONBOARDING, "certificate": {"holder": holder}}))
950
+ onboarding = await api.op("issuer_onboardings.get", ONBOARDING)
951
+ assert onboarding["certificate"]["holder"] == holder
952
+
900
953
  @pytest.mark.parametrize(
901
954
  ("name", "args"),
902
955
  [
@@ -22,12 +22,21 @@ from flashpi.types import (
22
22
  EventType,
23
23
  FieldError,
24
24
  FieldErrorCode,
25
+ IssuerOnboardingHolder,
25
26
  Problem,
27
+ SriEnvironmentStatus,
28
+ SriStatus,
29
+ Status,
26
30
  ThinWebhookEvent,
27
31
  WebhookEndpointVerificationEventData,
28
32
  WebhookEvent,
29
33
  )
30
- from flashpi.types._generated import CertificateWarningCode, DocumentFailureCode, EventThinType
34
+ from flashpi.types._generated import (
35
+ CertificateWarningCode,
36
+ DocumentFailureCode,
37
+ EventThinType,
38
+ SriEnvironmentStatusStatus,
39
+ )
31
40
 
32
41
  ROOT = Path(__file__).resolve().parent.parent
33
42
  CONTRACT: dict[str, Any] = json.loads((ROOT / "openapi" / "openapi.json").read_text("utf-8"))
@@ -86,6 +95,22 @@ def test_a_certificate_always_carries_its_warnings() -> None:
86
95
  assert CertificateWarning.__required_keys__ == {"code", "message"}
87
96
 
88
97
 
98
+ def test_an_onboarding_holder_always_carries_its_company_and_job_title() -> None:
99
+ assert IssuerOnboardingHolder.__required_keys__ == {
100
+ "commonName",
101
+ "organization",
102
+ "companyName",
103
+ "jobTitle",
104
+ }
105
+
106
+
107
+ def test_the_status_always_carries_the_sri_of_each_environment() -> None:
108
+ assert Status.__required_keys__ == {"status", "sri"}
109
+ assert SriStatus.__required_keys__ == {"test", "production"}
110
+ assert SriEnvironmentStatus.__required_keys__ == {"status", "since", "checkedAt", "latencyMs"}
111
+ assert get_args(SriEnvironmentStatusStatus) == ("operational", "degraded", "outage", "unknown")
112
+
113
+
89
114
  def test_every_public_name_is_exported() -> None:
90
115
  for name in flashpi.types.__all__:
91
116
  assert getattr(flashpi.types, name) is not None
@@ -127,6 +152,28 @@ def reads_certificate_warnings(certificate: Certificate) -> list[str]:
127
152
  return [f"{warning['code']}: {warning['message']}" for warning in certificate["warnings"]]
128
153
 
129
154
 
155
+ def names_the_company_of_a_holder(holder: IssuerOnboardingHolder) -> str | None:
156
+ assert_type(holder["organization"], str | None)
157
+ assert_type(holder["companyName"], str | None)
158
+ assert_type(holder["jobTitle"], str | None)
159
+ company = holder["companyName"]
160
+ return f"{company} ({holder['jobTitle']})" if company and holder["jobTitle"] else company
161
+
162
+
163
+ def reads_the_sri_status(status: Status) -> dict[str, str]:
164
+ assert_type(status["sri"], SriStatus)
165
+ readings: dict[str, str] = {}
166
+ for name, sri in (("test", status["sri"]["test"]), ("production", status["sri"]["production"])):
167
+ assert_type(sri, SriEnvironmentStatus)
168
+ assert_type(sri["status"], SriEnvironmentStatusStatus)
169
+ assert_type(sri["since"], str | None)
170
+ assert_type(sri["checkedAt"], str | None)
171
+ assert_type(sri["latencyMs"], int | None)
172
+ latency = "" if sri["latencyMs"] is None else f" {sri['latencyMs']} ms"
173
+ readings[name] = sri["status"] + latency
174
+ return readings
175
+
176
+
130
177
  def keeps_field_error_codes_open(error: FieldError, problem: Problem) -> None:
131
178
  assert_type(error["code"], ApiFieldErrorCode)
132
179
  code: ApiFieldErrorCode = "a_code_added_later"
@@ -164,4 +211,28 @@ def test_the_static_checks_run() -> None:
164
211
  '{"id": "1", "status": "accepted", "warnings": [{"code": "ruc_mismatch", "message": "M"}]}'
165
212
  )
166
213
  assert reads_certificate_warnings(certificate) == ["ruc_mismatch: M"]
214
+ holder: IssuerOnboardingHolder = {
215
+ "commonName": "MARIA PEREZ",
216
+ "organization": "SECURITY DATA S.A.",
217
+ "companyName": "SUPERMERCADOS LA PRADERA S.A.",
218
+ "jobTitle": "REPRESENTANTE LEGAL",
219
+ }
220
+ assert names_the_company_of_a_holder(holder) == (
221
+ "SUPERMERCADOS LA PRADERA S.A. (REPRESENTANTE LEGAL)"
222
+ )
223
+ person: IssuerOnboardingHolder = {
224
+ "commonName": "MARIA PEREZ",
225
+ "organization": None,
226
+ "companyName": None,
227
+ "jobTitle": None,
228
+ }
229
+ assert names_the_company_of_a_holder(person) is None
230
+ status: Status = json.loads(
231
+ '{"status": "operational", "sri": {'
232
+ '"test": {"status": "degraded", "since": "2026-11-27T19:02:11.000Z",'
233
+ ' "checkedAt": "2026-11-27T19:30:05.000Z", "latencyMs": 3140},'
234
+ ' "production": {"status": "unknown", "since": null, "checkedAt": null,'
235
+ ' "latencyMs": null}}}'
236
+ )
237
+ assert reads_the_sri_status(status) == {"test": "degraded 3140 ms", "production": "unknown"}
167
238
  assert xml["kind"] is None
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes