diff --git a/fragment/sdk/__init__.py b/fragment/sdk/__init__.py index 7501db8..bafdb82 100644 --- a/fragment/sdk/__init__.py +++ b/fragment/sdk/__init__.py @@ -97,6 +97,9 @@ SchemaConsistencyMode, SchemaLedgerAccountStatus, SchemaLedgerEntryStatus, + SchemaPaymentEntryStatus, + SchemaPaymentTypeDirection, + SchemaSystemLineKind, StripeEnv, TxType, UnitEnv, @@ -222,6 +225,7 @@ LedgerLineInput, LedgerLineMatchInput, LedgerLinesFilterSet, + LedgerLineTagInput, LedgerMatchInput, LedgersFilterSet, LedgerTypeFilter, @@ -245,7 +249,13 @@ SchemaLedgerEntryTagInput, SchemaLedgerLineInput, SchemaMatchInput, + SchemaPaymentAccountingInput, + SchemaPaymentEntryInput, SchemaPaymentInput, + SchemaPaymentLineInput, + SchemaPaymentsInput, + SchemaPaymentTypeDetailsInput, + SchemaPaymentTypeInput, SchemaRepeatedConfigInput, SchemaTxMatchInput, StringFilter, @@ -257,6 +267,7 @@ UpdateLedgerAccountInput, UpdateLedgerEntryInput, UpdateLedgerInput, + UpdateLedgerLineInput, ) from .list_ledger_account_balances import ( ListLedgerAccountBalances, @@ -577,6 +588,7 @@ "LedgerEntryTagInput", "LedgerLineInput", "LedgerLineMatchInput", + "LedgerLineTagInput", "LedgerLinesConsistencyMode", "LedgerLinesFilterSet", "LedgerMatchInput", @@ -693,8 +705,17 @@ "SchemaLedgerEntryTagInput", "SchemaLedgerLineInput", "SchemaMatchInput", + "SchemaPaymentAccountingInput", + "SchemaPaymentEntryInput", + "SchemaPaymentEntryStatus", "SchemaPaymentInput", + "SchemaPaymentLineInput", + "SchemaPaymentTypeDetailsInput", + "SchemaPaymentTypeDirection", + "SchemaPaymentTypeInput", + "SchemaPaymentsInput", "SchemaRepeatedConfigInput", + "SchemaSystemLineKind", "SchemaTxMatchInput", "StoreSchema", "StoreSchemaStoreSchemaBadRequestError", @@ -736,6 +757,7 @@ "UpdateLedgerEntryUpdateLedgerEntryUpdateLedgerEntryResultEntryLinesNodesAccount", "UpdateLedgerEntryUpdateLedgerEntryUpdateLedgerEntryResultEntryTags", "UpdateLedgerInput", + "UpdateLedgerLineInput", "UpdateLedgerUpdateLedgerBadRequestError", "UpdateLedgerUpdateLedgerInternalError", "UpdateLedgerUpdateLedgerUpdateLedgerResult", diff --git a/fragment/sdk/enums.py b/fragment/sdk/enums.py index 1c9468d..26a6de2 100644 --- a/fragment/sdk/enums.py +++ b/fragment/sdk/enums.py @@ -299,6 +299,20 @@ class SchemaLedgerEntryStatus(str, Enum): disabled = "disabled" +class SchemaPaymentEntryStatus(str, Enum): + active = "active" + + +class SchemaPaymentTypeDirection(str, Enum): + payin = "payin" + payout = "payout" + + +class SchemaSystemLineKind(str, Enum): + payment_fee_line = "payment_fee_line" + payment_settlement_line = "payment_settlement_line" + + class StripeEnv(str, Enum): livemode = "livemode" testmode = "testmode" diff --git a/fragment/sdk/input_types.py b/fragment/sdk/input_types.py index 8aa8a9f..62531a3 100644 --- a/fragment/sdk/input_types.py +++ b/fragment/sdk/input_types.py @@ -21,6 +21,9 @@ SchemaConsistencyMode, SchemaLedgerAccountStatus, SchemaLedgerEntryStatus, + SchemaPaymentEntryStatus, + SchemaPaymentTypeDirection, + SchemaSystemLineKind, TxType, ) @@ -576,6 +579,13 @@ class LedgerLineMatchInput(BaseModel): "The FRAGMENT ID of the ledger line" +class LedgerLineTagInput(BaseModel): + key: Any + "The key of this tag. Can be up to 128 characters long." + value: Any + "The value associated with this tag's key. Can be up to 128 characters long." + + class LedgerLinesFilterSet(BaseModel): created: Optional["DateTimeFilter"] = None "Filter by the created timestamp of the Ledger Line. This is the wall-clock time when the Ledger Line was created." @@ -726,6 +736,8 @@ class SchemaInput(BaseModel): "The Ledger Entries to add to the Schema." name: Optional[Any] = None "The human-readable name of the Schema." + payments: Optional["SchemaPaymentsInput"] = None + "EXPERIMENTAL: The Payment Types to add to the Schema." scenes: Optional[list["SceneInput"]] = None "Any scenes associated with this Schema." @@ -879,12 +891,80 @@ class SchemaMatchInput(BaseModel): "Optional parameter to specify version of requested Schema. If not provided, it defaults to 0, representing the latest available version for the provided Schema key." +class SchemaPaymentAccountingInput(BaseModel): + """EXPERIMENTAL: The Ledger Entries a Payment Type posts as a payment moves + through its lifecycle, keyed by lifecycle transition.""" + + needs_confirmation_to_processing: Optional["SchemaPaymentEntryInput"] = None + "Posted when the payment enters processing. Optional." + processing_to_settled: "SchemaPaymentEntryInput" + "Posted when the payment settles. Every Payment Type must define it." + + +class SchemaPaymentEntryInput(BaseModel): + """EXPERIMENTAL: The Ledger Entry a Payment Type posts on a payment lifecycle event.""" + + description: Optional[Any] = None + "Human-readable description of the payment entry." + lines: list["SchemaPaymentLineInput"] + "The Ledger Lines in the payment entry." + + class SchemaPaymentInput(BaseModel): """EXPERIMENTAL: Marks a Ledger Account as a Payment Account.""" penguin: bool +class SchemaPaymentLineInput(BaseModel): + """EXPERIMENTAL: A Ledger Line in a payment entry.""" + + account: "SchemaLedgerAccountMatchInput" + "The Ledger Account this line will be posted to.\nIt supports parameters in its attributes via handlebars syntax." + amount: Any + "The amount of the line. It supports parameters via the handlebars syntax and addition (+) and subtraction (-)." + currency: Optional["SchemaCurrencyMatchInput"] = None + "The currency of the line. This is required if the Ledger Account has currencyMode multi.\nIt supports parameters in its attributes via handlebars syntax." + description: Optional[Any] = None + "Human-readable description of the line." + key: Any + "The key for the line. Keys must be unique within a payment entry." + system: Optional[SchemaSystemLineKind] = None + "Marks this as a system-owned line. Fragment fills the amounts of system\nlines when the payment entry is posted." + + +class SchemaPaymentTypeDetailsInput(BaseModel): + """EXPERIMENTAL: The payment a Payment Type creates.""" + + amount: Any + "The amount requested for the payment, as a parameterized expression filled\nfrom createPayment parameters." + direction: SchemaPaymentTypeDirection + "The direction the payment moves money." + + +class SchemaPaymentTypeInput(BaseModel): + """EXPERIMENTAL: A Payment Type in a Schema. All Payment Types defined in a + Schema must have a unique `type` and `typeVersion` pair.""" + + accounting: "SchemaPaymentAccountingInput" + "The Ledger Entries posted as the payment moves through its lifecycle." + payment: "SchemaPaymentTypeDetailsInput" + "The payment this Payment Type creates." + status: SchemaPaymentEntryStatus + "The status of this Payment Type." + type_: Any = Field(alias="type") + "The type of this Payment Type. This is a stable, unique identifier for it.\nUniqueness is enforced at the Schema level." + type_version: int = Field(alias="typeVersion") + "The version of the Payment Type." + + +class SchemaPaymentsInput(BaseModel): + """EXPERIMENTAL: The Payment Types in your Schema.""" + + types: list["SchemaPaymentTypeInput"] + "A list of Payment Type definitions." + + class SchemaRepeatedConfigInput(BaseModel): """Configuration for repeated expansion of a line or condition. The key names a client-supplied array parameter whose elements each generate one copy of the line or condition at runtime. @@ -995,6 +1075,10 @@ class UpdateLedgerAccountInput(BaseModel): class UpdateLedgerEntryInput(BaseModel): groups: Optional[list["LedgerEntryGroupInput"]] = None "The list of Groups to add to this Ledger Entry." + ledger_lines: Optional[list["UpdateLedgerLineInput"]] = Field( + alias="ledgerLines", default=None + ) + "The list of Ledger Line updates to apply to Ledger Lines on this Ledger Entry." tags: Optional[list["LedgerEntryTagInput"]] = None "The list of Tags to add and/or update on this Ledger Entry." tags_to_remove: Optional[list["LedgerEntryTagInput"]] = Field( @@ -1008,6 +1092,17 @@ class UpdateLedgerInput(BaseModel): "The new Ledger name. " +class UpdateLedgerLineInput(BaseModel): + ledger_line: "LedgerLineMatchInput" = Field(alias="ledgerLine") + "The Ledger Line that is being updated. It must belong to the Ledger Entry being updated." + tags: Optional[list["LedgerLineTagInput"]] = None + "The list of Tags to add and/or update on this Ledger Line." + tags_to_remove: Optional[list["LedgerLineTagInput"]] = Field( + alias="tagsToRemove", default=None + ) + "The list of Tags to remove from this Ledger Line." + + AddLedgerEntryInput.model_rebuild() ChartOfAccountsInput.model_rebuild() CreateLedgerAccountInput.model_rebuild() @@ -1049,6 +1144,12 @@ class UpdateLedgerInput(BaseModel): SchemaLedgerEntryConditionInput.model_rebuild() SchemaLedgerEntryInput.model_rebuild() SchemaLedgerLineInput.model_rebuild() +SchemaPaymentAccountingInput.model_rebuild() +SchemaPaymentEntryInput.model_rebuild() +SchemaPaymentLineInput.model_rebuild() +SchemaPaymentTypeInput.model_rebuild() +SchemaPaymentsInput.model_rebuild() TagFilter.model_rebuild() UpdateLedgerAccountInput.model_rebuild() UpdateLedgerEntryInput.model_rebuild() +UpdateLedgerLineInput.model_rebuild() diff --git a/fragment/sync_sdk/__init__.py b/fragment/sync_sdk/__init__.py index 13c45a6..1c70f15 100644 --- a/fragment/sync_sdk/__init__.py +++ b/fragment/sync_sdk/__init__.py @@ -96,6 +96,9 @@ SchemaConsistencyMode, SchemaLedgerAccountStatus, SchemaLedgerEntryStatus, + SchemaPaymentEntryStatus, + SchemaPaymentTypeDirection, + SchemaSystemLineKind, StripeEnv, TxType, UnitEnv, @@ -221,6 +224,7 @@ LedgerLineInput, LedgerLineMatchInput, LedgerLinesFilterSet, + LedgerLineTagInput, LedgerMatchInput, LedgersFilterSet, LedgerTypeFilter, @@ -244,7 +248,13 @@ SchemaLedgerEntryTagInput, SchemaLedgerLineInput, SchemaMatchInput, + SchemaPaymentAccountingInput, + SchemaPaymentEntryInput, SchemaPaymentInput, + SchemaPaymentLineInput, + SchemaPaymentsInput, + SchemaPaymentTypeDetailsInput, + SchemaPaymentTypeInput, SchemaRepeatedConfigInput, SchemaTxMatchInput, StringFilter, @@ -256,6 +266,7 @@ UpdateLedgerAccountInput, UpdateLedgerEntryInput, UpdateLedgerInput, + UpdateLedgerLineInput, ) from .list_ledger_account_balances import ( ListLedgerAccountBalances, @@ -576,6 +587,7 @@ "LedgerEntryTagInput", "LedgerLineInput", "LedgerLineMatchInput", + "LedgerLineTagInput", "LedgerLinesConsistencyMode", "LedgerLinesFilterSet", "LedgerMatchInput", @@ -692,8 +704,17 @@ "SchemaLedgerEntryTagInput", "SchemaLedgerLineInput", "SchemaMatchInput", + "SchemaPaymentAccountingInput", + "SchemaPaymentEntryInput", + "SchemaPaymentEntryStatus", "SchemaPaymentInput", + "SchemaPaymentLineInput", + "SchemaPaymentTypeDetailsInput", + "SchemaPaymentTypeDirection", + "SchemaPaymentTypeInput", + "SchemaPaymentsInput", "SchemaRepeatedConfigInput", + "SchemaSystemLineKind", "SchemaTxMatchInput", "StoreSchema", "StoreSchemaStoreSchemaBadRequestError", @@ -736,6 +757,7 @@ "UpdateLedgerEntryUpdateLedgerEntryUpdateLedgerEntryResultEntryLinesNodesAccount", "UpdateLedgerEntryUpdateLedgerEntryUpdateLedgerEntryResultEntryTags", "UpdateLedgerInput", + "UpdateLedgerLineInput", "UpdateLedgerUpdateLedgerBadRequestError", "UpdateLedgerUpdateLedgerInternalError", "UpdateLedgerUpdateLedgerUpdateLedgerResult", diff --git a/fragment/sync_sdk/enums.py b/fragment/sync_sdk/enums.py index 1c9468d..26a6de2 100644 --- a/fragment/sync_sdk/enums.py +++ b/fragment/sync_sdk/enums.py @@ -299,6 +299,20 @@ class SchemaLedgerEntryStatus(str, Enum): disabled = "disabled" +class SchemaPaymentEntryStatus(str, Enum): + active = "active" + + +class SchemaPaymentTypeDirection(str, Enum): + payin = "payin" + payout = "payout" + + +class SchemaSystemLineKind(str, Enum): + payment_fee_line = "payment_fee_line" + payment_settlement_line = "payment_settlement_line" + + class StripeEnv(str, Enum): livemode = "livemode" testmode = "testmode" diff --git a/fragment/sync_sdk/input_types.py b/fragment/sync_sdk/input_types.py index 8aa8a9f..62531a3 100644 --- a/fragment/sync_sdk/input_types.py +++ b/fragment/sync_sdk/input_types.py @@ -21,6 +21,9 @@ SchemaConsistencyMode, SchemaLedgerAccountStatus, SchemaLedgerEntryStatus, + SchemaPaymentEntryStatus, + SchemaPaymentTypeDirection, + SchemaSystemLineKind, TxType, ) @@ -576,6 +579,13 @@ class LedgerLineMatchInput(BaseModel): "The FRAGMENT ID of the ledger line" +class LedgerLineTagInput(BaseModel): + key: Any + "The key of this tag. Can be up to 128 characters long." + value: Any + "The value associated with this tag's key. Can be up to 128 characters long." + + class LedgerLinesFilterSet(BaseModel): created: Optional["DateTimeFilter"] = None "Filter by the created timestamp of the Ledger Line. This is the wall-clock time when the Ledger Line was created." @@ -726,6 +736,8 @@ class SchemaInput(BaseModel): "The Ledger Entries to add to the Schema." name: Optional[Any] = None "The human-readable name of the Schema." + payments: Optional["SchemaPaymentsInput"] = None + "EXPERIMENTAL: The Payment Types to add to the Schema." scenes: Optional[list["SceneInput"]] = None "Any scenes associated with this Schema." @@ -879,12 +891,80 @@ class SchemaMatchInput(BaseModel): "Optional parameter to specify version of requested Schema. If not provided, it defaults to 0, representing the latest available version for the provided Schema key." +class SchemaPaymentAccountingInput(BaseModel): + """EXPERIMENTAL: The Ledger Entries a Payment Type posts as a payment moves + through its lifecycle, keyed by lifecycle transition.""" + + needs_confirmation_to_processing: Optional["SchemaPaymentEntryInput"] = None + "Posted when the payment enters processing. Optional." + processing_to_settled: "SchemaPaymentEntryInput" + "Posted when the payment settles. Every Payment Type must define it." + + +class SchemaPaymentEntryInput(BaseModel): + """EXPERIMENTAL: The Ledger Entry a Payment Type posts on a payment lifecycle event.""" + + description: Optional[Any] = None + "Human-readable description of the payment entry." + lines: list["SchemaPaymentLineInput"] + "The Ledger Lines in the payment entry." + + class SchemaPaymentInput(BaseModel): """EXPERIMENTAL: Marks a Ledger Account as a Payment Account.""" penguin: bool +class SchemaPaymentLineInput(BaseModel): + """EXPERIMENTAL: A Ledger Line in a payment entry.""" + + account: "SchemaLedgerAccountMatchInput" + "The Ledger Account this line will be posted to.\nIt supports parameters in its attributes via handlebars syntax." + amount: Any + "The amount of the line. It supports parameters via the handlebars syntax and addition (+) and subtraction (-)." + currency: Optional["SchemaCurrencyMatchInput"] = None + "The currency of the line. This is required if the Ledger Account has currencyMode multi.\nIt supports parameters in its attributes via handlebars syntax." + description: Optional[Any] = None + "Human-readable description of the line." + key: Any + "The key for the line. Keys must be unique within a payment entry." + system: Optional[SchemaSystemLineKind] = None + "Marks this as a system-owned line. Fragment fills the amounts of system\nlines when the payment entry is posted." + + +class SchemaPaymentTypeDetailsInput(BaseModel): + """EXPERIMENTAL: The payment a Payment Type creates.""" + + amount: Any + "The amount requested for the payment, as a parameterized expression filled\nfrom createPayment parameters." + direction: SchemaPaymentTypeDirection + "The direction the payment moves money." + + +class SchemaPaymentTypeInput(BaseModel): + """EXPERIMENTAL: A Payment Type in a Schema. All Payment Types defined in a + Schema must have a unique `type` and `typeVersion` pair.""" + + accounting: "SchemaPaymentAccountingInput" + "The Ledger Entries posted as the payment moves through its lifecycle." + payment: "SchemaPaymentTypeDetailsInput" + "The payment this Payment Type creates." + status: SchemaPaymentEntryStatus + "The status of this Payment Type." + type_: Any = Field(alias="type") + "The type of this Payment Type. This is a stable, unique identifier for it.\nUniqueness is enforced at the Schema level." + type_version: int = Field(alias="typeVersion") + "The version of the Payment Type." + + +class SchemaPaymentsInput(BaseModel): + """EXPERIMENTAL: The Payment Types in your Schema.""" + + types: list["SchemaPaymentTypeInput"] + "A list of Payment Type definitions." + + class SchemaRepeatedConfigInput(BaseModel): """Configuration for repeated expansion of a line or condition. The key names a client-supplied array parameter whose elements each generate one copy of the line or condition at runtime. @@ -995,6 +1075,10 @@ class UpdateLedgerAccountInput(BaseModel): class UpdateLedgerEntryInput(BaseModel): groups: Optional[list["LedgerEntryGroupInput"]] = None "The list of Groups to add to this Ledger Entry." + ledger_lines: Optional[list["UpdateLedgerLineInput"]] = Field( + alias="ledgerLines", default=None + ) + "The list of Ledger Line updates to apply to Ledger Lines on this Ledger Entry." tags: Optional[list["LedgerEntryTagInput"]] = None "The list of Tags to add and/or update on this Ledger Entry." tags_to_remove: Optional[list["LedgerEntryTagInput"]] = Field( @@ -1008,6 +1092,17 @@ class UpdateLedgerInput(BaseModel): "The new Ledger name. " +class UpdateLedgerLineInput(BaseModel): + ledger_line: "LedgerLineMatchInput" = Field(alias="ledgerLine") + "The Ledger Line that is being updated. It must belong to the Ledger Entry being updated." + tags: Optional[list["LedgerLineTagInput"]] = None + "The list of Tags to add and/or update on this Ledger Line." + tags_to_remove: Optional[list["LedgerLineTagInput"]] = Field( + alias="tagsToRemove", default=None + ) + "The list of Tags to remove from this Ledger Line." + + AddLedgerEntryInput.model_rebuild() ChartOfAccountsInput.model_rebuild() CreateLedgerAccountInput.model_rebuild() @@ -1049,6 +1144,12 @@ class UpdateLedgerInput(BaseModel): SchemaLedgerEntryConditionInput.model_rebuild() SchemaLedgerEntryInput.model_rebuild() SchemaLedgerLineInput.model_rebuild() +SchemaPaymentAccountingInput.model_rebuild() +SchemaPaymentEntryInput.model_rebuild() +SchemaPaymentLineInput.model_rebuild() +SchemaPaymentTypeInput.model_rebuild() +SchemaPaymentsInput.model_rebuild() TagFilter.model_rebuild() UpdateLedgerAccountInput.model_rebuild() UpdateLedgerEntryInput.model_rebuild() +UpdateLedgerLineInput.model_rebuild() diff --git a/tests/snapshots/001-marketing-schema/sdk/__init__.py b/tests/snapshots/001-marketing-schema/sdk/__init__.py index ffa9633..ab75f6f 100644 --- a/tests/snapshots/001-marketing-schema/sdk/__init__.py +++ b/tests/snapshots/001-marketing-schema/sdk/__init__.py @@ -97,6 +97,9 @@ SchemaConsistencyMode, SchemaLedgerAccountStatus, SchemaLedgerEntryStatus, + SchemaPaymentEntryStatus, + SchemaPaymentTypeDirection, + SchemaSystemLineKind, StripeEnv, TxType, UnitEnv, @@ -222,6 +225,7 @@ LedgerLineInput, LedgerLineMatchInput, LedgerLinesFilterSet, + LedgerLineTagInput, LedgerMatchInput, LedgersFilterSet, LedgerTypeFilter, @@ -245,7 +249,13 @@ SchemaLedgerEntryTagInput, SchemaLedgerLineInput, SchemaMatchInput, + SchemaPaymentAccountingInput, + SchemaPaymentEntryInput, SchemaPaymentInput, + SchemaPaymentLineInput, + SchemaPaymentsInput, + SchemaPaymentTypeDetailsInput, + SchemaPaymentTypeInput, SchemaRepeatedConfigInput, SchemaTxMatchInput, StringFilter, @@ -257,6 +267,7 @@ UpdateLedgerAccountInput, UpdateLedgerEntryInput, UpdateLedgerInput, + UpdateLedgerLineInput, ) from .list_ledger_account_balances import ( ListLedgerAccountBalances, @@ -694,6 +705,7 @@ "LedgerEntryTagInput", "LedgerLineInput", "LedgerLineMatchInput", + "LedgerLineTagInput", "LedgerLinesConsistencyMode", "LedgerLinesFilterSet", "LedgerMatchInput", @@ -909,8 +921,17 @@ "SchemaLedgerEntryTagInput", "SchemaLedgerLineInput", "SchemaMatchInput", + "SchemaPaymentAccountingInput", + "SchemaPaymentEntryInput", + "SchemaPaymentEntryStatus", "SchemaPaymentInput", + "SchemaPaymentLineInput", + "SchemaPaymentTypeDetailsInput", + "SchemaPaymentTypeDirection", + "SchemaPaymentTypeInput", + "SchemaPaymentsInput", "SchemaRepeatedConfigInput", + "SchemaSystemLineKind", "SchemaTxMatchInput", "StoreSchema", "StoreSchemaStoreSchemaBadRequestError", @@ -952,6 +973,7 @@ "UpdateLedgerEntryUpdateLedgerEntryUpdateLedgerEntryResultEntryLinesNodesAccount", "UpdateLedgerEntryUpdateLedgerEntryUpdateLedgerEntryResultEntryTags", "UpdateLedgerInput", + "UpdateLedgerLineInput", "UpdateLedgerUpdateLedgerBadRequestError", "UpdateLedgerUpdateLedgerInternalError", "UpdateLedgerUpdateLedgerUpdateLedgerResult", diff --git a/tests/snapshots/001-marketing-schema/sdk/enums.py b/tests/snapshots/001-marketing-schema/sdk/enums.py index 1c9468d..26a6de2 100644 --- a/tests/snapshots/001-marketing-schema/sdk/enums.py +++ b/tests/snapshots/001-marketing-schema/sdk/enums.py @@ -299,6 +299,20 @@ class SchemaLedgerEntryStatus(str, Enum): disabled = "disabled" +class SchemaPaymentEntryStatus(str, Enum): + active = "active" + + +class SchemaPaymentTypeDirection(str, Enum): + payin = "payin" + payout = "payout" + + +class SchemaSystemLineKind(str, Enum): + payment_fee_line = "payment_fee_line" + payment_settlement_line = "payment_settlement_line" + + class StripeEnv(str, Enum): livemode = "livemode" testmode = "testmode" diff --git a/tests/snapshots/001-marketing-schema/sdk/input_types.py b/tests/snapshots/001-marketing-schema/sdk/input_types.py index 8aa8a9f..62531a3 100644 --- a/tests/snapshots/001-marketing-schema/sdk/input_types.py +++ b/tests/snapshots/001-marketing-schema/sdk/input_types.py @@ -21,6 +21,9 @@ SchemaConsistencyMode, SchemaLedgerAccountStatus, SchemaLedgerEntryStatus, + SchemaPaymentEntryStatus, + SchemaPaymentTypeDirection, + SchemaSystemLineKind, TxType, ) @@ -576,6 +579,13 @@ class LedgerLineMatchInput(BaseModel): "The FRAGMENT ID of the ledger line" +class LedgerLineTagInput(BaseModel): + key: Any + "The key of this tag. Can be up to 128 characters long." + value: Any + "The value associated with this tag's key. Can be up to 128 characters long." + + class LedgerLinesFilterSet(BaseModel): created: Optional["DateTimeFilter"] = None "Filter by the created timestamp of the Ledger Line. This is the wall-clock time when the Ledger Line was created." @@ -726,6 +736,8 @@ class SchemaInput(BaseModel): "The Ledger Entries to add to the Schema." name: Optional[Any] = None "The human-readable name of the Schema." + payments: Optional["SchemaPaymentsInput"] = None + "EXPERIMENTAL: The Payment Types to add to the Schema." scenes: Optional[list["SceneInput"]] = None "Any scenes associated with this Schema." @@ -879,12 +891,80 @@ class SchemaMatchInput(BaseModel): "Optional parameter to specify version of requested Schema. If not provided, it defaults to 0, representing the latest available version for the provided Schema key." +class SchemaPaymentAccountingInput(BaseModel): + """EXPERIMENTAL: The Ledger Entries a Payment Type posts as a payment moves + through its lifecycle, keyed by lifecycle transition.""" + + needs_confirmation_to_processing: Optional["SchemaPaymentEntryInput"] = None + "Posted when the payment enters processing. Optional." + processing_to_settled: "SchemaPaymentEntryInput" + "Posted when the payment settles. Every Payment Type must define it." + + +class SchemaPaymentEntryInput(BaseModel): + """EXPERIMENTAL: The Ledger Entry a Payment Type posts on a payment lifecycle event.""" + + description: Optional[Any] = None + "Human-readable description of the payment entry." + lines: list["SchemaPaymentLineInput"] + "The Ledger Lines in the payment entry." + + class SchemaPaymentInput(BaseModel): """EXPERIMENTAL: Marks a Ledger Account as a Payment Account.""" penguin: bool +class SchemaPaymentLineInput(BaseModel): + """EXPERIMENTAL: A Ledger Line in a payment entry.""" + + account: "SchemaLedgerAccountMatchInput" + "The Ledger Account this line will be posted to.\nIt supports parameters in its attributes via handlebars syntax." + amount: Any + "The amount of the line. It supports parameters via the handlebars syntax and addition (+) and subtraction (-)." + currency: Optional["SchemaCurrencyMatchInput"] = None + "The currency of the line. This is required if the Ledger Account has currencyMode multi.\nIt supports parameters in its attributes via handlebars syntax." + description: Optional[Any] = None + "Human-readable description of the line." + key: Any + "The key for the line. Keys must be unique within a payment entry." + system: Optional[SchemaSystemLineKind] = None + "Marks this as a system-owned line. Fragment fills the amounts of system\nlines when the payment entry is posted." + + +class SchemaPaymentTypeDetailsInput(BaseModel): + """EXPERIMENTAL: The payment a Payment Type creates.""" + + amount: Any + "The amount requested for the payment, as a parameterized expression filled\nfrom createPayment parameters." + direction: SchemaPaymentTypeDirection + "The direction the payment moves money." + + +class SchemaPaymentTypeInput(BaseModel): + """EXPERIMENTAL: A Payment Type in a Schema. All Payment Types defined in a + Schema must have a unique `type` and `typeVersion` pair.""" + + accounting: "SchemaPaymentAccountingInput" + "The Ledger Entries posted as the payment moves through its lifecycle." + payment: "SchemaPaymentTypeDetailsInput" + "The payment this Payment Type creates." + status: SchemaPaymentEntryStatus + "The status of this Payment Type." + type_: Any = Field(alias="type") + "The type of this Payment Type. This is a stable, unique identifier for it.\nUniqueness is enforced at the Schema level." + type_version: int = Field(alias="typeVersion") + "The version of the Payment Type." + + +class SchemaPaymentsInput(BaseModel): + """EXPERIMENTAL: The Payment Types in your Schema.""" + + types: list["SchemaPaymentTypeInput"] + "A list of Payment Type definitions." + + class SchemaRepeatedConfigInput(BaseModel): """Configuration for repeated expansion of a line or condition. The key names a client-supplied array parameter whose elements each generate one copy of the line or condition at runtime. @@ -995,6 +1075,10 @@ class UpdateLedgerAccountInput(BaseModel): class UpdateLedgerEntryInput(BaseModel): groups: Optional[list["LedgerEntryGroupInput"]] = None "The list of Groups to add to this Ledger Entry." + ledger_lines: Optional[list["UpdateLedgerLineInput"]] = Field( + alias="ledgerLines", default=None + ) + "The list of Ledger Line updates to apply to Ledger Lines on this Ledger Entry." tags: Optional[list["LedgerEntryTagInput"]] = None "The list of Tags to add and/or update on this Ledger Entry." tags_to_remove: Optional[list["LedgerEntryTagInput"]] = Field( @@ -1008,6 +1092,17 @@ class UpdateLedgerInput(BaseModel): "The new Ledger name. " +class UpdateLedgerLineInput(BaseModel): + ledger_line: "LedgerLineMatchInput" = Field(alias="ledgerLine") + "The Ledger Line that is being updated. It must belong to the Ledger Entry being updated." + tags: Optional[list["LedgerLineTagInput"]] = None + "The list of Tags to add and/or update on this Ledger Line." + tags_to_remove: Optional[list["LedgerLineTagInput"]] = Field( + alias="tagsToRemove", default=None + ) + "The list of Tags to remove from this Ledger Line." + + AddLedgerEntryInput.model_rebuild() ChartOfAccountsInput.model_rebuild() CreateLedgerAccountInput.model_rebuild() @@ -1049,6 +1144,12 @@ class UpdateLedgerInput(BaseModel): SchemaLedgerEntryConditionInput.model_rebuild() SchemaLedgerEntryInput.model_rebuild() SchemaLedgerLineInput.model_rebuild() +SchemaPaymentAccountingInput.model_rebuild() +SchemaPaymentEntryInput.model_rebuild() +SchemaPaymentLineInput.model_rebuild() +SchemaPaymentTypeInput.model_rebuild() +SchemaPaymentsInput.model_rebuild() TagFilter.model_rebuild() UpdateLedgerAccountInput.model_rebuild() UpdateLedgerEntryInput.model_rebuild() +UpdateLedgerLineInput.model_rebuild() diff --git a/tests/snapshots/schema.graphql b/tests/snapshots/schema.graphql index 0db10f9..17d23b5 100644 --- a/tests/snapshots/schema.graphql +++ b/tests/snapshots/schema.graphql @@ -3065,6 +3065,16 @@ type LedgerLineTag { value: SafeString! } +input LedgerLineTagInput { + """The key of this tag. Can be up to 128 characters long.""" + key: SafeString! + + """ + The value associated with this tag's key. Can be up to 128 characters long. + """ + value: SafeString! +} + """A paginated list of Ledger Lines""" type LedgerLinesConnection { """The current page of results""" @@ -3509,7 +3519,7 @@ type Mutation { ledgerEntry: LedgerEntryMatchInput! """ - The payload containing the fields to update. Only a Ledger Entry's tags can be updated. + The payload containing the fields to update. Only a Ledger Entry's tags and its Ledger Lines' tags can be updated. """ update: UpdateLedgerEntryInput! ): UpdateLedgerEntryResponse! @@ -4018,6 +4028,9 @@ input SchemaInput { """The human-readable name of the Schema.""" name: ParameterizedString + """EXPERIMENTAL: The Payment Types to add to the Schema.""" + payments: SchemaPaymentsInput + """Any scenes associated with this Schema.""" scenes: [SceneInput!] } @@ -4303,11 +4316,123 @@ input SchemaMatchInput { version: Int } +""" +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 enters processing. Optional.""" + needs_confirmation_to_processing: SchemaPaymentEntryInput + + """Posted when the payment settles. Every Payment Type must define it.""" + processing_to_settled: SchemaPaymentEntryInput! +} + +""" +EXPERIMENTAL: The Ledger Entry a Payment Type posts on a payment lifecycle event. +""" +input SchemaPaymentEntryInput { + """Human-readable description of the payment entry.""" + description: ParameterizedString + + """The Ledger Lines in the payment entry.""" + lines: [SchemaPaymentLineInput!]! +} + +"""The status of a Payment Type.""" +enum SchemaPaymentEntryStatus { + """The Payment Type is active.""" + active +} + """EXPERIMENTAL: Marks a Ledger Account as a Payment Account.""" input SchemaPaymentInput { penguin: Boolean! } +"""EXPERIMENTAL: A Ledger Line in a payment entry.""" +input SchemaPaymentLineInput { + """ + The Ledger Account this line will be posted to. + It supports parameters in its attributes via handlebars syntax. + """ + account: SchemaLedgerAccountMatchInput! + + """ + The amount of the line. It supports parameters via the handlebars syntax and addition (+) and subtraction (-). + """ + amount: ParameterizedString! + + """ + The currency of the line. This is required if the Ledger Account has currencyMode multi. + It supports parameters in its attributes via handlebars syntax. + """ + currency: SchemaCurrencyMatchInput + + """Human-readable description of the line.""" + description: ParameterizedString + + """The key for the line. Keys must be unique within a payment entry.""" + key: SafeString! + + """ + Marks this as a system-owned line. Fragment fills the amounts of system + lines when the payment entry is posted. + """ + system: SchemaSystemLineKind +} + +"""EXPERIMENTAL: The payment a Payment Type creates.""" +input SchemaPaymentTypeDetailsInput { + """ + The amount requested for the payment, as a parameterized expression filled + from createPayment parameters. + """ + amount: ParameterizedString! + + """The direction the payment moves money.""" + direction: SchemaPaymentTypeDirection! +} + +"""The direction a Payment Type moves money.""" +enum SchemaPaymentTypeDirection { + """Money moves into the Payment Account.""" + payin + + """Money moves out of the Payment Account.""" + payout +} + +""" +EXPERIMENTAL: A Payment Type in a Schema. All Payment Types defined in a +Schema must have a unique `type` and `typeVersion` pair. +""" +input SchemaPaymentTypeInput { + """The Ledger Entries posted as the payment moves through its lifecycle.""" + accounting: SchemaPaymentAccountingInput! + + """The payment this Payment Type creates.""" + payment: SchemaPaymentTypeDetailsInput! + + """The status of this Payment Type.""" + status: SchemaPaymentEntryStatus! + + """ + The type of this Payment Type. This is a stable, unique identifier for it. + Uniqueness is enforced at the Schema level. + """ + type: SafeString! + + """The version of the Payment Type.""" + typeVersion: Int! +} + +"""EXPERIMENTAL: The Payment Types in your Schema.""" +input SchemaPaymentsInput { + """A list of Payment Type definitions.""" + types: [SchemaPaymentTypeInput!]! +} + """ Configuration for repeated expansion of a line or condition. The key names a client-supplied array parameter whose elements each generate one copy of the line or condition at runtime. @@ -4319,6 +4444,22 @@ input SchemaRepeatedConfigInput { key: SafeString! } +""" +Identifies a system-owned line in a payment entry. The amounts of system +lines are filled by Fragment when the payment entry is posted. +""" +enum SchemaSystemLineKind { + """ + The line carrying the Fragment fee amount, posted to the Payment Account. + """ + payment_fee_line + + """ + The line carrying the settled payment amount, posted to the Payment Account. + """ + payment_settlement_line +} + """ Matches a transaction at an external system. This is used to specify the transaction being reconciled into a Linked Ledger Account @@ -4669,6 +4810,11 @@ input UpdateLedgerEntryInput { """The list of Groups to add to this Ledger Entry.""" groups: [LedgerEntryGroupInput!] + """ + The list of Ledger Line updates to apply to Ledger Lines on this Ledger Entry. + """ + ledgerLines: [UpdateLedgerLineInput!] + """The list of Tags to add and/or update on this Ledger Entry.""" tags: [LedgerEntryTagInput!] @@ -4688,6 +4834,19 @@ input UpdateLedgerInput { name: String } +input UpdateLedgerLineInput { + """ + The Ledger Line that is being updated. It must belong to the Ledger Entry being updated. + """ + ledgerLine: LedgerLineMatchInput! + + """The list of Tags to add and/or update on this Ledger Line.""" + tags: [LedgerLineTagInput!] + + """The list of Tags to remove from this Ledger Line.""" + tagsToRemove: [LedgerLineTagInput!] +} + union UpdateLedgerResponse = BadRequestError | InternalError | UpdateLedgerResult type UpdateLedgerResult {