diff --git a/packages/manager/modules/billing-components/src/components/cancellation-form/billing-confirmTerminate.service.js b/packages/manager/modules/billing-components/src/components/cancellation-form/billing-confirmTerminate.service.js index b3542a9a5312..58da1ef0c8df 100644 --- a/packages/manager/modules/billing-components/src/components/cancellation-form/billing-confirmTerminate.service.js +++ b/packages/manager/modules/billing-components/src/components/cancellation-form/billing-confirmTerminate.service.js @@ -49,6 +49,10 @@ export default class BillingTerminate { return this.$http.post(`/services/${serviceId}/terminate`); } + serviceTerminationForVrack(serviceId) { + return this.$http.post(`/vrack/${serviceId}/terminate`); + } + getTerminationForm(serviceId) { return this.OvhApiServices.Form() .v6() diff --git a/packages/manager/modules/billing-components/src/components/services-actions/services-actions.controller.js b/packages/manager/modules/billing-components/src/components/services-actions/services-actions.controller.js index 0fc02e097fd9..b1b0b4ce6cb6 100644 --- a/packages/manager/modules/billing-components/src/components/services-actions/services-actions.controller.js +++ b/packages/manager/modules/billing-components/src/components/services-actions/services-actions.controller.js @@ -118,6 +118,12 @@ export default class ServicesActionsCtrl { case SERVICE_TYPE.VRACK_SERVICES: this.resiliateLink = `${this.autorenewLink}/terminate-service?id=${this.service.id}${serviceTypeParam}`; break; + case SERVICE_TYPE.VRACK: + this.resiliateLink = + this.service.status === 'suspended' || this.service.isEmpty + ? `${this.autorenewLink}/terminate-vrack-blocked?id=${this.service.id}${serviceTypeParam}` + : `${this.autorenewLink}/terminate-service?id=${this.service.id}${serviceTypeParam}`; + break; default: this.resiliateLink = this.service.canResiliateByEndRule() ? resiliationByEndRuleLink @@ -134,9 +140,11 @@ export default class ServicesActionsCtrl { } canResiliate() { - return ![this.SERVICE_TYPE.PACK_XDSL, this.SERVICE_TYPE.VRACK].includes( - this.service.serviceType, - ); + if (this.service.serviceType === this.SERVICE_TYPE.VRACK) { + return this.canDeleteVrack; + } + + return ![this.SERVICE_TYPE.PACK_XDSL].includes(this.service.serviceType); } getExchangeBilling() { diff --git a/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/controller.js b/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/controller.js index cd38f93dcfa5..a7a8733a48c3 100644 --- a/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/controller.js +++ b/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/controller.js @@ -9,6 +9,9 @@ export default class TerminateAgoraServiceController { } terminate() { + if (this.serviceType === 'VRACK') { + return this.BillingTerminate.serviceTerminationForVrack(this.id); + } return this.BillingTerminate.serviceTermination(this.id); } diff --git a/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/translations/Messages_fr_FR.json b/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/translations/Messages_fr_FR.json index 538233fa726b..b20de2fab0d7 100644 --- a/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/translations/Messages_fr_FR.json +++ b/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/translations/Messages_fr_FR.json @@ -3,6 +3,10 @@ "autorenew_agora_terminate_service_VRACK_SERVICES_RESOURCE": "Résilier vRack Services", "autorenew_agora_terminate_service_warning_OKMS_RESOURCE": "Veuillez confirmer la résiliation de votre KMS", "autorenew_agora_terminate_service_warning_VRACK_SERVICES_RESOURCE": "Veuillez confirmer la résiliation de vRAck Services", + "autorenew_agora_terminate_service_VRACK": "Résilier vRack", + "autorenew_agora_terminate_service_warning_VRACK": "Veuillez confirmer la résiliation de vRAck", + "autorenew_agora_terminate_service_success_VRACK": "Votre demande de résiliation de votre Vrack a été prise en compte. Un e-mail contenant la procédure vous a été envoyé.", + "autorenew_agora_terminate_service_error_VRACK": "Une erreur est survenue lors de la demande de résiliation de votre Vrack. {{error}}", "autorenew_agora_terminate_service_success_OKMS_RESOURCE": "Votre demande de résiliation de votre KMS a été prise en compte. Un e-mail contenant la procédure vous a été envoyé.", "autorenew_agora_terminate_service_success_VRACK_SERVICES_RESOURCE": "Votre demande de résiliation de vRAck Services a été prise en compte. Un e-mail contenant la procédure vous a été envoyé.", "autorenew_agora_terminate_service_error_OKMS_RESOURCE": "Une erreur est survenue lors de la demande de résiliation de votre KMS. {{error}}", diff --git a/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/component.js b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/component.js new file mode 100644 index 000000000000..e3f73b71f999 --- /dev/null +++ b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/component.js @@ -0,0 +1,11 @@ +import template from './template.html'; + +export default { + bindings: { + goBack: '<', + id: '<', + serviceType: '<', + }, + template, + name: 'billingAutorenewTerminateVrackBlocked', +}; diff --git a/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/index.js b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/index.js new file mode 100644 index 000000000000..5cfe60cf74bd --- /dev/null +++ b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/index.js @@ -0,0 +1,25 @@ +import angular from 'angular'; +import angularTranslate from 'angular-translate'; +import ngAtInternet from '@ovh-ux/ng-at-internet'; +import ngTranslateAsyncLoader from '@ovh-ux/ng-translate-async-loader'; +import '@ovh-ux/ui-kit'; +import uiRouter from '@uirouter/angularjs'; + +import component from './component'; +import routing from './routing'; + +const moduleName = 'ovhManagerBillingAutorenewTerminateVrackBlocked'; + +angular + .module(moduleName, [ + angularTranslate, + ngAtInternet, + ngTranslateAsyncLoader, + 'oui', + uiRouter, + ]) + .config(routing) + .component(component.name, component) + .run(/* @ngTranslationsInject:json ./translations */); + +export default moduleName; diff --git a/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/routing.js b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/routing.js new file mode 100644 index 000000000000..695598d9cd57 --- /dev/null +++ b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/routing.js @@ -0,0 +1,21 @@ +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('app.account.billing.autorenew.terminateVrackBlocked', { + url: '/terminate-vrack-blocked?id&serviceType', + views: { + modal: { + component: 'billingAutorenewTerminateVrackBlocked', + }, + }, + layout: 'modal', + resolve: { + goBack: /* @ngInject */ (goToAutorenew) => goToAutorenew, + id: /* @ngInject */ ($transition$) => $transition$.params().id, + serviceType: /* @ngInject */ ($transition$) => + $transition$.params().serviceType, + breadcrumb: () => null, + }, + atInternet: { + ignore: true, + }, + }); +}; diff --git a/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/template.html b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/template.html new file mode 100644 index 000000000000..a91f189df4f3 --- /dev/null +++ b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/template.html @@ -0,0 +1,13 @@ + + + + + diff --git a/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/translations/Messages_fr_FR.json b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/translations/Messages_fr_FR.json new file mode 100644 index 000000000000..e4684f276845 --- /dev/null +++ b/packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack-blocked/translations/Messages_fr_FR.json @@ -0,0 +1,5 @@ +{ + "autorenew_agora_terminate_vrack_blocked_title": "Supprimer mon Vrack", + "autorenew_agora_terminate_vrack_blocked_description": "Afin de supprimer votre Vrack vous devez au préalable deconnecter tous les services qui y sont ratachés", + "autorenew_agora_terminate_vrack_blocked_close": "Fermer" +} diff --git a/packages/manager/modules/billing/src/autoRenew/autorenew.module.js b/packages/manager/modules/billing/src/autoRenew/autorenew.module.js index afb15c98a527..f612f880aac6 100644 --- a/packages/manager/modules/billing/src/autoRenew/autorenew.module.js +++ b/packages/manager/modules/billing/src/autoRenew/autorenew.module.js @@ -30,6 +30,7 @@ import terminateHostingWeb from './actions/terminateHostingWeb/hosting-web.modul import terminatePrivateDatabase from './actions/terminatePrivateDatabase/private-database.module'; import terminateWebCoach from './actions/terminate-webcoach/terminate-webcoach.module'; import terminateAllDOm from './actions/terminate-all-dom/module'; +import terminateVrackBlocked from './actions/terminate-vrack-blocked'; import update from './actions/update/update.module'; import warnNicBilling from './actions/warnNicBilling/warnNicBilling.module'; import warnPendingDebt from './actions/warnPendingDebt/pending-debt.module'; @@ -71,6 +72,7 @@ angular terminatePrivateDatabase, terminateWebCoach, terminateAllDOm, + terminateVrackBlocked, uiRouter, update, warnNicBilling, diff --git a/packages/manager/modules/billing/src/autoRenew/autorenew.routing.js b/packages/manager/modules/billing/src/autoRenew/autorenew.routing.js index b38e9567aee5..8c3473b65bc6 100644 --- a/packages/manager/modules/billing/src/autoRenew/autorenew.routing.js +++ b/packages/manager/modules/billing/src/autoRenew/autorenew.routing.js @@ -91,6 +91,7 @@ export default /* @ngInject */ ($stateProvider, coreConfigProvider) => { }, featureAvailability: /* @ngInject */ (ovhFeatureFlipping) => ovhFeatureFlipping.checkFeatureAvailability([ + 'vrack:delete', 'billing:management', 'billing:autorenew2016Deployment', ]), @@ -103,6 +104,8 @@ export default /* @ngInject */ ($stateProvider, coreConfigProvider) => { featureAvailability?.isFeatureAvailable( 'billing:autorenew2016Deployment', ) || false, + canDeleteVrack: /* @ngInject */ (featureAvailability) => + featureAvailability?.isFeatureAvailable('vrack:delete') || false, hideBreadcrumb: /* @ngInject */ () => true, trackingPrefix: () => 'dedicated::account::billing::autorenew', },