Class: ActiveMerchant::Billing::CardStreamGateway
- 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', 'ALL' => '008', 'AMD' => '051', 'ANG' => '532', 'ARS' => '032', 'AUD' => '036', 'AWG' => '533', 'BAM' => '977', 'BBD' => '052', 'BGN' => '975', 'BMD' => '060', 'BOB' => '068', 'BRL' => '986', 'BSD' => '044', 'BWP' => '072', 'BZD' => '084', 'CAD' => '124', 'CHF' => '756', 'CLP' => '152', 'CNY' => '156', 'COP' => '170', 'CRC' => '188', 'CZK' => '203', 'DKK' => '208', 'DOP' => '214', 'EGP' => '818', 'EUR' => '978', 'GBP' => '826', 'GEL' => '981', 'GIP' => '292', 'GTQ' => '320', 'GYD' => '328', 'HKD' => '344', 'HNL' => '340', 'HRK' => '191', 'HUF' => '348', 'ISK' => '352', 'IDR' => '360', 'ILS' => '376', 'INR' => '356', 'JPY' => '392', 'JMD' => '388', 'KES' => '404', 'KRW' => '410', 'KYD' => '136', 'LBP' => '422', 'LKR' => '144', 'MAD' => '504', 'MVR' => '462', 'MWK' => '454', 'MXN' => '484', 'MYR' => '458', 'NAD' => '516', 'NGN' => '566', 'NIO' => '558', 'NOK' => '578', 'NPR' => '524', 'NZD' => '554', 'PAB' => '590', 'PEN' => '604', 'PGK' => '598', 'PHP' => '608', 'PKR' => '586', 'PLN' => '985', 'PYG' => '600', 'QAR' => '634', 'RON' => '946', 'RSD' => '941', 'RUB' => '643', 'RWF' => '646', 'SAR' => '682', 'SEK' => '752', 'SGD' => '702', 'SRD' => '968', 'THB' => '764', 'TND' => '788', 'TRY' => '949', 'TTD' => '780', 'TWD' => '901', 'TZS' => '834', 'UAH' => '980', 'UGX' => '800', 'USD' => '840', 'UYU' => '858', 'VND' => '704', 'WST' => '882', 'XAF' => '950', 'XCD' => '951', 'XOF' => '952', 'ZAR' => '710' }
- 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::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
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
#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
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ CardStreamGateway
Returns a new instance of CardStreamGateway.
141 142 143 144 145 146 147 148 149 |
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 141 def initialize( = {}) requires!(, :login, :shared_secret) @threeds_required = false if [:threeDSRequired] ActiveMerchant.deprecated(THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE) @threeds_required = [:threeDSRequired] end super end |
Instance Method Details
#authorize(money, credit_card_or_reference, options = {}) ⇒ Object
151 152 153 154 155 |
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 151 def (money, credit_card_or_reference, = {}) post = {} add_auth_purchase(post, -1, money, credit_card_or_reference, ) commit('SALE', post) end |
#capture(money, authorization, options = {}) ⇒ Object
163 164 165 166 167 168 169 170 |
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 163 def capture(money, , = {}) post = {} add_pair(post, :xref, ) add_pair(post, :amount, localized_amount(money, [:currency] || currency(money)), required: true) add_remote_address(post, ) commit('CAPTURE', post) end |
#purchase(money, credit_card_or_reference, options = {}) ⇒ Object
157 158 159 160 161 |
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 157 def purchase(money, credit_card_or_reference, = {}) post = {} add_auth_purchase(post, 0, money, credit_card_or_reference, ) commit('SALE', post) end |
#refund(money, authorization, options = {}) ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 172 def refund(money, , = {}) post = {} add_pair(post, :xref, ) add_amount(post, money, ) add_remote_address(post, ) add_country_code(post, ) response = commit('REFUND_SALE', post) return response if response.success? return response unless [:force_full_refund_if_unsettled] if response.params['responseCode'] == '65541' void(, ) else response end end |
#scrub(transcript) ⇒ Object
208 209 210 211 212 213 |
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 208 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
204 205 206 |
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 204 def supports_scrubbing? true end |
#verify(creditcard, options = {}) ⇒ Object
197 198 199 200 201 202 |
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 197 def verify(creditcard, = {}) MultiResponse.run(:use_first_response) do |r| r.process { (100, creditcard, ) } r.process(:ignore_result) { void(r., ) } end end |
#void(authorization, options = {}) ⇒ Object
190 191 192 193 194 195 |
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 190 def void(, = {}) post = {} add_pair(post, :xref, ) add_remote_address(post, ) commit('CANCEL', post) end |