Class: ActiveMerchant::Billing::FirstPayGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/first_pay.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 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

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ FirstPayGateway

Returns a new instance of FirstPayGateway.



16
17
18
19
# File 'lib/active_merchant/billing/gateways/first_pay.rb', line 16

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

Instance Method Details

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



31
32
33
34
35
36
37
38
39
# File 'lib/active_merchant/billing/gateways/first_pay.rb', line 31

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



41
42
43
44
45
# File 'lib/active_merchant/billing/gateways/first_pay.rb', line 41

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

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



21
22
23
24
25
26
27
28
29
# File 'lib/active_merchant/billing/gateways/first_pay.rb', line 21

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



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

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

#scrub(transcript) ⇒ Object



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

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

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


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

def supports_scrubbing?
  true
end

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



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

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