Class: ActiveMerchant::Billing::PaywayDotComGateway

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

Constant Summary collapse

STANDARD_ERROR_CODE_MAPPING =
{
  '5012' => STANDARD_ERROR_CODE[:card_declined],
  '5035' => STANDARD_ERROR_CODE[:invalid_number],
  '5037' => STANDARD_ERROR_CODE[:invalid_expiry_date],
  '5045' => STANDARD_ERROR_CODE[:incorrect_zip]
}
AVS_MAPPING =

Payway to standard AVSResult codes.

{
  'N1'  => 'I', #  No address given with order
  'N2'  => 'I', #  Bill-to address did not pass
  '““'  => 'R', #  AVS not performed (Blanks returned)
  'IU'  => 'G', #  AVS not performed by Issuer
  'ID'  => 'S', #  Issuer does not participate in AVS
  'IE'  => 'E', #  Edit Error - AVS data is invalid
  'IS'  => 'R', #  System unavailable or time-out
  'IB'  => 'B', #  Street address match. Postal code not verified due to incompatible formats (both were sent).
  'IC'  => 'C', #  Street address and postal code not verified due to incompatible format (both were sent).
  'IP'  => 'P', #  Postal code match. Street address not verified due to incompatible formats (both were sent).
  'A1'  => 'K', #  Accountholder name matches
  'A3'  => 'V', #  Accountholder name, billing address and postal code.
  'A4'  => 'L', #  Accountholder name and billing postal code match
  'A7'  => 'O', #  Accountholder name and billing address match
  'B3'  => 'H', #  Accountholder name incorrect, billing address and postal code match
  'B4'  => 'F', #  Accountholder name incorrect, billing postal code matches
  'B7'  => 'T', #  Accountholder name incorrect, billing address matches
  'B8'  => 'N', #  Accountholder name, billing address and postal code are all incorrect
  '??'  => 'R', #  A double question mark symbol indicates an unrecognized response from association
  'I1'  => 'X', #  Zip code +4 and Address Match
  'I2'  => 'W', #  Zip code +4 Match
  'I3'  => 'Y', #  Zip code and Address Match
  'I4'  => 'Z', #  Zip code Match
  'I5'  => 'M', #  +4 and Address Match
  'I6'  => 'W', #  +4 Match
  'I7'  => 'A', #  Address Match
  'I8'  => 'C' #  No Match
}
PAYWAY_WS_SUCCESS =
'5000'
SCRUB_PATTERNS =
[
  %r(("password\\?":\\?")[^\\]+),
  %r(("fsv\\?":\\?")\d+),
  %r(("fsv\\?": \\?")\d+),
  %r(("accountNumber\\?":\\?")\d+),
  %r(("accountNumber\\?": \\?")[^\\]+),
  %r(("Invalid account number: )\d+)
].freeze
SCRUB_REPLACEMENT =
'\1[FILTERED]'

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

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

#format, #strftime_yyyymm

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ PaywayDotComGateway

Returns a new instance of PaywayDotComGateway.



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

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

Instance Method Details

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



82
83
84
85
86
87
88
89
90
# File 'lib/active_merchant/billing/gateways/payway_dot_com.rb', line 82

def authorize(money, payment, options = {})
  post = {}
  add_common(post, options)
  add_card_payment(post, payment, options)
  add_card_transaction_details(post, money, options)
  add_address(post, payment, options)

  commit('authorize', post)
end

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



92
93
94
95
96
97
98
# File 'lib/active_merchant/billing/gateways/payway_dot_com.rb', line 92

def capture(money, authorization, options = {})
  post = {}
  add_common(post, options)
  add_card_transaction_name(post, authorization, options)

  commit('capture', post)
end

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



100
101
102
103
104
105
106
107
108
# File 'lib/active_merchant/billing/gateways/payway_dot_com.rb', line 100

def credit(money, payment, options = {})
  post = {}
  add_common(post, options)
  add_card_payment(post, payment, options)
  add_card_transaction_details(post, money, options)
  add_address(post, payment, options)

  commit('credit', post)
end

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



72
73
74
75
76
77
78
79
80
# File 'lib/active_merchant/billing/gateways/payway_dot_com.rb', line 72

def purchase(money, payment, options = {})
  post = {}
  add_common(post, options)
  add_card_payment(post, payment, options)
  add_card_transaction_details(post, money, options)
  add_address(post, payment, options)

  commit('sale', post)
end

#scrub(transcript) ⇒ Object



122
123
124
125
126
# File 'lib/active_merchant/billing/gateways/payway_dot_com.rb', line 122

def scrub(transcript)
  SCRUB_PATTERNS.inject(transcript) do |text, pattern|
    text.gsub(pattern, SCRUB_REPLACEMENT)
  end
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/active_merchant/billing/gateways/payway_dot_com.rb', line 118

def supports_scrubbing?
  true
end

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



110
111
112
113
114
115
116
# File 'lib/active_merchant/billing/gateways/payway_dot_com.rb', line 110

def void(authorization, options = {})
  post = {}
  add_common(post, options)
  add_card_transaction_name(post, authorization, options)

  commit('void', post)
end