Module: ActiveMerchant::Billing::Integrations::Payline

Defined in:
lib/active_merchant_payline/integration/payline.rb,
lib/active_merchant_payline/integration/lib/return.rb,
lib/active_merchant_payline/integration/lib/request.rb,
lib/active_merchant_payline/integration/lib/response.rb,
lib/active_merchant_payline/integration/lib/notification.rb,
lib/active_merchant_payline/integration/lib/web_payment_request.rb,
lib/active_merchant_payline/integration/lib/web_payment_response.rb

Defined Under Namespace

Classes: Notification, Request, Response, Return, WebPaymentRequest, WebPaymentResponse

Class Method Summary collapse

Class Method Details

.authorize(options = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/active_merchant_payline/integration/payline.rb', line 42

def self.authorize(options = {})
  soap_request= WebPaymentRequest.new(options)
  
  merchant= self.config[:merchant]
  unless merchant == nil
    merchant_id= merchant[:id]
    merchant_access_key= merchant[:access_key]
  end
  
  #Typhoeus can be replaced by 'net/https', but literraly 10x faster.
  response = Typhoeus::Request.post(
    "https://#{self.homologation_url}#{self.service_path}",
    :headers      => {
      'Content-Type' => nil,
      'Accept-Encoding' => nil      
    },
    :username     => merchant_id, 
    :password     => merchant_access_key,
    :method       => :basic,
    :user_agent   => 'Scrumers - Authorization',
    :body         => soap_request.to_xml,
    :verbose      => 1
  )
  WebPaymentResponse.new(
    response.body
  )
  response
end

.notification(post) ⇒ Object



38
39
40
# File 'lib/active_merchant_payline/integration/payline.rb', line 38

def self.notification(post)
  Notification.new(post)
end

.payment_detailsObject



71
72
73
# File 'lib/active_merchant_payline/integration/payline.rb', line 71

def self.payment_details
  
end

.return(query_string, options = {}) ⇒ Object



75
76
77
# File 'lib/active_merchant_payline/integration/payline.rb', line 75

def self.return(query_string, options = {})
  Return.new(query_string)
end

.service_urlObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/active_merchant_payline/integration/payline.rb', line 26

def self.service_url
  mode = ActiveMerchant::Billing::Base.integration_mode
  case mode
  when :production
    self.production_url
  when :test
    self.homologation_url
  else
    raise StandardError, "Integration mode set to an invalid value: #{mode}"
  end
end