from .base import Base
from .issuer import Issuer
from .list import List


class Method(Base):
    # TODO: Support Klarna payment method

    IDEAL = 'ideal'
    CREDITCARD = 'creditcard'
    MISTERCASH = 'mistercash'
    SOFORT = 'sofort'
    BANKTRANSFER = 'banktransfer'
    DIRECTDEBIT = 'directdebit'
    BITCOIN = 'bitcoin'
    PAYPAL = 'paypal'
    BELFIUS = 'belfius'
    PAYSAFECARD = 'paysafecard'
    PODIUMCADEAUKAART = 'podiumcadeaukaart'
    KBC = 'kbc'
    GIFTCARD = 'giftcard'
    INGHOMEPAY = 'inghomepay'
    BANCONTACT = 'bancontact'
    EPS = 'eps'
    GIROPAY = 'giropay'

    @property
    def description(self):
        return self._get_property('description')

    @property
    def id(self):
        return self._get_property('id')

    @property
    def image_svg(self):
        try:
            images = self._get_property('image')
            return images['svg']
        except KeyError:
            return None

    @property
    def image_size1x(self):
        try:
            images = self._get_property('image')
            return images['size1x']
        except KeyError:
            return None

    @property
    def image_size2x(self):
        try:
            images = self._get_property('image')
            return images['size2x']
        except KeyError:
            return None

    @property
    def issuers(self):
        """Return the list of available issuers for this payment method."""
        issuers = self._get_property('issuers') or []
        result = {
            '_embedded': {
                'issuers': issuers,
            },
            'count': len(issuers),
        }
        return List(result, Issuer)

@@ -92,51 +92,8 @@
 e):%0A
-    # TODO: Support Klarna payment method%0A%0A
     
@@ -543,16 +543,90 @@
 giropay'
+%0A    KLARNAPAYLATER = 'klarnapaylater'%0A    KLARNASLICEIT = 'klarnasliceit'
 %0A%0A    @p

add Klrana to mollie