Class: ActiveMerchant::Billing::CreditcallGateway

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

Constant Summary

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

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

Returns a new instance of CreditcallGateway.



18
19
20
21
# File 'lib/active_merchant/billing/gateways/creditcall.rb', line 18

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

Instance Method Details

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



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

def authorize(money, payment_method, options={})
  request = build_xml_request do |xml|
    add_transaction_details(xml, money, nil, "Auth", options)
    add_terminal_details(xml, options)
    add_card_details(xml, payment_method, options)
  end

  commit(request)
end

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



48
49
50
51
52
53
54
55
# File 'lib/active_merchant/billing/gateways/creditcall.rb', line 48

def capture(money, authorization, options={})
  request = build_xml_request do |xml|
    add_transaction_details(xml, money, authorization, "Conf", options)
    add_terminal_details(xml, options)
  end

  commit(request)
end

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



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/active_merchant/billing/gateways/creditcall.rb', line 23

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

  Response.new(
    multi_response.primary_response.success?,
    multi_response.primary_response.message,
    multi_response.primary_response.params,
    authorization: multi_response.responses.first.authorization,
    test: test?
  )
end

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



57
58
59
60
61
62
63
64
# File 'lib/active_merchant/billing/gateways/creditcall.rb', line 57

def refund(money, authorization, options={})
  request = build_xml_request do |xml|
    add_transaction_details(xml, money, authorization, "Refund", options)
    add_terminal_details(xml, options)
  end

  commit(request)
end

#scrub(transcript) ⇒ Object



86
87
88
89
90
91
# File 'lib/active_merchant/billing/gateways/creditcall.rb', line 86

def scrub(transcript)
  transcript.
    gsub(%r((<TransactionKey>).+?(</TransactionKey>))i, '\1[FILTERED]\2').
    gsub(%r((<PAN>).+?(</PAN>))i, '\1[FILTERED]\2').
    gsub(%r((<CSC>).+?(</CSC>))i, '\1[FILTERED]\2')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/active_merchant/billing/gateways/creditcall.rb', line 82

def supports_scrubbing?
  true
end

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



75
76
77
78
79
80
# File 'lib/active_merchant/billing/gateways/creditcall.rb', line 75

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



66
67
68
69
70
71
72
73
# File 'lib/active_merchant/billing/gateways/creditcall.rb', line 66

def void(authorization, options={})
  request = build_xml_request do |xml|
    add_transaction_details(xml, nil, authorization, "Void", options)
    add_terminal_details(xml, options)
  end

  commit(request)
end