From 692bd9c77f59f7448703da9cc0cf7f3dc17e6b9e Mon Sep 17 00:00:00 2001 From: JacquesLarique <134954692+JacquesLarique@users.noreply.github.com> Date: Tue, 4 Feb 2025 17:07:09 +0100 Subject: [PATCH] fix(billing): standardize and fix redirection to order tracking (#15290) ref: MANAGER-16966 Signed-off-by: Jacques Larique --- .../new-billing/src/billing.routing.js | 19 +------------------ .../manager/modules/new-billing/src/index.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/packages/manager/modules/new-billing/src/billing.routing.js b/packages/manager/modules/new-billing/src/billing.routing.js index 00c8cae90459..df4642e60996 100644 --- a/packages/manager/modules/new-billing/src/billing.routing.js +++ b/packages/manager/modules/new-billing/src/billing.routing.js @@ -5,30 +5,13 @@ import { GUIDE_TRACKING_TAG, } from './constants/guides-header.constants'; -export default /* @ngInject */ ( - $stateProvider, - $urlRouterProvider, - $urlServiceProvider, -) => { +export default /* @ngInject */ ($stateProvider) => { $stateProvider.state('billing', { url: '', translations: { value: ['.'], format: 'json' }, redirectTo: 'billing.main', template, controller, - onEnter: () => { - $urlServiceProvider.rules.when('/order/:id', '/orders/:id'); - - $urlRouterProvider.when( - /\/(credits|fidelity|mean|method|ovhaccount|vouchers)$/, - ($location, $state) => { - const [, subroute] = $location.$$path.match( - /\/(credits|fidelity|mean|method|ovhaccount|vouchers)(\/.*)?/, - ); - return $state.go(`billing.payment.${subroute}`); - }, - ); - }, resolve: { denyEnterprise: ($q, $state, currentUser) => { if ( diff --git a/packages/manager/modules/new-billing/src/index.js b/packages/manager/modules/new-billing/src/index.js index 5e8ca6f05f8f..8030baf18d96 100644 --- a/packages/manager/modules/new-billing/src/index.js +++ b/packages/manager/modules/new-billing/src/index.js @@ -57,7 +57,7 @@ angular ovhManagerAccountMigration, ]) .config( - /* @ngInject */ ($stateProvider) => { + /* @ngInject */ ($stateProvider, $urlRouterProvider) => { $stateProvider.state('billing.**', { url: '/', lazyLoad: ($transition$) => { @@ -68,6 +68,19 @@ angular ); }, }); + $urlRouterProvider.when('/order/:id', ($location) => { + $location.url($location.url().replace('/order', '/orders')); + }); + + $urlRouterProvider.when( + /\/(credits|fidelity|mean|method|ovhaccount|vouchers)$/, + ($location, $state) => { + const [, subroute] = $location.$$path.match( + /\/(credits|fidelity|mean|method|ovhaccount|vouchers)(\/.*)?/, + ); + return $state.go(`billing.payment.${subroute}`); + }, + ); }, );