Class: ActiveMerchant::Billing::GlobalTransportGateway

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

Constant Summary

Constants inherited from Gateway

ActiveMerchant::Billing::Gateway::CREDIT_DEPRECATION_MESSAGE, ActiveMerchant::Billing::Gateway::DEBIT_CARDS, ActiveMerchant::Billing::Gateway::RECURRING_DEPRECATION_MESSAGE, ActiveMerchant::Billing::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 = {}) ⇒ GlobalTransportGateway

Public: Create a new Global Transport gateway.

options - A hash of options:

:global_user_name - Your Global user name
:global_password  - Your Global password
:term_type        - 3 character field assigned by Global Transport after
                  - your application is certified.


23
24
25
26
# File 'lib/active_merchant/billing/gateways/global_transport.rb', line 23

def initialize(options={})
  requires!(options, :global_user_name, :global_password, :term_type)
  super
end

Instance Method Details

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



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

def authorize(money, payment_method, options={})
  post = {}
  add_invoice(post, money, options)
  add_payment_method(post, payment_method)
  add_address(post, options)

  commit('Auth', post, options)
end

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



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

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

  commit('Force', post, options)
end

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



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

def purchase(money, payment_method, options={})
  post = {}
  add_invoice(post, money, options)
  add_payment_method(post, payment_method)
  add_address(post, options)

  commit('Sale', post, options)
end

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



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

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

  commit('Return', post, options)
end

#scrub(transcript) ⇒ Object



81
82
83
84
85
86
# File 'lib/active_merchant/billing/gateways/global_transport.rb', line 81

def scrub(transcript)
  transcript.
    gsub(%r((&?CardNum=)[^&]*)i, '\1[FILTERED]').
    gsub(%r((&?CVNum=)[^&]*)i, '\1[FILTERED]').
    gsub(%r((&?GlobalPassword=)[^&]*)i, '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/active_merchant/billing/gateways/global_transport.rb', line 77

def supports_scrubbing?
  true
end

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



69
70
71
72
73
74
75
# File 'lib/active_merchant/billing/gateways/global_transport.rb', line 69

def verify(payment_method, options={})
  post = {}
  add_payment_method(post, payment_method)
  add_address(post, options)

  commit('CardVerify', post, options)
end

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



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

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

  commit('Void', post, options)
end