diff --git a/src/main/java/org/mskcc/cbio/oncokb/domain/enumeration/MailType.java b/src/main/java/org/mskcc/cbio/oncokb/domain/enumeration/MailType.java index bcd619376..f0815f48d 100644 --- a/src/main/java/org/mskcc/cbio/oncokb/domain/enumeration/MailType.java +++ b/src/main/java/org/mskcc/cbio/oncokb/domain/enumeration/MailType.java @@ -119,6 +119,9 @@ public enum MailType { , LIST_OF_UNAPPROVED_USERS(new MailTypeBuilder() .templateName("listOfUnapprovedUsers") .description("List of unapproved users")) + , TERMINATION_NOTIFICATION_EMAIL(new MailTypeBuilder() + .templateName("terminationNotificationEmail") + .description("Notifies admins about companies with licenses about to expire")) , TEST(new MailTypeBuilder() .templateName("testEmail") .description("Test")) diff --git a/src/main/java/org/mskcc/cbio/oncokb/service/MailService.java b/src/main/java/org/mskcc/cbio/oncokb/service/MailService.java index b716a38b3..e42eaec96 100644 --- a/src/main/java/org/mskcc/cbio/oncokb/service/MailService.java +++ b/src/main/java/org/mskcc/cbio/oncokb/service/MailService.java @@ -251,6 +251,21 @@ public void sendEmailFromTemplate(UserDTO user, MailType mailType, String subjec } } + public void sendInternalEmailFromTemplate(MailType mailType, String subject, String to, Context additionalContext) { + Context context = new Context(Locale.ENGLISH); + + if (additionalContext != null) + additionalContext.getVariableNames().forEach(name -> context.setVariable(name, additionalContext.getVariable(name))); + + String from = jHipsterProperties.getMail().getFrom(); + String content = templateEngine.process("mail/" + mailType.getTemplateName(), context); + try { + sendEmail(to, from, null, subject, content, null, false, true); + } catch (MailException | MessagingException e) { + log.warn("Internal email could not be sent to '{}'", to, e); + } + } + @Async public void sendActivationEmail(UserDTO user) { log.debug("Sending activation email to '{}'", user.getEmail()); diff --git a/src/main/java/org/mskcc/cbio/oncokb/service/dto/companyadditionalinfo/CompanyTermination.java b/src/main/java/org/mskcc/cbio/oncokb/service/dto/companyadditionalinfo/CompanyTermination.java index 112d032bd..7d8c0b11a 100644 --- a/src/main/java/org/mskcc/cbio/oncokb/service/dto/companyadditionalinfo/CompanyTermination.java +++ b/src/main/java/org/mskcc/cbio/oncokb/service/dto/companyadditionalinfo/CompanyTermination.java @@ -7,6 +7,7 @@ public class CompanyTermination implements Serializable { private Integer notificationDays; private Instant date; private String notes; + private Boolean hasBeenNotified; public Integer getNotificationDays() { return notificationDays; @@ -31,4 +32,12 @@ public String getNotes() { public void setNotes(String note) { this.notes = note; } + + public Boolean getHasBeenNotified() { + return hasBeenNotified; + } + + public void setHasBeenNotified(Boolean hasBeenNotified) { + this.hasBeenNotified = hasBeenNotified; + } } diff --git a/src/main/java/org/mskcc/cbio/oncokb/web/rest/CompanyResource.java b/src/main/java/org/mskcc/cbio/oncokb/web/rest/CompanyResource.java index e44051e99..13c7dc2ae 100644 --- a/src/main/java/org/mskcc/cbio/oncokb/web/rest/CompanyResource.java +++ b/src/main/java/org/mskcc/cbio/oncokb/web/rest/CompanyResource.java @@ -16,6 +16,9 @@ import org.mskcc.cbio.oncokb.web.rest.vm.VerifyCompanyNameVM; import org.mskcc.cbio.oncokb.service.dto.CompanyDTO; import org.mskcc.cbio.oncokb.service.dto.UserDTO; +import org.mskcc.cbio.oncokb.service.dto.companyadditionalinfo.CompanyAdditionalInfoDTO; +import org.mskcc.cbio.oncokb.service.dto.companyadditionalinfo.CompanyLicense; +import org.mskcc.cbio.oncokb.service.dto.companyadditionalinfo.CompanyTermination; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; @@ -28,6 +31,9 @@ import javax.validation.Valid; import java.net.URI; import java.net.URISyntaxException; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.Set; @@ -195,4 +201,35 @@ public ResponseEntity deleteCompany(@PathVariable Long id) { companyService.delete(id); return ResponseEntity.ok().build(); } + + @GetMapping("/companies/licenses-about-to-expire-pending-notification") + public List getLicensesAboutToExpirePendingNotification() { + log.debug("Request to get Company license is about to expire"); + Instant now = Instant.now(); + ArrayList companies = new ArrayList<>(); + for (CompanyDTO company : companyService.findAll()) { + CompanyAdditionalInfoDTO additionalInfo = company.getAdditionalInfo(); + if (additionalInfo != null) { + CompanyLicense license = additionalInfo.getLicense(); + if (license != null) { + CompanyTermination termination = license.getTermination(); + if (termination != null) { + Boolean hasBeenNotified = termination.getHasBeenNotified(); + if (hasBeenNotified == null) { + hasBeenNotified = false; + } + Integer notificationDays = termination.getNotificationDays(); + Instant terminationDate = termination.getDate(); + if (!hasBeenNotified && notificationDays != null && terminationDate != null) { + Instant start = terminationDate.minus(notificationDays, ChronoUnit.DAYS); + if (now.isAfter(start) && now.isBefore(terminationDate)) { + companies.add(company.getId()); + } + } + } + } + } + } + return companies; + } } diff --git a/src/main/java/org/mskcc/cbio/oncokb/web/rest/MailsController.java b/src/main/java/org/mskcc/cbio/oncokb/web/rest/MailsController.java index 98f671956..e53e12a46 100644 --- a/src/main/java/org/mskcc/cbio/oncokb/web/rest/MailsController.java +++ b/src/main/java/org/mskcc/cbio/oncokb/web/rest/MailsController.java @@ -26,8 +26,12 @@ import org.mskcc.cbio.oncokb.service.dto.CompanyDTO; import org.mskcc.cbio.oncokb.service.dto.TerminationEmailDTO; import org.mskcc.cbio.oncokb.service.dto.UserDTO; +import org.mskcc.cbio.oncokb.service.dto.companyadditionalinfo.CompanyAdditionalInfoDTO; +import org.mskcc.cbio.oncokb.service.dto.companyadditionalinfo.CompanyLicense; +import org.mskcc.cbio.oncokb.service.dto.companyadditionalinfo.CompanyTermination; import org.mskcc.cbio.oncokb.service.mapper.UserMapper; import org.mskcc.cbio.oncokb.web.rest.errors.BadRequestAlertException; +import org.mskcc.cbio.oncokb.web.rest.vm.CompanyVM; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; @@ -40,7 +44,9 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import org.mskcc.cbio.oncokb.config.Constants; +import org.thymeleaf.context.Context; /** * REST controller for managing mails. @@ -184,4 +190,60 @@ public TerminationEmailDTO getTerminationWarningEmail(@PathVariable Long id) { public void sendTerminationWarningEmail(@Valid @RequestBody TerminationEmailDTO terminationEmailDTO) throws MessagingException { this.mailService.sendEmail(terminationEmailDTO); } + + @PostMapping("mails/termination-notification") + public void sendTerminationNotificationEmail(@Valid @RequestBody List companyIds) throws MessagingException { + List allCompanies = companyService.findAll(); + List companiesToNotify = new ArrayList<>(); + for (CompanyDTO company : allCompanies) { + if (companyIds.contains(company.getId())) { + companiesToNotify.add(company); + } + } + EmailAddresses addresses = this.applicationProperties.getEmailAddresses(); + Context context = new Context(); + final String baseUrl = ServletUriComponentsBuilder.fromCurrentContextPath().build().toUriString(); + context.setVariable("baseUrl", baseUrl); + context.setVariable("companies", companiesToNotify); + String to = addresses.getLicenseAddress(); + mailService.sendInternalEmailFromTemplate(MailType.TERMINATION_NOTIFICATION_EMAIL, "Licenses are about to expire.", to, context); + + for (CompanyDTO company : companiesToNotify) { + if (company.getAdditionalInfo() == null) { + company.setAdditionalInfo(new CompanyAdditionalInfoDTO()); + } + + CompanyAdditionalInfoDTO additionalInfoDTO = company.getAdditionalInfo(); + + if (additionalInfoDTO.getLicense() == null) { + additionalInfoDTO.setLicense(new CompanyLicense()); + } + + CompanyLicense license = additionalInfoDTO.getLicense(); + + if (license.getTermination() == null) { + license.setTermination(new CompanyTermination()); + } + + CompanyTermination termination = license.getTermination(); + + termination.setHasBeenNotified(true); + + CompanyVM companyVM = new CompanyVM(); + companyVM.setId(company.getId()); + companyVM.setName(company.getName()); + companyVM.setDescription(company.getDescription()); + companyVM.setCompanyType(company.getCompanyType()); + companyVM.setLicenseType(company.getLicenseType()); + companyVM.setLicenseModel(company.getLicenseModel()); + companyVM.setLicenseStatus(company.getLicenseStatus()); + companyVM.setBusinessContact(company.getBusinessContact()); + companyVM.setLegalContact(company.getLegalContact()); + companyVM.setCompanyDomains(company.getCompanyDomains()); + companyVM.setAdditionalInfo(company.getAdditionalInfo()); + + companyService.updateCompany(companyVM); + } + + } } diff --git a/src/main/resources/templates/mail/terminationNotificationEmail.html b/src/main/resources/templates/mail/terminationNotificationEmail.html new file mode 100644 index 000000000..6d1920429 --- /dev/null +++ b/src/main/resources/templates/mail/terminationNotificationEmail.html @@ -0,0 +1,26 @@ + + + + Termination Notification Email + + + +

The following companies licenses are about to expire.

+ + + + + + + + + + + + +
NameLink to Company Page
+ + Company Page +
+ + diff --git a/src/main/webapp/app/components/newCompanyForm/NewCompanyForm.tsx b/src/main/webapp/app/components/newCompanyForm/NewCompanyForm.tsx index 18a28fc39..372a2a367 100644 --- a/src/main/webapp/app/components/newCompanyForm/NewCompanyForm.tsx +++ b/src/main/webapp/app/components/newCompanyForm/NewCompanyForm.tsx @@ -39,18 +39,6 @@ import CompanyAdditionalInfo, { createDefaultAdditionalInfo, } from 'app/pages/companyPage/CompanyAdditionalInfo'; -const defaultInfo: CompanyAdditionalInfoDTO = { - license: { - autoRenewal: false, - activation: '', - termination: { - date: '', - notificationDays: 60, - notes: '', - }, - }, -}; - type INewCompanyFormProps = { onValidSubmit: (newCompany: Partial) => void; }; diff --git a/src/main/webapp/app/pages/companyPage/CompanyAdditionalInfo.tsx b/src/main/webapp/app/pages/companyPage/CompanyAdditionalInfo.tsx index b5913f1e3..27dd72a02 100644 --- a/src/main/webapp/app/pages/companyPage/CompanyAdditionalInfo.tsx +++ b/src/main/webapp/app/pages/companyPage/CompanyAdditionalInfo.tsx @@ -96,6 +96,7 @@ export default function CompanyAdditionalInfo({ undefined ? additionalInfo?.license?.termination?.notificationDays : 90, + hasBeenNotified: false, }, }, }); @@ -122,6 +123,7 @@ export default function CompanyAdditionalInfo({ notificationDays: value ? +value : ((undefined as unknown) as number), + hasBeenNotified: false, }, }, }); diff --git a/src/main/webapp/app/shared/api/generated/API-docs.json b/src/main/webapp/app/shared/api/generated/API-docs.json index 87c19a006..32c8baea9 100644 --- a/src/main/webapp/app/shared/api/generated/API-docs.json +++ b/src/main/webapp/app/shared/api/generated/API-docs.json @@ -881,6 +881,40 @@ "deprecated": false } }, + "/api/companies/licenses-about-to-expire-pending-notification": { + "get": { + "tags": [ + "company-resource" + ], + "summary": "getLicensesAboutToExpirePendingNotification", + "operationId": "getLicensesAboutToExpirePendingNotificationUsingGET", + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + } + }, "/api/companies/lookup": { "get": { "tags": [ @@ -1656,6 +1690,54 @@ "deprecated": false } }, + "/api/mails/termination-notification": { + "post": { + "tags": [ + "mails-controller" + ], + "summary": "sendTerminationNotificationEmail", + "operationId": "sendTerminationNotificationEmailUsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "in": "body", + "name": "companyIds", + "description": "companyIds", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + ], + "responses": { + "200": { + "description": "OK" + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false + } + }, "/api/mails/termination-warning": { "post": { "tags": [ @@ -1842,6 +1924,7 @@ "TOKEN_HAS_BEEN_EXPOSED_USER", "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED", "LIST_OF_UNAPPROVED_USERS", + "TERMINATION_NOTIFICATION_EMAIL", "TEST" ] }, @@ -3174,7 +3257,7 @@ "properties": { "activation": { "type": "string", - "format": "date" + "format": "date-time" }, "autoRenewal": { "type": "boolean" @@ -3190,7 +3273,10 @@ "properties": { "date": { "type": "string", - "format": "date" + "format": "date-time" + }, + "hasBeenNotified": { + "type": "boolean" }, "notes": { "type": "string" @@ -3402,6 +3488,7 @@ "TOKEN_HAS_BEEN_EXPOSED_USER", "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED", "LIST_OF_UNAPPROVED_USERS", + "TERMINATION_NOTIFICATION_EMAIL", "TEST" ] } @@ -3923,6 +4010,7 @@ "TOKEN_HAS_BEEN_EXPOSED_USER", "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED", "LIST_OF_UNAPPROVED_USERS", + "TERMINATION_NOTIFICATION_EMAIL", "TEST" ] }, diff --git a/src/main/webapp/app/shared/api/generated/API.ts b/src/main/webapp/app/shared/api/generated/API.ts index 54b954bb3..a93e8db25 100644 --- a/src/main/webapp/app/shared/api/generated/API.ts +++ b/src/main/webapp/app/shared/api/generated/API.ts @@ -72,6 +72,8 @@ export type CompanyLicense = { export type CompanyTermination = { 'date': string + 'hasBeenNotified': boolean + 'notes': string 'notificationDays': number @@ -143,7 +145,7 @@ export type LoginVM = { export type MailTypeInfo = { 'description': string - 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TEST" + 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TERMINATION_NOTIFICATION_EMAIL" | "TEST" }; export type ManagedUserVM = { @@ -363,7 +365,7 @@ export type UserDetailsDTO = { export type UserMailsDTO = { 'id': number - 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TEST" + 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TERMINATION_NOTIFICATION_EMAIL" | "TEST" 'sentBy': string @@ -1942,6 +1944,68 @@ export default class API { return response.body; }); }; + getLicensesAboutToExpirePendingNotificationUsingGETURL(parameters: { + $queryParameters ? : any + }): string { + let queryParameters: any = {}; + let path = '/api/companies/licenses-about-to-expire-pending-notification'; + + if (parameters.$queryParameters) { + Object.keys(parameters.$queryParameters).forEach(function(parameterName) { + var parameter = parameters.$queryParameters[parameterName]; + queryParameters[parameterName] = parameter; + }); + } + let keys = Object.keys(queryParameters); + return this.domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : ''); + }; + + /** + * getLicensesAboutToExpirePendingNotification + * @method + * @name API#getLicensesAboutToExpirePendingNotificationUsingGET + */ + getLicensesAboutToExpirePendingNotificationUsingGETWithHttpInfo(parameters: { + $queryParameters ? : any, + $domain ? : string + }): Promise < request.Response > { + const domain = parameters.$domain ? parameters.$domain : this.domain; + const errorHandlers = this.errorHandlers; + const request = this.request; + let path = '/api/companies/licenses-about-to-expire-pending-notification'; + let body: any; + let queryParameters: any = {}; + let headers: any = {}; + let form: any = {}; + return new Promise(function(resolve, reject) { + headers['Accept'] = '*/*'; + + if (parameters.$queryParameters) { + Object.keys(parameters.$queryParameters).forEach(function(parameterName) { + var parameter = parameters.$queryParameters[parameterName]; + queryParameters[parameterName] = parameter; + }); + } + + request('GET', domain + path, body, headers, queryParameters, form, reject, resolve, errorHandlers); + + }); + }; + + /** + * getLicensesAboutToExpirePendingNotification + * @method + * @name API#getLicensesAboutToExpirePendingNotificationUsingGET + */ + getLicensesAboutToExpirePendingNotificationUsingGET(parameters: { + $queryParameters ? : any, + $domain ? : string + }): Promise < Array < number > + > { + return this.getLicensesAboutToExpirePendingNotificationUsingGETWithHttpInfo(parameters).then(function(response: request.Response) { + return response.body; + }); + }; getCompanyByNameUsingGETURL(parameters: { 'name': string, $queryParameters ? : any @@ -3458,6 +3522,82 @@ export default class API { return response.body; }); }; + sendTerminationNotificationEmailUsingPOSTURL(parameters: { + 'companyIds': Array < number > , + $queryParameters ? : any + }): string { + let queryParameters: any = {}; + let path = '/api/mails/termination-notification'; + + if (parameters.$queryParameters) { + Object.keys(parameters.$queryParameters).forEach(function(parameterName) { + var parameter = parameters.$queryParameters[parameterName]; + queryParameters[parameterName] = parameter; + }); + } + let keys = Object.keys(queryParameters); + return this.domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : ''); + }; + + /** + * sendTerminationNotificationEmail + * @method + * @name API#sendTerminationNotificationEmailUsingPOST + * @param {} companyIds - companyIds + */ + sendTerminationNotificationEmailUsingPOSTWithHttpInfo(parameters: { + 'companyIds': Array < number > , + $queryParameters ? : any, + $domain ? : string + }): Promise < request.Response > { + const domain = parameters.$domain ? parameters.$domain : this.domain; + const errorHandlers = this.errorHandlers; + const request = this.request; + let path = '/api/mails/termination-notification'; + let body: any; + let queryParameters: any = {}; + let headers: any = {}; + let form: any = {}; + return new Promise(function(resolve, reject) { + headers['Accept'] = '*/*'; + headers['Content-Type'] = 'application/json'; + + if (parameters['companyIds'] !== undefined) { + body = parameters['companyIds']; + } + + if (parameters['companyIds'] === undefined) { + reject(new Error('Missing required parameter: companyIds')); + return; + } + + if (parameters.$queryParameters) { + Object.keys(parameters.$queryParameters).forEach(function(parameterName) { + var parameter = parameters.$queryParameters[parameterName]; + queryParameters[parameterName] = parameter; + }); + } + + request('POST', domain + path, body, headers, queryParameters, form, reject, resolve, errorHandlers); + + }); + }; + + /** + * sendTerminationNotificationEmail + * @method + * @name API#sendTerminationNotificationEmailUsingPOST + * @param {} companyIds - companyIds + */ + sendTerminationNotificationEmailUsingPOST(parameters: { + 'companyIds': Array < number > , + $queryParameters ? : any, + $domain ? : string + }): Promise < any > { + return this.sendTerminationNotificationEmailUsingPOSTWithHttpInfo(parameters).then(function(response: request.Response) { + return response.body; + }); + }; sendTerminationWarningEmailUsingPOSTURL(parameters: { 'terminationEmailDto': TerminationEmailDTO, $queryParameters ? : any @@ -3675,7 +3815,7 @@ export default class API { 'by': string, 'cc' ? : string, 'from': string, - 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TEST", + 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TERMINATION_NOTIFICATION_EMAIL" | "TEST", 'to': string, $queryParameters ? : any }): string { @@ -3725,7 +3865,7 @@ export default class API { 'by': string, 'cc' ? : string, 'from': string, - 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TEST", + 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TERMINATION_NOTIFICATION_EMAIL" | "TEST", 'to': string, $queryParameters ? : any, $domain ? : string @@ -3808,7 +3948,7 @@ export default class API { 'by': string, 'cc' ? : string, 'from': string, - 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TEST", + 'mailType': "ACTIVATION" | "CREATION" | "APPROVAL" | "API_ACCESS_APPROVAL" | "APPROVAL_ALIGN_LICENSE_WITH_COMPANY" | "REJECTION" | "REJECTION_US_SANCTION" | "REJECT_ALUMNI_ADDRESS" | "PASSWORD_RESET" | "LICENSE_REVIEW_COMMERCIAL" | "LICENSE_REVIEW_RESEARCH_COMMERCIAL" | "LICENSE_REVIEW_HOSPITAL" | "CLARIFY_ACADEMIC_FOR_PROFIT" | "CLARIFY_ACADEMIC_NON_INSTITUTE_EMAIL" | "CLARIFY_USE_CASE" | "CLARIFY_DUPLICATE_USER" | "CLARIFY_REGISTRATION_INFO" | "LICENSE_OPTIONS" | "VERIFY_EMAIL_BEFORE_ACCOUNT_EXPIRES" | "ACTIVATE_FREE_TRIAL" | "TRIAL_ACCOUNT_IS_ABOUT_TO_EXPIRE" | "TRIAL_ACCOUNT_IS_ACTIVATED" | "DATA_USAGE_EXCEEDS_THRESHOLD" | "TOKEN_HAS_BEEN_EXPOSED" | "TOKEN_HAS_BEEN_EXPOSED_USER" | "SEARCHING_RESPONSE_STRUCTURE_HAS_CHANGED" | "LIST_OF_UNAPPROVED_USERS" | "TERMINATION_NOTIFICATION_EMAIL" | "TEST", 'to': string, $queryParameters ? : any, $domain ? : string