mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 14:36:22 +02:00
added more conditions for unpaid and cancelled statuses
This commit is contained in:
parent
7b05e1e28a
commit
1b377dadcd
3 changed files with 9 additions and 2 deletions
|
@ -26,12 +26,15 @@ module EisBilling
|
|||
|
||||
def payment_orders_handler
|
||||
if @invoice.payment_orders.present?
|
||||
return if (@invoice.paid? && status.paid?) || (@invoice.cancelled? && status.cancelled?)
|
||||
return if (@invoice.paid? && status.paid?) || (@invoice.unpaid? && status.issued?)
|
||||
|
||||
if status.cancelled? || status.failed?
|
||||
if status.issued?
|
||||
@invoice.cancel_manualy
|
||||
elsif status.paid?
|
||||
@invoice.autobind_manually
|
||||
else
|
||||
# TODO
|
||||
# CANCELLED
|
||||
end
|
||||
else
|
||||
return unless status.paid?
|
||||
|
|
|
@ -33,6 +33,8 @@ module Invoice::Cancellable
|
|||
end
|
||||
|
||||
def cancel_manualy
|
||||
return unless cancellable?
|
||||
|
||||
account_activity = AccountActivity.find_by(invoice_id: id)
|
||||
account_activity_dup = account_activity.dup
|
||||
account_activity_dup.sum = -account_activity.sum.to_i
|
||||
|
|
|
@ -303,4 +303,6 @@ class EInvoiceResponseTest < ApplicationIntegrationTest
|
|||
|
||||
assert_equal registry_response[:message], 'Invoice with nonexisted-invoice number not found'
|
||||
end
|
||||
|
||||
test 'it should ignore if you trying to set failed status to canceled'
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue