@@ -221,34 +221,25 @@ namespace netlicensing {
221221 * Validates active licenses of the licensee. See NetLicensingAPI for details:
222222 * https://netlicensing.io/wiki/licensee-services#validate-licensee
223223 */
224+ [[deprecated(" Use LicenseeService::validate(Context, std::string, ValidationParameters) instead" )]]
224225 ValidationResult LicenseeService::validate (Context& ctx,
225226 const std::string& licenseeNumber,
226227 const std::string& productNumber/* = std::string()*/ ,
227228 const std::string& licenseeName/* = std::string()*/ ,
228229 const parameters_type& validationParameters) {
229230
230- std::string endpoint = std::string (LICENSEE_ENDPOINT_PATH) + " / " + escape_string (licenseeNumber) + " / " + ENDPOINT_PATH_VALIDATE ;
231- parameters_type params;
232- if (!productNumber. empty ()) params. push_back ( std::make_pair (PRODUCT_NUMBER, escape_string ( productNumber)) );
233- if (!licenseeName. empty ()) params. push_back ( std::make_pair (PROP_LICENSEE_NAME, escape_string ( licenseeName)) );
231+ ValidationParameters vp ;
232+
233+ vp. setProductNumber ( productNumber);
234+ vp. setLicenseeName ( licenseeName);
234235
235236 // Add licensing model specific validation parameters
236237 for (parameters_type::const_iterator paramIt = validationParameters.begin ();
237- paramIt != validationParameters.end (); ++paramIt) {
238- params.push_back (std::make_pair (escape_string (paramIt->first ), escape_string (paramIt->second )));
239- }
240-
241- long http_code;
242- std::string res = ctx.post (endpoint, params, http_code);
243- ValidationResult validationResult;
244- ValidationResultMapper vrm (validationResult);
245- traverse (vrm, res);
246-
247- if (http_code != 200 ) {
248- throw RestException (vrm.getInfos (), http_code);
238+ paramIt != validationParameters.end (); ++paramIt) {
239+ vp.setLicenseeProperty (escape_string (paramIt->first ), escape_string (paramIt->second ));
249240 }
250241
251- return validationResult ;
242+ return LicenseeService::validate (ctx, licenseeNumber, vp) ;
252243 }
253244
254245 /* *
@@ -265,19 +256,12 @@ namespace netlicensing {
265256 if (!escape_string (validationParameters.getProductNumber ()).empty ()) {
266257 params.push_back (std::make_pair (PRODUCT_NUMBER, escape_string (validationParameters.getProductNumber ())));
267258 }
268- if (!escape_string (validationParameters.getLicenseeName ()).empty ()) {
269- params.push_back (std::make_pair (PROP_LICENSEE_NAME, escape_string (validationParameters.getLicenseeName ())));
270- }
271- #ifdef __clang__
272- #pragma clang diagnostic push
273- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
274- #endif
275- if (!escape_string (validationParameters.getLicenseeSecret ()).empty ()) {
276- params.push_back (std::make_pair (PROP_LICENSEE_SECRET, escape_string (validationParameters.getLicenseeSecret ())));
259+
260+ for (auto const & ent1 : validationParameters.getLicenseeProperties ()) {
261+ auto const &key = ent1.first ;
262+ auto const & value = ent1.second ;
263+ params.push_back (std::make_pair (key, escape_string (value)));
277264 }
278- #ifdef __clang__
279- #pragma clang diagnostic pop
280- #endif
281265
282266 int paramIt = 0 ;
283267 for (auto const &ent1 : validationParameters.getParameters ()) {
0 commit comments