mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
parent
2cfcb6d54c
commit
d79ce87fba
1 changed files with 27 additions and 20 deletions
|
@ -105,29 +105,36 @@ class Epp::DomainsController < EppController
|
||||||
|
|
||||||
balance_ok?('renew', period, period_unit) # loading pricelist
|
balance_ok?('renew', period, period_unit) # loading pricelist
|
||||||
|
|
||||||
ActiveRecord::Base.transaction do
|
begin
|
||||||
success = @domain.renew(
|
ActiveRecord::Base.transaction(isolation: :serializable) do
|
||||||
params[:parsed_frame].css('curExpDate').text,
|
@domain.reload
|
||||||
period, period_unit
|
|
||||||
)
|
|
||||||
|
|
||||||
if success
|
success = @domain.renew(
|
||||||
unless balance_ok?('renew', period, period_unit)
|
params[:parsed_frame].css('curExpDate').text,
|
||||||
handle_errors
|
period, period_unit
|
||||||
fail ActiveRecord::Rollback
|
)
|
||||||
|
|
||||||
|
if success
|
||||||
|
unless balance_ok?('renew', period, period_unit)
|
||||||
|
handle_errors
|
||||||
|
fail ActiveRecord::Rollback
|
||||||
|
end
|
||||||
|
|
||||||
|
current_user.registrar.debit!({
|
||||||
|
sum: @domain_pricelist.price.amount,
|
||||||
|
description: "#{I18n.t('renew')} #{@domain.name}",
|
||||||
|
activity_type: AccountActivity::RENEW,
|
||||||
|
log_pricelist_id: @domain_pricelist.id
|
||||||
|
})
|
||||||
|
|
||||||
|
render_epp_response '/epp/domains/renew'
|
||||||
|
else
|
||||||
|
handle_errors(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
current_user.registrar.debit!({
|
|
||||||
sum: @domain_pricelist.price.amount,
|
|
||||||
description: "#{I18n.t('renew')} #{@domain.name}",
|
|
||||||
activity_type: AccountActivity::RENEW,
|
|
||||||
log_pricelist_id: @domain_pricelist.id
|
|
||||||
})
|
|
||||||
|
|
||||||
render_epp_response '/epp/domains/renew'
|
|
||||||
else
|
|
||||||
handle_errors(@domain)
|
|
||||||
end
|
end
|
||||||
|
rescue ActiveRecord::StatementInvalid => e
|
||||||
|
sleep rand / 100
|
||||||
|
retry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue