Class: MerbMerchant::Billing::PaySecureGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/merb_merchant/billing/gateways/pay_secure.rb

Constant Summary collapse

URL =
'https://clearance.commsecure.com.au/cgi-bin/PSDirect'
TRANSACTIONS =

Currently Authorization and Capture is not implemented because capturing requires the original credit card information

{
  :purchase       => 'PURCHASE',
  :authorization  => 'AUTHORISE',
  :capture        => 'ADVICE', 
  :credit         => 'REFUND'
}
SUCCESS =
'Accepted'
SUCCESS_MESSAGE =
'The transaction was approved'

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 = {}) ⇒ PaySecureGateway

Returns a new instance of PaySecureGateway.



25
26
27
28
29
# File 'lib/merb_merchant/billing/gateways/pay_secure.rb', line 25

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

Instance Method Details

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



31
32
33
34
35
36
37
38
39
40
# File 'lib/merb_merchant/billing/gateways/pay_secure.rb', line 31

def purchase(money, credit_card, options = {})
  requires!(options, :order_id)
  
  post = {}
  add_amount(post, money)
  add_invoice(post, options)
  add_credit_card(post, credit_card)        
       
  commit(:purchase, money, post)
end