generated from UK-Export-Finance/nestjs-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FN-3664): add risk data to created customers (#1163)
## Introduction ✏️ In discussion with Risk teams, they wanted Risk data to be added to newly created customers in Salesforce. The APIM side will default Risk rating at B+ and Loss given default at 50%, and the DTFS side will pass Probability of Default through to APIM to be set on the new record. ## Resolution ✔️ Defaults the first two risk values, and sets the Probability of Default value to the value DTFS passes through. ## Miscellaneous ➕ A small doc typo fix I found. --------- Co-authored-by: Nat Dean-Lewis <[email protected]>
- Loading branch information
1 parent
30184c1
commit 5ff21fa
Showing
10 changed files
with
162 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 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,22 @@ | ||
import { salesforceFormattedCurrentDate } from './date-formatter.helper'; | ||
|
||
describe('salesforceFormattedCurrentDate function', () => { | ||
afterEach(() => { | ||
jest.restoreAllMocks(); | ||
}); | ||
|
||
const testCases = [ | ||
{ mockDate: new Date('2007-04-27T00:00:00Z'), expected: '2007-04-27' }, | ||
{ mockDate: new Date('2007-04-27'), expected: '2007-04-27' }, | ||
{ mockDate: new Date(2007, 3, 27), expected: '2007-04-27' }, | ||
{ mockDate: new Date('1970-01-01T12:34:56Z'), expected: '1970-01-01' }, | ||
{ mockDate: new Date('9999-12-31'), expected: '9999-12-31' }, | ||
{ mockDate: new Date('2020-02-29T00:00:00Z'), expected: '2020-02-29' }, // Leap year | ||
]; | ||
|
||
test.each(testCases)('should format the date $input as $expected', ({ mockDate, expected }) => { | ||
jest.spyOn(global, 'Date').mockImplementation(() => mockDate); | ||
|
||
expect(salesforceFormattedCurrentDate()).toBe(expected); | ||
}); | ||
}); |
This file contains 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,14 @@ | ||
/** | ||
* Returns the current date in the correct format for ingestion by the Salesforce sObject API. | ||
* | ||
* @returns {string} the current date in yyyy-mm-dd format | ||
*/ | ||
|
||
export const salesforceFormattedCurrentDate = () => { | ||
const today = new Date(); | ||
const dd = String(today.getDate()).padStart(2, '0'); | ||
const mm = String(today.getMonth() + 1).padStart(2, '0'); | ||
const yyyy = String(today.getFullYear()); | ||
|
||
return `${yyyy}-${mm}-${dd}`; | ||
}; |
This file contains 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 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 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 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 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 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 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