Class: ActiveMerchant::Billing::Flo2cashGateway

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

Direct Known Subclasses

Flo2cashSimpleGateway

Constant Summary collapse

BRAND_MAP =
{
  'visa' => 'VISA',
  'master' => 'MC',
  'american_express' => 'AMEX',
  'diners_club' => 'DINERS'
}

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 = {}) ⇒ Flo2cashGateway

Returns a new instance of Flo2cashGateway.



22
23
24
25
# File 'lib/active_merchant/billing/gateways/flo2cash.rb', line 22

def initialize(options = {})
  requires!(options, :username, :password, :account_id)
  super
end

Instance Method Details

#authorize(amount, payment_method, options = {}) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/active_merchant/billing/gateways/flo2cash.rb', line 34

def authorize(amount, payment_method, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method)
  add_customer_data(post, options)

  commit('ProcessAuthorise', post)
end

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



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

def capture(amount, authorization, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_reference(post, authorization)
  add_customer_data(post, options)

  commit('ProcessCapture', post)
end

#purchase(amount, payment_method, options = {}) ⇒ Object



27
28
29
30
31
32
# File 'lib/active_merchant/billing/gateways/flo2cash.rb', line 27

def purchase(amount, payment_method, options = {})
  MultiResponse.run do |r|
    r.process { authorize(amount, payment_method, options) }
    r.process { capture(amount, r.authorization, options) }
  end
end

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



52
53
54
55
56
57
58
59
# File 'lib/active_merchant/billing/gateways/flo2cash.rb', line 52

def refund(amount, authorization, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_reference(post, authorization)
  add_customer_data(post, options)

  commit('ProcessRefund', post)
end

#scrub(transcript) ⇒ Object



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

def scrub(transcript)
  transcript.
    gsub(%r((<Password>)[^<]+(<))i, '\1[FILTERED]\2').
    gsub(%r((<CardNumber>)[^<]+(<))i, '\1[FILTERED]\2').
    gsub(%r((<CardCSC>)[^<]+(<))i, '\1[FILTERED]\2')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/active_merchant/billing/gateways/flo2cash.rb', line 61

def supports_scrubbing?
  true
end