Class: ActiveMerchant::Billing::CardStreamGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::CardStreamGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/card_stream.rb
Constant Summary
collapse
- THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE =
"Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead."
- CURRENCY_CODES =
{
"AED" => "784",
"AUD" => "036",
"BRL" => "986",
"CAD" => "124",
"CHF" => "756",
"CZK" => "203",
"DKK" => "208",
"EUR" => "978",
"GBP" => "826",
"HKD" => "344",
"ICK" => "352",
"JPY" => "392",
"MXN" => "484",
"NOK" => "578",
"NZD" => "554",
"SEK" => "752",
"SGD" => "702",
"USD" => "840",
}
- CVV_CODE =
{
'0' => 'U',
'1' => 'P',
'2' => 'M',
'4' => 'N'
}
- AVS_POSTAL_MATCH =
0 - No additional information available. 1 - Postcode not checked. 2 - Postcode matched. 4 - Postcode not matched. 8 - Postcode partially matched.
{
"0" => nil,
"1" => nil,
"2" => "Y",
"4" => "N",
"8" => "N"
}
- AVS_STREET_MATCH =
0 - No additional information available. 1 - Address numeric not checked. 2 - Address numeric matched. 4 - Address numeric not matched. 8 - Address numeric partially matched.
{
"0" => nil,
"1" => nil,
"2" => "Y",
"4" => "N",
"8" => "N"
}
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
-
#authorize(money, credit_card_or_reference, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ CardStreamGateway
constructor
A new instance of CardStreamGateway.
-
#purchase(money, credit_card_or_reference, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(creditcard, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of CardStreamGateway.
69
70
71
72
73
74
75
76
77
|
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 69
def initialize(options = {})
requires!(options, :login, :shared_secret)
@threeds_required = false
if (options[:threeDSRequired])
ActiveMerchant.deprecated(THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE)
@threeds_required = options[:threeDSRequired]
end
super
end
|
Instance Method Details
#authorize(money, credit_card_or_reference, options = {}) ⇒ Object
79
80
81
82
83
84
85
86
87
|
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 79
def authorize(money, credit_card_or_reference, options = {})
post = {}
add_pair(post, :captureDelay, -1)
add_amount(post, money, options)
add_invoice(post, credit_card_or_reference, money, options)
add_credit_card_or_reference(post, credit_card_or_reference)
add_customer_data(post, options)
commit('SALE', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
99
100
101
102
103
104
105
|
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 99
def capture(money, authorization, options = {})
post = {}
add_pair(post, :xref, authorization)
add_pair(post, :amount, amount(money), :required => true)
commit('CAPTURE', post)
end
|
#purchase(money, credit_card_or_reference, options = {}) ⇒ Object
89
90
91
92
93
94
95
96
97
|
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 89
def purchase(money, credit_card_or_reference, options = {})
post = {}
add_pair(post, :captureDelay, 0)
add_amount(post, money, options)
add_invoice(post, credit_card_or_reference, money, options)
add_credit_card_or_reference(post, credit_card_or_reference)
add_customer_data(post, options)
commit('SALE', post)
end
|
#refund(money, authorization, options = {}) ⇒ Object
107
108
109
110
111
112
|
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 107
def refund(money, authorization, options = {})
post = {}
add_pair(post, :xref, authorization)
add_amount(post, money, options)
commit('REFUND', post)
end
|
#scrub(transcript) ⇒ Object
131
132
133
134
135
136
|
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 131
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
gsub(%r((cardNumber=)\d+), '\1[FILTERED]').
gsub(%r((CVV=)\d+), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
127
128
129
|
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 127
def supports_scrubbing?
true
end
|
#verify(creditcard, options = {}) ⇒ Object
120
121
122
123
124
125
|
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 120
def verify(creditcard, options={})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, creditcard, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|
#void(authorization, options = {}) ⇒ Object
114
115
116
117
118
|
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 114
def void(authorization, options = {})
post = {}
add_pair(post, :xref, authorization)
commit('CANCEL', post)
end
|