Class: MollieBank::Application

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/mollie-bank/application/app.rb

Overview

The Sinatra Application

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_or_post(path, opts = {}, &block) ⇒ Object


15
16
17
18
# File 'lib/mollie-bank/application/app.rb', line 15

def self.get_or_post(path, opts={}, &block)
  get(path, opts, &block)
  post(path, opts, &block)
end

Instance Method Details

#error(code) ⇒ Object

Render the XML error for a specific code

Parameters:

  • code (int)

163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/mollie-bank/application/app.rb', line 163

def error(code)
  # Mollie codes taken from https://www.mollie.nl/support/documentatie/betaaldiensten/ideal/en/
  errors = []
  errors[1] = "Did not receive a proper input value."
  errors[2] = "A fetch was issued without specification of 'partnerid'."
  errors[3] = "A fetch was issued without (proper) specification of 'reporturl'."
  errors[4] = "A fetch was issued without specification of 'amount'."
  errors[5] = "A fetch was issued without specification of 'bank_id'."
  errors[6] = "A fetch was issues without specification of a known 'bank_id'."
  errors[7] = "A fetch was issued without specification of 'description'."
  errors[8] = "A check was issued without specification of transaction_id."
  errors[9] = "Transaction_id contains illegal characters. (Logged as attempt to mangle)."
  errors[10] = "This is an unknown order."
  errors[11] = "A check was issued without specification of your partner_id."
  errors[12] = "A fetch was issued without (proper) specification of 'returnurl'."
  errors[13] = "This amount is only permitted when iDEAL contract is signed and sent to Mollie."
  errors[14] = "Minimum amount for an ideal transaction is 1,18 EUR."
  errors[15] = "A fetch was issued for an account which is not allowed to accept iDEAL payments (yet)."
  errors[16] = "A fetch was issued for an unknown or inactive profile."

  haml :error, :layout => false, :locals => {
    :type => "error",
    :code => code,
    :message => errors[code*-1]
  }
end