mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
Merge pull request #2438 from internetee/ignore-statuses-update-if-invoice-already-paid
Ignore statuses update if invoice already paid
This commit is contained in:
commit
e3a5f15fce
2 changed files with 35 additions and 0 deletions
32
test/integration/eis_billing/payment_status_test.rb
Normal file
32
test/integration/eis_billing/payment_status_test.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
require 'test_helper'
|
||||
|
||||
class PaymentStatusTest < ApplicationIntegrationTest
|
||||
setup do
|
||||
sign_in users(:api_bestnames)
|
||||
@invoice = invoices(:one)
|
||||
@unpaid = invoices(:unpaid)
|
||||
@registrar = registrars(:bestnames)
|
||||
Spy.on_instance_method(EisBilling::BaseController, :authorized).and_return(true)
|
||||
end
|
||||
|
||||
def shoudl_update_buyer_balance
|
||||
assert @invoice.paid?
|
||||
assert_equal @invoice.buyer.balance.to_f, 100.0
|
||||
|
||||
payload = {
|
||||
payment_state: 'settled',
|
||||
order_reference: @unpaid.number,
|
||||
standing_amount: @unpaid.total,
|
||||
transaction_time: Time.zone.now,
|
||||
}
|
||||
|
||||
put eis_billing_payment_status_path, params: payload
|
||||
|
||||
@invoice.reload
|
||||
@invoice.buyer.reload
|
||||
@registrar.reload
|
||||
|
||||
assert @invoice.paid?
|
||||
assert_equal @invoice.buyer.balance.to_f, 100.0
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue