Class: OffsitePayments::Integrations::BitPay::Helper

Inherits:
Helper
  • Object
show all
Defined in:
lib/offsite_payments/integrations/bit_pay.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, inherited, mapping, #raw_html_fields, #shipping_address, #test?

Constructor Details

#initialize(order_id, account, options) ⇒ Helper

Returns a new instance of Helper


23
24
25
26
27
28
29
30
# File 'lib/offsite_payments/integrations/bit_pay.rb', line 23

def initialize(order_id, , options)
  super
  @account = 

  add_field('posData', {'orderId' => order_id}.to_json)
  add_field('fullNotifications', true)
  add_field('transactionSpeed', 'high')
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OffsitePayments::Helper

Instance Method Details

#form_fieldsObject


55
56
57
58
59
60
61
# File 'lib/offsite_payments/integrations/bit_pay.rb', line 55

def form_fields
  invoice = create_invoice

  raise ActionViewHelperError, "Invalid response while retrieving BitPay Invoice ID. Please try again." unless invoice

  {"id" => invoice['id']}
end

#form_methodObject


51
52
53
# File 'lib/offsite_payments/integrations/bit_pay.rb', line 51

def form_method
  "GET"
end