Class: ActiveMerchant::Billing::AlliedWalletGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/allied_wallet.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 = {}) ⇒ AlliedWalletGateway

Returns a new instance of AlliedWalletGateway.



15
16
17
18
# File 'lib/active_merchant/billing/gateways/allied_wallet.rb', line 15

def initialize(options = {})
  requires!(options, :site_id, :merchant_id, :token)
  super
end

Instance Method Details

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



29
30
31
32
33
34
35
36
# File 'lib/active_merchant/billing/gateways/allied_wallet.rb', line 29

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

  commit(:authorize, post)
end

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



38
39
40
41
42
43
44
45
# File 'lib/active_merchant/billing/gateways/allied_wallet.rb', line 38

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

  commit(:capture, post)
end

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



20
21
22
23
24
25
26
27
# File 'lib/active_merchant/billing/gateways/allied_wallet.rb', line 20

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

  commit(:purchase, post)
end

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



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

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

  commit(:refund, post)
end

#scrub(transcript) ⇒ Object



75
76
77
78
79
80
81
82
83
# File 'lib/active_merchant/billing/gateways/allied_wallet.rb', line 75

def scrub(transcript)
  transcript.
    gsub(%r((Authorization: Bearer )[a-zA-Z0-9._-]+)i, '\1[FILTERED]').
    gsub(%r(("cardNumber\\?":\\?")[^"]*)i, '\1[FILTERED]').
    gsub(%r(("cVVCode\\?":\\?")\d+[^"]*)i, '\1[FILTERED]').
    gsub(%r(("cVVCode\\?":)null), '\1[BLANK]').
    gsub(%r(("cVVCode\\?":\\?")\\?"), '\1[BLANK]"').
    gsub(%r(("cVVCode\\?":\\?")\s+), '\1[BLANK]"')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/active_merchant/billing/gateways/allied_wallet.rb', line 71

def supports_scrubbing?
  true
end

#verify(credit_card, options = {}) ⇒ Object



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

def verify(credit_card, options = {})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, credit_card, options) }
    r.process(:ignore_result) { void(r.authorization, options) }
  end
end

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



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

def void(authorization, options = {})
  post = {}
  add_reference(post, authorization, :void)

  commit(:void, post)
end