Class: ActiveMerchant::Billing::Integrations::BitPay::Helper

Inherits:
Helper
  • Object
show all
Defined in:
lib/active_merchant/billing/integrations/bit_pay/helper.rb

Instance Attribute Summary

Attributes inherited from Helper

#fields

Instance Method Summary collapse

Methods inherited from Helper

#add_field, #add_fields, #add_raw_html_field, #billing_address, #form_fields, mapping, #raw_html_fields, #shipping_address, #test?

Constructor Details

#initialize(order_id, account, options) ⇒ Helper

Returns a new instance of Helper.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/active_merchant/billing/integrations/bit_pay/helper.rb', line 6

def initialize(order_id, , options)
  super
  @account = 
  add_field('orderID', order_id)
  add_field('posData', options[:authcode])
  add_field('currency', options[:currency])
  add_field('fullNotifications', 'true')
  add_field('transactionSpeed', options[:transactionSpeed] || "high")
  add_field('address1', options[:address1])

  generate_invoice_id
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveMerchant::Billing::Integrations::Helper

Instance Method Details

#form_methodObject



46
47
48
# File 'lib/active_merchant/billing/integrations/bit_pay/helper.rb', line 46

def form_method
  "GET"
end

#generate_invoice_idObject



40
41
42
43
44
# File 'lib/active_merchant/billing/integrations/bit_pay/helper.rb', line 40

def generate_invoice_id
  invoice_data = ssl_post(BitPay.invoicing_url)

  add_field('id', JSON.parse(invoice_data.body)['id'])
end