tools2fast-fastapi 0.1.4__tar.gz → 0.1.5__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 (32) hide show
  1. {tools2fast_fastapi-0.1.4/src/tools2fast_fastapi.egg-info → tools2fast_fastapi-0.1.5}/PKG-INFO +1 -1
  2. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/pyproject.toml +1 -1
  3. tools2fast_fastapi-0.1.5/src/tools2fast_fastapi/__version__.py +1 -0
  4. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/schemas/response_schema.py +28 -0
  5. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5/src/tools2fast_fastapi.egg-info}/PKG-INFO +1 -1
  6. tools2fast_fastapi-0.1.4/src/tools2fast_fastapi/__version__.py +0 -1
  7. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/LICENSE +0 -0
  8. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/MANIFEST.in +0 -0
  9. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/README.md +0 -0
  10. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/docs/guide.md +0 -0
  11. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/examples/example.py +0 -0
  12. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/setup.cfg +0 -0
  13. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/__init__.py +0 -0
  14. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/models/__init__.py +0 -0
  15. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/models/mixins.py +0 -0
  16. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/schemas/__init__.py +0 -0
  17. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/schemas/mixins.py +0 -0
  18. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/services/__init__.py +0 -0
  19. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/services/document_simple_revision_service.py +0 -0
  20. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/services/document_with_items_revision_service.py +0 -0
  21. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/services/number_service.py +0 -0
  22. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/services/revision_service.py +0 -0
  23. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/services/transaction_service.py +0 -0
  24. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/utils/__init__.py +0 -0
  25. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi/utils/routing.py +0 -0
  26. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi.egg-info/SOURCES.txt +0 -0
  27. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi.egg-info/dependency_links.txt +0 -0
  28. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi.egg-info/requires.txt +0 -0
  29. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/src/tools2fast_fastapi.egg-info/top_level.txt +0 -0
  30. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/tests/test_initial.py +0 -0
  31. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/tests/test_revision_service.py +0 -0
  32. {tools2fast_fastapi-0.1.4 → tools2fast_fastapi-0.1.5}/tests/test_schemas.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tools2fast-fastapi
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Shared tools, mixins, and base services for FastAPI applications - Solautyc Team internal use
5
5
  Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tools2fast-fastapi"
7
- version = "0.1.4"
7
+ version = "0.1.5"
8
8
  description = "Shared tools, mixins, and base services for FastAPI applications - Solautyc Team internal use"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -0,0 +1 @@
1
+ __version__ = "0.1.5"
@@ -238,6 +238,34 @@ class APIResponse:
238
238
  body = ErrorResponse(message=message, error=error_detail)
239
239
  return JSONResponse(status_code=status_code, content=body.model_dump())
240
240
 
241
+ @staticmethod
242
+ def payment_required(
243
+ message: str = "Pago Requerido",
244
+ *,
245
+ error: str | dict | None = None,
246
+ ) -> JSONResponse:
247
+ """Error 402 explícito cuando el usuario debe realizar un pago.
248
+
249
+ Args:
250
+ message: Mensaje legible para el usuario.
251
+ error: Detalle opcional: ``str`` o ``{"type": …, "detail": …}``.
252
+
253
+ Example::
254
+
255
+ return APIResponse.payment_required()
256
+ """
257
+ error_detail: ErrorDetail | None = None
258
+ if error is not None:
259
+ if isinstance(error, dict):
260
+ error_detail = ErrorDetail(**error)
261
+ else:
262
+ error_detail = ErrorDetail(type="PaymentRequired", detail=str(error))
263
+
264
+ body = ErrorResponse(message=message, error=error_detail)
265
+ return JSONResponse(
266
+ status_code=status.HTTP_402_PAYMENT_REQUIRED, content=body.model_dump()
267
+ )
268
+
241
269
  @staticmethod
242
270
  def from_exception(
243
271
  exc: Exception,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tools2fast-fastapi
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Shared tools, mixins, and base services for FastAPI applications - Solautyc Team internal use
5
5
  Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
6
6
  License: MIT License
@@ -1 +0,0 @@
1
- __version__ = "0.1.4"