Class/Module Index [+]

Quicksearch

ActiveMerchant::Billing::CyberSourceGateway

See the remote and mocked unit test files for example usage. Pay special attention to the contents of the options hash.

Initial setup instructions can be found in cybersource.com/support_center/implementation/downloads/soap_api/SOAP_toolkits.pdf

Debugging If you experience an issue with this gateway be sure to examine the transaction information from a general transaction search inside the CyberSource Business Center for the full error messages including field names.

Important Notes

Constants

LIVE_URL
TEST_URL

Public Class Methods

new(options = {}) click to toggle source

These are the options that can be used when creating a new CyberSource Gateway object.

:login => your username

:password => the transaction key you generated in the Business Center

:test => true sets the gateway to test mode

:vat_reg_number => your VAT registration number

:nexus => “WI CA QC” sets the states/provinces where you have a physical presense for tax purposes

:ignore_avs => true don’t want to use AVS so continue processing even if AVS would have failed

:ignore_cvv => true don’t want to use CVV so continue processing even if CVV would have failed

# File lib/active_merchant/billing/gateways/cyber_source.rb, line 93
def initialize(options = {})
  requires!(options, :login, :password)
  @options = options
  super
end

Public Instance Methods

auth_reversal(money, identification, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/cyber_source.rb, line 113
def auth_reversal(money, identification, options = {})
  commit(build_auth_reversal_request(money, identification, options), options)
end
authorize(money, creditcard, options = {}) click to toggle source

Request an authorization for an amount from CyberSource

You must supply an :order_id in the options hash

# File lib/active_merchant/billing/gateways/cyber_source.rb, line 107
def authorize(money, creditcard, options = {})
  requires!(options,  :order_id, :email)
  setup_address_hash(options)
  commit(build_auth_request(money, creditcard, options), options )
end
calculate_tax(creditcard, options) click to toggle source

CyberSource requires that you provide line item information for tax calculations If you do not have prices for each item or want to simplify the situation then pass in one fake line item that costs the subtotal of the order

The line_item hash goes in the options hash and should look like

:line_items => [
  {
    :declared_value => '1',
    :quantity => '2',
    :code => 'default',
    :description => 'Giant Walrus',
    :sku => 'WA323232323232323'
  },
  {
    :declared_value => '6',
    :quantity => '1',
    :code => 'default',
    :description => 'Marble Snowcone',
    :sku => 'FAKE1232132113123'
  }
]

This functionality is only supported by this particular gateway may be changed at any time

# File lib/active_merchant/billing/gateways/cyber_source.rb, line 168
def calculate_tax(creditcard, options)
  requires!(options,  :line_items)
  setup_address_hash(options)
  commit(build_tax_calculation_request(creditcard, options), options)       
end
capture(money, authorization, options = {}) click to toggle source

Capture an authorization that has previously been requested

# File lib/active_merchant/billing/gateways/cyber_source.rb, line 118
def capture(money, authorization, options = {})
  setup_address_hash(options)
  commit(build_capture_request(money, authorization, options), options)
end
credit(money, identification, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/cyber_source.rb, line 139
def credit(money, identification, options = {})
  deprecated CREDIT_DEPRECATION_MESSAGE
  refund(money, identification, options)
end
purchase(money, creditcard, options = {}) click to toggle source

Purchase is an auth followed by a capture You must supply an order_id in the options hash

# File lib/active_merchant/billing/gateways/cyber_source.rb, line 125
def purchase(money, creditcard, options = {})
  requires!(options, :order_id, :email)
  setup_address_hash(options)
  commit(build_purchase_request(money, creditcard, options), options)
end
refund(money, identification, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/cyber_source.rb, line 135
def refund(money, identification, options = {})
  commit(build_credit_request(money, identification, options), options)
end
test?() click to toggle source

Should run against the test servers or not?

# File lib/active_merchant/billing/gateways/cyber_source.rb, line 100
def test?
  @options[:test] || Base.gateway_mode == :test
end
void(identification, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/cyber_source.rb, line 131
def void(identification, options = {})
  commit(build_void_request(identification, options), options)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.