Class: ActiveMerchant::Billing::PsigateGateway
- Defined in:
- lib/active_merchant/billing/gateways/psigate.rb
Overview
This class implements the Psigate gateway for the ActiveMerchant module.
Modifications by Sean O’Hara ( sohara at sohara dot com )
Usage for a PreAuth (authorize) is as follows:
gateway = PsigateGateway.new(
:login => 'teststore',
:password => 'psigate1234'
)
creditcard = CreditCard.new(
:number => '4242424242424242',
:month => 8,
:year => 2006,
:first_name => 'Longbob',
:last_name => 'Longsen'
)
twenty = 2000 response = @gateway.authorize(twenty, creditcard,
:order_id => 1234,
:billing_address => {
:address1 => '123 fairweather Lane',
:address2 => 'Apt B',
:city => 'New York',
:state => 'NY',
:country => 'U.S.A.',
:zip => '10010'
},
:email => '[email protected]'
)
Constant Summary collapse
- SUCCESS_MESSAGE =
'Success'
- FAILURE_MESSAGE =
'The transaction was declined'
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #authorize(money, creditcard, options = {}) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
- #credit(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ PsigateGateway
constructor
A new instance of PsigateGateway.
- #purchase(money, creditcard, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from CreditCardFormatting
Constructor Details
#initialize(options = {}) ⇒ PsigateGateway
Returns a new instance of PsigateGateway.
49 50 51 52 |
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 49 def initialize( = {}) requires!(, :login, :password) super end |
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
54 55 56 57 58 |
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 54 def (money, creditcard, = {}) requires!(, :order_id) [:CardAction] = "1" commit(money, creditcard, ) end |
#capture(money, authorization, options = {}) ⇒ Object
66 67 68 69 70 |
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 66 def capture(money, , = {}) [:CardAction] = "2" [:order_id], [:trans_ref_number] = () commit(money, nil, ) end |
#credit(money, authorization, options = {}) ⇒ Object
72 73 74 75 |
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 72 def credit(money, , = {}) deprecated CREDIT_DEPRECATION_MESSAGE refund(money, , ) end |
#purchase(money, creditcard, options = {}) ⇒ Object
60 61 62 63 64 |
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 60 def purchase(money, creditcard, = {}) requires!(, :order_id) [:CardAction] = "0" commit(money, creditcard, ) end |
#refund(money, authorization, options = {}) ⇒ Object
77 78 79 80 81 |
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 77 def refund(money, , = {}) [:CardAction] = "3" [:order_id], [:trans_ref_number] = () commit(money, nil, ) end |
#void(authorization, options = {}) ⇒ Object
83 84 85 86 87 |
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 83 def void(, = {}) [:CardAction] = "9" [:order_id], [:trans_ref_number] = () commit(nil, nil, ) end |