appirits/comable

View on GitHub
sample/db/samples/payments.rb

Summary

Maintainability
A
0 mins
Test Coverage
Comable::Sample.import('orders')
Comable::Sample.import('payment_methods')

payment_method = Comable::PaymentMethod.first

Comable::Order.complete.each do |order|
  payment = order.create_payment!(payment_method: payment_method, fee: payment_method.fee)
  payment.state = 'completed'
  payment.completed_at = Time.now
  payment.save!
end