bcp-sdk 0.1.0a2__py3-none-any.whl

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 (197) hide show
  1. bcp_sdk/canonical.py +87 -0
  2. bcp_sdk/models/__init__.py +4 -0
  3. bcp_sdk/models/discovery/__init__.py +4 -0
  4. bcp_sdk/models/discovery/profile_schema.py +104 -0
  5. bcp_sdk/models/schemas/__init__.py +4 -0
  6. bcp_sdk/models/schemas/capability.py +267 -0
  7. bcp_sdk/models/schemas/common/__init__.py +4 -0
  8. bcp_sdk/models/schemas/common/identity_linking/__init__.py +45 -0
  9. bcp_sdk/models/schemas/common/identity_linking/br/__init__.py +4 -0
  10. bcp_sdk/models/schemas/common/identity_linking/br/dev/__init__.py +4 -0
  11. bcp_sdk/models/schemas/common/identity_linking/br/dev/bcp/__init__.py +4 -0
  12. bcp_sdk/models/schemas/common/identity_linking/br/dev/bcp/common.py +17 -0
  13. bcp_sdk/models/schemas/handlers/__init__.py +4 -0
  14. bcp_sdk/models/schemas/handlers/pix/__init__.py +4 -0
  15. bcp_sdk/models/schemas/handlers/pix/pix.py +182 -0
  16. bcp_sdk/models/schemas/payment_handler.py +168 -0
  17. bcp_sdk/models/schemas/service.py +577 -0
  18. bcp_sdk/models/schemas/shopping/__init__.py +4 -0
  19. bcp_sdk/models/schemas/shopping/ap2_mandate/__init__.py +104 -0
  20. bcp_sdk/models/schemas/shopping/ap2_mandate/br/__init__.py +4 -0
  21. bcp_sdk/models/schemas/shopping/ap2_mandate/br/dev/__init__.py +4 -0
  22. bcp_sdk/models/schemas/shopping/ap2_mandate/br/dev/bcp/__init__.py +4 -0
  23. bcp_sdk/models/schemas/shopping/ap2_mandate/br/dev/bcp/shopping.py +43 -0
  24. bcp_sdk/models/schemas/shopping/buyer_consent/__init__.py +61 -0
  25. bcp_sdk/models/schemas/shopping/buyer_consent/br/__init__.py +4 -0
  26. bcp_sdk/models/schemas/shopping/buyer_consent/br/dev/__init__.py +4 -0
  27. bcp_sdk/models/schemas/shopping/buyer_consent/br/dev/bcp/__init__.py +4 -0
  28. bcp_sdk/models/schemas/shopping/buyer_consent/br/dev/bcp/shopping.py +25 -0
  29. bcp_sdk/models/schemas/shopping/cart.py +88 -0
  30. bcp_sdk/models/schemas/shopping/cart_create_request.py +55 -0
  31. bcp_sdk/models/schemas/shopping/cart_update_request.py +59 -0
  32. bcp_sdk/models/schemas/shopping/catalog_lookup.py +159 -0
  33. bcp_sdk/models/schemas/shopping/catalog_search.py +60 -0
  34. bcp_sdk/models/schemas/shopping/checkout.py +89 -0
  35. bcp_sdk/models/schemas/shopping/checkout_complete_request.py +24 -0
  36. bcp_sdk/models/schemas/shopping/checkout_create_request.py +39 -0
  37. bcp_sdk/models/schemas/shopping/checkout_update_request.py +39 -0
  38. bcp_sdk/models/schemas/shopping/discount/__init__.py +103 -0
  39. bcp_sdk/models/schemas/shopping/discount/br/__init__.py +4 -0
  40. bcp_sdk/models/schemas/shopping/discount/br/dev/__init__.py +4 -0
  41. bcp_sdk/models/schemas/shopping/discount/br/dev/bcp/__init__.py +4 -0
  42. bcp_sdk/models/schemas/shopping/discount/br/dev/bcp/shopping.py +34 -0
  43. bcp_sdk/models/schemas/shopping/fiscal_identity/__init__.py +76 -0
  44. bcp_sdk/models/schemas/shopping/fiscal_identity/br/__init__.py +4 -0
  45. bcp_sdk/models/schemas/shopping/fiscal_identity/br/dev/__init__.py +4 -0
  46. bcp_sdk/models/schemas/shopping/fiscal_identity/br/dev/bcp/__init__.py +4 -0
  47. bcp_sdk/models/schemas/shopping/fiscal_identity/br/dev/bcp/shopping.py +38 -0
  48. bcp_sdk/models/schemas/shopping/fulfillment/__init__.py +64 -0
  49. bcp_sdk/models/schemas/shopping/fulfillment/br/__init__.py +4 -0
  50. bcp_sdk/models/schemas/shopping/fulfillment/br/dev/__init__.py +4 -0
  51. bcp_sdk/models/schemas/shopping/fulfillment/br/dev/bcp/__init__.py +4 -0
  52. bcp_sdk/models/schemas/shopping/fulfillment/br/dev/bcp/shopping.py +33 -0
  53. bcp_sdk/models/schemas/shopping/nfe/__init__.py +46 -0
  54. bcp_sdk/models/schemas/shopping/nfe/br/__init__.py +4 -0
  55. bcp_sdk/models/schemas/shopping/nfe/br/dev/__init__.py +4 -0
  56. bcp_sdk/models/schemas/shopping/nfe/br/dev/bcp/__init__.py +4 -0
  57. bcp_sdk/models/schemas/shopping/nfe/br/dev/bcp/shopping.py +25 -0
  58. bcp_sdk/models/schemas/shopping/order.py +106 -0
  59. bcp_sdk/models/schemas/shopping/order_create_request.py +97 -0
  60. bcp_sdk/models/schemas/shopping/order_update_request.py +97 -0
  61. bcp_sdk/models/schemas/shopping/payment.py +24 -0
  62. bcp_sdk/models/schemas/shopping/payment_complete_request.py +24 -0
  63. bcp_sdk/models/schemas/shopping/payment_create_request.py +24 -0
  64. bcp_sdk/models/schemas/shopping/payment_update_request.py +24 -0
  65. bcp_sdk/models/schemas/shopping/returns/__init__.py +86 -0
  66. bcp_sdk/models/schemas/shopping/returns/br/__init__.py +4 -0
  67. bcp_sdk/models/schemas/shopping/returns/br/dev/__init__.py +4 -0
  68. bcp_sdk/models/schemas/shopping/returns/br/dev/bcp/__init__.py +4 -0
  69. bcp_sdk/models/schemas/shopping/returns/br/dev/bcp/shopping.py +33 -0
  70. bcp_sdk/models/schemas/shopping/tax/__init__.py +87 -0
  71. bcp_sdk/models/schemas/shopping/tax/br/__init__.py +4 -0
  72. bcp_sdk/models/schemas/shopping/tax/br/dev/__init__.py +4 -0
  73. bcp_sdk/models/schemas/shopping/tax/br/dev/bcp/__init__.py +4 -0
  74. bcp_sdk/models/schemas/shopping/tax/br/dev/bcp/shopping.py +34 -0
  75. bcp_sdk/models/schemas/shopping/types/__init__.py +4 -0
  76. bcp_sdk/models/schemas/shopping/types/account_info.py +23 -0
  77. bcp_sdk/models/schemas/shopping/types/adjustment.py +63 -0
  78. bcp_sdk/models/schemas/shopping/types/adjustment_create_request.py +63 -0
  79. bcp_sdk/models/schemas/shopping/types/adjustment_update_request.py +63 -0
  80. bcp_sdk/models/schemas/shopping/types/amount.py +19 -0
  81. bcp_sdk/models/schemas/shopping/types/attribution.py +23 -0
  82. bcp_sdk/models/schemas/shopping/types/attribution_complete_request.py +23 -0
  83. bcp_sdk/models/schemas/shopping/types/attribution_create_request.py +23 -0
  84. bcp_sdk/models/schemas/shopping/types/attribution_update_request.py +23 -0
  85. bcp_sdk/models/schemas/shopping/types/available_payment_instrument.py +28 -0
  86. bcp_sdk/models/schemas/shopping/types/binding.py +28 -0
  87. bcp_sdk/models/schemas/shopping/types/business_fulfillment_config.py +46 -0
  88. bcp_sdk/models/schemas/shopping/types/buyer.py +31 -0
  89. bcp_sdk/models/schemas/shopping/types/buyer_create_request.py +31 -0
  90. bcp_sdk/models/schemas/shopping/types/buyer_update_request.py +31 -0
  91. bcp_sdk/models/schemas/shopping/types/card_credential.py +57 -0
  92. bcp_sdk/models/schemas/shopping/types/card_payment_instrument.py +98 -0
  93. bcp_sdk/models/schemas/shopping/types/category.py +27 -0
  94. bcp_sdk/models/schemas/shopping/types/context.py +60 -0
  95. bcp_sdk/models/schemas/shopping/types/context_create_request.py +62 -0
  96. bcp_sdk/models/schemas/shopping/types/context_update_request.py +62 -0
  97. bcp_sdk/models/schemas/shopping/types/description.py +40 -0
  98. bcp_sdk/models/schemas/shopping/types/detail_option_value.py +28 -0
  99. bcp_sdk/models/schemas/shopping/types/error_code.py +32 -0
  100. bcp_sdk/models/schemas/shopping/types/error_response.py +33 -0
  101. bcp_sdk/models/schemas/shopping/types/expectation.py +59 -0
  102. bcp_sdk/models/schemas/shopping/types/expectation_create_request.py +59 -0
  103. bcp_sdk/models/schemas/shopping/types/expectation_update_request.py +59 -0
  104. bcp_sdk/models/schemas/shopping/types/fulfillment.py +28 -0
  105. bcp_sdk/models/schemas/shopping/types/fulfillment_available_method.py +36 -0
  106. bcp_sdk/models/schemas/shopping/types/fulfillment_available_method_create_request.py +19 -0
  107. bcp_sdk/models/schemas/shopping/types/fulfillment_available_method_update_request.py +19 -0
  108. bcp_sdk/models/schemas/shopping/types/fulfillment_create_request.py +24 -0
  109. bcp_sdk/models/schemas/shopping/types/fulfillment_destination.py +24 -0
  110. bcp_sdk/models/schemas/shopping/types/fulfillment_destination_create_request.py +24 -0
  111. bcp_sdk/models/schemas/shopping/types/fulfillment_destination_update_request.py +24 -0
  112. bcp_sdk/models/schemas/shopping/types/fulfillment_event.py +65 -0
  113. bcp_sdk/models/schemas/shopping/types/fulfillment_event_create_request.py +65 -0
  114. bcp_sdk/models/schemas/shopping/types/fulfillment_event_update_request.py +65 -0
  115. bcp_sdk/models/schemas/shopping/types/fulfillment_group.py +36 -0
  116. bcp_sdk/models/schemas/shopping/types/fulfillment_group_create_request.py +23 -0
  117. bcp_sdk/models/schemas/shopping/types/fulfillment_group_update_request.py +27 -0
  118. bcp_sdk/models/schemas/shopping/types/fulfillment_method.py +45 -0
  119. bcp_sdk/models/schemas/shopping/types/fulfillment_method_create_request.py +43 -0
  120. bcp_sdk/models/schemas/shopping/types/fulfillment_method_update_request.py +47 -0
  121. bcp_sdk/models/schemas/shopping/types/fulfillment_option.py +48 -0
  122. bcp_sdk/models/schemas/shopping/types/fulfillment_option_create_request.py +19 -0
  123. bcp_sdk/models/schemas/shopping/types/fulfillment_option_update_request.py +19 -0
  124. bcp_sdk/models/schemas/shopping/types/fulfillment_update_request.py +24 -0
  125. bcp_sdk/models/schemas/shopping/types/info_code.py +23 -0
  126. bcp_sdk/models/schemas/shopping/types/input_correlation.py +27 -0
  127. bcp_sdk/models/schemas/shopping/types/item.py +32 -0
  128. bcp_sdk/models/schemas/shopping/types/item_create_request.py +19 -0
  129. bcp_sdk/models/schemas/shopping/types/item_update_request.py +19 -0
  130. bcp_sdk/models/schemas/shopping/types/line_item.py +34 -0
  131. bcp_sdk/models/schemas/shopping/types/line_item_create_request.py +25 -0
  132. bcp_sdk/models/schemas/shopping/types/line_item_update_request.py +30 -0
  133. bcp_sdk/models/schemas/shopping/types/link.py +27 -0
  134. bcp_sdk/models/schemas/shopping/types/media.py +39 -0
  135. bcp_sdk/models/schemas/shopping/types/merchant_fulfillment_config.py +46 -0
  136. bcp_sdk/models/schemas/shopping/types/message.py +26 -0
  137. bcp_sdk/models/schemas/shopping/types/message_create_request.py +26 -0
  138. bcp_sdk/models/schemas/shopping/types/message_error.py +40 -0
  139. bcp_sdk/models/schemas/shopping/types/message_info.py +34 -0
  140. bcp_sdk/models/schemas/shopping/types/message_update_request.py +26 -0
  141. bcp_sdk/models/schemas/shopping/types/message_warning.py +46 -0
  142. bcp_sdk/models/schemas/shopping/types/ncm.py +19 -0
  143. bcp_sdk/models/schemas/shopping/types/option_value.py +27 -0
  144. bcp_sdk/models/schemas/shopping/types/order_confirmation.py +31 -0
  145. bcp_sdk/models/schemas/shopping/types/order_line_item.py +63 -0
  146. bcp_sdk/models/schemas/shopping/types/order_line_item_create_request.py +63 -0
  147. bcp_sdk/models/schemas/shopping/types/order_line_item_update_request.py +63 -0
  148. bcp_sdk/models/schemas/shopping/types/pagination.py +59 -0
  149. bcp_sdk/models/schemas/shopping/types/payment_credential.py +23 -0
  150. bcp_sdk/models/schemas/shopping/types/payment_identity.py +23 -0
  151. bcp_sdk/models/schemas/shopping/types/payment_instrument.py +56 -0
  152. bcp_sdk/models/schemas/shopping/types/platform_fulfillment_config.py +23 -0
  153. bcp_sdk/models/schemas/shopping/types/postal_address.py +51 -0
  154. bcp_sdk/models/schemas/shopping/types/postal_address_create_request.py +51 -0
  155. bcp_sdk/models/schemas/shopping/types/postal_address_update_request.py +51 -0
  156. bcp_sdk/models/schemas/shopping/types/price.py +28 -0
  157. bcp_sdk/models/schemas/shopping/types/price_filter.py +28 -0
  158. bcp_sdk/models/schemas/shopping/types/price_range.py +28 -0
  159. bcp_sdk/models/schemas/shopping/types/product.py +85 -0
  160. bcp_sdk/models/schemas/shopping/types/product_option.py +28 -0
  161. bcp_sdk/models/schemas/shopping/types/rating.py +35 -0
  162. bcp_sdk/models/schemas/shopping/types/retail_location.py +32 -0
  163. bcp_sdk/models/schemas/shopping/types/retail_location_create_request.py +28 -0
  164. bcp_sdk/models/schemas/shopping/types/retail_location_update_request.py +28 -0
  165. bcp_sdk/models/schemas/shopping/types/returns_config.py +27 -0
  166. bcp_sdk/models/schemas/shopping/types/reverse_domain_name.py +21 -0
  167. bcp_sdk/models/schemas/shopping/types/reverse_domain_name_create_request.py +23 -0
  168. bcp_sdk/models/schemas/shopping/types/reverse_domain_name_update_request.py +23 -0
  169. bcp_sdk/models/schemas/shopping/types/search_filters.py +25 -0
  170. bcp_sdk/models/schemas/shopping/types/selected_option.py +31 -0
  171. bcp_sdk/models/schemas/shopping/types/shipping_destination.py +24 -0
  172. bcp_sdk/models/schemas/shopping/types/shipping_destination_create_request.py +24 -0
  173. bcp_sdk/models/schemas/shopping/types/shipping_destination_update_request.py +24 -0
  174. bcp_sdk/models/schemas/shopping/types/signals.py +27 -0
  175. bcp_sdk/models/schemas/shopping/types/signals_complete_request.py +27 -0
  176. bcp_sdk/models/schemas/shopping/types/signals_create_request.py +27 -0
  177. bcp_sdk/models/schemas/shopping/types/signals_update_request.py +27 -0
  178. bcp_sdk/models/schemas/shopping/types/signed_amount.py +19 -0
  179. bcp_sdk/models/schemas/shopping/types/token_credential.py +28 -0
  180. bcp_sdk/models/schemas/shopping/types/total.py +29 -0
  181. bcp_sdk/models/schemas/shopping/types/total_create_request.py +19 -0
  182. bcp_sdk/models/schemas/shopping/types/total_update_request.py +19 -0
  183. bcp_sdk/models/schemas/shopping/types/totals.py +87 -0
  184. bcp_sdk/models/schemas/shopping/types/totals_create_request.py +99 -0
  185. bcp_sdk/models/schemas/shopping/types/totals_update_request.py +99 -0
  186. bcp_sdk/models/schemas/shopping/types/variant.py +214 -0
  187. bcp_sdk/models/schemas/shopping/types/warning_code.py +23 -0
  188. bcp_sdk/models/schemas/transports/__init__.py +4 -0
  189. bcp_sdk/models/schemas/transports/embedded_config.py +28 -0
  190. bcp_sdk/models/schemas/ucp.py +301 -0
  191. bcp_sdk/models/schemas/ucp_create_request.py +301 -0
  192. bcp_sdk/models/schemas/ucp_update_request.py +301 -0
  193. bcp_sdk-0.1.0a2.dist-info/METADATA +373 -0
  194. bcp_sdk-0.1.0a2.dist-info/RECORD +197 -0
  195. bcp_sdk-0.1.0a2.dist-info/WHEEL +4 -0
  196. bcp_sdk-0.1.0a2.dist-info/licenses/LICENSE +202 -0
  197. bcp_sdk-0.1.0a2.dist-info/licenses/NOTICE +25 -0
