fragment-python 1.1.1__tar.gz → 1.2.0__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 (105) hide show
  1. {fragment_python-1.1.1 → fragment_python-1.2.0}/PKG-INFO +1 -1
  2. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/__init__.py +14 -2
  3. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/client.py +48 -0
  4. fragment_python-1.2.0/fragment/sdk/create_payment.py +40 -0
  5. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/enums.py +5 -5
  6. {fragment_python-1.1.1/fragment/sync_sdk → fragment_python-1.2.0/fragment/sdk}/input_types.py +14 -3
  7. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/std_queries/queries.graphql +34 -0
  8. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/__init__.py +14 -2
  9. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/client.py +48 -0
  10. fragment_python-1.2.0/fragment/sync_sdk/create_payment.py +40 -0
  11. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/enums.py +5 -5
  12. {fragment_python-1.1.1/fragment/sdk → fragment_python-1.2.0/fragment/sync_sdk}/input_types.py +14 -3
  13. {fragment_python-1.1.1 → fragment_python-1.2.0}/pyproject.toml +1 -1
  14. {fragment_python-1.1.1 → fragment_python-1.2.0}/LICENSE +0 -0
  15. {fragment_python-1.1.1 → fragment_python-1.2.0}/README.md +0 -0
  16. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/__init__.py +0 -0
  17. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/client/__init__.py +0 -0
  18. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/client/async_client.py +0 -0
  19. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/client/sync_client.py +0 -0
  20. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/codegen/__init__.py +0 -0
  21. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/codegen/helpers.py +0 -0
  22. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/codegen/main.py +0 -0
  23. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/codegen/plugins/__init__.py +0 -0
  24. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/codegen/plugins/generate_client_method.py +0 -0
  25. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/codegen/plugins/generate_typed_entries.py +0 -0
  26. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/codegen/plugins/get_file_comment.py +0 -0
  27. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/codegen/typed_entries.py +0 -0
  28. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/exceptions.py +0 -0
  29. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/logger.py +0 -0
  30. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/py.typed +0 -0
  31. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/add_ledger_entries.py +0 -0
  32. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/add_ledger_entry.py +0 -0
  33. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/add_ledger_entry_runtime.py +0 -0
  34. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/async_client.py +0 -0
  35. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/base_model.py +0 -0
  36. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/create_custom_currency.py +0 -0
  37. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/create_custom_link.py +0 -0
  38. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/create_ledger.py +0 -0
  39. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/delete_custom_txs.py +0 -0
  40. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/delete_ledger.py +0 -0
  41. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/delete_schema.py +0 -0
  42. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_account_data_migrations.py +0 -0
  43. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_entries_to_migrate_for_ledger_account_data_migration.py +0 -0
  44. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_entries_to_migrate_for_ledger_entry_data_migration.py +0 -0
  45. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_entry_data_migrations.py +0 -0
  46. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_ledger.py +0 -0
  47. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_ledger_account_balance.py +0 -0
  48. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_ledger_account_balance_with_child_rollup.py +0 -0
  49. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_ledger_account_lines.py +0 -0
  50. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_ledger_entry.py +0 -0
  51. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_schema.py +0 -0
  52. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/get_workspace.py +0 -0
  53. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/list_ledger_account_balances.py +0 -0
  54. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/list_ledger_accounts.py +0 -0
  55. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/list_ledger_entries.py +0 -0
  56. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/list_ledger_entry_group_balances.py +0 -0
  57. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/list_multi_currency_ledger_account_balances.py +0 -0
  58. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/migrate_ledger_entry.py +0 -0
  59. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/reconcile_tx.py +0 -0
  60. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/reconcile_tx_runtime.py +0 -0
  61. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/reverse_ledger_entry.py +0 -0
  62. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/store_schema.py +0 -0
  63. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/sync_custom_accounts.py +0 -0
  64. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/sync_custom_txs.py +0 -0
  65. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/typed_entries.py +0 -0
  66. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/update_ledger.py +0 -0
  67. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sdk/update_ledger_entry.py +0 -0
  68. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/add_ledger_entries.py +0 -0
  69. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/add_ledger_entry.py +0 -0
  70. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/add_ledger_entry_runtime.py +0 -0
  71. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/async_client.py +0 -0
  72. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/base_model.py +0 -0
  73. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/create_custom_currency.py +0 -0
  74. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/create_custom_link.py +0 -0
  75. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/create_ledger.py +0 -0
  76. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/delete_custom_txs.py +0 -0
  77. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/delete_ledger.py +0 -0
  78. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/delete_schema.py +0 -0
  79. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_account_data_migrations.py +0 -0
  80. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_entries_to_migrate_for_ledger_account_data_migration.py +0 -0
  81. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_entries_to_migrate_for_ledger_entry_data_migration.py +0 -0
  82. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_entry_data_migrations.py +0 -0
  83. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_ledger.py +0 -0
  84. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_ledger_account_balance.py +0 -0
  85. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_ledger_account_balance_with_child_rollup.py +0 -0
  86. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_ledger_account_lines.py +0 -0
  87. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_ledger_entry.py +0 -0
  88. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_schema.py +0 -0
  89. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/get_workspace.py +0 -0
  90. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/list_ledger_account_balances.py +0 -0
  91. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/list_ledger_accounts.py +0 -0
  92. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/list_ledger_entries.py +0 -0
  93. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/list_ledger_entry_group_balances.py +0 -0
  94. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/list_multi_currency_ledger_account_balances.py +0 -0
  95. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/migrate_ledger_entry.py +0 -0
  96. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/reconcile_tx.py +0 -0
  97. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/reconcile_tx_runtime.py +0 -0
  98. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/reverse_ledger_entry.py +0 -0
  99. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/store_schema.py +0 -0
  100. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/sync_client.py +0 -0
  101. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/sync_custom_accounts.py +0 -0
  102. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/sync_custom_txs.py +0 -0
  103. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/typed_entries.py +0 -0
  104. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/update_ledger.py +0 -0
  105. {fragment_python-1.1.1 → fragment_python-1.2.0}/fragment/sync_sdk/update_ledger_entry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fragment-python
