diff --git a/src/order/cart/serviceOption/order-cart-serviceOption.service.js b/src/order/cart/serviceOption/order-cart-serviceOption.service.js index d3bbe2e0..1e3a8a26 100644 --- a/src/order/cart/serviceOption/order-cart-serviceOption.service.js +++ b/src/order/cart/serviceOption/order-cart-serviceOption.service.js @@ -1,3 +1,8 @@ +/** + * @deprecated + * Use order/cartServiceOptions/cartServiceOptions.service.js instead + * as this service is overrided by the same name in this file. + */ angular.module("ovh-api-services").service("OvhApiOrderCartServiceOption", function ($injector) { "use strict"; diff --git a/src/order/cart/serviceOption/order-cart-serviceOption.v6.service.js b/src/order/cart/serviceOption/order-cart-serviceOption.v6.service.js index b0931aa0..60f4bb82 100644 --- a/src/order/cart/serviceOption/order-cart-serviceOption.v6.service.js +++ b/src/order/cart/serviceOption/order-cart-serviceOption.v6.service.js @@ -1,3 +1,8 @@ +/** + * @deprecated + * Use order/cartServiceOptions/cartServiceOptions.service.v6.js instead + * as this service is not reachable as there is a duplicate of the OvhApiOrderCartServiceOption service. + */ angular.module("ovh-api-services").service("OvhApiOrderCartServiceOptionV6", function ($resource, $cacheFactory) { "use strict"; diff --git a/src/order/cartServiceOption/cartServiceOption.service.js b/src/order/cartServiceOption/cartServiceOption.service.js index d12102b3..349bd843 100644 --- a/src/order/cartServiceOption/cartServiceOption.service.js +++ b/src/order/cartServiceOption/cartServiceOption.service.js @@ -1,6 +1,9 @@ angular.module("ovh-api-services").service("OvhApiOrderCartServiceOption", function ($injector) { "use strict"; return { + v6: function () { + return $injector.get("OvhApiOrderCartServiceOptionV6"); + }, Microsoft: function () { return $injector.get("OvhApiOrderCartServiceOptionMicrosoft"); }, diff --git a/src/order/cartServiceOption/cartServiceOption.v6.service.js b/src/order/cartServiceOption/cartServiceOption.v6.service.js new file mode 100644 index 00000000..b0931aa0 --- /dev/null +++ b/src/order/cartServiceOption/cartServiceOption.v6.service.js @@ -0,0 +1,33 @@ +angular.module("ovh-api-services").service("OvhApiOrderCartServiceOptionV6", function ($resource, $cacheFactory) { + + "use strict"; + + // Cache to invalidate + var queryCache = $cacheFactory("OvhApiOrderCartServiceOptionV6Query"); + var cache = $cacheFactory("OvhApiOrderCartServiceOptionV6"); + + var interceptor = { + response: function (response) { + orderCartServiceOption.resetQueryCache(); + return response.data; + } + }; + + var orderCartServiceOption = $resource("/order/cartServiceOption/:productName/:serviceName", { + productName: "@productName", + serviceName: "@serviceName" + }, { + get: { method: "GET", cache: cache, isArray: true }, + post: { method: "POST", interceptor: interceptor } + }); + + orderCartServiceOption.resetCache = function () { + cache.removeAll(); + }; + + orderCartServiceOption.resetQueryCache = function () { + queryCache.removeAll(); + }; + + return orderCartServiceOption; +});