From 942d5daf8708728e27ab8b059da6c07ec2e6d546 Mon Sep 17 00:00:00 2001 From: "fragment-pr-bot[bot]" Date: Fri, 25 Sep 2026 14:43:19 +0000 Subject: [PATCH] Update Python SDK queries --- fragment/sdk/__init__.py | 2 + fragment/sdk/client.py | 7 ++ fragment/sdk/create_payment.py | 14 ++- fragment/sdk/enums.py | 2 +- fragment/sdk/input_types.py | 10 +- fragment/std_queries/queries.graphql | 7 ++ fragment/sync_sdk/__init__.py | 2 + fragment/sync_sdk/client.py | 7 ++ fragment/sync_sdk/create_payment.py | 14 ++- fragment/sync_sdk/enums.py | 2 +- fragment/sync_sdk/input_types.py | 10 +- .../001-marketing-schema/sdk/__init__.py | 2 + .../001-marketing-schema/sdk/client.py | 7 ++ .../sdk/create_payment.py | 14 ++- .../001-marketing-schema/sdk/enums.py | 2 +- .../001-marketing-schema/sdk/input_types.py | 10 +- tests/snapshots/schema.graphql | 98 +++++++++++++++++-- 17 files changed, 187 insertions(+), 23 deletions(-) diff --git a/fragment/sdk/__init__.py b/fragment/sdk/__init__.py index 8ad2fb0..f5e9f83 100644 --- a/fragment/sdk/__init__.py +++ b/fragment/sdk/__init__.py @@ -60,6 +60,7 @@ CreatePaymentCreatePaymentBadRequestError, CreatePaymentCreatePaymentCreatePaymentResult, CreatePaymentCreatePaymentCreatePaymentResultPayment, + CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency, CreatePaymentCreatePaymentInternalError, ) from .delete_custom_txs import ( @@ -498,6 +499,7 @@ "CreatePaymentCreatePaymentBadRequestError", "CreatePaymentCreatePaymentCreatePaymentResult", "CreatePaymentCreatePaymentCreatePaymentResultPayment", + "CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency", "CreatePaymentCreatePaymentInternalError", "CreatePaymentInput", "CurrencyCode", diff --git a/fragment/sdk/client.py b/fragment/sdk/client.py index 2eefbd9..3fd3bc3 100644 --- a/fragment/sdk/client.py +++ b/fragment/sdk/client.py @@ -1858,8 +1858,15 @@ async def create_payment( __typename ... on CreatePaymentResult { payment { + id + ik clientSecret status + amount + mode + currency { + code + } } } ... on BadRequestError { diff --git a/fragment/sdk/create_payment.py b/fragment/sdk/create_payment.py index 54ed57e..cffc8c8 100644 --- a/fragment/sdk/create_payment.py +++ b/fragment/sdk/create_payment.py @@ -1,12 +1,12 @@ # Generated by fragment (with the help of ariadne-codegen) # Source: queries/ -from typing import Literal, Union +from typing import Any, Literal, Union from pydantic import Field from .base_model import BaseModel -from .enums import PaymentStatus +from .enums import PaymentCurrencyCode, PaymentMode, PaymentStatus class CreatePayment(BaseModel): @@ -30,8 +30,17 @@ class CreatePaymentCreatePaymentCreatePaymentResult(BaseModel): class CreatePaymentCreatePaymentCreatePaymentResultPayment(BaseModel): + id: str + ik: Any client_secret: str = Field(alias="clientSecret") status: PaymentStatus + amount: Any + mode: PaymentMode + currency: "CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency" + + +class CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency(BaseModel): + code: PaymentCurrencyCode class CreatePaymentCreatePaymentInternalError(BaseModel): @@ -43,3 +52,4 @@ class CreatePaymentCreatePaymentInternalError(BaseModel): CreatePayment.model_rebuild() CreatePaymentCreatePaymentCreatePaymentResult.model_rebuild() +CreatePaymentCreatePaymentCreatePaymentResultPayment.model_rebuild() diff --git a/fragment/sdk/enums.py b/fragment/sdk/enums.py index acf8316..72b7e7c 100644 --- a/fragment/sdk/enums.py +++ b/fragment/sdk/enums.py @@ -271,7 +271,7 @@ class PaymentMode(str, Enum): class PaymentStatus(str, Enum): - approved = "approved" + accepted = "accepted" needs_payment_method = "needs_payment_method" processing = "processing" settled = "settled" diff --git a/fragment/sdk/input_types.py b/fragment/sdk/input_types.py index bf0df33..dc8321a 100644 --- a/fragment/sdk/input_types.py +++ b/fragment/sdk/input_types.py @@ -606,6 +606,8 @@ class LedgerLinesFilterSet(BaseModel): "Filter by the currency of the Ledger Line." date: Optional["DateFilter"] = None "Use this filter to filter Ledger Lines by their `posted` date." + external_tx_ids: Optional[list[str]] = Field(alias="externalTxIds", default=None) + "Filter Ledger Lines by the external IDs of their linked transactions. Only supported on `LedgerAccount.lines` for a linked Ledger Account." is_reversal: Optional[bool] = Field(alias="isReversal", default=None) "Use this to filter Ledger Lines that were posted to this Ledger Account, using `reverseLedgerEntry`." is_reversed: Optional[bool] = Field(alias="isReversed", default=None) @@ -648,7 +650,11 @@ class LedgersFilterSet(BaseModel): class LinkMatchInput(BaseModel): - id: str + """Specify a Link by ID, or a Custom Link by its creation IK.""" + + id: Optional[str] = None + ik: Optional[Any] = None + "The IK passed to createCustomLink. If id is also provided, both must identify the same Link." class MigrateLedgerEntryInput(BaseModel): @@ -965,7 +971,7 @@ class SchemaPaymentAccountingInput(BaseModel): through its lifecycle, keyed by lifecycle transition.""" initiated: Optional["SchemaPaymentEntryInput"] = None - "Posted when the payment is approved. Optional." + "Posted when the payment is captured. Optional." settled: "SchemaPaymentEntryInput" "Posted when the payment settles. Every Payment Type must define it." diff --git a/fragment/std_queries/queries.graphql b/fragment/std_queries/queries.graphql index 94914ad..8c49694 100644 --- a/fragment/std_queries/queries.graphql +++ b/fragment/std_queries/queries.graphql @@ -1291,8 +1291,15 @@ mutation createPayment( __typename ... on CreatePaymentResult { payment { + id + ik clientSecret status + amount + mode + currency { + code + } } } ... on BadRequestError { diff --git a/fragment/sync_sdk/__init__.py b/fragment/sync_sdk/__init__.py index 5c323b9..2f33998 100644 --- a/fragment/sync_sdk/__init__.py +++ b/fragment/sync_sdk/__init__.py @@ -59,6 +59,7 @@ CreatePaymentCreatePaymentBadRequestError, CreatePaymentCreatePaymentCreatePaymentResult, CreatePaymentCreatePaymentCreatePaymentResultPayment, + CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency, CreatePaymentCreatePaymentInternalError, ) from .delete_custom_txs import ( @@ -497,6 +498,7 @@ "CreatePaymentCreatePaymentBadRequestError", "CreatePaymentCreatePaymentCreatePaymentResult", "CreatePaymentCreatePaymentCreatePaymentResultPayment", + "CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency", "CreatePaymentCreatePaymentInternalError", "CreatePaymentInput", "CurrencyCode", diff --git a/fragment/sync_sdk/client.py b/fragment/sync_sdk/client.py index 2133686..2bd1e72 100644 --- a/fragment/sync_sdk/client.py +++ b/fragment/sync_sdk/client.py @@ -1852,8 +1852,15 @@ def create_payment( __typename ... on CreatePaymentResult { payment { + id + ik clientSecret status + amount + mode + currency { + code + } } } ... on BadRequestError { diff --git a/fragment/sync_sdk/create_payment.py b/fragment/sync_sdk/create_payment.py index 54ed57e..cffc8c8 100644 --- a/fragment/sync_sdk/create_payment.py +++ b/fragment/sync_sdk/create_payment.py @@ -1,12 +1,12 @@ # Generated by fragment (with the help of ariadne-codegen) # Source: queries/ -from typing import Literal, Union +from typing import Any, Literal, Union from pydantic import Field from .base_model import BaseModel -from .enums import PaymentStatus +from .enums import PaymentCurrencyCode, PaymentMode, PaymentStatus class CreatePayment(BaseModel): @@ -30,8 +30,17 @@ class CreatePaymentCreatePaymentCreatePaymentResult(BaseModel): class CreatePaymentCreatePaymentCreatePaymentResultPayment(BaseModel): + id: str + ik: Any client_secret: str = Field(alias="clientSecret") status: PaymentStatus + amount: Any + mode: PaymentMode + currency: "CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency" + + +class CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency(BaseModel): + code: PaymentCurrencyCode class CreatePaymentCreatePaymentInternalError(BaseModel): @@ -43,3 +52,4 @@ class CreatePaymentCreatePaymentInternalError(BaseModel): CreatePayment.model_rebuild() CreatePaymentCreatePaymentCreatePaymentResult.model_rebuild() +CreatePaymentCreatePaymentCreatePaymentResultPayment.model_rebuild() diff --git a/fragment/sync_sdk/enums.py b/fragment/sync_sdk/enums.py index acf8316..72b7e7c 100644 --- a/fragment/sync_sdk/enums.py +++ b/fragment/sync_sdk/enums.py @@ -271,7 +271,7 @@ class PaymentMode(str, Enum): class PaymentStatus(str, Enum): - approved = "approved" + accepted = "accepted" needs_payment_method = "needs_payment_method" processing = "processing" settled = "settled" diff --git a/fragment/sync_sdk/input_types.py b/fragment/sync_sdk/input_types.py index bf0df33..dc8321a 100644 --- a/fragment/sync_sdk/input_types.py +++ b/fragment/sync_sdk/input_types.py @@ -606,6 +606,8 @@ class LedgerLinesFilterSet(BaseModel): "Filter by the currency of the Ledger Line." date: Optional["DateFilter"] = None "Use this filter to filter Ledger Lines by their `posted` date." + external_tx_ids: Optional[list[str]] = Field(alias="externalTxIds", default=None) + "Filter Ledger Lines by the external IDs of their linked transactions. Only supported on `LedgerAccount.lines` for a linked Ledger Account." is_reversal: Optional[bool] = Field(alias="isReversal", default=None) "Use this to filter Ledger Lines that were posted to this Ledger Account, using `reverseLedgerEntry`." is_reversed: Optional[bool] = Field(alias="isReversed", default=None) @@ -648,7 +650,11 @@ class LedgersFilterSet(BaseModel): class LinkMatchInput(BaseModel): - id: str + """Specify a Link by ID, or a Custom Link by its creation IK.""" + + id: Optional[str] = None + ik: Optional[Any] = None + "The IK passed to createCustomLink. If id is also provided, both must identify the same Link." class MigrateLedgerEntryInput(BaseModel): @@ -965,7 +971,7 @@ class SchemaPaymentAccountingInput(BaseModel): through its lifecycle, keyed by lifecycle transition.""" initiated: Optional["SchemaPaymentEntryInput"] = None - "Posted when the payment is approved. Optional." + "Posted when the payment is captured. Optional." settled: "SchemaPaymentEntryInput" "Posted when the payment settles. Every Payment Type must define it." diff --git a/tests/snapshots/001-marketing-schema/sdk/__init__.py b/tests/snapshots/001-marketing-schema/sdk/__init__.py index a9b1848..8db61cc 100644 --- a/tests/snapshots/001-marketing-schema/sdk/__init__.py +++ b/tests/snapshots/001-marketing-schema/sdk/__init__.py @@ -60,6 +60,7 @@ CreatePaymentCreatePaymentBadRequestError, CreatePaymentCreatePaymentCreatePaymentResult, CreatePaymentCreatePaymentCreatePaymentResultPayment, + CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency, CreatePaymentCreatePaymentInternalError, ) from .delete_custom_txs import ( @@ -615,6 +616,7 @@ "CreatePaymentCreatePaymentBadRequestError", "CreatePaymentCreatePaymentCreatePaymentResult", "CreatePaymentCreatePaymentCreatePaymentResultPayment", + "CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency", "CreatePaymentCreatePaymentInternalError", "CreatePaymentInput", "CurrencyCode", diff --git a/tests/snapshots/001-marketing-schema/sdk/client.py b/tests/snapshots/001-marketing-schema/sdk/client.py index 78b5083..597b366 100644 --- a/tests/snapshots/001-marketing-schema/sdk/client.py +++ b/tests/snapshots/001-marketing-schema/sdk/client.py @@ -2627,8 +2627,15 @@ async def create_payment( __typename ... on CreatePaymentResult { payment { + id + ik clientSecret status + amount + mode + currency { + code + } } } ... on BadRequestError { diff --git a/tests/snapshots/001-marketing-schema/sdk/create_payment.py b/tests/snapshots/001-marketing-schema/sdk/create_payment.py index 298d03a..2856ace 100644 --- a/tests/snapshots/001-marketing-schema/sdk/create_payment.py +++ b/tests/snapshots/001-marketing-schema/sdk/create_payment.py @@ -1,12 +1,12 @@ # Generated by fragment (with the help of ariadne-codegen) # Source: tests/snapshots/001-marketing-schema/ -from typing import Literal, Union +from typing import Any, Literal, Union from pydantic import Field from .base_model import BaseModel -from .enums import PaymentStatus +from .enums import PaymentCurrencyCode, PaymentMode, PaymentStatus class CreatePayment(BaseModel): @@ -30,8 +30,17 @@ class CreatePaymentCreatePaymentCreatePaymentResult(BaseModel): class CreatePaymentCreatePaymentCreatePaymentResultPayment(BaseModel): + id: str + ik: Any client_secret: str = Field(alias="clientSecret") status: PaymentStatus + amount: Any + mode: PaymentMode + currency: "CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency" + + +class CreatePaymentCreatePaymentCreatePaymentResultPaymentCurrency(BaseModel): + code: PaymentCurrencyCode class CreatePaymentCreatePaymentInternalError(BaseModel): @@ -43,3 +52,4 @@ class CreatePaymentCreatePaymentInternalError(BaseModel): CreatePayment.model_rebuild() CreatePaymentCreatePaymentCreatePaymentResult.model_rebuild() +CreatePaymentCreatePaymentCreatePaymentResultPayment.model_rebuild() diff --git a/tests/snapshots/001-marketing-schema/sdk/enums.py b/tests/snapshots/001-marketing-schema/sdk/enums.py index acf8316..72b7e7c 100644 --- a/tests/snapshots/001-marketing-schema/sdk/enums.py +++ b/tests/snapshots/001-marketing-schema/sdk/enums.py @@ -271,7 +271,7 @@ class PaymentMode(str, Enum): class PaymentStatus(str, Enum): - approved = "approved" + accepted = "accepted" needs_payment_method = "needs_payment_method" processing = "processing" settled = "settled" diff --git a/tests/snapshots/001-marketing-schema/sdk/input_types.py b/tests/snapshots/001-marketing-schema/sdk/input_types.py index bf0df33..dc8321a 100644 --- a/tests/snapshots/001-marketing-schema/sdk/input_types.py +++ b/tests/snapshots/001-marketing-schema/sdk/input_types.py @@ -606,6 +606,8 @@ class LedgerLinesFilterSet(BaseModel): "Filter by the currency of the Ledger Line." date: Optional["DateFilter"] = None "Use this filter to filter Ledger Lines by their `posted` date." + external_tx_ids: Optional[list[str]] = Field(alias="externalTxIds", default=None) + "Filter Ledger Lines by the external IDs of their linked transactions. Only supported on `LedgerAccount.lines` for a linked Ledger Account." is_reversal: Optional[bool] = Field(alias="isReversal", default=None) "Use this to filter Ledger Lines that were posted to this Ledger Account, using `reverseLedgerEntry`." is_reversed: Optional[bool] = Field(alias="isReversed", default=None) @@ -648,7 +650,11 @@ class LedgersFilterSet(BaseModel): class LinkMatchInput(BaseModel): - id: str + """Specify a Link by ID, or a Custom Link by its creation IK.""" + + id: Optional[str] = None + ik: Optional[Any] = None + "The IK passed to createCustomLink. If id is also provided, both must identify the same Link." class MigrateLedgerEntryInput(BaseModel): @@ -965,7 +971,7 @@ class SchemaPaymentAccountingInput(BaseModel): through its lifecycle, keyed by lifecycle transition.""" initiated: Optional["SchemaPaymentEntryInput"] = None - "Posted when the payment is approved. Optional." + "Posted when the payment is captured. Optional." settled: "SchemaPaymentEntryInput" "Posted when the payment settles. Every Payment Type must define it." diff --git a/tests/snapshots/schema.graphql b/tests/snapshots/schema.graphql index be7651e..8b3ad1f 100644 --- a/tests/snapshots/schema.graphql +++ b/tests/snapshots/schema.graphql @@ -3157,6 +3157,11 @@ input LedgerLinesFilterSet { """Use this filter to filter Ledger Lines by their `posted` date.""" date: DateFilter + """ + Filter Ledger Lines by the external IDs of their linked transactions. Only supported on `LedgerAccount.lines` for a linked Ledger Account. + """ + externalTxIds: [String!] + """ Use this to filter Ledger Lines that were posted to this Ledger Account, using `reverseLedgerEntry`. """ @@ -3302,8 +3307,14 @@ interface Link { name: String! } +"""Specify a Link by ID, or a Custom Link by its creation IK.""" input LinkMatchInput { - id: ID! + id: ID + + """ + The IK passed to createCustomLink. If id is also provided, both must identify the same Link. + """ + ik: SafeString } """The type of Link an external account belongs to.""" @@ -3548,7 +3559,7 @@ type Mutation { """A list of external accounts to sync""" accounts: [CustomAccountInput!]! - """An object containing the ID of a Custom Link.""" + """An object containing the ID or creation IK of a Custom Link.""" link: LinkMatchInput! ): SyncCustomAccountsResponse! @@ -3556,7 +3567,7 @@ type Mutation { You can create transactions under a Custom Account in a [Custom Link](https://fragment.dev/guides/sync-payments#custom-link) using this mutation. Once you've imported transactions, you can use the reconcileTx mutation to add them to a Ledger via the Linked Ledger Account. You can sync up to 100 Custom Transactions in one API call. """ syncCustomTxs( - """An object containing the ID of a Custom Link.""" + """An object containing the ID or creation IK of a Custom Link.""" link: LinkMatchInput! """A list of external transactions to sync""" @@ -3639,6 +3650,11 @@ type Payment { """The currency this Payment is denominated in.""" currency: PaymentCurrency! + """ + EXPERIMENTAL: The log of events that have occurred on this Payment, most recent first. + """ + events: PaymentEventsConnection! + """The ID of this Payment.""" id: ID! @@ -3666,6 +3682,38 @@ type Payment { typeVersion: Int! } +"""EXPERIMENTAL: The card network captured the Payment.""" +type PaymentCardCapturedEvent implements PaymentEvent { + """ + The `initiated` Ledger Entry, `null` where the Payment Type defines none. + """ + ledgerEntry: LedgerEntry + + """When this event occurred.""" + occurredAt: DateTime! + + """The status of the Payment after this event.""" + status: PaymentStatus! +} + +"""EXPERIMENTAL: The payer completed checkout.""" +type PaymentCheckoutCompletedEvent implements PaymentEvent { + """When this event occurred.""" + occurredAt: DateTime! + + """The status of the Payment after this event.""" + status: PaymentStatus! +} + +"""EXPERIMENTAL: The Payment was created.""" +type PaymentCreatedEvent implements PaymentEvent { + """When this event occurred.""" + occurredAt: DateTime! + + """The status of the Payment after this event.""" + status: PaymentStatus! +} + """EXPERIMENTAL: The currency a Payment is denominated in.""" type PaymentCurrency { """The currency code.""" @@ -3691,6 +3739,24 @@ enum PaymentCurrencyCode { USD } +"""EXPERIMENTAL: Something that happened to a Payment.""" +interface PaymentEvent { + """When this event occurred.""" + occurredAt: DateTime! + + """The status of the Payment after this event.""" + status: PaymentStatus! +} + +"""EXPERIMENTAL: A paginated list of Payment events.""" +type PaymentEventsConnection { + """The current page of results.""" + nodes: [PaymentEvent!]! + + """The pagination info for this list.""" + pageInfo: PageInfo! +} + """Specify a Ledger Payment by using `ledger` and `ik`.""" input PaymentMatchInput { """The Idempotency Key the Payment was created with.""" @@ -3706,13 +3772,25 @@ enum PaymentMode { sandbox } +"""EXPERIMENTAL: The Payment settled.""" +type PaymentSettledEvent implements PaymentEvent { + """The `settled` Ledger Entry.""" + ledgerEntry: LedgerEntry! + + """When this event occurred.""" + occurredAt: DateTime! + + """The status of the Payment after this event.""" + status: PaymentStatus! +} + """ EXPERIMENTAL — subject to change. Status of a Payment. """ enum PaymentStatus { - approved + accepted needs_payment_method processing settled @@ -3888,9 +3966,13 @@ type Query { last: Int ): LedgersConnection! - """Get a Link by ID. Returns a BadRequestError if the Link is not found.""" + """ + Get a Link by ID or a Custom Link by creation IK. Returns a BadRequestError if the Link is not found. + """ link( - """An object containing the ID of the Link you are querying""" + """ + An object containing the ID or creation IK of the Link you are querying + """ link: LinkMatchInput! ): Link @@ -4543,7 +4625,7 @@ input SchemaMatchInput { """EXPERIMENTAL: A lifecycle transition of a Payment.""" enum SchemaPaymentAccountingEventKey { - """The payment was approved and is guaranteed to settle.""" + """The payment was captured and is guaranteed to settle.""" initiated """The payment settled.""" @@ -4555,7 +4637,7 @@ EXPERIMENTAL: The Ledger Entries a Payment Type posts as a payment moves through its lifecycle, keyed by lifecycle transition. """ input SchemaPaymentAccountingInput { - """Posted when the payment is approved. Optional.""" + """Posted when the payment is captured. Optional.""" initiated: SchemaPaymentEntryInput """Posted when the payment settles. Every Payment Type must define it."""