mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 06:56:23 +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
|
def payment_orders_handler
|
||||||
if @invoice.payment_orders.present?
|
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
|
@invoice.cancel_manualy
|
||||||
elsif status.paid?
|
elsif status.paid?
|
||||||
@invoice.autobind_manually
|
@invoice.autobind_manually
|
||||||
|
else
|
||||||
|
# TODO
|
||||||
|
# CANCELLED
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return unless status.paid?
|
return unless status.paid?
|
||||||
|
|
|
@ -33,6 +33,8 @@ module Invoice::Cancellable
|
||||||
end
|
end
|
||||||
|
|
||||||
def cancel_manualy
|
def cancel_manualy
|
||||||
|
return unless cancellable?
|
||||||
|
|
||||||
account_activity = AccountActivity.find_by(invoice_id: id)
|
account_activity = AccountActivity.find_by(invoice_id: id)
|
||||||
account_activity_dup = account_activity.dup
|
account_activity_dup = account_activity.dup
|
||||||
account_activity_dup.sum = -account_activity.sum.to_i
|
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'
|
assert_equal registry_response[:message], 'Invoice with nonexisted-invoice number not found'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'it should ignore if you trying to set failed status to canceled'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue