Class: ActiveMerchant::Billing::EzicGateway

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

Returns a new instance of EzicGateway.



13
14
15
16
# File 'lib/active_merchant/billing/gateways/ezic.rb', line 13

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

Instance Method Details

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



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

def authorize(money, payment, options = {})
  post = {}

  (post)
  add_invoice(post, money, options)
  add_payment(post, payment)
  add_customer_data(post, options)

  commit('A', post)
end

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



40
41
42
43
44
45
46
47
48
49
# File 'lib/active_merchant/billing/gateways/ezic.rb', line 40

def capture(money, authorization, options = {})
  post = {}

  (post)
  add_invoice(post, money, options)
  add_authorization(post, authorization)
  add_pay_type(post)

  commit('D', post)
end

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



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

def purchase(money, payment, options = {})
  post = {}

  (post)
  add_invoice(post, money, options)
  add_payment(post, payment)
  add_customer_data(post, options)

  commit('S', post)
end

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



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

def refund(money, authorization, options = {})
  post = {}

  (post)
  add_invoice(post, money, options)
  add_authorization(post, authorization)
  add_pay_type(post)

  commit('R', post)
end

#scrub(transcript) ⇒ Object



83
84
85
86
87
# File 'lib/active_merchant/billing/gateways/ezic.rb', line 83

def scrub(transcript)
  transcript.
    gsub(%r((card_number=)\w+), '\1[FILTERED]').
    gsub(%r((card_cvv2=)\w+), '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/active_merchant/billing/gateways/ezic.rb', line 79

def supports_scrubbing?
  true
end

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



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

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



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

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

  (post)
  add_authorization(post, authorization)
  add_pay_type(post)

  commit('U', post)
end