bcp_sdk/canonical.py ADDED
@@ -0,0 +1,87 @@
1
+ import json
2
+ import math
3
+ from collections.abc import Mapping, Sequence
4
+ from typing import Any
5
+
6
+
7
+ def canonicalize(obj: Mapping[str, Any]) -> bytes:
8
+ """Serializes obj to JCS (RFC 8785) canonical JSON bytes, ready to sign/verify."""
9
+ return _encode(obj).encode("utf-8")
10
+
11
+
12
+ def _encode(value: Any) -> str:
13
+ if value is None:
14
+ return "null"
15
+ if isinstance(value, bool):
16
+ return "true" if value else "false"
17
+ if isinstance(value, int):
18
+ return str(value)
19
+ if isinstance(value, float):
20
+ return _encode_number(value)
21
+ if isinstance(value, str):
22
+ return json.dumps(value, ensure_ascii=False)
23
+ if isinstance(value, Mapping):
24
+ return _encode_object(value)
25
+ if isinstance(value, Sequence):
26
+ return "[" + ",".join(_encode(item) for item in value) + "]"
27
+ msg = f"cannot canonicalize value of type {type(value).__name__}"
28
+ raise TypeError(msg)
29
+
30
+
31
+ def _encode_object(value: Mapping[str, Any]) -> str:
32
+ for key in value:
33
+ if not isinstance(key, str):
34
+ msg = f"object keys must be str, got {type(key).__name__}"
35
+ raise TypeError(msg)
36
+ items = sorted(value.items(), key=lambda kv: _utf16_code_units(kv[0]))
37
+ body = ",".join(f"{json.dumps(key, ensure_ascii=False)}:{_encode(val)}" for key, val in items)
38
+ return "{" + body + "}"
39
+
40
+
41
+ def _utf16_code_units(value: str) -> tuple[int, ...]:
42
+ """Sort key matching RFC 8785 key ordering: UTF-16 code unit order, not code point order."""
43
+ encoded = value.encode("utf-16-be")
44
+ return tuple(int.from_bytes(encoded[i : i + 2], "big") for i in range(0, len(encoded), 2))
45
+
46
+
47
+ def _encode_number(value: float) -> str:
48
+ if math.isnan(value) or math.isinf(value):
49
+ msg = "NaN and Infinity are not representable in JSON"
50
+ raise ValueError(msg)
51
+ if value == 0:
52
+ return "0"
53
+ sign = "-" if value < 0 else ""
54
+ digits, point = _shortest_digits(abs(value))
55
+ k = len(digits)
56
+ if k <= point <= 21:
57
+ return sign + digits + "0" * (point - k)
58
+ if 0 < point <= 21:
59
+ return sign + digits[:point] + "." + digits[point:]
60
+ if -6 < point <= 0:
61
+ return sign + "0." + "0" * -point + digits
62
+ exponent = point - 1
63
+ mantissa = digits[0] + ("." + digits[1:] if k > 1 else "")
64
+ exp_sign = "+" if exponent >= 0 else "-"
65
+ return f"{sign}{mantissa}e{exp_sign}{abs(exponent)}"
66
+
67
+
68
+ def _shortest_digits(value: float) -> tuple[str, int]:
69
+ """Extracts the shortest round-trip digit string and decimal point position from repr().
70
+
71
+ Returns (digits, n) such that value == 0.<digits> * 10**n, matching the (s, k, n)
72
+ triple of ECMA-262 Number::toString: digits has no leading/trailing zero and is the
73
+ shortest sequence that round-trips to the same float (guaranteed by Python's repr).
74
+ """
75
+ text = repr(value)
76
+ mantissa, _, exp_text = text.partition("e")
77
+ exponent = int(exp_text) if exp_text else 0
78
+ int_part, _, frac_part = mantissa.partition(".")
79
+ all_digits = int_part + frac_part
80
+ point = len(int_part) + exponent
81
+
82
+ stripped = all_digits.lstrip("0")
83
+ point -= len(all_digits) - len(stripped)
84
+ stripped = stripped.rstrip("0")
85
+ if not stripped:
86
+ return "0", 1
87
+ return stripped, point
@@ -0,0 +1,4 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
@@ -0,0 +1,4 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
@@ -0,0 +1,104 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
5
+
6
+ from __future__ import annotations
7
+
8
+ from pydantic import ConfigDict
9
+ from typing import Literal
10
+ from pydantic import BaseModel, ConfigDict, Field, RootModel
11
+ from ..schemas import ucp as ucp_1
12
+
13
+
14
+ class SigningKey(BaseModel):
15
+ """
16
+ Public key for signature verification in JWK format.
17
+ """
18
+
19
+ model_config = ConfigDict(
20
+ extra="allow",
21
+ )
22
+ kid: str
23
+ """
24
+ Key ID. Referenced in signature headers to identify which key to use for verification.
25
+ """
26
+ kty: str
27
+ """
28
+ Key type (e.g., 'EC', 'RSA').
29
+ """
30
+ crv: str | None = None
31
+ """
32
+ Curve name for EC keys (e.g., 'P-256').
33
+ """
34
+ x: str | None = None
35
+ """
36
+ X coordinate for EC public keys (base64url encoded).
37
+ """
38
+ y: str | None = None
39
+ """
40
+ Y coordinate for EC public keys (base64url encoded).
41
+ """
42
+ n: str | None = None
43
+ """
44
+ Modulus for RSA public keys (base64url encoded).
45
+ """
46
+ e: str | None = None
47
+ """
48
+ Exponent for RSA public keys (base64url encoded).
49
+ """
50
+ use: Literal["sig", "enc"] | None = None
51
+ """
52
+ Key usage. Should be 'sig' for signing keys.
53
+ """
54
+ alg: str | None = None
55
+ """
56
+ Algorithm (e.g., 'ES256', 'RS256').
57
+ """
58
+
59
+
60
+ class Base(BaseModel):
61
+ """
62
+ Base discovery profile with shared properties for all profile types.
63
+ """
64
+
65
+ model_config = ConfigDict(
66
+ extra="allow",
67
+ )
68
+ ucp: ucp_1.Base
69
+ keys: list[SigningKey] | None = None
70
+ """
71
+ Public keys for signature verification (JWK format). Used to verify signed responses, webhooks, and other authenticated messages from this party.
72
+ """
73
+
74
+
75
+ class PlatformProfile(Base):
76
+ """
77
+ Full discovery profile for platforms. Exposes complete service, capability, and payment handler registries.
78
+ """
79
+
80
+ model_config = ConfigDict(
81
+ extra="allow",
82
+ )
83
+ ucp: ucp_1.PlatformSchema | None = None
84
+
85
+
86
+ class BusinessProfile(Base):
87
+ """
88
+ Discovery profile for businesses/merchants. Subset of platform profile with business-specific configuration.
89
+ """
90
+
91
+ model_config = ConfigDict(
92
+ extra="allow",
93
+ )
94
+ ucp: ucp_1.BusinessSchema | None = None
95
+
96
+
97
+ class BcpDiscoveryProfile(RootModel[PlatformProfile | BusinessProfile]):
98
+ model_config = ConfigDict(
99
+ frozen=True,
100
+ )
101
+ root: PlatformProfile | BusinessProfile = Field(..., title="BCP Discovery Profile")
102
+ """
103
+ Schema for BCP discovery profiles. Business profiles are hosted at /.well-known/bcp; platform profiles are hosted at URIs advertised in request headers.
104
+ """
@@ -0,0 +1,4 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
@@ -0,0 +1,267 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
5
+
6
+ from __future__ import annotations
7
+
8
+ from pydantic import ConfigDict
9
+ from typing import Any
10
+ from pydantic import AnyUrl, BaseModel, ConfigDict, Field, RootModel
11
+
12
+
13
+ class BcpCapability(RootModel[Any]):
14
+ model_config = ConfigDict(
15
+ frozen=True,
16
+ )
17
+ root: Any = Field(..., title="BCP Capability")
18
+ """
19
+ Schema for BCP capabilities and extensions. Extensions are capabilities with an 'extends' field. Uses reverse-domain naming for governance.
20
+ """
21
+
22
+
23
+ class Extends(RootModel[str]):
24
+ model_config = ConfigDict(
25
+ frozen=True,
26
+ )
27
+ root: str = Field(..., pattern="^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")
28
+ """
29
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
30
+ """
31
+
32
+
33
+ class Extends1Item(RootModel[str]):
34
+ model_config = ConfigDict(
35
+ frozen=True,
36
+ )
37
+ root: str = Field(..., pattern="^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")
38
+
39
+
40
+ class Extends1(RootModel[list[Extends1Item]]):
41
+ model_config = ConfigDict(
42
+ frozen=True,
43
+ )
44
+ root: list[Extends1Item] = Field(..., min_length=1)
45
+ """
46
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
47
+ """
48
+
49
+
50
+ class Extends2(RootModel[str]):
51
+ model_config = ConfigDict(
52
+ frozen=True,
53
+ )
54
+ root: str = Field(..., pattern="^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")
55
+ """
56
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
57
+ """
58
+
59
+
60
+ class Extends3Item(RootModel[str]):
61
+ model_config = ConfigDict(
62
+ frozen=True,
63
+ )
64
+ root: str = Field(..., pattern="^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")
65
+
66
+
67
+ class Extends3(RootModel[list[Extends3Item]]):
68
+ model_config = ConfigDict(
69
+ frozen=True,
70
+ )
71
+ root: list[Extends3Item] = Field(..., min_length=1)
72
+ """
73
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
74
+ """
75
+
76
+
77
+ class Extends4(RootModel[str]):
78
+ model_config = ConfigDict(
79
+ frozen=True,
80
+ )
81
+ root: str = Field(..., pattern="^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")
82
+ """
83
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
84
+ """
85
+
86
+
87
+ class Extends5Item(RootModel[str]):
88
+ model_config = ConfigDict(
89
+ frozen=True,
90
+ )
91
+ root: str = Field(..., pattern="^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")
92
+
93
+
94
+ class Extends5(RootModel[list[Extends5Item]]):
95
+ model_config = ConfigDict(
96
+ frozen=True,
97
+ )
98
+ root: list[Extends5Item] = Field(..., min_length=1)
99
+ """
100
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
101
+ """
102
+
103
+
104
+ class Extends6(RootModel[str]):
105
+ model_config = ConfigDict(
106
+ frozen=True,
107
+ )
108
+ root: str = Field(..., pattern="^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")
109
+ """
110
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
111
+ """
112
+
113
+
114
+ class Extends7Item(RootModel[str]):
115
+ model_config = ConfigDict(
116
+ frozen=True,
117
+ )
118
+ root: str = Field(..., pattern="^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")
119
+
120
+
121
+ class Extends7(RootModel[list[Extends7Item]]):
122
+ model_config = ConfigDict(
123
+ frozen=True,
124
+ )
125
+ root: list[Extends7Item] = Field(..., min_length=1)
126
+ """
127
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
128
+ """
129
+
130
+
131
+ class Version(RootModel[Any]):
132
+ model_config = ConfigDict(
133
+ frozen=True,
134
+ )
135
+ root: Any
136
+
137
+
138
+ class Base(BaseModel):
139
+ model_config = ConfigDict(
140
+ extra="allow",
141
+ )
142
+ version: Version
143
+ """
144
+ Entity version in YYYY-MM-DD format.
145
+ """
146
+ spec: AnyUrl | None = None
147
+ """
148
+ URL to human-readable specification document.
149
+ """
150
+ schema_: AnyUrl | None = Field(None, alias="schema")
151
+ """
152
+ URL to JSON Schema defining this entity's structure and payloads.
153
+ """
154
+ id: str | None = None
155
+ """
156
+ Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
157
+ """
158
+ config: dict[str, Any] | None = None
159
+ """
160
+ Entity-specific configuration. Structure defined by each entity's schema.
161
+ """
162
+ extends: Extends | Extends1 | None = None
163
+ """
164
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
165
+ """
166
+
167
+
168
+ class PlatformSchema(BaseModel):
169
+ """
170
+ Full capability declaration for platform-level discovery. Includes spec/schema URLs for agent fetching.
171
+ """
172
+
173
+ model_config = ConfigDict(
174
+ extra="allow",
175
+ )
176
+ version: Version
177
+ """
178
+ Entity version in YYYY-MM-DD format.
179
+ """
180
+ spec: AnyUrl
181
+ """
182
+ URL to human-readable specification document.
183
+ """
184
+ schema_: AnyUrl = Field(..., alias="schema")
185
+ """
186
+ URL to JSON Schema defining this entity's structure and payloads.
187
+ """
188
+ id: str | None = None
189
+ """
190
+ Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
191
+ """
192
+ config: dict[str, Any] | None = None
193
+ """
194
+ Entity-specific configuration. Structure defined by each entity's schema.
195
+ """
196
+ extends: Extends2 | Extends3 | None = None
197
+ """
198
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
199
+ """
200
+
201
+
202
+ class BusinessSchema(BaseModel):
203
+ """
204
+ Capability configuration for business/merchant level. May include business-specific config overrides.
205
+ """
206
+
207
+ model_config = ConfigDict(
208
+ extra="allow",
209
+ )
210
+ version: Version
211
+ """
212
+ Entity version in YYYY-MM-DD format.
213
+ """
214
+ spec: AnyUrl | None = None
215
+ """
216
+ URL to human-readable specification document.
217
+ """
218
+ schema_: AnyUrl | None = Field(None, alias="schema")
219
+ """
220
+ URL to JSON Schema defining this entity's structure and payloads.
221
+ """
222
+ id: str | None = None
223
+ """
224
+ Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
225
+ """
226
+ config: dict[str, Any] | None = None
227
+ """
228
+ Entity-specific configuration. Structure defined by each entity's schema.
229
+ """
230
+ extends: Extends4 | Extends5 | None = None
231
+ """
232
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
233
+ """
234
+
235
+
236
+ class ResponseSchema(BaseModel):
237
+ """
238
+ Capability reference in responses. Only name/version required to confirm active capabilities.
239
+ """
240
+
241
+ model_config = ConfigDict(
242
+ extra="allow",
243
+ )
244
+ version: Version
245
+ """
246
+ Entity version in YYYY-MM-DD format.
247
+ """
248
+ spec: AnyUrl | None = None
249
+ """
250
+ URL to human-readable specification document.
251
+ """
252
+ schema_: AnyUrl | None = Field(None, alias="schema")
253
+ """
254
+ URL to JSON Schema defining this entity's structure and payloads.
255
+ """
256
+ id: str | None = None
257
+ """
258
+ Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.
259
+ """
260
+ config: dict[str, Any] | None = None
261
+ """
262
+ Entity-specific configuration. Structure defined by each entity's schema.
263
+ """
264
+ extends: Extends6 | Extends7 | None = None
265
+ """
266
+ Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.
267
+ """
@@ -0,0 +1,4 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
@@ -0,0 +1,45 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
5
+
6
+ from __future__ import annotations
7
+
8
+ from pydantic import ConfigDict
9
+ from typing import Any
10
+ from pydantic import BaseModel, ConfigDict, Field, RootModel
11
+ from ...shopping.types import description as description_1
12
+
13
+
14
+ class IdentityLinking(RootModel[Any]):
15
+ model_config = ConfigDict(
16
+ frozen=True,
17
+ )
18
+ root: Any = Field(..., title="Identity Linking")
19
+ """
20
+ Capability schema for identity linking. Businesses declare the user-authenticated scopes they offer in a flat 'scopes' map. Each key is the OAuth scope string as it appears on the wire ('{capability}:{scope}', e.g. 'br.dev.bcp.shopping.order:read'). Scope presence implies that the corresponding operations require user authentication. Operations not gated by any listed scope operate at whatever access level the business permits; BCP does not prescribe a default.
21
+ """
22
+
23
+
24
+ class ScopePolicy(BaseModel):
25
+ """
26
+ Per-scope policy and metadata — auth constraints (e.g. min_acr, max_token_age), declarative metadata (e.g. claims produced, consent descriptions), or any other scope-specific configuration. An empty object means user authentication is required with no additional policy. Open for non-breaking extension.
27
+ """
28
+
29
+ model_config = ConfigDict(
30
+ extra="allow",
31
+ )
32
+ description: description_1.Description | None = None
33
+ """
34
+ Optional human-readable description of the scope that platforms can use to present and explain context (requirement and value) to the user.
35
+ """
36
+
37
+
38
+ class ScopeToken(RootModel[str]):
39
+ model_config = ConfigDict(
40
+ frozen=True,
41
+ )
42
+ root: str = Field(..., pattern="^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+:[a-z][a-z0-9_]*$")
43
+ """
44
+ OAuth scope string formed by joining a capability name and a scope name with a colon: '{capability}:{scope}', e.g. 'br.dev.bcp.shopping.order:read'. Capability names use reverse-DNS naming; scope names denote the permission granted, defined by each capability's spec (e.g. 'read', 'manage', 'create'). Platforms request these strings verbatim in OAuth 'scope' parameters; issued tokens carry them in the 'scope' claim.
45
+ """
@@ -0,0 +1,4 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
@@ -0,0 +1,4 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
@@ -0,0 +1,4 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
@@ -0,0 +1,17 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
5
+
6
+ from __future__ import annotations
7
+
8
+ from pydantic import ConfigDict
9
+ from typing import Any
10
+ from pydantic import RootModel
11
+
12
+
13
+ class IdentityLinking(RootModel[Any]):
14
+ model_config = ConfigDict(
15
+ frozen=True,
16
+ )
17
+ root: Any
@@ -0,0 +1,4 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.
@@ -0,0 +1,4 @@
1
+ # Generated by datamodel-codegen. Do not edit.
2
+ # Part of the Brazilian Commerce Protocol (BCP), derived in part from the
3
+ # Universal Commerce Protocol (UCP), Apache License 2.0.
4
+ # See LICENSE and NOTICE for copyright, attribution, and modifications.