Sha256: 39a693138c24c0e4a8bc69f1935ca4162277010d03a042b1c761584a5ae6fedb

Contents?: true

Size: 995 Bytes

Versions: 2

Compression:

Stored size: 995 Bytes

Contents

module ActiveMerchant
  module Billing
    class BogusStripeGateway < BogusGateway
      def initialize(options = {})
        # noop
      end


      def authorize(money, paysource, options = {})
        if paysource.respond_to?(:emv?) && paysource.emv?
          authorize_emv(money, paysource, options)
        else
          authorize_swipe(money, paysource, options)
        end
      end

      def store(paysource, options = {})
        case normalize(paysource)
        when /1$/, /^tok/, ""
          Response.new(true, SUCCESS_MESSAGE, { "id" => "cus_5678", "sources" => { "data" => [{ "id" => 'card_1111', "last4" => '1111', "exp_month" => "1", "exp_year" => "2020", "brand" => "Test Card" }] } }, test: true)
        when /2$/
          Response.new(false, FAILURE_MESSAGE, { billingid: nil, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
        else
          raise Error, error_message(paysource)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-stripe-1.1.1 lib/active_merchant/billing/bogus_stripe_gateway.rb
workarea-stripe-1.1.0 lib/active_merchant/billing/bogus_stripe_gateway.rb