Class: ActiveMerchant::Billing::PsigateGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/psigate.rb

Constant Summary collapse

TEST_URL =
'https://dev.psigate.com:7989/Messenger/XMLMessenger'
LIVE_URL =
'https://secure.psigate.com:7934/Messenger/XMLMessenger'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gateway

gateway, supports?, #test?

Methods included from RequiresParameters

#requires!

Methods included from PostsData

#included?

Constructor Details

#initialize(options = {}) ⇒ PsigateGateway

Returns a new instance of PsigateGateway.



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 49

def initialize(options = {})
  requires!(options, :login, :password)

  options[:store_id] ||= options[:login]

  # these are the defaults for the psigate test server
  @options = {
    :store_id   => "teststore",
    :password   => "testpass",          
  }.update(options)                           
  super      
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



44
45
46
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 44

def options
  @options
end

#responseObject (readonly)

Returns the value of attribute response.



43
44
45
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 43

def response
  @response
end

#urlObject (readonly)

URL



42
43
44
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 42

def url
  @url
end

Class Method Details

.supported_cardtypesObject

We support visa and master card



90
91
92
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 90

def self.supported_cardtypes
  [:visa, :master]
end

Instance Method Details

#authorize(money, creditcard, options = {}) ⇒ Object

Psigate PreAuth



63
64
65
66
67
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 63

def authorize(money, creditcard, options = {})
  requires!(options, :order_id)                                                          
  options.update({ :CardAction => "1" })
  commit(money, creditcard, options)      
end

#capture(money, authorization, options = {}) ⇒ Object

Psigate PostAuth



77
78
79
80
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 77

def capture(money, authorization, options = {})
  options.update({ :CardAction => "2", :order_id => authorization })
  commit(money, nil, options)
end

#credit(money, authorization, options = {}) ⇒ Object

Psigate Credit



84
85
86
87
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 84

def credit(money, authorization, options = {})
  options.update({ :CardAction => "3", :order_id => authorization })
  commit(money, nil, options)
end

#purchase(money, creditcard, options = {}) ⇒ Object

Psigate Sale



70
71
72
73
74
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 70

def purchase(money, creditcard, options = {})
  requires!(options, :order_id)                                                          
  options.update({ :CardAction => "0" })
  commit(money, creditcard, options)     
end