Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: release v6.73.0 #6657

Merged
merged 5 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v6.73.0](https://github.com/opengovsg/FormSG/compare/v6.73.0...v6.73.0)

- fix: add specific payment descriptions logic for payment types [`#6651`](https://github.com/opengovsg/FormSG/pull/6651)

#### [v6.73.0](https://github.com/opengovsg/FormSG/compare/v6.72.0...v6.73.0)

> 24 August 2023

- fix: failed ensures should block submission [`#6654`](https://github.com/opengovsg/FormSG/pull/6654)
- build: merge v6.72.0 into develop [`#6650`](https://github.com/opengovsg/FormSG/pull/6650)
- fix: address should be lower case [`#6653`](https://github.com/opengovsg/FormSG/pull/6653)
- build: release v6.72.0 [`#6649`](https://github.com/opengovsg/FormSG/pull/6649)
- chore: bump version to v6.73.0 [`d190a63`](https://github.com/opengovsg/FormSG/commit/d190a63cace7ccd4e757195f85e5b38101eac14a)

#### [v6.72.0](https://github.com/opengovsg/FormSG/compare/v6.71.0...v6.72.0)

> 23 August 2023

- feat: dashboard infobox message for e2ee [`#6647`](https://github.com/opengovsg/FormSG/pull/6647)
- fix: prevent saving empty product items [`#6646`](https://github.com/opengovsg/FormSG/pull/6646)
- feat: ui review changes [`#6637`](https://github.com/opengovsg/FormSG/pull/6637)
Expand All @@ -16,6 +32,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- feat: upgrade sgid sdk [`#6584`](https://github.com/opengovsg/FormSG/pull/6584)
- build: merge release v6.71.0 into develop [`#6636`](https://github.com/opengovsg/FormSG/pull/6636)
- build: release v6.71.0 [`#6635`](https://github.com/opengovsg/FormSG/pull/6635)
- chore: bump version to v6.72.0 [`9392c77`](https://github.com/opengovsg/FormSG/commit/9392c77580b4425e6e7cd319b24b081fbc6899e3)

#### [v6.71.0](https://github.com/opengovsg/FormSG/compare/v6.70.0...v6.71.0)

Expand Down Expand Up @@ -102,7 +119,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- build: release v6.67.0 [`#6555`](https://github.com/opengovsg/FormSG/pull/6555)
- chore: bump version to 6.67.1 [`b641094`](https://github.com/opengovsg/FormSG/commit/b641094d40a67a888e3a8ac967a43f9d1732bd49)

#### [v6.67.0](https://github.com/opengovsg/FormSG/compare/v6.66.1...v6.67.0)
#### [v6.67.0](https://github.com/opengovsg/FormSG/compare/v6.66.0...v6.67.0)

> 20 July 2023

Expand All @@ -112,23 +129,16 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- build: release v6.66.0 [`#6550`](https://github.com/opengovsg/FormSG/pull/6550)
- feat: MyInfo Children compound fields beta [`#6523`](https://github.com/opengovsg/FormSG/pull/6523)
- ci: adjust timeouts for playwright pipe [`#6551`](https://github.com/opengovsg/FormSG/pull/6551)
- fix: use proof-of-payment for payment receipt/invoice [`#6549`](https://github.com/opengovsg/FormSG/pull/6549)
- build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 in /frontend [`#6548`](https://github.com/opengovsg/FormSG/pull/6548)
- fix(deps): bump word-wrap from 1.2.3 to 1.2.4 [`#6547`](https://github.com/opengovsg/FormSG/pull/6547)
- build(deps): bump winston-cloudwatch to v6.2.0 [`#6545`](https://github.com/opengovsg/FormSG/pull/6545)
- chore: bump version to v6.66.0 [`0233ba8`](https://github.com/opengovsg/FormSG/commit/0233ba8018532d4978d13717fac065f81e2eb515)
- chore: bump version to v6.67.0 [`6ca03c6`](https://github.com/opengovsg/FormSG/commit/6ca03c68cb162a4ae3af01f172425b3305742ae0)

#### [v6.66.1](https://github.com/opengovsg/FormSG/compare/v6.66.0...v6.66.1)

> 18 July 2023

- revert: build(deps): bump winston-cloudwatch version to 6.2.0 [`#6542`](https://github.com/opengovsg/FormSG/pull/6542)

#### [v6.66.0](https://github.com/opengovsg/FormSG/compare/v6.65.0...v6.66.0)

> 18 July 2023
> 19 July 2023

- fix: use proof-of-payment for payment receipt/invoice [`#6549`](https://github.com/opengovsg/FormSG/pull/6549)
- build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 in /frontend [`#6548`](https://github.com/opengovsg/FormSG/pull/6548)
- fix(deps): bump word-wrap from 1.2.3 to 1.2.4 [`#6547`](https://github.com/opengovsg/FormSG/pull/6547)
- build(deps): bump winston-cloudwatch to v6.2.0 [`#6545`](https://github.com/opengovsg/FormSG/pull/6545)
- fix(deps): [Snyk] Security upgrade mongoose from 5.13.15 to 5.13.20 [`#6541`](https://github.com/opengovsg/FormSG/pull/6541)
- feat: indicate if GST has been applied to a payment transaction [`#6538`](https://github.com/opengovsg/FormSG/pull/6538)
- chore: reduce max payment limit [`#6543`](https://github.com/opengovsg/FormSG/pull/6543)
Expand All @@ -140,7 +150,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- build: merge v6.65.0 into develop [`#6531`](https://github.com/opengovsg/FormSG/pull/6531)
- build: release v6.65.0 [`#6528`](https://github.com/opengovsg/FormSG/pull/6528)
- fix: add FE validation rule that email domains must be non empty [`#6529`](https://github.com/opengovsg/FormSG/pull/6529)
- chore: bump version to v6.66.0 [`b3a9818`](https://github.com/opengovsg/FormSG/commit/b3a9818762e334bc7126c029cdba63156bac85ed)
- chore: bump version to v6.66.0 [`0233ba8`](https://github.com/opengovsg/FormSG/commit/0233ba8018532d4978d13717fac065f81e2eb515)

#### [v6.65.0](https://github.com/opengovsg/FormSG/compare/v6.64.0...v6.65.0)

Expand Down Expand Up @@ -640,13 +650,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix: add staging-alt2 to deployment script [`#6019`](https://github.com/opengovsg/FormSG/pull/6019)
- build: merge release 6.38.0 to develop [`#6017`](https://github.com/opengovsg/FormSG/pull/6017)
- build: release v6.38.0 [`#6004`](https://github.com/opengovsg/FormSG/pull/6004)
- feat: more logging on fetch fallback [`#6008`](https://github.com/opengovsg/FormSG/pull/6008)
- chore: bump version to v6.39.0 [`081515a`](https://github.com/opengovsg/FormSG/commit/081515a2521c950dac7261f4b6c1b1b423c3af16)

#### [v6.38.0](https://github.com/opengovsg/FormSG/compare/v6.37.0...v6.38.0)

> 29 March 2023
> 30 March 2023

- feat: more logging on fetch fallback [`#6008`](https://github.com/opengovsg/FormSG/pull/6008)
- feat: implement fetch API fallback for network error [`#5948`](https://github.com/opengovsg/FormSG/pull/5948)
- fix: lowercase collaborator endpoint emails [`#5992`](https://github.com/opengovsg/FormSG/pull/5992)
- chore(deps-dev): bump @typescript-eslint/parser from 5.56.0 to 5.57.0 in /shared [`#5995`](https://github.com/opengovsg/FormSG/pull/5995)
Expand All @@ -655,7 +665,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix(deps): bump type-fest from 3.7.0 to 3.7.1 in /shared [`#5991`](https://github.com/opengovsg/FormSG/pull/5991)
- build: merge v6.37.0 into develop [`#5989`](https://github.com/opengovsg/FormSG/pull/5989)
- build: release v6.37.0 [`#5988`](https://github.com/opengovsg/FormSG/pull/5988)
- chore: bump version to v6.38.0 [`d199213`](https://github.com/opengovsg/FormSG/commit/d19921314cae6b79920cf5ec3fb4f396794816d6)

#### [v6.37.0](https://github.com/opengovsg/FormSG/compare/v6.36.0...v6.37.0)

Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-frontend",
"version": "6.72.0",
"version": "6.73.0",
"homepage": ".",
"private": true,
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const PaymentPreview = ({
}: PaymentPreviewProps) => {
const emailFieldSchema: VerifiableEmailFieldSchema = {
...(getFieldCreationMeta(BasicField.Email) as EmailFieldBase),
title: 'Email Address',
title: 'Email address',
_id: PAYMENT_CONTACT_FIELD_ID,
description: 'Proof of payment will be sent to this email',
isVerifiable: true,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "FormSG",
"description": "Form Manager for Government",
"version": "6.72.0",
"version": "6.73.0",
"homepage": "https://form.gov.sg",
"authors": [
"FormSG <formsg@data.gov.sg>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { cloneDeep } from 'lodash'
import moment from 'moment-timezone'
import { FormPaymentsField, PaymentType } from 'shared/types'

import { SubmissionData } from 'src/types'
import { IPopulatedEncryptedForm, SubmissionData } from 'src/types'

import { handleDuplicatesInAttachments } from '../../receiver/receiver.utils'
import {
createEncryptedSubmissionDto,
getPaymentAmount,
getPaymentIntentDescription,
} from '../encrypt-submission.utils'

const validSingleFile = {
Expand Down Expand Up @@ -101,4 +102,79 @@ describe('encrypt-submission.utils', () => {
expect(newFilenames).toContain(`2-${validSingleFile.filename}`)
})
})

describe('getPaymentIntentDescription', () => {
it('should description for Fixed Payments Type', () => {
const expectedValue = 'expectedValue'
const formData = {
payments_field: {
payment_type: PaymentType.Fixed,
description: expectedValue,
name: 'name',
},
} as unknown as IPopulatedEncryptedForm

const products: any = [{}]

const result = getPaymentIntentDescription(formData, products)

expect(result).toEqual(expectedValue)
})
it('should return name for Variable Payment Type', () => {
const expectedValue = 'expectedValue'
const formData = {
payments_field: {
payment_type: PaymentType.Variable,
description: 'description',
name: expectedValue,
},
} as unknown as IPopulatedEncryptedForm

const products: any = [{}]

const result = getPaymentIntentDescription(formData, products)

expect(result).toEqual(expectedValue)
})

it('should return product names for Products Payment Type', () => {
const expectedItemName1 = 'expectedItemName1'
const expectedItemName2 = 'expectedItemName2'
const formData = {
payments_field: {
payment_type: PaymentType.Products,
description: 'description',
name: 'name',
},
} as unknown as IPopulatedEncryptedForm

const products: any = [
{ data: { name: expectedItemName1 }, quantity: 1 },
{ data: { name: expectedItemName2 }, quantity: 2 },
]

const result = getPaymentIntentDescription(formData, products)

expect(result).toContain(expectedItemName1)
expect(result).toContain(expectedItemName2)
})

it('should return form title for Products Payment Type when there are no products', () => {
const expectedValue = 'formTitle'
const formData = {
payments_field: {
payment_type: PaymentType.Products,
description: 'description',
name: 'name',
},
title: expectedValue,
} as unknown as IPopulatedEncryptedForm

const products: any = null

const result = getPaymentIntentDescription(formData, products)

expect(result).toContain(expectedValue)
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import {
import {
createEncryptedSubmissionDto,
getPaymentAmount,
getPaymentIntentDescription,
mapRouteError,
} from './encrypt-submission.utils'
import IncomingEncryptSubmission from './IncomingEncryptSubmission.class'
Expand Down Expand Up @@ -115,11 +116,14 @@ const submitEncryptModeForm = async (
res,
})

if (!hasEnsuredAll && !res.headersSent) {
const { errorMessage, statusCode } = mapRouteError(
new SubmissionFailedError(),
)
return res.status(statusCode).json({ message: errorMessage })
if (!hasEnsuredAll) {
if (!res.headersSent) {
const { errorMessage, statusCode } = mapRouteError(
new SubmissionFailedError(),
)
return res.status(statusCode).json({ message: errorMessage })
}
return // required to stop submission processing
}

const encryptedPayload = req.formsg.encryptedPayload
Expand Down Expand Up @@ -458,7 +462,7 @@ const _createPaymentSubmission = async ({
automatic_payment_methods: {
enabled: true,
},
description: form.payments_field.description,
description: getPaymentIntentDescription(form, paymentProducts),
receipt_email: paymentReceiptEmail,
metadata,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { calculatePrice } from '../../../../../shared/utils/paymentProductPrice'
import {
IEncryptedSubmissionSchema,
IPopulatedEncryptedForm,
ISubmissionSchema,
MapRouteErrors,
SubmissionData,
Expand Down Expand Up @@ -302,3 +303,39 @@ export const getPaymentAmount = (
}
}
}

/**
* Retrieves payment description by payment_type
*
* - `Fixed Payments` references the description to as legacy behaviour
* - `Variable Payments` references the name
* - `Products` references the product name and quantity separated by a comma
* @param form
* @param paymentProducts
*/
export const getPaymentIntentDescription = (
form: IPopulatedEncryptedForm,
paymentProducts?: StorageModeSubmissionContentDto['paymentProducts'],
) => {
const formPaymentFields = form.payments_field
const { payment_type } = formPaymentFields
switch (payment_type) {
case PaymentType.Fixed:
// legacy behaviour of fixed payments where the product name is referred as description
return formPaymentFields.description
case PaymentType.Variable:
return formPaymentFields.name
case PaymentType.Products: {
if (!paymentProducts) return form.title
const productDescriptions = paymentProducts
.map((product) => `${product.data.name} x ${product.quantity}`)
.join(', ')
return productDescriptions
}
default: {
// Force TS to emit an error if the cases above are not exhaustive
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const exhaustiveCheck: never = payment_type
}
}
}
Loading