Class: ActiveMerchant::Billing::CardStreamGateway

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

Overview

CardStream supports the following credit cards, which are auto-detected by the gateway based on the card number used:

  • AM American Express

  • Diners Club

  • Electron

  • JCB

  • UK Maestro

  • Maestro International

  • Mastercard

  • Solo

  • Style

  • Switch

  • Visa Credit

  • Visa Debit

  • Visa Purchasing

Constant Summary collapse

URL =
'https://gateway.cardstream.com/process.ashx'
APPROVED =
'00'
CURRENCY_CODES =
{ 
  "AUD"=> '036',
  "CAD"=> '124',
  "CZK"=> '203',
  "DKK"=> '208',
  "HKD"=> '344',
  "ICK"=> '352',
  "JPY"=> '392',
  "NOK"=> '578',
  "SGD"=> '702',
  "SEK"=> '752',
  "CHF"=> '756',
  "GBP"=> '826',
  "USD"=> '840',
  "EUR"=> '978'
}
TRANSACTIONS =
{
  :purchase => 'ESALE_KEYED',
  :refund => 'EREFUND_KEYED',
  :authorization => 'ESALE_KEYED'
}
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::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?

Methods included from Utils

#deprecated, generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

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.



88
89
90
91
92
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 88

def initialize(options = {})
  requires!(options, :login, :password)
  @options = options
  super
end

Instance Method Details

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



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/active_merchant/billing/gateways/card_stream.rb', line 94

def purchase(money, credit_card, options = {})
  requires!(options, :order_id)
  
  post = {}
  
  add_amount(post, money, options)
  add_invoice(post, money, credit_card, options)
  add_credit_card(post, credit_card)
  add_address(post, options)
  add_customer_data(post, options)

  commit(:purchase, post)
end