Skip to content

Commit 015acae

Browse files
authored
Merge pull request #8 from paywithextend/fix/update-transaction-expense-data-schema
2 parents 08f8b47 + 0cfd0c2 commit 015acae

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

extend/resources/transactions.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,12 @@ async def update_transaction_expense_data(self, transaction_id: str, data: Dict)
8484
data (Dict): A dictionary representing the expense data to update, should match
8585
the schema:
8686
{
87-
"supplier": {
88-
"name": "Some Supplier",
89-
"id": "supplier-id"
90-
},
91-
"expenseCategories": [
87+
"expenseDetails": [
9288
{
93-
"categoryCode": "COMPCODE",
94-
"labelCode": "ABC123"
89+
"categoryId": "ec_1234",
90+
"labelId": "ecl_1234"
9591
}
9692
],
97-
"customer": {
98-
"name": "Some Customer",
99-
"id": "customer-id"
100-
}
10193
}
10294
10395
Returns:

tests/test_client.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,8 @@ async def test_update_transaction_expense_data_success(extend, mocker, mock_tran
389389
mock_response = {
390390
"transaction": {
391391
**mock_transaction,
392-
"supplier": {"name": "Acme Inc", "id": "sup_123"},
393-
"customer": {"name": "Client A", "id": "cust_456"},
394-
"expenseCategories": [
395-
{"categoryCode": "TRAVEL", "labelCode": "TAXI"}
392+
"expenseDetails": [
393+
{"categoryId": "ec_1234", "labelId": "ecl_1234"}
396394
]
397395
}
398396
}
@@ -406,15 +404,11 @@ async def test_update_transaction_expense_data_success(extend, mocker, mock_tran
406404
response = await extend.transactions.update_transaction_expense_data(
407405
transaction_id=mock_transaction["id"],
408406
data={
409-
"supplier": {"name": "Acme Inc", "id": "sup_123"},
410-
"customer": {"name": "Client A", "id": "cust_456"},
411-
"expenseCategories": [{"categoryCode": "TRAVEL", "labelCode": "TAXI"}]
407+
"expenseDetails": [{"categoryId": "ec_1234", "labelId": "ecl_1234"}]
412408
}
413409
)
414410

415-
assert response["transaction"]["supplier"]["name"] == "Acme Inc"
416-
assert response["transaction"]["customer"]["id"] == "cust_456"
417-
assert response["transaction"]["expenseCategories"][0]["categoryCode"] == "TRAVEL"
411+
assert response["transaction"]["expenseDetails"][0]["categoryId"] == "ec_1234"
418412

419413

420414
@pytest.mark.asyncio

0 commit comments

Comments
 (0)