Sha256: 4a3152349e7b95ad536293d5ddba4cf37e054155e4e656c4ef6296b46b017142

Contents?: true

Size: 1.37 KB

Versions: 9

Compression:

Stored size: 1.37 KB

Contents

module Braintree
  class IdealPayment
    include BaseModule

    attr_reader :id, :ideal_transaction_id, :currency, :amount, :status, :order_id, :issuer, :approval_url, :iban_bank_account

    def initialize(gateway, attributes) # :nodoc:
      @gateway = gateway
      set_instance_variables_from_hash(attributes)
      @iban_bank_account = IbanBankAccount.new(attributes[:iban_bank_account]) if attributes[:iban_bank_account]
    end

    class << self
      protected :new
    end

    def self._new(*args) # :nodoc:
      self.new *args
    end

    def self.sale(ideal_payment_id, transaction_attributes)
      Configuration.gateway.transaction.sale(transaction_attributes.merge(
            :payment_method_nonce => ideal_payment_id,
            :options => { :submit_for_settlement => true }
          )
        )
    end

    def self.sale!(ideal_payment_id, transaction_attributes)
      return_object_or_raise(:transaction) { sale(ideal_payment_id, transaction_attributes) }
    end

    def self.find(ideal_payment_id)
      Configuration.gateway.ideal_payment.find(ideal_payment_id)
    end

    class IbanBankAccount
      include BaseModule
      attr_reader :account_holder_name, :bic, :masked_iban, :iban_account_number_last_4, :iban_country, :description

      def initialize(attributes) # :nodoc:
        set_instance_variables_from_hash(attributes)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
braintree-2.80.1 lib/braintree/ideal_payment.rb
braintree-2.80.0 lib/braintree/ideal_payment.rb
braintree-2.79.0 lib/braintree/ideal_payment.rb
braintree-2.78.0 lib/braintree/ideal_payment.rb
braintree-2.77.0 lib/braintree/ideal_payment.rb
braintree-2.76.0 lib/braintree/ideal_payment.rb
braintree-2.75.0 lib/braintree/ideal_payment.rb
braintree-2.74.0 lib/braintree/ideal_payment.rb
braintree-2.73.0 lib/braintree/ideal_payment.rb