Sha256: bbc01dd2c2c67cdc67e023f4442e33999ed3a271f6794b400a921428044f1c99

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

require 'digest/md5'

module VaultedBilling
  module Gateways
    class Bogus
      include VaultedBilling::Gateway

      def initialize(options = {})
      end

      def add_customer(customer)
        respond_with(customer.to_vaulted_billing) { |c| c.vault_id = new_identifier }
      end

      def update_customer(customer)
        respond_with customer.to_vaulted_billing
      end

      def remove_customer(customer)
        respond_with customer.to_vaulted_billing
      end

      def add_customer_credit_card(customer, credit_card)
        respond_with(credit_card.to_vaulted_billing) { |c| c.vault_id = new_identifier }
      end

      def update_customer_credit_card(customer, credit_card)
        respond_with credit_card.to_vaulted_billing
      end

      def remove_customer_credit_card(customer, credit_card)
        respond_with credit_card.to_vaulted_billing
      end

      def authorize(customer, credit_card, amount)
        transaction_response
      end

      def void(transaction_id)
        transaction_response
      end

      def capture(transaction_id, amount)
        transaction_response
      end

      def refund(transaction_id, amount)
        transaction_response
      end


      private


      def new_identifier
        Digest::MD5.hexdigest("--#{Time.now.to_f}--#{rand(1_000_000)}--#{rand(1_000_000)}--")
      end

      def transaction_response
        respond_with VaultedBilling::Transaction.new(:id => new_identifier)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vaulted_billing-0.0.6 lib/vaulted_billing/gateways/bogus.rb
vaulted_billing-0.0.5 lib/vaulted_billing/gateways/bogus.rb
vaulted_billing-0.0.4 lib/vaulted_billing/gateways/bogus.rb
vaulted_billing-0.0.3 lib/vaulted_billing/gateways/bogus.rb
vaulted_billing-0.0.2 lib/vaulted_billing/gateways/bogus.rb