From 74100880c4ebc80116dd4b2d969c8c470bbcb7cb Mon Sep 17 00:00:00 2001 From: Keyna Rafael <95432445+keyn4@users.noreply.github.com> Date: Fri, 31 May 2024 12:26:53 -0500 Subject: [PATCH] type payment line as object (#105) --- tap_quickbooks/quickbooks/__init__.py | 44 +++++++++++++++++++ .../quickbooks/schemas/object_definition.json | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/tap_quickbooks/quickbooks/__init__.py b/tap_quickbooks/quickbooks/__init__.py index 45cb495..f54507d 100644 --- a/tap_quickbooks/quickbooks/__init__.py +++ b/tap_quickbooks/quickbooks/__init__.py @@ -218,6 +218,50 @@ def field_to_property_schema(field, mdata): # pylint:disable=too-many-branches } } + qb_types["LinkedTxn"] = { + "type": object_type["type"], + "properties": { + "TxnId": string_type, + "TxnType": string_type, + } + } + + qb_types["any"] = { + "type": object_type["type"], + "properties": { + "name": string_type, + "declaredType": string_type, + "scope": string_type, + "value": { + "type": object_type["type"], + "properties": { + "Name": string_type, + "Value": string_type, + } + }, + "nil": boolean_type, + "globalScope": boolean_type, + "typeSubstituted": boolean_type, + } + } + + qb_types["payment_line"] = { + "type": object_type["type"], + "properties": { + "Amount": number_type, + "LinkedTxn": {"type": "array", "items": qb_types["LinkedTxn"]}, + "LineEx": { + "type": object_type["type"], + "properties": { + "any": { + "type": "array", + "items": qb_types["any"] + } + } + } + } + } + qb_type = field['type'] property_schema = qb_types[qb_type] if qb_type == 'array': diff --git a/tap_quickbooks/quickbooks/schemas/object_definition.json b/tap_quickbooks/quickbooks/schemas/object_definition.json index e960141..28de90c 100644 --- a/tap_quickbooks/quickbooks/schemas/object_definition.json +++ b/tap_quickbooks/quickbooks/schemas/object_definition.json @@ -76,7 +76,7 @@ {"name": "DepositToAccountRef", "type": "string"}, {"name": "ExchangeRate", "type": "number"}, {"name": "SyncToken", "type": "string"}, - {"name": "Line", "type": "string"}, + {"name": "Line", "type": "array", "child_type": "payment_line"}, {"name": "TxnSource", "type": "string"}, {"name": "ARAccountRef", "type": "string"}, {"name": "TxnDate", "type": "string"},