Skip to content

Commit 30770b9

Browse files
committed
feat(connections): entity_id on the Plaid and Mercury connection configs
Regenerated from the server after the native-versus-synced rule moved to the entity (robosystems #1724). A bank feed can now name the entity whose books its accounts land on; omitted, it is the group parent. Claude-Session: https://claude.ai/code/session_01BY3uYE5zMjjFHnjiZfiJu8
1 parent d54bce8 commit 30770b9

3 files changed

Lines changed: 57 additions & 8 deletions

File tree

‎robosystems_client/api/robo_ledger_setup/link_bank_account.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ def sync_detailed(
118118
books the feed's lines go into, so this is also how a feed account is bound to a subsidiary. Lines
119119
still in the inbox move with it (across an entity change their suggestion is resolved again on the
120120
new chart, and a classification that named the old entity's account is dropped); posted entries stay
121-
where they were posted. An account another connection already feeds is refused. An account the feed
121+
where they were posted. An account another connection already feeds is refused, as is an entity
122+
whose books QuickBooks keeps (the group parent, while QuickBooks is connected). An account the feed
122123
created and then left stays on its chart as an ordinary account. A sync already in flight when the
123124
link moves can still land a line or two on the old account; running this again moves them. Read the
124125
group's accounts with the `bankAccounts` GraphQL field.
@@ -172,7 +173,8 @@ def sync(
172173
books the feed's lines go into, so this is also how a feed account is bound to a subsidiary. Lines
173174
still in the inbox move with it (across an entity change their suggestion is resolved again on the
174175
new chart, and a classification that named the old entity's account is dropped); posted entries stay
175-
where they were posted. An account another connection already feeds is refused. An account the feed
176+
where they were posted. An account another connection already feeds is refused, as is an entity
177+
whose books QuickBooks keeps (the group parent, while QuickBooks is connected). An account the feed
176178
created and then left stays on its chart as an ordinary account. A sync already in flight when the
177179
link moves can still land a line or two on the old account; running this again moves them. Read the
178180
group's accounts with the `bankAccounts` GraphQL field.
@@ -221,7 +223,8 @@ async def asyncio_detailed(
221223
books the feed's lines go into, so this is also how a feed account is bound to a subsidiary. Lines
222224
still in the inbox move with it (across an entity change their suggestion is resolved again on the
223225
new chart, and a classification that named the old entity's account is dropped); posted entries stay
224-
where they were posted. An account another connection already feeds is refused. An account the feed
226+
where they were posted. An account another connection already feeds is refused, as is an entity
227+
whose books QuickBooks keeps (the group parent, while QuickBooks is connected). An account the feed
225228
created and then left stays on its chart as an ordinary account. A sync already in flight when the
226229
link moves can still land a line or two on the old account; running this again moves them. Read the
227230
group's accounts with the `bankAccounts` GraphQL field.
@@ -273,7 +276,8 @@ async def asyncio(
273276
books the feed's lines go into, so this is also how a feed account is bound to a subsidiary. Lines
274277
still in the inbox move with it (across an entity change their suggestion is resolved again on the
275278
new chart, and a classification that named the old entity's account is dropped); posted entries stay
276-
where they were posted. An account another connection already feeds is refused. An account the feed
279+
where they were posted. An account another connection already feeds is refused, as is an entity
280+
whose books QuickBooks keeps (the group parent, while QuickBooks is connected). An account the feed
277281
created and then left stays on its chart as an ordinary account. A sync already in flight when the
278282
link moves can still land a line or two on the old account; running this again moves them. Read the
279283
group's accounts with the `bankAccounts` GraphQL field.

‎robosystems_client/models/mercury_connection_config.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ class MercuryConnectionConfig:
3030
include_treasury (bool | Unset): Capture treasury-account activity alongside checking/savings. Default: True.
3131
api_key (None | str | Unset): A personal read-only Mercury API token, for deployments that allow the api_key
3232
credential mode. Omit to connect over OAuth.
33+
entity_id (None | str | Unset): The entity whose books the feed's accounts land on: a subsidiary's id, or omit
34+
for the group parent. Required when QuickBooks keeps the parent's books. Each account can be moved to another
35+
entity later with `link-bank-account`.
3336
"""
3437

3538
since_date: datetime.date | None | Unset = UNSET
3639
include_treasury: bool | Unset = True
3740
api_key: None | str | Unset = UNSET
41+
entity_id: None | str | Unset = UNSET
3842
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
3943

4044
def to_dict(self) -> dict[str, Any]:
@@ -54,6 +58,12 @@ def to_dict(self) -> dict[str, Any]:
5458
else:
5559
api_key = self.api_key
5660

61+
entity_id: None | str | Unset
62+
if isinstance(self.entity_id, Unset):
63+
entity_id = UNSET
64+
else:
65+
entity_id = self.entity_id
66+
5767
field_dict: dict[str, Any] = {}
5868
field_dict.update(self.additional_properties)
5969
field_dict.update({})
@@ -63,6 +73,8 @@ def to_dict(self) -> dict[str, Any]:
6373
field_dict["include_treasury"] = include_treasury
6474
if api_key is not UNSET:
6575
field_dict["api_key"] = api_key
76+
if entity_id is not UNSET:
77+
field_dict["entity_id"] = entity_id
6678

6779
return field_dict
6880

@@ -98,10 +110,20 @@ def _parse_api_key(data: object) -> None | str | Unset:
98110

99111
api_key = _parse_api_key(d.pop("api_key", UNSET))
100112

113+
def _parse_entity_id(data: object) -> None | str | Unset:
114+
if data is None:
115+
return data
116+
if isinstance(data, Unset):
117+
return data
118+
return cast(None | str | Unset, data)
119+
120+
entity_id = _parse_entity_id(d.pop("entity_id", UNSET))
121+
101122
mercury_connection_config = cls(
102123
since_date=since_date,
103124
include_treasury=include_treasury,
104125
api_key=api_key,
126+
entity_id=entity_id,
105127
)
106128

107129
mercury_connection_config.additional_properties = d

‎robosystems_client/models/plaid_connection_config.py‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,24 @@
1616
class PlaidConnectionConfig:
1717
"""Plaid bank-feed connection configuration.
1818
19-
A bank feed is native accounting: the graph must already have a chart of
20-
accounts and no live QuickBooks connection. The connection is created
21-
`pending_oauth`; `POST /oauth/init` returns a `link_token` for Plaid
22-
Link, and the `public_token` Link hands back completes it through
19+
A bank feed is native accounting: the entity its accounts land on must
20+
already have a chart of accounts and must not be the one QuickBooks keeps
21+
(the group parent, while QuickBooks is connected). The connection is
22+
created `pending_oauth`; `POST /oauth/init` returns a `link_token` for
23+
Plaid Link, and the `public_token` Link hands back completes it through
2324
`POST /oauth/callback/plaid` (as `code`). One connection per institution
2425
login; a graph can hold several.
2526
2627
Attributes:
2728
since_date (datetime.date | None | Unset): First day of the backfill (ISO 8601), and how much history Plaid is
2829
asked to pull for the new Item (at most two years). Defaults to 1 January of last year.
30+
entity_id (None | str | Unset): The entity whose books the feed's accounts land on: a subsidiary's id, or omit
31+
for the group parent. Required when QuickBooks keeps the parent's books. Each account can be moved to another
32+
entity later with `link-bank-account`.
2933
"""
3034

3135
since_date: datetime.date | None | Unset = UNSET
36+
entity_id: None | str | Unset = UNSET
3237
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
3338

3439
def to_dict(self) -> dict[str, Any]:
@@ -40,11 +45,19 @@ def to_dict(self) -> dict[str, Any]:
4045
else:
4146
since_date = self.since_date
4247

48+
entity_id: None | str | Unset
49+
if isinstance(self.entity_id, Unset):
50+
entity_id = UNSET
51+
else:
52+
entity_id = self.entity_id
53+
4354
field_dict: dict[str, Any] = {}
4455
field_dict.update(self.additional_properties)
4556
field_dict.update({})
4657
if since_date is not UNSET:
4758
field_dict["since_date"] = since_date
59+
if entity_id is not UNSET:
60+
field_dict["entity_id"] = entity_id
4861

4962
return field_dict
5063

@@ -69,8 +82,18 @@ def _parse_since_date(data: object) -> datetime.date | None | Unset:
6982

7083
since_date = _parse_since_date(d.pop("since_date", UNSET))
7184

85+
def _parse_entity_id(data: object) -> None | str | Unset:
86+
if data is None:
87+
return data
88+
if isinstance(data, Unset):
89+
return data
90+
return cast(None | str | Unset, data)
91+
92+
entity_id = _parse_entity_id(d.pop("entity_id", UNSET))
93+
7294
plaid_connection_config = cls(
7395
since_date=since_date,
96+
entity_id=entity_id,
7497
)
7598

7699
plaid_connection_config.additional_properties = d

0 commit comments

Comments
 (0)