Class: MerbMerchant::Billing::PsigateGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/merb_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'
SUCCESS_MESSAGE =
'Success'
FAILURE_MESSAGE =
'The transaction was declined'

Constants inherited from Gateway

Gateway::DEBIT_CARDS

Constants included from PostsData

PostsData::MAX_RETRIES, PostsData::OPEN_TIMEOUT, PostsData::READ_TIMEOUT

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?, #test?

Methods included from Utils

generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

Methods included from PostsData

included, #ssl_get, #ssl_post

Constructor Details

#initialize(options = {}) ⇒ PsigateGateway

Returns a new instance of PsigateGateway.



53
54
55
56
57
# File 'lib/merb_merchant/billing/gateways/psigate.rb', line 53

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

Instance Method Details

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

Psigate PreAuth



60
61
62
63
64
# File 'lib/merb_merchant/billing/gateways/psigate.rb', line 60

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



74
75
76
77
# File 'lib/merb_merchant/billing/gateways/psigate.rb', line 74

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

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

Psigate Credit



81
82
83
84
# File 'lib/merb_merchant/billing/gateways/psigate.rb', line 81

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

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

Psigate Sale



67
68
69
70
71
# File 'lib/merb_merchant/billing/gateways/psigate.rb', line 67

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