From f1d40c5febf9e6f9b87815e25cd7540ab788bfcb Mon Sep 17 00:00:00 2001 From: Emile Bex <emile.bex@gmail.com> Date: Wed, 25 Oct 2023 09:26:57 +0200 Subject: [PATCH] fix(salesforce): add variable environment to disable SF requests --- src/contacts/contacts.service.ts | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/contacts/contacts.service.ts b/src/contacts/contacts.service.ts index 8554bb38..5d76e34c 100644 --- a/src/contacts/contacts.service.ts +++ b/src/contacts/contacts.service.ts @@ -41,25 +41,31 @@ export class ContactsService { async sendCompanyContactToSalesforce( contactCompanyFormDto: ContactCompanyFormDto ) { - return this.salesforceService.createOrUpdateCompanySalesforceLead( - contactCompanyFormDto - ); + if (process.env.ENABLE_SF === 'true') { + return this.salesforceService.createOrUpdateCompanySalesforceLead( + contactCompanyFormDto + ); + } } async sendCandidateContactToSalesforce( contactCandidateFormDto: ContactCandidateFormDto ) { - return this.salesforceService.createOrUpdateContactCandidateSalesforceLead( - contactCandidateFormDto - ); + if (process.env.ENABLE_SF === 'true') { + return this.salesforceService.createOrUpdateContactCandidateSalesforceLead( + contactCandidateFormDto + ); + } } async sendCandidateInscriptionToSalesforce( inscriptionCandidateFormDto: InscriptionCandidateFormDto ) { - return this.salesforceService.createOrUpdateInscriptionCandidateSalesforceLead( - inscriptionCandidateFormDto - ); + if (process.env.ENABLE_SF === 'true') { + return this.salesforceService.createOrUpdateInscriptionCandidateSalesforceLead( + inscriptionCandidateFormDto + ); + } } async sendContactUsMail(contactUsFormDto: ContactUsFormDto) { @@ -67,6 +73,8 @@ export class ContactsService { } async getCampaignsFromSF() { - return this.salesforceService.getCampaigns(); + if (process.env.ENABLE_SF === 'true') { + return this.salesforceService.getCampaigns(); + } } }