Class: ActiveMerchant::Billing::ArgusGateway

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

Overview

For more information visit Argus Payments

Written by Piers Chambers (Varyonic.com)

Constant Summary collapse

STANDARD_ERROR_CODE_MAPPING =
{
  '555' => STANDARD_ERROR_CODE[:call_issuer],
  '600' => STANDARD_ERROR_CODE[:card_declined],
  '620' => STANDARD_ERROR_CODE[:invalid_cvc],
  '621' => STANDARD_ERROR_CODE[:incorrect_cvc],
  '623' => STANDARD_ERROR_CODE[:incorrect_address],
  '624' => STANDARD_ERROR_CODE[:expired_card],
  '630' => STANDARD_ERROR_CODE[:invalid_number],
  '610' => STANDARD_ERROR_CODE[:pickup_card],
}

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ArgusGateway

Returns a new instance of ArgusGateway.



30
31
32
33
# File 'lib/active_merchant/billing/gateways/argus.rb', line 30

def initialize(options={})
  requires!(options, :site_id, :req_username, :req_password)
  super
end

Instance Method Details

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



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/active_merchant/billing/gateways/argus.rb', line 47

def authorize(money, payment, options={})
  post = PostData.new
  add_invoice(post, money, options)
  add_payment(post, payment)
  add_address(post, payment, options)
  add_customer_data(post, options)
  add_3ds_auth(post, options)
  add_stored_credential_options(post, options)

  commit('CCAUTHORIZE', post)
end

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



59
60
61
62
63
64
# File 'lib/active_merchant/billing/gateways/argus.rb', line 59

def capture(money, authorization, options={})
  post = PostData.new
  post[:li_value_1] = amount(money)
  post[:request_ref_po_id] = authorization
  commit('CCCAPTURE', post)
end

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



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/active_merchant/billing/gateways/argus.rb', line 35

def purchase(money, payment, options={})
  post = PostData.new
  add_invoice(post, money, options)
  add_payment(post, payment)
  add_address(post, payment, options)
  add_customer_data(post, options)
  add_3ds_auth(post, options)
  add_stored_credential_options(post, options)

  commit('CCAUTHCAP', post)
end

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



66
67
68
69
70
71
# File 'lib/active_merchant/billing/gateways/argus.rb', line 66

def refund(money, authorization, options={})
  post = PostData.new
  post[:li_value_1] = amount(money)
  post[:request_ref_po_id] = authorization
  commit('CCCREDIT', post)
end

#scrub(transcript) ⇒ Object



90
91
92
93
94
# File 'lib/active_merchant/billing/gateways/argus.rb', line 90

def scrub(transcript)
  transcript.gsub(%r((&?pmt_numb=)[^&]*)i, '\1[FILTERED]').
    gsub(%r((&?pmt_key=)[^&]*)i, '\1[FILTERED]').
    gsub(%r((&?req_password=)[^&]*)i, '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/active_merchant/billing/gateways/argus.rb', line 86

def supports_scrubbing?
  true
end

#verify(credit_card, options = {}) ⇒ Object



79
80
81
82
83
84
# File 'lib/active_merchant/billing/gateways/argus.rb', line 79

def verify(credit_card, options={})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, credit_card, options) }
    r.process(:ignore_result) { void(r.authorization, options) }
  end
end

#void(authorization, options = {}) ⇒ Object



73
74
75
76
77
# File 'lib/active_merchant/billing/gateways/argus.rb', line 73

def void(authorization, options={})
  post = PostData.new
  post[:request_ref_po_id] = authorization
  commit('CCREVERSE', post)
end