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::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
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
- #scrub(transcript) ⇒ Object
- #supports_scrubbing? ⇒ Boolean
- #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
Methods included from CreditCardFormatting
#expdate, #format, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
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, , = {}) ActiveMerchant.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 |
#scrub(transcript) ⇒ Object
93 94 95 96 97 98 |
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 93 def scrub(transcript) transcript. gsub(%r((<Passphrase>)[^<]*(</Passphrase>))i, '\1[FILTERED]\2'). gsub(%r((<CardNumber>)[^<]*(</CardNumber>))i, '\1[FILTERED]\2'). gsub(%r((<CardIDNumber>)[^<]*(</CardIDNumber>))i, '\1[FILTERED]\2') end |
#supports_scrubbing? ⇒ Boolean
89 90 91 |
# File 'lib/active_merchant/billing/gateways/psigate.rb', line 89 def supports_scrubbing? true 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 |