-
Notifications
You must be signed in to change notification settings - Fork 1
Feat(DF-623): Gov UK Payment integration #446
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f4e7877
feat: add payment formatting helpers
mokhld e4f456b
test: add fixtures for payment submissions
mokhld 249f30d
feat: include payment data in submission exports
mokhld 075e984
fix: add forceExit to jest in lint-staged
mokhld 4fc230b
refactor: refactor submission file generation to satisfy Sonar
mokhld bf0de5a
feat: add date-fns for payment date formatting
mokhld 955b167
refactor: update header handling
mokhld 29e69e8
refactor: update payment header names in submission service
mokhld d9638c8
Fixed types
jbarnsley10 4dd09f7
refactor: consolidate payment data structure and update related servi…
mokhld fbf279b
chore: sonar fix
mokhld 065738b
Model and engine bump
jbarnsley10 397d884
Changed date/time format
jbarnsley10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| export default { | ||
| '*.{cjs,js,mjs}': ['eslint --fix', 'prettier --write'], | ||
| '*.{json,md}': 'prettier --write', | ||
| '*.test.{cjs,js,mjs}': 'jest' | ||
| '*.test.{cjs,js,mjs}': 'jest --forceExit' | ||
| } |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { format } from 'date-fns' | ||
|
|
||
| /** | ||
| * Formats a payment date for display | ||
| * @param {string} isoString - ISO date string | ||
| * @returns {string} Formatted date string (e.g., "26 January 2026 – 17:01:29") | ||
| */ | ||
| export function formatPaymentDate(isoString) { | ||
| return format(new Date(isoString), 'd MMMM yyyy h:mmaaa') | ||
| } | ||
|
|
||
| /** | ||
| * Formats a payment amount with two decimal places | ||
| * @param {number} amount - amount in pounds | ||
| * @returns {string} Formatted amount (e.g., "£10.00") | ||
| */ | ||
| export function formatPaymentAmount(amount) { | ||
| return `£${amount.toFixed(2)}` | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { formatPaymentAmount, formatPaymentDate } from './payment-helper.js' | ||
|
|
||
| describe('payment-helper', () => { | ||
| describe('formatPaymentDate', () => { | ||
| it('should format an ISO date string to UK format with time', () => { | ||
| // Using a fixed date to avoid timezone issues | ||
| const result = formatPaymentDate('2025-11-10T17:01:29.000Z') | ||
|
|
||
| // The date part should always be correct | ||
| expect(result).toContain('10 November 2025') | ||
| // The time will vary by timezone, so just check format | ||
| expect(result).toMatch(/10 November 2025 \d{1,2}:\d{2}(am|pm)/) | ||
| }) | ||
|
|
||
| it('should handle different dates correctly', () => { | ||
| const result = formatPaymentDate('2026-01-26T09:30:15.000Z') | ||
|
|
||
| expect(result).toContain('26 January 2026') | ||
| expect(result).toMatch(/26 January 2026 \d{1,2}:\d{2}(am|pm)/) | ||
| }) | ||
| }) | ||
|
|
||
| describe('formatPaymentAmount', () => { | ||
| it('should format a whole number with two decimal places', () => { | ||
| expect(formatPaymentAmount(10)).toBe('£10.00') | ||
| }) | ||
|
|
||
| it('should format a decimal number with two decimal places', () => { | ||
| expect(formatPaymentAmount(10.5)).toBe('£10.50') | ||
| }) | ||
|
|
||
| it('should format a number with more than two decimal places', () => { | ||
| expect(formatPaymentAmount(10.999)).toBe('£11.00') | ||
| }) | ||
|
|
||
| it('should format zero correctly', () => { | ||
| expect(formatPaymentAmount(0)).toBe('£0.00') | ||
| }) | ||
|
|
||
| it('should format large amounts correctly', () => { | ||
| expect(formatPaymentAmount(1234.56)).toBe('£1234.56') | ||
| }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.