Class: ActiveMerchant::Billing::MollieIdealGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/mollie_ideal.rb

Constant Summary collapse

URL =
"https://secure.mollie.nl/xml/ideal"

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ MollieIdealGateway

Returns a new instance of MollieIdealGateway.



9
10
11
12
13
# File 'lib/active_merchant/billing/mollie_ideal.rb', line 9

def initialize(options={})
  requires!(options, :partner_id)
  @options = options
  super
end

Instance Method Details

#details_for(token) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/active_merchant/billing/mollie_ideal.rb', line 34

def details_for(token)
  build_response_check(commit('check', {
    :partnerid        => @options[:partner_id],
    :transaction_id   => token,
    :testmode         => ActiveMerchant::Billing::Base.test?
  }))
end

#redirect_url_for(token) ⇒ Object



30
31
32
# File 'lib/active_merchant/billing/mollie_ideal.rb', line 30

def redirect_url_for(token)
  @response.url if @response.token == token
end

#setup_purchase(money, options) ⇒ Object

Raises:

  • (ArgumentError)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/active_merchant/billing/mollie_ideal.rb', line 15

def setup_purchase(money, options)
  requires!(options, :return_url, :report_url, :bank_id, :description)
  
  raise ArgumentError.new("Amount should be at least EUR 1,18") if money < 118
  
  @response = build_response_fetch(commit("fetch", {
    :amount         => money,
    :bank_id        => options[:bank_id],
    :description    => CGI::escape(options[:description] || ""),
    :partnerid      => @options[:partner_id],
    :reporturl      => options[:report_url],
    :returnurl      => options[:return_url]
  }))
end