Skip to content

Commit 23652c1

Browse files
authored
use Counterparty.from_json_api (unit-finance#144)
1 parent b2680e5 commit 23652c1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

unit/models/payment.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self, id: str, created_at: datetime, status: PaymentStatus, counter
2929
def from_json_api(_id, _type, attributes, relationships):
3030
settlement_date = date_utils.to_date(attributes.get("settlementDate")) if attributes.get("settlementDate") else None
3131
return AchPaymentDTO(_id, date_utils.to_datetime(attributes["createdAt"]), attributes["status"],
32-
attributes["counterparty"], attributes["direction"], attributes["description"],
32+
Counterparty.from_json_api(attributes["counterparty"]), attributes["direction"], attributes["description"],
3333
attributes["amount"], attributes.get("addenda"), attributes.get("reason"), settlement_date,
3434
attributes.get("tags"), relationships)
3535

@@ -177,7 +177,7 @@ def __init__(self, amount: int, description: str, plaid_processor_token: str, re
177177
counterparty_name: Optional[str], verify_counterparty_balance: Optional[bool],
178178
idempotency_key: Optional[str], tags: Optional[Dict[str, str]], direction: str = "Credit"):
179179
CreatePaymentBaseRequest.__init__(self, amount, description, relationships, idempotency_key, tags)
180-
self.plaid_Processor_token = plaid_Processor_token
180+
self.plaid_Processor_token = plaid_processor_token
181181
self.counterparty_name = counterparty_name
182182
self.verify_counterparty_balance = verify_counterparty_balance
183183

@@ -186,10 +186,10 @@ def to_json_api(self) -> Dict:
186186
payload["data"]["attributes"]["counterparty"] = self.counterparty
187187
payload["data"]["attributes"]["plaidProcessorToken"] = self.plaid_processor_token
188188

189-
if counterparty_name:
189+
if self.counterparty_name:
190190
payload["data"]["attributes"]["counterpartyName"] = self.counterparty_name
191191

192-
if verify_counterparty_balance:
192+
if self.verify_counterparty_balance:
193193
payload["data"]["attributes"]["verifyCounterpartyBalance"] = self.verify_counterparty_balance
194194

195195
return payload

0 commit comments

Comments
 (0)