added test payment status test

This commit is contained in:
olegphenomenon 2022-01-27 14:16:19 +02:00
parent dbc7525dd5
commit fd9187a943

View file

@ -0,0 +1,31 @@
require 'test_helper'
class PaymentStatusIntegrationTest < ApplicationIntegrationTest
setup do
@invoice = invoices(:unpaid)
sign_in users(:api_bestnames)
end
def test_update_payment_status
payload = {
"order_reference" => @invoice.number,
"paid_at" => Time.zone.now - 2.minute,
"sum" => @invoice.total,
"payment_state" => 'settled'
}
p @invoice.payment_orders.count
p BankTransaction.count
assert_difference -> { @invoice.payment_orders.count } do
assert_difference -> { BankTransaction.count } do
put eis_billing_payment_status_path, params: payload,
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
end
assert_equal @invoice.account_activity.activity_type, "add_credit"
assert_response :ok
end
end