Skip to content

Commit 0abc696

Browse files
authored
fix: fee test now properly adds funds to the created deposit account (#289)
1 parent 1738166 commit 0abc696

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

e2e_tests/fee_test.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import os
2-
import unittest
2+
import requests
33
from unit import Unit
44
from unit.models.fee import *
5+
from unit.models.codecs import UnitEncoder
56
from e2e_tests.account_test import create_deposit_account
67

78
token = os.environ.get('TOKEN')
@@ -11,6 +12,40 @@ def test_create_individual_application():
1112
deposit_account_id = create_deposit_account().data.id
1213

1314
request = CreateFeeRequest(150, "test fee", {"account": Relationship("depositAccount", deposit_account_id)})
15+
16+
headers = {
17+
"content-type": "application/vnd.api+json",
18+
"authorization": f"Bearer {token}",
19+
"user-agent": "unit-python-sdk"
20+
}
21+
22+
data = {
23+
"data": {
24+
"type": "achReceivedPayment",
25+
"attributes": {
26+
"amount": 10000,
27+
"direction": "Credit",
28+
"description": "Payment from Sandbox",
29+
"companyName": "Sandbox",
30+
"completionDate": datetime.now().strftime("%Y-%m-%d")
31+
},
32+
"relationships": {
33+
"account": {
34+
"data": {
35+
"type": "depositAccount",
36+
"id": deposit_account_id
37+
}
38+
}
39+
}
40+
}
41+
}
42+
43+
receivedPaymentRes = requests.post(f"https://api.s.unit.sh/sandbox/received-payments", data=json.dumps(data, cls=UnitEncoder),
44+
headers=headers)
45+
46+
receivedPaymentId = receivedPaymentRes.json()["data"]["id"]
47+
requests.post(f"https://api.s.unit.sh/sandbox/received-payments/{receivedPaymentId}/complete", headers=headers)
48+
1449
response = client.fees.create(request)
1550
assert response.data.type == "fee"
1651

0 commit comments

Comments
 (0)