@@ -238,3 +238,108 @@ def test_update_network_token(self):
238238 json = request ,
239239 xapikey = "YourXapikey" ,
240240 )
241+
242+ def test_get_list_of_mandates (self ):
243+ request = {}
244+ self .adyen .client = self .test .create_client_from_file (
245+ 200 , request , "test/mocks/configuration/get-mandates-success.json"
246+ )
247+ result = self .adyen .balancePlatform .direct_debit_mandates_api .get_list_of_mandates ()
248+ self .assertEqual (1 , len (result .message ["mandates" ]))
249+ self .assertEqual ("MD00000000000000000000001" , result .message ["mandates" ][0 ]["id" ])
250+ self .adyen .client .http_client .request .assert_called_once_with (
251+ "GET" ,
252+ f"{ self .balance_platform_url } /mandates" ,
253+ headers = {
254+ "adyen-library-name" : "adyen-python-api-library" ,
255+ "adyen-library-version" : settings .LIB_VERSION ,
256+ "User-Agent" : "adyen-python-api-library/" + settings .LIB_VERSION ,
257+ },
258+ json = None ,
259+ xapikey = "YourXapikey" ,
260+ )
261+
262+ def test_get_mandate_by_id (self ):
263+ request = {}
264+ mandate_id = "MD00000000000000000000001"
265+ self .adyen .client = self .test .create_client_from_file (
266+ 200 , request , "test/mocks/configuration/get-mandate-success.json"
267+ )
268+ result = self .adyen .balancePlatform .direct_debit_mandates_api .get_mandate_by_id (mandate_id )
269+ self .assertEqual (mandate_id , result .message ["id" ])
270+ self .adyen .client .http_client .request .assert_called_once_with (
271+ "GET" ,
272+ f"{ self .balance_platform_url } /mandates/{ mandate_id } " ,
273+ headers = {
274+ "adyen-library-name" : "adyen-python-api-library" ,
275+ "adyen-library-version" : settings .LIB_VERSION ,
276+ "User-Agent" : "adyen-python-api-library/" + settings .LIB_VERSION ,
277+ },
278+ json = None ,
279+ xapikey = "YourXapikey" ,
280+ )
281+
282+ def test_cancel_mandate (self ):
283+ mandate_id = "MD00000000000000000000001"
284+ self .adyen .client = self .test .create_client_from_file (202 , None )
285+ result = self .adyen .balancePlatform .direct_debit_mandates_api .cancel_mandate (mandate_id )
286+
287+ self .assertEqual (202 , result .status_code )
288+ self .assertEqual ({}, result .message )
289+ self .assertEqual ("" , result .raw_response )
290+ self .adyen .client .http_client .request .assert_called_once_with (
291+ "POST" ,
292+ f"{ self .balance_platform_url } /mandates/{ mandate_id } /cancel" ,
293+ headers = {
294+ "adyen-library-name" : "adyen-python-api-library" ,
295+ "adyen-library-version" : settings .LIB_VERSION ,
296+ "User-Agent" : "adyen-python-api-library/" + settings .LIB_VERSION ,
297+ },
298+ json = None ,
299+ xapikey = "YourXapikey" ,
300+ )
301+
302+ def test_update_mandate (self ):
303+ request = {"status" : "active" }
304+ mandate_id = "MD00000000000000000000001"
305+ self .adyen .client = self .test .create_client_from_file (
306+ 200 , request , "test/mocks/configuration/update-mandate-success.json"
307+ )
308+ result = self .adyen .balancePlatform .direct_debit_mandates_api .update_mandate (
309+ request , mandate_id
310+ )
311+ self .assertEqual (mandate_id , result .message ["id" ])
312+ self .assertEqual ("active" , result .message ["status" ])
313+ self .adyen .client .http_client .request .assert_called_once_with (
314+ "PATCH" ,
315+ f"{ self .balance_platform_url } /mandates/{ mandate_id } " ,
316+ headers = {
317+ "adyen-library-name" : "adyen-python-api-library" ,
318+ "adyen-library-version" : settings .LIB_VERSION ,
319+ "User-Agent" : "adyen-python-api-library/" + settings .LIB_VERSION ,
320+ },
321+ json = request ,
322+ xapikey = "YourXapikey" ,
323+ )
324+
325+ def test_get_tax_form_summary (self ):
326+ request = {}
327+ account_holder_id = "AH00000000000000000000001"
328+ self .adyen .client = self .test .create_client_from_file (
329+ 200 , request , "test/mocks/configuration/get-tax-form-summary-success.json"
330+ )
331+ result = self .adyen .balancePlatform .account_holders_api .get_tax_form_summary (
332+ account_holder_id
333+ )
334+ self .assertEqual ("available" , result .message ["taxForms" ][0 ]["status" ])
335+ self .adyen .client .http_client .request .assert_called_once_with (
336+ "GET" ,
337+ f"{ self .balance_platform_url } /accountHolders/{ account_holder_id } /taxFormSummary" ,
338+ headers = {
339+ "adyen-library-name" : "adyen-python-api-library" ,
340+ "adyen-library-version" : settings .LIB_VERSION ,
341+ "User-Agent" : "adyen-python-api-library/" + settings .LIB_VERSION ,
342+ },
343+ json = None ,
344+ xapikey = "YourXapikey" ,
345+ )
0 commit comments