Fix payment not being captured due to being to small to cover order's distribution fee

This commit is contained in:
Rohan Mitchell
2013-08-06 11:25:57 +10:00
parent cfb8c05cb5
commit 8fdf0b6ff9
2 changed files with 4 additions and 1 deletions

View File

@@ -110,6 +110,7 @@ FactoryGirl.define do
after(:create) do |order|
p = create(:simple_product, :distributors => [order.distributor])
FactoryGirl.create(:line_item, :order => order, :product => p)
order.reload
end
end
end

View File

@@ -12,13 +12,15 @@ feature %q{
@order = create(:order_with_totals_and_distributor, :user => @user, :state => 'complete', :payment_state => 'balance_due')
# ensure order has a payment to capture
create :check_payment, order: @order, amount: @order.amount
distribution_fee = 1
create :check_payment, order: @order, amount: (@order.amount + distribution_fee)
@order.finalize!
end
context "managing orders" do
scenario "capture multiple payments from the orders index page" do
# d.cook: could also test for an order that has had payment voided, then a new check payment created but not yet captured. But it's not critical and I know it works anyway.
login_to_admin_section
click_link 'Orders'