class ActiveMerchant::Billing::BogusWorldpayGateway

Public Instance Methods

authorize_swipe(money, paysource, options = {}) click to toggle source
# File lib/active_merchant/billing/bogus_worldpay_gateway.rb, line 27
def authorize_swipe(money, paysource, options = {})
  money = amount(money)
  case normalize(paysource)
    when /2$/
      Response.new(false, FAILURE_MESSAGE, {:authorized_amount => money, :error => FAILURE_MESSAGE }, :test => true, :error_code => STANDARD_ERROR_CODE[:processing_error])
    when /3$/
      Response.new(false, FAILURE_MESSAGE, {:authorized_amount => money, :error => FAILURE_MESSAGE }, :test => true, :error_code => STANDARD_ERROR_CODE[:processing_error])
    else
      Response.new(true, SUCCESS_MESSAGE, {:authorized_amount => money}, :test => true, :authorization => AUTHORIZATION )
  end
end
create_token(paysource, options= {}) click to toggle source
# File lib/active_merchant/billing/bogus_worldpay_gateway.rb, line 4
def create_token(paysource, options= {})
  case normalize(paysource)
    when /1$/
      Response.new(
        true,
        SUCCESS_MESSAGE,
        { payment_token_id: SecureRandom.hex(10).upcase + '1' },
        :test => true,
        :authorization => AUTHORIZATION
      )
    when /2$/
      Response.new(
        false,
        FAILURE_MESSAGE,
        { payment_token_id: nil, error: FAILURE_MESSAGE },
        :test => true,
        :error_code => STANDARD_ERROR_CODE[:processing_error]
      )
    else
      raise Error, error_message(paysource)
  end
end
purchase_swipe(money, paysource, options = {}) click to toggle source
# File lib/active_merchant/billing/bogus_worldpay_gateway.rb, line 39
def purchase_swipe(money, paysource, options = {})
  money = amount(money)
  case normalize(paysource)
    when /3$/
      raise Error, error_message(paysource)
    when /2$/
      Response.new(
        false,
        FAILURE_MESSAGE,
        {:paid_amount => money, :error => FAILURE_MESSAGE },
        :test => true,
        :error_code => STANDARD_ERROR_CODE[:processing_error]
      )
    else
      Response.new(
        true,
        SUCCESS_MESSAGE,
        {:paid_amount => money},
        :test => true,
        :authorization => AUTHORIZATION
      )
  end
end