Skip to content

Commit

Permalink
Revert "enhancement(TaxForms): bring back delegated links (#8483)"
Browse files Browse the repository at this point in the history
This reverts commit b52e7ae.
  • Loading branch information
Betree committed Jan 31, 2023
1 parent 6e6fad3 commit 0c7e907
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
29 changes: 13 additions & 16 deletions server/lib/tax-forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export async function sendHelloWorksUsTaxForm(
workflowId,
documentDelivery: true,
documentDeliveryType: 'link',
delegatedAuthentication: true, // See "authenticated link" below.
// delegatedAuthentication: true, // See "authenticated link" below.
participants,
metadata: {
accountType: accountToSubmitRequestTo.type,
Expand All @@ -157,23 +157,20 @@ export async function sendHelloWorksUsTaxForm(
});

// Get the authenticated link ("delegated authentication")
const step = instance.steps[0];
let documentLink = step.url;
try {
documentLink = await client.workflowInstances.getAuthenticatedLinkForStep({
instanceId: instance.id,
step: step.step,
});
} catch (e) {
// Fallback to the default `step.url` (unauthenticated link)
reportErrorToSentry(e, {
severity: 'warning',
transactionName: 'taxForm.sendHelloWorksUsTaxForm.getAuthenticatedLinkForStep',
extra: { instanceId: instance.id, step: JSON.stringify(step) },
});
}
// We currently don't have access to this feature with our pricing plan
// try {
// documentLink = await client.workflowInstances.getAuthenticatedLinkForStep({
// instanceId: instance.id,
// step: step.step,
// });
// } catch (e) {
// // Fallback to the default `step.url` (unauthenticated link)
// logger.warn(`Tax form: error getting authenticated link for ${instance.id}: ${e.message}`);
// }

// Save the authenticated link to the database, in case we want to send it again later
const step = instance.steps[0];
const documentLink = step.url;
await document.update({ data: deepMerge(document.data, { helloWorks: { documentLink } }) });

// Send the actual email
Expand Down
2 changes: 1 addition & 1 deletion test/server/lib/tax-forms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ describe('server/lib/tax-forms', () => {
expect(client.workflowInstances.createInstance.called).to.be.true;
const callArgs = client.workflowInstances.createInstance.firstCall.args;
expect(callArgs[0].participants['participant_swVuvW'].fullName).to.eq('Mr. Legal Name');
expect(client.workflowInstances.getAuthenticatedLinkForStep.called).to.be.true;
// when we'll activate authenticated links expect(client.workflowInstances.getAuthenticatedLinkForStep.called).to.be.true;
expect(doc.requestStatus).to.eq(REQUESTED);

assert.callCount(sendMessageSpy, 1);
Expand Down

0 comments on commit 0c7e907

Please sign in to comment.