Class: ActiveMerchant::Billing::FirstPayXmlGateway

Inherits:
Gateway
  • Object
show all
Includes:
FirstPayCommon
Defined in:
lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb

Constant Summary

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 included from FirstPayCommon

included, #supports_scrubbing?

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?, #supports_scrubbing?, #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 = {}) ⇒ FirstPayXmlGateway

Creates a new FirstPayXmlGateway

The gateway requires two values for connection to be passed in the options hash

Options

  • :gateway_id – FirstPay’s gateway_id (REQUIRED)

  • :transaction_center_id – FirstPay’s transaction_center_id or processorId (REQUIRED) Otherwise, perform transactions against the production server.



21
22
23
24
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb', line 21

def initialize(options = {})
  requires!(options, :gateway_id, :transaction_center_id)
  super
end

Instance Method Details

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



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

def authorize(money, payment, options = {})
  post = {}
  add_invoice(post, money, options)
  add_payment(post, payment, options)
  add_address(post, payment, options)
  add_customer_data(post, options)

  commit('auth', post)
end

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



46
47
48
49
50
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb', line 46

def capture(money, authorization, options = {})
  post = {}
  add_reference(post, 'settle', money, authorization)
  commit('settle', post)
end

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



26
27
28
29
30
31
32
33
34
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb', line 26

def purchase(money, payment, options = {})
  post = {}
  add_invoice(post, money, options)
  add_payment(post, payment, options)
  add_address(post, payment, options)
  add_customer_data(post, options)

  commit('sale', post)
end

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



52
53
54
55
56
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb', line 52

def refund(money, authorization, options = {})
  post = {}
  add_reference(post, 'credit', money, authorization)
  commit('credit', post)
end

#scrub(transcript) ⇒ Object



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

def scrub(transcript)
  transcript.
    gsub(%r((gateway_id)[^<]*(</FIELD>))i, '\1[FILTERED]\2').
    gsub(%r((card_number)[^<]*(</FIELD>))i, '\1[FILTERED]\2').
    gsub(%r((cvv2)[^<]*(</FIELD>))i, '\1[FILTERED]\2')
end

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



58
59
60
61
62
# File 'lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb', line 58

def void(authorization, options = {})
  post = {}
  add_reference(post, 'void', nil, authorization)
  commit('void', post)
end