class OffsitePayments::Integrations::MollieMistercash::Notification

Public Class Methods

new(post_arguments, options = {}) click to toggle source
Calls superclass method OffsitePayments::Notification::new
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 80
def initialize(post_arguments, options = {})
  super

  raise ArgumentError, "The transaction_id needs to be included in the query string." if transaction_id.nil?
  raise ArgumentError, "The credential1 option needs to be set to the Mollie API key." if api_key.blank?
end

Public Instance Methods

acknowledge(authcode = nil) click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 128
def acknowledge(authcode = nil)
  @params = check_payment_status(transaction_id)
  true
end
api_key() click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 99
def api_key
  @options[:credential1]
end
check_payment_status(transaction_id) click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 133
def check_payment_status(transaction_id)
  MollieMistercash.check_payment_status(@options[:credential1], transaction_id)
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 87
def complete?
  true
end
currency() click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 103
def currency
  "EUR"
end
gross() click to toggle source

the money amount we received in X.2 decimal.

# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 108
def gross
  @params['amount']
end
gross_cents() click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 112
def gross_cents
  (BigDecimal.new(@params['amount'], 2) * 100).to_i
end
item_id() click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 91
def item_id
  params['metadata']['order']
end
status() click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 116
def status
  case @params['status']
    when 'open';                 'Pending'
    when 'paidout', 'paid';      'Completed'
    else                         'Failed'
  end
end
test?() click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 124
def test?
  @params['mode'] == 'test'
end
transaction_id() click to toggle source
# File lib/offsite_payments/integrations/mollie_mistercash.rb, line 95
def transaction_id
  params['id']
end