# WARNING: Do not edit by hand, this file was generated by Crank:
#
#   https://github.com/gocardless/crank
#

class Payment(object):
    """A thin wrapper around a payment, providing easy access to its
    attributes.

    Example:
      payment = client.payments.get()
      payment.id
    """

    def __init__(self, attributes, api_response):
        self.attributes = attributes
        self.api_response = api_response

    @property
    def amount(self):
        return self.attributes.get('amount')

    @property
    def amount_refunded(self):
        return self.attributes.get('amount_refunded')

    @property
    def charge_date(self):
        return self.attributes.get('charge_date')

    @property
    def created_at(self):
        return self.attributes.get('created_at')

    @property
    def currency(self):
        return self.attributes.get('currency')

    @property
    def description(self):
        return self.attributes.get('description')

    @property
    def id(self):
        return self.attributes.get('id')

    @property
    def links(self):
        return self.Links(self.attributes.get('links'))

    @property
    def metadata(self):
        return self.attributes.get('metadata')

    @property
    def reference(self):
        return self.attributes.get('reference')

    @property
    def status(self):
        return self.attributes.get('status')

    class Links(object):
        """Wrapper for the response's 'links' attribute."""

        def __init__(self, attributes):
            self.attributes = attributes

        @property
        def creditor(self):
            return self.attributes.get('creditor')

        @property
        def mandate(self):
            return self.attributes.get('mandate')

        @property
        def payout(self):
            return self.attributes.get('payout')

        @property
        def subscription(self):
            return self.attributes.get('subscription')