3
- Version: 1.1.1
3
+ Version: 1.2.0
4
4
  Summary: Python SDK for https://fragment.dev/
5
5
  License: Apache 2.0
6
6
  License-File: LICENSE
@@ -55,6 +55,12 @@ from .create_ledger import (
55
55
  CreateLedgerCreateLedgerCreateLedgerResultLedgerSchema,
56
56
  CreateLedgerCreateLedgerInternalError,
57
57
  )
58
+ from .create_payment import (
59
+ CreatePayment,
60
+ CreatePaymentCreatePaymentBadRequestError,
61
+ CreatePaymentCreatePaymentInternalError,
62
+ CreatePaymentCreatePaymentPayment,
63
+ )
58
64
  from .delete_custom_txs import (
59
65
  DeleteCustomTxs,
60
66
  DeleteCustomTxsDeleteCustomTxsBadRequestError,
@@ -97,8 +103,8 @@ from .enums import (
97
103
  SchemaConsistencyMode,
98
104
  SchemaLedgerAccountStatus,
99
105
  SchemaLedgerEntryStatus,
100
- SchemaPaymentEntryStatus,
101
106
  SchemaPaymentTypeDirection,
107
+ SchemaPaymentTypeStatus,
102
108
  SchemaSystemLineKind,
103
109
  StripeEnv,
104
110
  TxType,
@@ -184,6 +190,7 @@ from .input_types import (
184
190
  CreateLedgerAccountInput,
185
191
  CreateLedgerAccountsInput,
186
192
  CreateLedgerInput,
193
+ CreatePaymentInput,
187
194
  CurrencyFilter,
188
195
  CurrencyMatchInput,
189
196
  CustomAccountInput,
@@ -462,6 +469,11 @@ __all__ = [
462
469
  "CreateLedgerCreateLedgerCreateLedgerResultLedgerSchema",
463
470
  "CreateLedgerCreateLedgerInternalError",
464
471
  "CreateLedgerInput",
472
+ "CreatePayment",
473
+ "CreatePaymentCreatePaymentBadRequestError",
474
+ "CreatePaymentCreatePaymentInternalError",
475
+ "CreatePaymentCreatePaymentPayment",
476
+ "CreatePaymentInput",
465
477
  "CurrencyCode",
466
478
  "CurrencyFilter",
467
479
  "CurrencyMatchInput",
@@ -707,12 +719,12 @@ __all__ = [
707
719
  "SchemaMatchInput",
708
720
  "SchemaPaymentAccountingInput",
709
721
  "SchemaPaymentEntryInput",
710
- "SchemaPaymentEntryStatus",
711
722
  "SchemaPaymentInput",
712
723
  "SchemaPaymentLineInput",
713
724
  "SchemaPaymentTypeDetailsInput",
714
725
  "SchemaPaymentTypeDirection",
715
726
  "SchemaPaymentTypeInput",
727
+ "SchemaPaymentTypeStatus",
716
728
  "SchemaPaymentsInput",
717
729
  "SchemaRepeatedConfigInput",
718
730
  "SchemaSystemLineKind",
@@ -10,6 +10,7 @@ from .async_client import AsyncFragmentClient
10
10
  from .create_custom_currency import CreateCustomCurrency
11
11
  from .create_custom_link import CreateCustomLink
12
12
  from .create_ledger import CreateLedger
13
+ from .create_payment import CreatePayment
13
14
  from .delete_custom_txs import DeleteCustomTxs
14
15
  from .delete_ledger import DeleteLedger
15
16
  from .delete_schema import DeleteSchema
@@ -1786,3 +1787,50 @@ class Client(AsyncFragmentClient):
1786
1787
  )
1787
1788
  data = self.get_data(response)
1788
1789
  return CreateCustomCurrency.model_validate(data)
1790
+
1791
+ async def create_payment(
1792
+ self,
1793
+ ik: Any,
1794
+ ledger_ik: Any,
1795
+ type_: Any,
1796
+ type_version: Optional[int] = None,
1797
+ parameters: Optional[Any] = None,
1798
+ **kwargs: Any
1799
+ ) -> CreatePayment:
1800
+ query = gql("""
1801
+ mutation createPayment($ik: SafeString!, $ledgerIk: SafeString!, $type: SafeString!, $typeVersion: Int, $parameters: JSON) {
1802
+ createPayment(
1803
+ ik: $ik
1804
+ ledger: {ik: $ledgerIk}
1805
+ payment: {type: $type, typeVersion: $typeVersion, parameters: $parameters}
1806
+ ) {
1807
+ __typename
1808
+ ... on Payment {
1809
+ clientSecret
1810
+ status
1811
+ }
1812
+ ... on BadRequestError {
1813
+ code
1814
+ message
1815
+ retryable
1816
+ }
1817
+ ... on InternalError {
1818
+ code
1819
+ message
1820
+ retryable
1821
+ }
1822
+ }
1823
+ }
1824
+ """)
1825
+ variables: dict[str, object] = {
1826
+ "ik": ik,
1827
+ "ledgerIk": ledger_ik,
1828
+ "type": type_,
1829
+ "typeVersion": type_version,
1830
+ "parameters": parameters,
1831
+ }
1832
+ response = await self.execute(
1833
+ query=query, operation_name="createPayment", variables=variables, **kwargs
1834
+ )
1835
+ data = self.get_data(response)
1836
+ return CreatePayment.model_validate(data)
@@ -0,0 +1,40 @@
1
+ # Generated by fragment (with the help of ariadne-codegen)
2
+ # Source: queries/
3
+
4
+ from typing import Literal, Union
5
+
6
+ from pydantic import Field
7
+
8
+ from .base_model import BaseModel
9
+ from .enums import PaymentStatus
10
+
11
+
12
+ class CreatePayment(BaseModel):
13
+ create_payment: Union[
14
+ "CreatePaymentCreatePaymentBadRequestError",
15
+ "CreatePaymentCreatePaymentInternalError",
16
+ "CreatePaymentCreatePaymentPayment",
17
+ ] = Field(alias="createPayment", discriminator="typename__")
18
+
19
+
20
+ class CreatePaymentCreatePaymentBadRequestError(BaseModel):
21
+ typename__: Literal["BadRequestError"] = Field(alias="__typename")
22
+ code: str
23
+ message: str
24
+ retryable: bool
25
+
26
+
27
+ class CreatePaymentCreatePaymentInternalError(BaseModel):
28
+ typename__: Literal["InternalError"] = Field(alias="__typename")
29
+ code: str
30
+ message: str
31
+ retryable: bool
32
+
33
+
34
+ class CreatePaymentCreatePaymentPayment(BaseModel):
35
+ typename__: Literal["Payment"] = Field(alias="__typename")
36
+ client_secret: str = Field(alias="clientSecret")
37
+ status: PaymentStatus
38
+
39
+
40
+ CreatePayment.model_rebuild()
@@ -261,8 +261,8 @@ class LinkType(str, Enum):
261
261
 
262
262
 
263
263
  class PaymentStatus(str, Enum):
264
+ needs_payment_method = "needs_payment_method"
264
265
  processing = "processing"
265
- requires_confirmation = "requires_confirmation"
266
266
  settled = "settled"
267
267
 
268
268
 
@@ -299,15 +299,15 @@ class SchemaLedgerEntryStatus(str, Enum):
299
299
  disabled = "disabled"
300
300
 
301
301
 
302
- class SchemaPaymentEntryStatus(str, Enum):
303
- active = "active"
304
-
305
-
306
302
  class SchemaPaymentTypeDirection(str, Enum):
307
303
  payin = "payin"
308
304
  payout = "payout"
309
305
 
310
306
 
307
+ class SchemaPaymentTypeStatus(str, Enum):
308
+ active = "active"
309
+
310
+
311
311
  class SchemaSystemLineKind(str, Enum):
312
312
  payment_fee_line = "payment_fee_line"
313
313
  payment_settlement_line = "payment_settlement_line"
@@ -21,8 +21,8 @@ from .enums import (
21
21
  SchemaConsistencyMode,
22
22
  SchemaLedgerAccountStatus,
23
23
  SchemaLedgerEntryStatus,
24
- SchemaPaymentEntryStatus,
25
24
  SchemaPaymentTypeDirection,
25
+ SchemaPaymentTypeStatus,
26
26
  SchemaSystemLineKind,
27
27
  TxType,
28
28
  )
@@ -120,6 +120,17 @@ class CreateLedgerInput(BaseModel):
120
120
  type_: Optional[LedgerTypes] = Field(alias="type", default=None)
121
121
 
122
122
 
123
+ class CreatePaymentInput(BaseModel):
124
+ """EXPERIMENTAL: The Payment to create."""
125
+
126
+ parameters: Optional[Any] = None
127
+ "Parameters for the specific Payment Type. Must be a key-value pair of strings. Must be a flat object: nested objects and arrays are rejected."
128
+ type_: Any = Field(alias="type")
129
+ "The type of the Payment. Must be defined in the Schema linked to the Ledger."
130
+ type_version: Optional[int] = Field(alias="typeVersion", default=None)
131
+ "The version of the Payment Type. Defaults to the latest active version."
132
+
133
+
123
134
  class CurrencyFilter(BaseModel):
124
135
  equal_to: Optional["CurrencyMatchInput"] = Field(alias="equalTo", default=None)
125
136
  "Must match the value provided"
@@ -895,7 +906,7 @@ class SchemaPaymentAccountingInput(BaseModel):
895
906
  """EXPERIMENTAL: The Ledger Entries a Payment Type posts as a payment moves
896
907
  through its lifecycle, keyed by lifecycle transition."""
897
908
 
898
- needs_confirmation_to_processing: Optional["SchemaPaymentEntryInput"] = None
909
+ needs_payment_method_to_processing: Optional["SchemaPaymentEntryInput"] = None
899
910
  "Posted when the payment enters processing. Optional."
900
911
  processing_to_settled: "SchemaPaymentEntryInput"
901
912
  "Posted when the payment settles. Every Payment Type must define it."
@@ -950,7 +961,7 @@ class SchemaPaymentTypeInput(BaseModel):
950
961
  "The Ledger Entries posted as the payment moves through its lifecycle."
951
962
  payment: "SchemaPaymentTypeDetailsInput"
952
963
  "The payment this Payment Type creates."
953
- status: SchemaPaymentEntryStatus
964
+ status: SchemaPaymentTypeStatus
954
965
  "The status of this Payment Type."
955
966
  type_: Any = Field(alias="type")
956
967
  "The type of this Payment Type. This is a stable, unique identifier for it.\nUniqueness is enforced at the Schema level."
@@ -1241,3 +1241,37 @@ mutation createCustomCurrency(
1241
1241
  }
1242
1242
  }
1243
1243
  }
1244
+
1245
+ mutation createPayment(
1246
+ $ik: SafeString!
1247
+ $ledgerIk: SafeString!
1248
+ $type: SafeString!
1249
+ $typeVersion: Int
1250
+ $parameters: JSON
1251
+ ) {
1252
+ createPayment(
1253
+ ik: $ik
1254
+ ledger: { ik: $ledgerIk }
1255
+ payment: {
1256
+ type: $type
1257
+ typeVersion: $typeVersion
1258
+ parameters: $parameters
1259
+ }
1260
+ ) {
1261
+ __typename
1262
+ ... on Payment {
1263
+ clientSecret
1264
+ status
1265
+ }
1266
+ ... on BadRequestError {
1267
+ code
1268
+ message
1269
+ retryable
1270
+ }
1271
+ ... on InternalError {
1272
+ code
1273
+ message
1274
+ retryable
1275
+ }
1276
+ }
1277
+ }
@@ -54,6 +54,12 @@ from .create_ledger import (
54
54
  CreateLedgerCreateLedgerCreateLedgerResultLedgerSchema,
55
55
  CreateLedgerCreateLedgerInternalError,
56
56
  )
57
+ from .create_payment import (
58
+ CreatePayment,
59
+ CreatePaymentCreatePaymentBadRequestError,
60
+ CreatePaymentCreatePaymentInternalError,
61
+ CreatePaymentCreatePaymentPayment,
62
+ )
57
63
  from .delete_custom_txs import (
58
64
  DeleteCustomTxs,
59
65
  DeleteCustomTxsDeleteCustomTxsBadRequestError,
@@ -96,8 +102,8 @@ from .enums import (
96
102
  SchemaConsistencyMode,
97
103
  SchemaLedgerAccountStatus,
98
104
  SchemaLedgerEntryStatus,
99
- SchemaPaymentEntryStatus,
100
105
  SchemaPaymentTypeDirection,
106
+ SchemaPaymentTypeStatus,
101
107
  SchemaSystemLineKind,
102
108
  StripeEnv,
103
109
  TxType,
@@ -183,6 +189,7 @@ from .input_types import (
183
189
  CreateLedgerAccountInput,
184
190
  CreateLedgerAccountsInput,
185
191
  CreateLedgerInput,
192
+ CreatePaymentInput,
186
193
  CurrencyFilter,
187
194
  CurrencyMatchInput,
188
195
  CustomAccountInput,
@@ -461,6 +468,11 @@ __all__ = [
461
468
  "CreateLedgerCreateLedgerCreateLedgerResultLedgerSchema",
462
469
  "CreateLedgerCreateLedgerInternalError",
463
470
  "CreateLedgerInput",
471
+ "CreatePayment",
472
+ "CreatePaymentCreatePaymentBadRequestError",
473
+ "CreatePaymentCreatePaymentInternalError",
474
+ "CreatePaymentCreatePaymentPayment",
475
+ "CreatePaymentInput",
464
476
  "CurrencyCode",
465
477
  "CurrencyFilter",
466
478
  "CurrencyMatchInput",
@@ -706,12 +718,12 @@ __all__ = [
706
718
  "SchemaMatchInput",
707
719
  "SchemaPaymentAccountingInput",
708
720
  "SchemaPaymentEntryInput",
709
- "SchemaPaymentEntryStatus",
710
721
  "SchemaPaymentInput",
711
722
  "SchemaPaymentLineInput",
712
723
  "SchemaPaymentTypeDetailsInput",
713
724
  "SchemaPaymentTypeDirection",
714
725
  "SchemaPaymentTypeInput",
726
+ "SchemaPaymentTypeStatus",
715
727
  "SchemaPaymentsInput",
716
728
  "SchemaRepeatedConfigInput",
717
729
  "SchemaSystemLineKind",
@@ -9,6 +9,7 @@ from .add_ledger_entry_runtime import AddLedgerEntryRuntime
9
9
  from .create_custom_currency import CreateCustomCurrency
10
10
  from .create_custom_link import CreateCustomLink
11
11
  from .create_ledger import CreateLedger
12
+ from .create_payment import CreatePayment
12
13
  from .delete_custom_txs import DeleteCustomTxs
13
14
  from .delete_ledger import DeleteLedger
14
15
  from .delete_schema import DeleteSchema
@@ -1780,3 +1781,50 @@ class Client(SyncFragmentClient):
1780
1781
  )
1781
1782
  data = self.get_data(response)
1782
1783
  return CreateCustomCurrency.model_validate(data)
1784
+
1785
+ def create_payment(
1786
+ self,
1787
+ ik: Any,
1788
+ ledger_ik: Any,
1789
+ type_: Any,
1790
+ type_version: Optional[int] = None,
1791
+ parameters: Optional[Any] = None,
1792
+ **kwargs: Any
1793
+ ) -> CreatePayment:
1794
+ query = gql("""
1795
+ mutation createPayment($ik: SafeString!, $ledgerIk: SafeString!, $type: SafeString!, $typeVersion: Int, $parameters: JSON) {
1796
+ createPayment(
1797
+ ik: $ik
1798
+ ledger: {ik: $ledgerIk}
1799
+ payment: {type: $type, typeVersion: $typeVersion, parameters: $parameters}
1800
+ ) {
1801
+ __typename
1802
+ ... on Payment {
1803
+ clientSecret
1804
+ status
1805
+ }
1806
+ ... on BadRequestError {
1807
+ code
1808
+ message
1809
+ retryable
1810
+ }
1811
+ ... on InternalError {
1812
+ code
1813
+ message
1814
+ retryable
1815
+ }
1816
+ }
1817
+ }
1818
+ """)
1819
+ variables: dict[str, object] = {
1820
+ "ik": ik,
1821
+ "ledgerIk": ledger_ik,
1822
+ "type": type_,
1823
+ "typeVersion": type_version,
1824
+ "parameters": parameters,
1825
+ }
1826
+ response = self.execute(
1827
+ query=query, operation_name="createPayment", variables=variables, **kwargs
1828
+ )
1829
+ data = self.get_data(response)
1830
+ return CreatePayment.model_validate(data)
@@ -0,0 +1,40 @@
1
+ # Generated by fragment (with the help of ariadne-codegen)
2
+ # Source: queries/
3
+
4
+ from typing import Literal, Union
5
+
6
+ from pydantic import Field
7
+
8
+ from .base_model import BaseModel
9
+ from .enums import PaymentStatus
10
+
11
+
12
+ class CreatePayment(BaseModel):
13
+ create_payment: Union[
14
+ "CreatePaymentCreatePaymentBadRequestError",
15
+ "CreatePaymentCreatePaymentInternalError",
16
+ "CreatePaymentCreatePaymentPayment",
17
+ ] = Field(alias="createPayment", discriminator="typename__")
18
+
19
+
20
+ class CreatePaymentCreatePaymentBadRequestError(BaseModel):
21
+ typename__: Literal["BadRequestError"] = Field(alias="__typename")
22
+ code: str
23
+ message: str
24
+ retryable: bool
25
+
26
+
27
+ class CreatePaymentCreatePaymentInternalError(BaseModel):
28
+ typename__: Literal["InternalError"] = Field(alias="__typename")
29
+ code: str
30
+ message: str
31
+ retryable: bool
32
+
33
+
34
+ class CreatePaymentCreatePaymentPayment(BaseModel):
35
+ typename__: Literal["Payment"] = Field(alias="__typename")
36
+ client_secret: str = Field(alias="clientSecret")
37
+ status: PaymentStatus
38
+
39
+
40
+ CreatePayment.model_rebuild()
@@ -261,8 +261,8 @@ class LinkType(str, Enum):
261
261
 
262
262
 
263
263
  class PaymentStatus(str, Enum):
264
+ needs_payment_method = "needs_payment_method"
264
265
  processing = "processing"
265
- requires_confirmation = "requires_confirmation"
266
266
  settled = "settled"
267
267
 
268
268
 
@@ -299,15 +299,15 @@ class SchemaLedgerEntryStatus(str, Enum):
299
299
  disabled = "disabled"
300
300
 
301
301
 
302
- class SchemaPaymentEntryStatus(str, Enum):
303
- active = "active"
304
-
305
-
306
302
  class SchemaPaymentTypeDirection(str, Enum):
307
303
  payin = "payin"
308
304
  payout = "payout"
309
305
 
310
306
 
307
+ class SchemaPaymentTypeStatus(str, Enum):
308
+ active = "active"
309
+
310
+
311
311
  class SchemaSystemLineKind(str, Enum):
312
312
  payment_fee_line = "payment_fee_line"
313
313
  payment_settlement_line = "payment_settlement_line"
@@ -21,8 +21,8 @@ from .enums import (
21
21
  SchemaConsistencyMode,
22
22
  SchemaLedgerAccountStatus,
23
23
  SchemaLedgerEntryStatus,
24
- SchemaPaymentEntryStatus,
25
24
  SchemaPaymentTypeDirection,
25
+ SchemaPaymentTypeStatus,
26
26
  SchemaSystemLineKind,
27
27
  TxType,
28
28
  )
@@ -120,6 +120,17 @@ class CreateLedgerInput(BaseModel):
120
120
  type_: Optional[LedgerTypes] = Field(alias="type", default=None)
121
121
 
122
122
 
123
+ class CreatePaymentInput(BaseModel):
124
+ """EXPERIMENTAL: The Payment to create."""
125
+
126
+ parameters: Optional[Any] = None
127
+ "Parameters for the specific Payment Type. Must be a key-value pair of strings. Must be a flat object: nested objects and arrays are rejected."
128
+ type_: Any = Field(alias="type")
129
+ "The type of the Payment. Must be defined in the Schema linked to the Ledger."
130
+ type_version: Optional[int] = Field(alias="typeVersion", default=None)
131
+ "The version of the Payment Type. Defaults to the latest active version."
132
+
133
+
123
134
  class CurrencyFilter(BaseModel):
124
135
  equal_to: Optional["CurrencyMatchInput"] = Field(alias="equalTo", default=None)
125
136
  "Must match the value provided"
@@ -895,7 +906,7 @@ class SchemaPaymentAccountingInput(BaseModel):
895
906
  """EXPERIMENTAL: The Ledger Entries a Payment Type posts as a payment moves
896
907
  through its lifecycle, keyed by lifecycle transition."""
897
908
 
898
- needs_confirmation_to_processing: Optional["SchemaPaymentEntryInput"] = None
909
+ needs_payment_method_to_processing: Optional["SchemaPaymentEntryInput"] = None
899
910
  "Posted when the payment enters processing. Optional."
900
911
  processing_to_settled: "SchemaPaymentEntryInput"
901
912
  "Posted when the payment settles. Every Payment Type must define it."
@@ -950,7 +961,7 @@ class SchemaPaymentTypeInput(BaseModel):
950
961
  "The Ledger Entries posted as the payment moves through its lifecycle."
951
962
  payment: "SchemaPaymentTypeDetailsInput"
952
963
  "The payment this Payment Type creates."
953
- status: SchemaPaymentEntryStatus
964
+ status: SchemaPaymentTypeStatus
954
965
  "The status of this Payment Type."
955
966
  type_: Any = Field(alias="type")
956
967
  "The type of this Payment Type. This is a stable, unique identifier for it.\nUniqueness is enforced at the Schema level."
@@ -5,7 +5,7 @@ target_package_name = "fragment_graphql_client"
5
5
 
6
6
  [tool.poetry]
7
7
  name = "fragment-python"
8
- version = "1.1.1"
8
+ version = "1.2.0"
9
9
  description = "Python SDK for https://fragment.dev/"
10
10
  authors = ["Fragment Foundries Inc"]
11
11
  license = "Apache 2.0"
File without changes