Class Index [+]

Quicksearch

ActiveMerchant::Billing::Integrations::Directebanking::Helper

Constants

SIGNATURE_FIELDS
SIGNATURE_IGNORE_AT_METHOD_CREATION_FIELDS

Public Class Methods

new(order, account, options = {}) click to toggle source

All credentials are mandatory and need to be set

credential1: User ID credential2: Project ID credential3: Project Password (Algorithm: SH1) credential4: Notification Password (Algorithm: SH1)

    # File lib/active_merchant/billing/integrations/directebanking/helper.rb, line 13
13:           def initialize(order, account, options = {})
14:             super
15:             add_field('user_variable_0', order)
16:             add_field('project_id', options[:credential2])
17:             @project_password = options[:credential3]
18:           end

Public Instance Methods

amount=(money) click to toggle source

Need to format the amount to have 2 decimal places

    # File lib/active_merchant/billing/integrations/directebanking/helper.rb, line 57
57:           def amount=(money)
58:             cents = money.respond_to?(:cents) ? money.cents : money
59:             if money.is_a?(String) or cents.to_i <= 0
60:               raise ArgumentError, 'money amount must be either a Money object or a positive integer in cents.'
61:             end
62:             add_field mappings[:amount], sprintf("%.2f", cents.to_f/100)
63:           end
form_fields() click to toggle source
    # File lib/active_merchant/billing/integrations/directebanking/helper.rb, line 74
74:           def form_fields
75:             @fields.merge('hash' => generate_signature)
76:           end
generate_signature() click to toggle source
    # File lib/active_merchant/billing/integrations/directebanking/helper.rb, line 70
70:           def generate_signature
71:             Digest::SHA1.hexdigest(generate_signature_string)
72:           end
generate_signature_string() click to toggle source
    # File lib/active_merchant/billing/integrations/directebanking/helper.rb, line 65
65:           def generate_signature_string
66:             # format of signature: user_id|project_id|sender_holder|sender_account_number|sender_bank_code| sender_country_id|amount|currency_id|reason_1|reason_2|user_variable_0|user_variable_1|user_variable_2|user_variable_3|user_variable_4|user_variable_5|project_password
67:             SIGNATURE_FIELDS.map {|key| @fields[key.to_s]} * "|" + "|#{@project_password}"
68:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.