Class: OffsitePayments::Integrations::Coinbase::Return

Inherits:
Return
  • Object
show all
Defined in:
lib/offsite_payments/integrations/coinbase.rb

Instance Attribute Summary

Attributes inherited from Return

#notification, #params

Instance Method Summary collapse

Methods inherited from Return

#cancelled?, #message, #success?

Constructor Details

#initialize(query_string, options = {}) ⇒ Return

Returns a new instance of Return.



131
132
133
134
# File 'lib/offsite_payments/integrations/coinbase.rb', line 131

def initialize(query_string, options = {})
  super
  @notification = Notification.new(@params.to_json, options)
end

Instance Method Details

#parse(query_string) ⇒ Object



136
137
138
139
140
141
142
143
144
# File 'lib/offsite_payments/integrations/coinbase.rb', line 136

def parse(query_string)
  parsed_hash = Rack::Utils.parse_nested_query(query_string)

  if native_cents = parsed_hash['order'] && parsed_hash['order']['total_native'] && parsed_hash['order']['total_native']['cents']
    parsed_hash['order']['total_native']['cents'] = native_cents.to_i
  end

  parsed_hash
end