lib/active_merchant/billing/gateways/skip_jack.rb in activemerchant-1.4.2 vs lib/active_merchant/billing/gateways/skip_jack.rb in activemerchant-1.5.0

- old
+ new

@@ -1,12 +1,19 @@ +#!ruby19 +# encoding: utf-8 + module ActiveMerchant #:nodoc: module Billing #:nodoc: class SkipJackGateway < Gateway API_VERSION = '?.?' - LIVE_URL = "https://www.skipjackic.com/scripts/evolvcc.dll" - TEST_URL = "https://developer.skipjackic.com/scripts/evolvcc.dll" - + + LIVE_HOST = "https://www.skipjackic.com" + TEST_HOST = "https://developer.skipjackic.com" + + BASIC_PATH = "/scripts/evolvcc.dll" + ADVANCED_PATH = "/evolvcc/evolvcc.aspx" + ACTIONS = { :authorization => 'AuthorizeAPI', :change_status => 'SJAPI_TransactionChangeStatusRequest', :get_status => 'SJAPI_TransactionStatusRequest' } @@ -125,13 +132,13 @@ '-86' => 'Airline ticket info invalid Airline ticket info field is invalid or empty', '-87' => 'Point of Sale check routing number must be 9 numeric digits Point of Sale check routing number is invalid or empty.', '-88' => 'Point of Sale check account number missing or invalid Point of Sale check account number is invalid or empty.', '-89' => 'Point of Sale check MICR missing or invalid Point of Sale check MICR invalid or empty.', '-90' => 'Point of Sale check number missing or invalid Point of Sale check number invalid or empty.', - '-91' => 'CVV2 Invalid or empty “Make CVV a required field feature” enabled (New feature 01 April 2006) in the Merchant Account Setup interface but no CVV code was sent in the transaction data.', + '-91' => 'CVV2 Invalid or empty "Make CVV a required field feature" enabled (New feature 01 April 2006) in the Merchant Account Setup interface but no CVV code was sent in the transaction data.', '-92' => 'Approval Code Invalid Approval Code Invalid. Approval Code is a 6 digit code.', - '-93' => 'Blind Credits Request Refused “Allow Blind Credits” option must be enabled on the Skipjack Merchant Account.', + '-93' => 'Blind Credits Request Refused "Allow Blind Credits" option must be enabled on the Skipjack Merchant Account.', '-94' => 'Blind Credits Failed', '-95' => 'Voice Authorization Request Refused Voice Authorization option must be enabled on the Skipjack Merchant Account.', '-96' => 'Voice Authorizations Failed', '-97' => 'Fraud Rejection Violates Velocity Settling.', '-98' => 'Invalid Discount Amount', @@ -168,10 +175,12 @@ # ==== Options # # * <tt>:login</tt> -- The SkipJack Merchant Serial Number. # * <tt>:password</tt> -- The SkipJack Developer Serial Number. # * <tt>:test => +true+ or +false+</tt> -- Use the test or live SkipJack url. + # * <tt>:advanced => +true+ or +false+</tt> -- Set to true if you're using an advanced processor + # See the SkipJack Integration Guide for details. (default: +false+) def initialize(options = {}) requires!(options, :login, :password) @options = options super end @@ -234,16 +243,19 @@ add_transaction_id(post, identification) commit(:change_status, money, post) end def status(order_id) - post = { } - post[:szOrderNumber] = :order_id - commit(:get_status, nil, post) + commit(:get_status, nil, :szOrderNumber => order_id) end - + private + + def advanced? + @options[:advanced] + end + def add_forced_settlement(post, options) post[:szForceSettlement] = options[:force_settlment] ? 1 : 0 end def add_status_action(post, action) @@ -261,10 +273,11 @@ :cvv_result => response[:szCVV2ResponseCode] ) end def url_for(action) - result = test? ? TEST_URL : LIVE_URL + result = test? ? TEST_HOST : LIVE_HOST + result += advanced? && action == :authorization ? ADVANCED_PATH : BASIC_PATH result += "?#{ACTIONS[action]}" end def add_credentials(params, action) if action == :authorization