-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(FN-3163): create new dtfs customer in sf feature branch #3892
base: feat/FN-3163/create-new-dtfs-customers-in-sf
Are you sure you want to change the base?
feat(FN-3163): create new dtfs customer in sf feature branch #3892
Conversation
@@ -820,13 +821,35 @@ const getPartyDbInfo = async ({ companyRegNo }) => { | |||
url: `${EXTERNAL_API_URL}/party-db/${encodeURIComponent(companyRegNo)}`, | |||
headers: headers.external, | |||
}); | |||
return response.data; | |||
return AUTOMATIC_SF_CUSTOMER_CREATION_ENABLED ? { status: 200, data: response.data } : response.data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The response needs a status (following the pattern elsewhere in dtfs) so that we can distinguish between a 404 and an actual failure when querying SF - we don't want to create customers unless we definitely have a 404
@@ -60,7 +77,7 @@ const addPartyUrns = async (deal, auditDetails) => { | |||
...deal.tfm, | |||
parties: { | |||
exporter: { | |||
partyUrn: await getPartyUrn({ companyRegNo: deal.exporter.companiesHouseRegistrationNumber }), | |||
partyUrn: await getPartyUrn({ companyRegNo: deal.exporter.companiesHouseRegistrationNumber, companyName: deal.exporter.companyName }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not flagged this additional input as that seems unnecessarily fiddly, let me know if I should!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by flagged please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry that was confusing of me - I mean I've added an extra parameter to this function but it's not behind a feature flag, is that okay?
@@ -21,7 +21,9 @@ export const lookup = async (req: Request, res: Response) => { | |||
|
|||
const response: { status: number; data: unknown } = await axios({ | |||
method: 'get', | |||
url: `${APIM_MDM_URL}customers?companyReg=${companyReg}`, | |||
url: AUTOMATIC_SF_CUSTOMER_CREATION_ENABLED | |||
? `${APIM_MDM_URL}customers/direct?companyRegistrationNumber=${companyReg}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses the new direct SF api in MDM, old route is Informatica
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we call this route customers/salesforce
rather than customers/direct
, makes it a little clearer/less tied to the fact that an endpoint already exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I agree /salesforce is slightly clearer, will update my MDM work to match also
40ddede
to
ca987fb
Compare
Quality Gate passedIssues Measures |
Introduction ✏️
As part of the CCM project, if a customer does exist in Salesforce, we are automatically creating it rather than relying on the manual process currently undertaken by Business Support Group. This change sends a request to a new createParty endpoint that will be merged in to the MDM codebase.
Tech docs of the full process are available here
Resolution ✔️
Feature flagged for now:
If the customer lookup fails, send a creation request to MDM.
Miscellaneous ➕
We also replace the current GET customer in SF (that uses Informatica) with a new one that goes direct (hence the new url with /direct/ in) via the SF API.