def get_supported_payment_services(self, country_code): """Return a list of supported credit cards and other payment services. Args: country_code (str): country code of the requested payment services Returns: [Service]: list of supported credit cards and other payment services """ services = self._request_with_exception("/rest/catalog/services/%s" % country_code)[ "services"] return [Service.from_dict(self, service) for service in services]
def get_supported_banks(self, country_code): """Return a list of supported banks. Args: country_code (str): country code of the requested banks Retursn: [Service]: list of supported banks """ banks = self._request_with_exception("/rest/catalog/banks/%s" % country_code)[ "banks"] return [Service.from_dict(self, bank) for bank in banks]
def get_catalog(self): """Return a dict with lists of supported banks and payment services. Returns: dict {'banks': [Service], 'services': [Service]}: dict with lists of supported banks and payment services """ catalog = self._request_with_exception("/rest/catalog") for k, v in catalog.items(): catalog[k] = [Service.from_dict(self, service) for service in v] return catalog
def test_create_service_from_dict(self): data = { "additional_icons": { "48x48": "https://api.figo.me/assets/images/accounts/[email protected]", "60x60": "https://api.figo.me/assets/images/accounts/[email protected]" }, "bank_code": "90090042", "icon": "https://api.figo.me/assets/images/accounts/demokonto.png", "name": "Demokonto" } service = Service.from_dict(self.sut, data) self.assertTrue(isinstance(service, Service))
def test_create_service_from_dict(figo_session): data = { "additional_icons": { "48x48": "https://api.figo.me/assets/images/accounts/[email protected]", "60x60": "https://api.figo.me/assets/images/accounts/[email protected]" }, "bank_code": "90090042", "icon": "https://api.figo.me/assets/images/accounts/demokonto.png", "name": "Demokonto", "language": { "available": [ "de", "en", ], "current": "de", }, } service = Service.from_dict(figo_session, data) assert isinstance(service, Service)
def test_create_service_from_dict(figo_session): data = { "additional_icons": { "48x48": "https://api.figo.me/assets/images/accounts/[email protected]", "60x60": "https://api.figo.me/assets/images/accounts/[email protected]" }, "bank_code": "90090042", "icon": "https://api.figo.me/assets/images/accounts/demokonto.png", "name": "Demokonto", "language": { "available_languages": [ "de", "en", ], "current_language": "de", }, } service = Service.from_dict(figo_session, data) assert isinstance(service, Service)