Class: ActiveMerchant::Billing::PacNetRavenGateway

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

Constant Summary collapse

AVS_ADDRESS_CODES =
{
  'avs_address_unavailable'   => 'X',
  'avs_address_not_checked'   => 'X',
  'avs_address_matched'       => 'Y',
  'avs_address_not_matched'   => 'N',
  'avs_address_partial_match' => 'N'
}
AVS_POSTAL_CODES =
{
  'avs_postal_unavailable'   => 'X',
  'avs_postal_not_checked'   => 'X',
  'avs_postal_matched'       => 'Y',
  'avs_postal_not_matched'   => 'N',
  'avs_postal_partial_match' => 'N'
}
CVV2_CODES =
{
  'cvv2_matched'     => 'Y',
  'cvv2_not_matched' => 'N',
  'cvv2_unavailable' => 'X',
  'cvv2_not_checked' => 'X'
}

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, #scrub, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ PacNetRavenGateway

Returns a new instance of PacNetRavenGateway.



38
39
40
41
# File 'lib/active_merchant/billing/gateways/pac_net_raven.rb', line 38

def initialize(options = {})
  requires!(options, :user, :secret, :prn)
  super
end

Instance Method Details

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



43
44
45
46
47
48
49
50
51
# File 'lib/active_merchant/billing/gateways/pac_net_raven.rb', line 43

def authorize(money, creditcard, options = {})
  post = {}
  add_creditcard(post, creditcard)
  add_currency_code(post, money, options)
  add_address(post, options)
  post['PRN'] = @options[:prn]

  commit('cc_preauth', money, post)
end

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



71
72
73
74
75
76
77
78
# File 'lib/active_merchant/billing/gateways/pac_net_raven.rb', line 71

def capture(money, authorization, options = {})
  post = {}
  post['PreauthNumber'] = authorization
  post['PRN'] = @options[:prn]
  add_currency_code(post, money, options)

  commit('cc_settle', money, post)
end

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



53
54
55
56
57
58
59
60
61
# File 'lib/active_merchant/billing/gateways/pac_net_raven.rb', line 53

def purchase(money, creditcard, options = {})
  post = {}
  add_currency_code(post, money, options)
  add_creditcard(post, creditcard)
  add_address(post, options)
  post['PRN'] = @options[:prn]

  commit('cc_debit', money, post)
end

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



80
81
82
83
84
85
86
87
# File 'lib/active_merchant/billing/gateways/pac_net_raven.rb', line 80

def refund(money, template_number, options = {})
  post = {}
  post['PRN'] = @options[:prn]
  post['TemplateNumber'] = template_number
  add_currency_code(post, money, options)

  commit('cc_refund', money, post)
end

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



63
64
65
66
67
68
69
# File 'lib/active_merchant/billing/gateways/pac_net_raven.rb', line 63

def void(authorization, options = {})
  post = {}
  post['TrackingNumber'] = authorization
  post['PymtType'] = options[:pymt_type]

  commit('void', nil, post)
end