Skip to content

Commit

Permalink
feat(twilio): remove twilio be (#7870)
Browse files Browse the repository at this point in the history
* feat: remove twilio from fe

* chore: restore shared files as they are used by BE

* feat: remove twilio from be pass 1

* test: verification.service.spec.ts

* test: admin-form.service.spec.ts

* fix: remove deleted files

* fix: lint issues

* fix: verification routes

* chore: fix lint errors

* Revert "chore: restore shared files as they are used by BE"

This reverts commit bc8ee76.

* feat: remove twilio verifications

* chore: fix lint issues

* chore: remove retrievePublicFormsWithSmsVerification func

* chore: fix lint issues

* feat: remove get/set for msgSrvcName, remove aws ssm

* chore: remove stoplight/prism

* feat: remove twilioCredentials from i18n

* feat: remove msgSrvcName

* chore: document msgSrvcName in code

* fix: remove unused import

* feat: update docs to mark msgSrvcName as legacy

---------

Co-authored-by: Kevin Foong <[email protected]>
  • Loading branch information
KenLSM and kevin9foong authored Nov 29, 2024
1 parent 3be7636 commit a0f1a15
Show file tree
Hide file tree
Showing 63 changed files with 79 additions and 5,905 deletions.
7 changes: 0 additions & 7 deletions .template-env
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ FORMSG_SDK_MODE=
## If the variable exists, the [verified] feature will be enabled.
# VERIFICATION_SECRET_KEY=

## Twilio
## If the below variables exists, the [sms] feature will be enabled.
# TWILIO_ACCOUNT_SID=
# TWILIO_API_KEY=
# TWILIO_API_SECRET=
# TWILIO_MESSAGING_SERVICE_SID=

## SingPass, CorpPass related environment variables
# If you are not a member of the Singapore Government, you can safely exclude
Expand Down Expand Up @@ -113,7 +107,6 @@ FORMSG_SDK_MODE=

# Used to check if BE Server is currently running on local development environment
# One of boolean: "true" | "false"
# USE_MOCK_TWILIO=
# USE_MOCK_POSTMAN_SMS=

# POSTMAN_MOP_CAMPAIGN_ID=
Expand Down
20 changes: 0 additions & 20 deletions __tests__/integration/helpers/twilio.ts

This file was deleted.

45 changes: 0 additions & 45 deletions __tests__/unit/backend/helpers/jest-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,50 +233,6 @@ const insertEncryptForm = async ({
}
}

const insertFormWithMsgSrvcName = async ({
formId,
userId,
mailDomain = 'test.gov.sg',
mailName = 'test',
shortName = 'govtest',
formOptions = {},
msgSrvcName = 'mockMsgSrvcname',
}: {
formId?: Schema.Types.ObjectId
userId?: Schema.Types.ObjectId
mailName?: string
mailDomain?: string
shortName?: string
formOptions?: Partial<IForm>
msgSrvcName?: string
} = {}): Promise<{
form: IFormSchema
user: IUserSchema
agency: IAgencySchema
}> => {
const { user, agency } = await insertFormCollectionReqs({
userId,
mailDomain,
mailName,
shortName,
})

const FormModel = getFormModel(mongoose)
const form = await FormModel.create({
title: 'example form title',
admin: user._id,
_id: formId,
...formOptions,
msgSrvcName: msgSrvcName,
})

return {
form: form as IFormSchema,
user,
agency,
}
}

const getFullFormById = async (
formId: string,
): Promise<IPopulatedForm | null> =>
Expand Down Expand Up @@ -344,7 +300,6 @@ const dbHandler = {
clearCollection,
insertEmailForm,
insertEncryptForm,
insertFormWithMsgSrvcName,
getFullFormById,
insertFormSubmission,
insertFormFeedback,
Expand Down
12 changes: 1 addition & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ services:
# Keep in sync with the development key in
# https://github.com/opengovsg/formsg-javascript-sdk/blob/develop/src/resource/signing-keys.ts
- SIGNING_SECRET_KEY=HDBXpu+2/gu10bLHpy8HjpN89xbA6boH9GwibPGJA8BOXmB+zOUpxCP33/S5p8vBWlPokC7gLR0ca8urVwfMUQ==
# Mock Twilio credentials. SMSes do not work in dev environment.
- TWILIO_ACCOUNT_SID=AC00000000000000000000000000000000
- TWILIO_API_KEY=mockTwilioApiKey
- TWILIO_API_SECRET=mockTwilioApiSecret
- TWILIO_MESSAGING_SERVICE_SID=MG00000000000000000000000000000000
- SP_OIDC_NDI_DISCOVERY_ENDPOINT=http://localhost:5156/singpass/v2/.well-known/openid-configuration
- SP_OIDC_NDI_JWKS_ENDPOINT=http://localhost:5156/singpass/v2/.well-known/keys
- SP_OIDC_RP_CLIENT_ID=rpClientId
Expand Down Expand Up @@ -167,7 +162,7 @@ services:
depends_on:
- backend
environment:
- SERVICES=s3,sqs,secretsmanager
- SERVICES=s3,sqs
- DNS_ADDRESS=0
- EXTRA_CORS_ALLOWED_ORIGINS=http://localhost:5173
volumes:
Expand All @@ -189,11 +184,6 @@ services:
- STRIPE_API_KEY
- STRIPE_DEVICE_NAME=StripeWebhookListener

mocktwilio:
image: stoplight/prism:4
network_mode: 'service:backend' # reuse backend service's network stack so that it can resolve localhost:4010 to prismtwilio:4010
command: mock https://raw.githubusercontent.com/twilio/twilio-oai/main/spec/json/twilio_api_v2010.json

volumes:
mongodb_data:
driver: local
1 change: 0 additions & 1 deletion frontend/src/constants/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const GUIDE_SPCP_ESRVCID =
'https://go.gov.sg/formsg-guide-singpass-myinfo'
export const GUIDE_ENABLE_SPCP =
'https://go.gov.sg/formsg-guide-singpass-myinfo-enable'
export const GUIDE_TWILIO = 'https://go.gov.sg/formsg-guide-verified-smses'
export const GUIDE_ATTACHMENT_SIZE_LIMIT =
'https://go.gov.sg/formsg-guide-attachments'
export const GUIDE_E2EE = 'https://go.gov.sg/formsg-guide-e2e'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
FormPermissionsDto,
PermissionsUpdateDto,
PreviewFormViewDto,
SmsCountsDto,
} from '~shared/types/form/form'

import { ADMINFORM_USETEMPLATE_ROUTE } from '~constants/routes'
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/features/whats-new/FeatureUpdateList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,5 @@ export const FEATURE_UPDATE_LIST: FeatureUpdateList = {
alt: 'The new FormSG experience',
},
},
{
title: 'Big little improvements',
date: new Date('12 October 2022 GMT+8'),
description: dedent`
* Easily paste options into Radio fields
* Add your Twilio credentials so form-fillers can verify their mobile number
* Enhanced security to prevent malicious inputs in form responses, [read more about it here](https://formsg.gitbook.io/form-user-guide/faq/faq/storage-mode#why-do-i-have-an-additional-quote-in-some-of-my-responses)
`,
},
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ export const enSG: Fields = {
},
allowInternationalNumber: 'Allow international numbers',
smsCounts: 'SMSes used',
twilioCredentials: {
success: 'Twilio credentials added',
exceedQuota: 'You have reached the free tier limit for SMS verification.',
noCredentials: 'Twilio credentials not added.',
cta: 'Add credentials now',
},
},
date: {
dateValidation: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ export interface Fields {
}
allowInternationalNumber: string
smsCounts: string
twilioCredentials: {
success: string
exceedQuota: string
noCredentials: string
cta: string
}
}
date: {
dateValidation: {
Expand Down
Loading

0 comments on commit a0f1a15

Please sign in to comment.