11import os
2- import unittest
2+ import requests
33from unit import Unit
44from unit .models .fee import *
5+ from unit .models .codecs import UnitEncoder
56from e2e_tests .account_test import create_deposit_account
67
78token = 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