Class: OffsitePayments::Integrations::Pay2goCvs::Fetcher

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Fetcher

Returns a new instance of Fetcher.



275
276
277
278
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 275

def initialize(params)
  raise 'parameter missmatch' if params['CheckValue'] != OffsitePayments::Integrations::Pay2goCvs.fetch_url_encode_data(params)
  @params = pay2go_params(params)
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



273
274
275
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 273

def params
  @params
end

Instance Method Details

#fetchObject



280
281
282
283
284
285
286
287
288
289
290
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 280

def fetch
  result = RestClient.post OffsitePayments::Integrations::Pay2goCvs.gateway_url, {
    MerchantID_: OffsitePayments::Integrations::Pay2goCvs.merchant_id,
    PostData_: self.class.encrypted_data(@params.to_query)
  }
  if @params['RespondType'] == 'JSON'
    JSON.parse(result)
  else
    result
  end
end