@@ -25,20 +25,21 @@ def display_options():
2525 retrieve KBA (RKBA)
2626 verify KBA (VKBA)
2727 Create beneficial owner (CBO)
28- Reterieve beneficial owner (RBO)
28+ Retrieve beneficial owner (RBO)
2929 list beneficial owners (LBO)
3030 update beneficial owner (UBO)
3131 Remove beneficial owner (DBO)
3232 Retrieve beneficial ownership status (RBOS)
3333 Certify beneficial ownership (CBOS)
34+ Quit (Q)
3435 '''
3536 print (action_menu )
3637
3738def get_user_input ():
3839 return input ('Enter your action: ' )
3940
40- def handle_input (input , pk , sk ):
41- client = dwollav2 .Client (key = pk , secret = sk , environment = 'sandbox' )
41+ def handle_input (input , DWOLLA_APP_KEY , DWOLLA_APP_SECRET ):
42+ client = dwollav2 .Client (key = DWOLLA_APP_KEY , secret = DWOLLA_APP_SECRET , environment = 'sandbox' )
4243 application_token = client .Auth .client ()
4344 if input == 'R' :
4445 root (application_token )
@@ -90,11 +91,16 @@ def handle_input(input, pk, sk):
9091 retrieve_beneficial_ownership_status (application_token )
9192 elif input == 'CBOS' :
9293 certify_beneficial_ownership (application_token )
94+ elif input == 'Q' :
95+ quit ()
9396
9497
9598def print_response (res ):
9699 print (json .dumps (res .body , indent = 4 ))
97100
101+ def print_location (res ):
102+ print (res .headers ['Location' ])
103+
98104# ROOT RESOURCE
99105def root (token ):
100106 res = token .get ('/' )
@@ -112,23 +118,15 @@ def create_account_funding_source(token):
112118 bankAccountType = input ('Enter your bank account type: ' )
113119 name = input ('Enter your funding source nickname: ' )
114120
115- has_channels = input ('Does your funding source have channels? (y/n): ' )
116-
117121 body = {
118122 'routingNumber' : routingNumber ,
119123 'accountNumber' : accountNumber ,
120124 'type' : bankAccountType ,
121125 'name' : name
122126 }
123127
124- if has_channels == 'y' :
125- channels = input ('Enter your channels seperated by commas: ' )
126- channels = channels .split (',' )
127- body ['channels' ] = channels
128-
129-
130128 res = token .post (f'/funding-sources' , body )
131- print_response (res )
129+ print_location (res )
132130
133131def create_account_van (token ):
134132 name = input ('Enter your account name: ' )
@@ -141,7 +139,7 @@ def create_account_van(token):
141139 }
142140
143141 res = token .post (f'/funding-sources' , body )
144- print_response (res )
142+ print_location (res )
145143
146144def list_account_funding_sources (token ):
147145 id = input ('Enter your account ID: ' )
@@ -173,7 +171,7 @@ def create_receive_only_customer(token):
173171 }
174172
175173 res = token .post (f'/customers' , body )
176- print_response (res )
174+ print_location (res )
177175
178176def create_unverified_customer (token ):
179177 firstName = input ('Enter customer first name: ' )
@@ -187,7 +185,7 @@ def create_unverified_customer(token):
187185 }
188186
189187 res = token .post (f'/customers' , body )
190- print_response (res )
188+ print_location (res )
191189
192190def create_verified_personal_customer (token ):
193191 firstName = input ('Enter customer first name: ' )
@@ -215,7 +213,7 @@ def create_verified_personal_customer(token):
215213 }
216214
217215 res = token .post (f'/customers' , body )
218- print_response (res )
216+ print_location (res )
219217
220218def retrieve_customer (token ):
221219 id = input ('Enter customer ID: ' )
@@ -228,26 +226,10 @@ def list_and_search_customers(token):
228226
229227def update_customer (token ):
230228 id = input ('Enter customer ID: ' )
231- firstName = input ('Enter customer first name: ' )
232- lastName = input ('Enter customer last name: ' )
233- email = input ('Enter customer email: ' )
234- address1 = input ('Enter customer address 1: ' )
235- city = input ('Enter customer city: ' )
236- state = input ('Enter customer state: ' )
237- postalCode = input ('Enter customer postal code: ' )
238- dateOfBirth = input ('Enter customer date of birth: ' )
239- ssn = input ('Enter customer ssn: ' )
229+ email = input ('Enter updated customer email: ' )
240230
241231 body = {
242- 'firstName' : firstName ,
243- 'lastName' : lastName ,
244232 'email' : email ,
245- 'address1' : address1 ,
246- 'city' : city ,
247- 'state' : state ,
248- 'postalCode' : postalCode ,
249- 'dateOfBirth' : dateOfBirth ,
250- 'ssn' : ssn ,
251233 }
252234
253235 res = token .post (f'/customers/{ id } ' , body )
@@ -266,7 +248,7 @@ def retrieve_business_classification(token):
266248def initiate_kba (token ):
267249 id = input ('Enter customer ID: ' )
268250 res = token .post (f'/customers/{ id } /kba' )
269- print_response (res )
251+ print_location (res )
270252
271253def retrieve_kba (token ):
272254 id = input ('Enter KBA session ID: ' )
@@ -302,21 +284,25 @@ def create_beneficial_owner(token):
302284 address1 = input ('Enter beneficial owner address 1: ' )
303285 city = input ('Enter beneficial owner city: ' )
304286 state = input ('Enter beneficial owner state: ' )
287+ country = input ('Enter beneficial owner country: ' )
305288 postalCode = input ('Enter beneficial owner postal code: ' )
306289
307290 body = {
308291 'firstName' : firstName ,
309292 'lastName' : lastName ,
310293 'dateOfBirth' : dateOfBirth ,
311294 'ssn' : ssn ,
312- 'address1' : address1 ,
313- 'city' : city ,
314- 'state' : state ,
315- 'postalCode' : postalCode
295+ 'address' : {
296+ 'address1' : address1 ,
297+ 'city' : city ,
298+ 'stateProvinceRegion' : state ,
299+ 'country' : country ,
300+ 'postalCode' : postalCode
301+ }
316302 }
317303
318304 res = token .post (f'/customers/{ id } /beneficial-owners' , body )
319- print_response (res )
305+ print_location (res )
320306
321307def retrieve_beneficial_owner (token ):
322308 id = input ('Enter beneficial owner ID: ' )
@@ -337,17 +323,21 @@ def update_beneficial_owner(token):
337323 address1 = input ('Enter beneficial owner address 1: ' )
338324 city = input ('Enter beneficial owner city: ' )
339325 state = input ('Enter beneficial owner state: ' )
326+ country = input ('Enter beneficial owner country: ' )
340327 postalCode = input ('Enter beneficial owner postal code: ' )
341328
342329 body = {
343330 'firstName' : firstName ,
344331 'lastName' : lastName ,
345332 'dateOfBirth' : dateOfBirth ,
346333 'ssn' : ssn ,
347- 'address1' : address1 ,
348- 'city' : city ,
349- 'state' : state ,
350- 'postalCode' : postalCode
334+ 'address' : {
335+ 'address1' : address1 ,
336+ 'city' : city ,
337+ 'stateProvinceRegion' : state ,
338+ 'country' : country ,
339+ 'postalCode' : postalCode
340+ }
351341 }
352342
353343 res = token .post (f'/beneficial-owners/{ id } ' , body )
0 commit comments