class OffsitePayments::Integrations::Doku::Helper

service.shipping_address :city     => 'Jakarta',
                         :address  => 'Jl. Jendral Sudirman kav 59, Plaza Asia Office Park Unit 3',
                         :state    => 'DKI Jakarta',
                         :zip      => '12190',
                         :country  => 'ID'

service.url 'http://yourstore.com'

end

Public Class Methods

new(order, account, options = {}) click to toggle source
Calls superclass method
# File lib/offsite_payments/integrations/doku.rb, line 44
def initialize(order, account, options = {})
  @shared_key      = options.delete(:credential2)
  @transidmerchant = order
  super
end

Public Instance Methods

customer(params = {}) click to toggle source
# File lib/offsite_payments/integrations/doku.rb, line 57
def customer(params = {})
  add_field mappings[:customer][:name], "#{params[:first_name]} #{params[:last_name]}"
  add_field mappings[:customer][:email], params[:email]
  add_field mappings[:customer][:phone], params[:phone]
  add_field mappings[:customer][:mobile_phone], params[:mobile_phone]
  add_field mappings[:customer][:working_phone], params[:working_phone]
  add_field mappings[:customer][:birth_date], params[:birth_date]
end
form_fields() click to toggle source
# File lib/offsite_payments/integrations/doku.rb, line 50
def form_fields
  add_field 'WORDS', words
  add_field 'BASKET', basket
  add_field 'TRANSIDMERCHANT', @transidmerchant
  @fields
end

Private Instance Methods

add_address(key, params) click to toggle source
# File lib/offsite_payments/integrations/doku.rb, line 100
def add_address(key, params)
  return if mappings[key].nil?

  code = lookup_country_code(params.delete(:country), :numeric)
  add_field(mappings[key][:country], code)
  add_fields(key, params)
end
basket() click to toggle source
# File lib/offsite_payments/integrations/doku.rb, line 92
def basket
  "Checkout #{@transidmerchant},#{@fields['AMOUNT']},1,#{@fields['AMOUNT']}"
end
words() click to toggle source
# File lib/offsite_payments/integrations/doku.rb, line 96
def words
  @words ||= Digest::SHA1.hexdigest("#{ @fields['AMOUNT'] }#{ @shared_key }#{ @transidmerchant }")
end