mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 21:54:48 +02:00
Merge remote-tracking branch 'origin/master' into 1422-record-payment-method-and-failed-payments
This commit is contained in:
commit
cb76a9f962
8 changed files with 118 additions and 4 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,3 +1,10 @@
|
||||||
|
29.01.2020
|
||||||
|
* Fixed the invoice binding bug where process failed if registrar tried to load a sum that they have used before [#1496](https://github.com/internetee/registry/issues/1496)
|
||||||
|
|
||||||
|
28.01.2020
|
||||||
|
* Registrar: fixed sorting of domain view [#1461](https://github.com/internetee/registry/issues/1461)
|
||||||
|
* clientHold status is now set once instead of resetting it every time the job is run [#1480](https://github.com/internetee/registry/issues/1480)
|
||||||
|
|
||||||
27.01.2020
|
27.01.2020
|
||||||
* Admin: fixed history view for domains with legacy id [#1489](https://github.com/internetee/registry/issues/1489)
|
* Admin: fixed history view for domains with legacy id [#1489](https://github.com/internetee/registry/issues/1489)
|
||||||
|
|
||||||
|
@ -56,6 +63,9 @@
|
||||||
* Set not null constraint on contact.name db column [#1417](https://github.com/internetee/registry/pull/1417)
|
* Set not null constraint on contact.name db column [#1417](https://github.com/internetee/registry/pull/1417)
|
||||||
* Removed domain name from registrant_verifications table [#1431](https://github.com/internetee/registry/pull/1431)
|
* Removed domain name from registrant_verifications table [#1431](https://github.com/internetee/registry/pull/1431)
|
||||||
|
|
||||||
|
19.11.2019
|
||||||
|
* Updated Rails to 5.0.7 [#377](https://github.com/internetee/registry/issues/377)
|
||||||
|
|
||||||
15.11.2019
|
15.11.2019
|
||||||
* Restored EPP exception logging to syslog [#1371](https://github.com/internetee/registry/issues/1371)
|
* Restored EPP exception logging to syslog [#1371](https://github.com/internetee/registry/issues/1371)
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,8 @@ class Registrar
|
||||||
:contacts_ident_eq,
|
:contacts_ident_eq,
|
||||||
:nameservers_hostname_eq,
|
:nameservers_hostname_eq,
|
||||||
:valid_to_gteq,
|
:valid_to_gteq,
|
||||||
:valid_to_lteq)
|
:valid_to_lteq,
|
||||||
|
:s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,13 @@ class BankTransaction < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def invoice
|
def invoice
|
||||||
@invoice ||= registrar.invoices.find_by(total: sum) if registrar
|
return unless registrar
|
||||||
|
|
||||||
|
@invoice ||= registrar.invoices
|
||||||
|
.order(created_at: :asc)
|
||||||
|
.unpaid
|
||||||
|
.non_cancelled
|
||||||
|
.find_by(total: sum)
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrar
|
def registrar
|
||||||
|
|
|
@ -25,7 +25,8 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
||||||
|
|
||||||
def should_notify_on_soft_force_delete?
|
def should_notify_on_soft_force_delete?
|
||||||
force_delete_scheduled? && contact_notification_sent_date.blank? &&
|
force_delete_scheduled? && contact_notification_sent_date.blank? &&
|
||||||
force_delete_start.to_date <= Time.zone.now.to_date && force_delete_type.to_sym == :soft
|
force_delete_start.to_date <= Time.zone.now.to_date && force_delete_type.to_sym == :soft &&
|
||||||
|
!statuses.include?(DomainStatus::CLIENT_HOLD)
|
||||||
end
|
end
|
||||||
|
|
||||||
def client_holdable?
|
def client_holdable?
|
||||||
|
|
|
@ -11,8 +11,9 @@ module Concerns
|
||||||
|
|
||||||
::Domain.force_delete_scheduled.each do |domain|
|
::Domain.force_delete_scheduled.each do |domain|
|
||||||
proceed_client_hold(domain: domain)
|
proceed_client_hold(domain: domain)
|
||||||
log_end_end_client_hold(domain)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
log_end_end_force_delete_job
|
||||||
end
|
end
|
||||||
|
|
||||||
def proceed_client_hold(domain:)
|
def proceed_client_hold(domain:)
|
||||||
|
@ -24,6 +25,8 @@ module Concerns
|
||||||
|
|
||||||
domain.save(validate: false)
|
domain.save(validate: false)
|
||||||
notify_client_hold(domain)
|
notify_client_hold(domain)
|
||||||
|
|
||||||
|
log_end_end_client_hold(domain)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,6 +22,12 @@ module Concerns
|
||||||
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Successfully set client_hold on (#{domain.name})"
|
STDOUT << "#{Time.zone.now.utc} - Successfully set client_hold on (#{domain.name})"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log_end_end_force_delete_job
|
||||||
|
return if Rails.env.test?
|
||||||
|
|
||||||
|
STDOUT << "#{Time.zone.now.utc} - All client_hold setting are done\n"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,79 @@ class BankTransactionTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_binds_if_this_sum_invoice_already_present
|
||||||
|
create_payable_invoice(number: '2222', total: 10, reference_no: '1234567')
|
||||||
|
another_invoice = @invoice.dup
|
||||||
|
another_invoice.save(validate: false)
|
||||||
|
another_invoice.update(reference_no: '7654321', number: '2221')
|
||||||
|
|
||||||
|
another_item = @invoice.items.first.dup
|
||||||
|
another_item.invoice = another_invoice
|
||||||
|
another_item.save
|
||||||
|
another_invoice.reload
|
||||||
|
|
||||||
|
first_transaction = BankTransaction.new(description: 'invoice #2221',
|
||||||
|
sum: 10,
|
||||||
|
description: 'Order nr 1 from registrar 1234567 second number 2345678')
|
||||||
|
|
||||||
|
first_transaction.create_activity(another_invoice.buyer, another_invoice)
|
||||||
|
|
||||||
|
transaction = BankTransaction.new(description: 'invoice #2222',
|
||||||
|
sum: 10,
|
||||||
|
description: 'Order nr 1 from registrar 1234567 second number 2345678')
|
||||||
|
|
||||||
|
assert_difference 'AccountActivity.count' do
|
||||||
|
transaction.autobind_invoice
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_binds_if_this_sum_cancelled_invoice_already_present
|
||||||
|
create_payable_invoice(number: '2222', total: 10, reference_no: '1234567')
|
||||||
|
another_invoice = @invoice.dup
|
||||||
|
another_invoice.save(validate: false)
|
||||||
|
|
||||||
|
|
||||||
|
another_item = @invoice.items.first.dup
|
||||||
|
another_item.invoice = another_invoice
|
||||||
|
|
||||||
|
another_item.save
|
||||||
|
another_invoice.reload
|
||||||
|
another_invoice.update(reference_no: '1234567', number: '2221', cancelled_at: Time.zone.now)
|
||||||
|
|
||||||
|
transaction = BankTransaction.new(description: 'invoice #2222',
|
||||||
|
sum: 10,
|
||||||
|
description: 'Order nr 1 from registrar 1234567 second number 2345678')
|
||||||
|
|
||||||
|
assert_difference 'AccountActivity.count' do
|
||||||
|
transaction.autobind_invoice
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_marks_the_first_one_as_paid_if_same_sum
|
||||||
|
create_payable_invoice(number: '2222', total: 10, reference_no: '1234567')
|
||||||
|
another_invoice = @invoice.dup
|
||||||
|
another_invoice.save(validate: false)
|
||||||
|
another_invoice.update(reference_no: '7654321', number: '2221')
|
||||||
|
|
||||||
|
another_item = @invoice.items.first.dup
|
||||||
|
another_item.invoice = another_invoice
|
||||||
|
another_item.save
|
||||||
|
another_invoice.reload
|
||||||
|
|
||||||
|
transaction = BankTransaction.new(description: 'invoice #2222',
|
||||||
|
sum: 10,
|
||||||
|
description: 'Order nr 1 from registrar 1234567 second number 2345678')
|
||||||
|
|
||||||
|
assert_difference 'AccountActivity.count' do
|
||||||
|
transaction.autobind_invoice
|
||||||
|
end
|
||||||
|
|
||||||
|
@invoice.reload
|
||||||
|
another_invoice.reload
|
||||||
|
assert(@invoice.paid?)
|
||||||
|
assert_not(another_invoice.paid?)
|
||||||
|
end
|
||||||
|
|
||||||
def test_matches_against_invoice_nubmber_and_reference_number_in_description
|
def test_matches_against_invoice_nubmber_and_reference_number_in_description
|
||||||
create_payable_invoice(number: '2222', total: 10, reference_no: '1234567')
|
create_payable_invoice(number: '2222', total: 10, reference_no: '1234567')
|
||||||
transaction = BankTransaction.new(description: 'invoice #2222',
|
transaction = BankTransaction.new(description: 'invoice #2222',
|
||||||
|
|
|
@ -38,4 +38,18 @@ class DomainCronTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
assert_emails 1
|
assert_emails 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_does_not_sets_hold_if_already_set
|
||||||
|
Setting.redemption_grace_period = 30
|
||||||
|
|
||||||
|
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
|
||||||
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
@domain.schedule_force_delete(type: :soft)
|
||||||
|
@domain.reload
|
||||||
|
@domain.update(template_name: 'legal_person', statuses: [DomainStatus::CLIENT_HOLD])
|
||||||
|
travel_to Time.zone.parse('2010-08-06')
|
||||||
|
DomainCron.start_client_hold
|
||||||
|
|
||||||
|
assert_emails 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue