Skip to content

Commit

Permalink
update v4 to append verify.form_submitted
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrayson committed Jan 8, 2025
1 parent 3dee53d commit 392cf1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org)
## [2.4.3] - 2025-01-08
### Fixed
- v4 now appends `share_url` ([sc-84484](https://app.shortcut.com/active-prospect/story/84484/trustedform-v4-retain-include-trustedform-share-url-as-an-appended-field))
and `verify.form_submitted` ([sc-84576](https://app.shortcut.com/active-prospect/story/84576/trustedform-v4-verify-include-form-submitted-as-an-appended-field))

## [2.4.1] - 2024-08-12
### Added
Expand Down
3 changes: 3 additions & 0 deletions lib/trustedform.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ const response = (vars, req, res) => {
const verify = hasVerifyData(parsed)
? pickBy({
languages: parsed.verify.languages.map(lang => lang.text),
form_submitted: parsed.verify.result.form_submitted,
language_approved: parsed.verify.result.language_approved,
// note that the Verify one_to_one value is handled separately
success: parsed.verify.result.success,
}, (v) => !isUndefined(v))
: undefined;
Expand Down Expand Up @@ -271,6 +273,7 @@ response.variables = () => [
{ name: 'one_to_one', type: 'boolean', description: 'A boolean indicating if the cert structure satisfied the requirements for 1:1 consent.' },
{ name: 'verify.languages', type: 'array', description: 'A list of the consent languages detected within the certificate' },
{ name: 'verify.language_approved', type: 'boolean', description: 'A boolean indicating if any of the consent languages found have been approved in your account\'s consent language manager.' },
{ name: 'verify.form_submitted', type: 'boolean', description: 'A boolean indicating whether the form was successfully submitted by the consumer.' },
{ name: 'verify.success', type: 'boolean', description: 'A boolean indicating if any of the consent languages found meet the success criteria defined for your account.' },
];

Expand Down
2 changes: 2 additions & 0 deletions test/trustedform_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ describe('v4', () => {
result: {
language_approved: true,
success: true,
form_submitted: true,
one_to_one: true
}
}
Expand Down Expand Up @@ -516,6 +517,7 @@ describe('v4', () => {
verify: {
languages: ['I understand that the TrustedForm certificate is sent to the email address I provided above and I will receive product updates as they are released.'],
language_approved: true,
form_submitted: true,
success: true
}
};
Expand Down

0 comments on commit 392cf1b

Please sign in to comment.