From f09c8167849b68fdea0c58ce95b5d40c8265d07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phanie=20MOALLIC?= Date: Tue, 6 Apr 2021 14:50:58 +0200 Subject: [PATCH] feat(connectivity): add eligibility endpoints for partners (#321) Add: - testAddressPartners - testLinePartners Signed-off-by: Stephanie Moallic --- .../connectivity-eligibility.v6.service.js | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/api/connectivity/eligibility/connectivity-eligibility.v6.service.js b/src/api/connectivity/eligibility/connectivity-eligibility.v6.service.js index f619885e..c3deee94 100644 --- a/src/api/connectivity/eligibility/connectivity-eligibility.v6.service.js +++ b/src/api/connectivity/eligibility/connectivity-eligibility.v6.service.js @@ -98,5 +98,65 @@ angular.module('ovh-api-services').service('OvhApiConnectivityEligibilityV6', ($ ); }; + // Only for partners + eligibility.testAddressPartners = function ($scope, opts) { + const url = '/connectivity/eligibility/test/address/partners'; + + $scope.$on('$destroy', () => { + Poller.kill({ + scope: $scope.$id, + }); + }); + + return Poller.poll( + url, + null, + { + postData: { + streetCode: opts.streetCode, + streetNumber: opts.streetNumber, + }, + successRule: { + status(elem) { + return elem.status === 'error' || elem.status === 'ok'; + }, + }, + scope: $scope.$id, + method: 'POST', + retryMaxAttempts: 3, + }, + ); + }; + + // Only for partners + eligibility.testLinePartners = function ($scope, opts) { + const url = '/connectivity/eligibility/test/line/partners'; + + $scope.$on('$destroy', () => { + Poller.kill({ + scope: $scope.$id, + }); + }); + + return Poller.poll( + url, + null, + { + postData: { + lineNumber: opts.lineNumber, + status: opts.status, + }, + successRule: { + status(elem) { + return elem.status === 'error' || elem.status === 'ok'; + }, + }, + scope: $scope.$id, + method: 'POST', + retryMaxAttempts: 3, + }, + ); + }; + return eligibility; });