| .. | .. |
|---|
| 239 | 239 | |
|---|
| 240 | 240 | /** |
|---|
| 241 | 241 | * Returns a new License file in JSON format based in a previous license |
|---|
| 242 | + * There is 2 /renew services with json input and with upload file |
|---|
| 242 | 243 | * |
|---|
| 243 | 244 | * @param mpfdi |
|---|
| 244 | 245 | * @param bsc |
|---|
| .. | .. |
|---|
| 301 | 302 | if (lic.getStatus() != LicenseStatus.ACTIVE && lic.getStatus() != LicenseStatus.PRE_ACTIVE) { |
|---|
| 302 | 303 | throw new SeCurisServiceException(ErrorCodes.INVALID_DATA, "The current license has been cancelled"); |
|---|
| 303 | 304 | } |
|---|
| 304 | | - } |
|---|
| 305 | | - |
|---|
| 306 | | - if (!renew) { |
|---|
| 305 | + } else { |
|---|
| 307 | 306 | try { |
|---|
| 308 | 307 | lic = License.findValidLicenseByRequestData(JsonUtils.toJSON(req), em); |
|---|
| 309 | 308 | } catch (SeCurisException e1) { |
|---|
| .. | .. |
|---|
| 334 | 333 | } |
|---|
| 335 | 334 | if (!renew && lic.getStatus() == LicenseStatus.REQUESTED && !pack.isLicensePreactivation()) { |
|---|
| 336 | 335 | throw new SeCurisServiceException(ErrorCodes.NO_AVAILABLE_LICENSES, "Current pack doesn't allow license preactivation"); |
|---|
| 336 | + } |
|---|
| 337 | + |
|---|
| 338 | + if (!req.getCustomerCode().equals(pack.getOrganization().getCode())) { |
|---|
| 339 | + throw new SeCurisServiceException(ErrorCodes.INVALID_LICENSE_REQUEST_DATA, "Customer code is not valid: " + req.getCustomerCode()); |
|---|
| 340 | + } |
|---|
| 341 | + |
|---|
| 342 | + if (!req.getLicenseTypeCode().equals(pack.getLicenseTypeCode())) { |
|---|
| 343 | + throw new SeCurisServiceException(ErrorCodes.INVALID_LICENSE_REQUEST_DATA, "License type code is not valid: " + req.getLicenseTypeCode()); |
|---|
| 337 | 344 | } |
|---|
| 338 | 345 | |
|---|
| 339 | 346 | SignedLicenseBean signedLicense; |
|---|
| .. | .. |
|---|
| 399 | 406 | |
|---|
| 400 | 407 | return signedLicense; |
|---|
| 401 | 408 | } |
|---|
| 402 | | - |
|---|
| 403 | 409 | } |
|---|