Create System / Admin payment log

This commit is contained in:
Karl Erik Õunapuu 2020-02-04 18:36:06 +02:00
parent 6418924faf
commit 2645654aef
10 changed files with 122 additions and 41 deletions

View file

@ -58,6 +58,30 @@ class ProcessPaymentsTaskTest < ActiveSupport::TestCase
assert @invoice.paid?
end
def test_attaches_paid_payment_order_to_invoice
assert @invoice.unpaid?
capture_io { run_task }
@invoice.reload
payment_order = @invoice.payment_orders.last
assert_equal 'PaymentOrders::SystemPayment', payment_order.type
assert payment_order.paid?
end
def test_attaches_failed_payment_order_to_invoice
assert @invoice.unpaid?
account = accounts(:cash)
account.update!(registrar: registrars(:goodnames))
capture_io { run_task }
@invoice.reload
payment_order = @invoice.payment_orders.last
assert_equal 'PaymentOrders::SystemPayment', payment_order.type
assert payment_order.failed?
end
def test_output
assert_output "Transactions processed: 1\n" do
run_task
@ -75,4 +99,4 @@ class ProcessPaymentsTaskTest < ActiveSupport::TestCase
invoice.update!({ account_activity: nil, cancelled_at: nil }.merge(attributes))
invoice
end
end
end