Sha256: a6b1e44c538f197fc2c10211c0069c5672b50d6d379cebd8cf02022caa1caecc

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

module Mollie
  module API
    module Object
      class Payment < Base
        STATUS_OPEN      = "open"
        STATUS_CANCELLED = "cancelled"
        STATUS_EXPIRED   = "expired"
        STATUS_PAID      = "paid"
        STATUS_PAIDOUT   = "paidout"
        STATUS_FAILED    = "failed"
        STATUS_REFUNDED  = "refunded"

        RECURRINGTYPE_NONE      = nil
        RECURRINGTYPE_FIRST     = "first"
        RECURRINGTYPE_RECURRING = "recurring"

        attr_accessor :id,
                      :status,
                      :mode,
                      :amount,
                      :description,
                      :method,
                      :createdDatetime,
                      :paidDatetime,
                      :expiredDatetime,
                      :cancelledDatetime,
                      :customerId,
                      :recurringType,
                      :mandateId,
                      :subscriptionId,
                      :settlementId,
                      :metadata,
                      :details,
                      :links

        def open?
          @status == STATUS_OPEN
        end

        def cancelled?
          @status == STATUS_CANCELLED
        end

        def expired?
          @status == STATUS_EXPIRED
        end

        def paid?
          !@paidDatetime.nil?
        end

        def paidout?
          @status == STATUS_PAIDOUT
        end

        def refunded?
          @status == STATUS_REFUNDED
        end

        def getPaymentUrl
          @links && @links.paymentUrl
        end

        alias_method :payment_url, :getPaymentUrl
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mollie-api-ruby-1.4.2 lib/Mollie/API/Object/Payment.rb
mollie-api-ruby-1.4.1 lib/Mollie/API/Object/Payment.rb