Пример #1
0
    def get(self, currency=None):
        """
        Args:
            currency (str)

        """
        request_data = {
            'currency': Item.sanitize_currency_value(currency, blank=True),
            'url': self.CURRENCY_URL if currency else self.URL
        }

        return self.transport.get().request(**request_data)
Пример #2
0
    def get(self, currency=None):
        """
        Args:
            currency (str)

        """
        request_data = {
            'currency': Item.sanitize_currency_value(currency, blank=True),
            'url': self.CURRENCY_URL if currency else self.URL
        }

        return self.transport.get().request(**request_data)
Пример #3
0
    def create(self, _code, **kwargs):
        """
        Create a payment request.
        _code is a code of currency

        Args:
            _code (str)

        """
        request_data = {
            'url': self.CREATE_URL,
            'code': Item.sanitize_currency_value(_code)
        }

        return self.transport.post().request(**request_data)
Пример #4
0
    def create(self, _code, **kwargs):
        """
        Create a payment request.
        _code is a code of currency

        Args:
            _code (str)

        """
        request_data = {
            'url': self.CREATE_URL,
            'code': Item.sanitize_currency_value(_code)
        }

        return self.transport.post().request(**request_data)
Пример #5
0
    def test_sanitize_currency(self):
        self.assertEqual(Item.sanitize_currency_value(None, True), None)
        self.assertEqual(Item.sanitize_currency_value('', True), '')
        self.assertEqual(Item.sanitize_currency_value('usd', False), 'USD')
        self.assertEqual(Item.sanitize_currency_value('EUR', False), 'EUR')

        with self.assertRaises(ValueError):
            Item.sanitize_currency_value(None, False)
            Item.sanitize_currency_value('', False)
            Item.sanitize_currency_value('foobarbaz', True)
            Item.sanitize_currency_value('12', True)