Skip to content

Commit 3f9ec59

Browse files
committed
Changed date/time format
Payment options now mandatory
1 parent 752220f commit 3f9ec59

5 files changed

Lines changed: 16 additions & 14 deletions

File tree

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/server/plugins/engine/components/PaymentField.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export class PaymentField extends FormComponent {
100100
: undefined
101101

102102
// When user initially visits the payment page, there is no payment state yet so the amount is read form the form definition.
103-
const amount = paymentState?.amount ?? this.options.amount ?? 0
103+
const amount = paymentState?.amount ?? this.options.amount
104+
104105
const formattedAmount = amount.toFixed(2)
105106

106107
return {
@@ -205,8 +206,9 @@ export class PaymentField extends FormComponent {
205206
const uuid = randomUUID()
206207

207208
const reference = state.$$__referenceNumber as string
208-
const amount = options.amount ?? 0
209-
const description = options.description ?? ''
209+
const amount = options.amount
210+
211+
const description = options.description
210212

211213
const slug = `/${model.basePath}`
212214

src/server/plugins/engine/outputFormatters/human/v1.payment.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('v1 human formatter', () => {
4545
isLivePayment: false,
4646
preAuth: {
4747
status: 'success',
48-
createdAt: '2026-01-02T11:00:04+0000'
48+
createdAt: '2026-01-02T11:02:04+0000'
4949
}
5050
} as PaymentState
5151
}
@@ -137,7 +137,7 @@ describe('v1 human formatter', () => {
137137
138138
## Date of payment
139139
140-
2 January 2026 11:00:04
140+
2 January 2026 11:02am
141141
142142
---
143143
`

src/server/plugins/payment/helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ export function createPaymentService(isLivePayment, formId) {
4040
/**
4141
* Formats a payment date for display
4242
* @param {string} isoString - ISO date string
43-
* @returns {string} Formatted date string (e.g., "26 January 2026 – 17:01:29")
43+
* @returns {string} Formatted date string (e.g., "26 January 2026 5:01pm")
4444
*/
4545
export function formatPaymentDate(isoString) {
46-
return format(new Date(isoString), 'd MMMM yyyy – HH:mm:ss')
46+
return format(new Date(isoString), 'd MMMM yyyy h:mmaaa')
4747
}
4848

4949
/**

src/server/plugins/payment/helper.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('getPaymentApiKey', () => {
3737
describe('formatPaymentDate', () => {
3838
it('should format ISO date string to en-GB format', () => {
3939
const result = formatPaymentDate('2025-11-10T17:01:29.000Z')
40-
expect(result).toBe('10 November 2025 – 17:01:29')
40+
expect(result).toBe('10 November 2025 5:01pm')
4141
})
4242
})
4343

0 commit comments

Comments
 (0)