Sha256: f518515d5cb76507e6434b25b72ee86a7604836f370fafe5ef751853aafea7af

Contents?: true

Size: 1.17 KB

Versions: 18

Compression:

Stored size: 1.17 KB

Contents

# create payments based on the totals since they can't be known in YAML (quantities are random)
method = Spree::PaymentMethod.where(:name => 'Credit Card', :active => true).first

# Hack the current method so we're able to return a gateway without a RAILS_ENV
Spree::Gateway.class_eval do
  def self.current
    Spree::Gateway::Bogus.new
  end
end

# This table was previously called spree_creditcards, and older migrations
# reference it as such. Make it explicit here that this table has been renamed.
Spree::CreditCard.table_name = 'spree_credit_cards'

creditcard = Spree::CreditCard.create({ :cc_type => 'visa', :month => 12, :year => 2014, :last_digits => '1111',
                                        :first_name => 'Sean', :last_name => 'Schofield',
                                        :gateway_customer_profile_id => 'BGS-1234' }, :without_protection => true)

Spree::Order.all.each_with_index do |order, index|
  order.update!
  payment = order.payments.create!({ :amount => order.total, :source => creditcard.clone, :payment_method => method }, :without_protection => true)
  payment.update_attributes_without_callbacks({
    :state => 'pending',
    :response_code => '12345'
  })
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
spree_sample-2.0.13 db/samples/payments.rb
spree_sample-2.0.12 db/samples/payments.rb
spree_sample-2.0.11 db/samples/payments.rb
spree_sample-2.0.10 db/samples/payments.rb
spree_sample-2.0.9 db/samples/payments.rb
spree_sample-1.3.5 db/samples/payments.rb
spree_sample-2.0.8 db/samples/payments.rb
spree_sample-2.0.7 db/samples/payments.rb
spree_sample-2.0.6 db/samples/payments.rb
spree_sample-1.3.4 db/samples/payments.rb
spree_sample-2.0.5 db/samples/payments.rb
spree_sample-2.0.4 db/samples/payments.rb
spree_sample-2.0.3 db/samples/payments.rb
spree_sample-1.3.3 db/samples/payments.rb
spree_sample-2.0.2 db/samples/payments.rb
spree_sample-2.0.1 db/samples/payments.rb
spree_sample-2.0.0 db/samples/payments.rb
spree_sample-2.0.0.rc1 db/samples/payments.rb