mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Add failed payments, update spec
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
%td.order1{"bo-text" => "payment.payment_method"}
|
||||
%td.order2{"bo-text" => "payment.updated_at"}
|
||||
%td.order3.show-for-large-up
|
||||
%i{"ng-class" => "{'ofn-i_012-warning': payment.state == 'invalid' || payment.state == 'void'}"}
|
||||
%i{"ng-class" => "{'ofn-i_012-warning': payment.state == 'invalid' || payment.state == 'void' || payment.state == 'failed'}"}
|
||||
%span{"bo-text" => "'spree.payment_states.' + payment.state | t | capitalize"}
|
||||
%td.order4.show-for-large-up
|
||||
%td.order5.text-right{"ng-class" => "{'credit' : payment.amount > 0, 'debit' : payment.amount < 0, 'paid' : payment.amount == 0}","bo-text" => "payment.amount | localizeCurrency"}
|
||||
|
||||
@@ -92,7 +92,7 @@ describe Spree.user_class do
|
||||
let!(:d2o1) { create(:completed_order_with_totals, distributor: distributor2, user_id: u2.id)}
|
||||
|
||||
let!(:completed_payment) { create(:payment, order: d1o1, state: 'completed')}
|
||||
let!(:payment) { create(:payment, order: d1o2, state: 'invalid')}
|
||||
let!(:payment) { create(:payment, order: d1o2, state: 'checkout')}
|
||||
|
||||
it "returns enterprises that the user has ordered from" do
|
||||
expect(u1.enterprises_ordered_from).to eq [distributor1.id]
|
||||
@@ -114,7 +114,7 @@ describe Spree.user_class do
|
||||
expect(u1.orders_by_distributor.first.distributed_orders).not_to include d1o3
|
||||
end
|
||||
|
||||
it "doesn't return uncompleted payments" do
|
||||
it "doesn't return payments that are still at checkout stage" do
|
||||
expect(u1.orders_by_distributor.first.distributed_orders.map{|o| o.payments}.flatten).not_to include payment
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user