LG-10287: Add Acuant SDK 11.9.1 files#8846
Conversation
|
I tried this out with my iPhone, and it told me to "try again with a driver's license" with both my Oregon and California Real ID drivers licenses. I retried with the current sdk and it accepted the images as it has in the past. |
I saw the same behavior, @soniaconnolly. It's because this version has a fix for the |
…uant SDK to 11.9.1
soniaconnolly
left a comment
There was a problem hiding this comment.
Overall looks good! Couple of comments, and I'm about to test on my iPhone.
|
|
||
| type AcuantCameraUIStart = ( | ||
| callbacks: AcuantCameraUICallbacks, | ||
| onFailure: AcuantFailureCallback, |
There was a problem hiding this comment.
Does it still work for the older version to remove this? Same on line 308 below.
There was a problem hiding this comment.
Good point. I addressed this in my latest commits, with lots of help from Matt! 🙏🏻
| onError('iOS 15 sequence break', code); | ||
| onFailure('iOS 15 sequence break', code); |
There was a problem hiding this comment.
Would it make sense to have two versions of these specs, one for each value of the SDK feature flag, to confirm the code still works for both values?
There was a problem hiding this comment.
Good idea! I added more tests. 👍🏻
app/javascript/packages/document-capture/components/acuant-capture.tsx
Outdated
Show resolved
Hide resolved
spec/javascript/packages/document-capture/components/acuant-capture-spec.jsx
Outdated
Show resolved
Hide resolved
spec/javascript/packages/document-capture/components/acuant-capture-spec.jsx
Outdated
Show resolved
Hide resolved
spec/javascript/packages/document-capture/components/acuant-capture-spec.jsx
Outdated
Show resolved
Hide resolved
app/javascript/packages/document-capture/components/acuant-capture.tsx
Outdated
Show resolved
Hide resolved
|
Tried it on my iPhone with both versions locally, and SDK loaded and was able to capture images. 👍 To clarify this comment, I don't know how to trigger those failure callbacks, and I'm wondering if the old version still works the way the code is now. |
|
I tried locally with an android. I snapped terrible pictures- blur w/ flash- and I am still successfully moving on to the SSN page. |
| return window.AcuantCameraUI; | ||
| // evaluate the arguments the function start takes | ||
| // if the second argument is not a function, it is the current start method, so just return the AcuantCameraUIInterface as is | ||
| if (window.AcuantCameraUI && typeof window.AcuantCameraUI.start.arguments[1] !== 'function') { |
There was a problem hiding this comment.
I don't think this will work, since JS does not augment functions with argument type information like this.
Looking at the diff between 11.8 and 11.9, it looks like they went from:
start(objectWithCallbacks, errorCallback, options)
to:
start(objectWithCallbacksIncludingErrorCallback, options)
I think you want to build a set of 3 arguments that you can pass to both versions of the code. This means:
- Put the error callback on the first argument
- Augment the error callback with options and pass that as the second argument
- Pass the options as the third argument to support the 11.8 version
So something like:
const callbacks = {
onError() { /* ... */ },
onCropped(response) { /* ... */ },
}
const options = { /* ... */ }
const errorCallbackMushedTogetherWithOptions = (...args) => {
return callbacks.onError(...args)
}
Object.keys(options).forEach(key => {
errorCallbackMushedTogetherWithOptions[key] = options[key];
});
// Support 11.8 or 11.9
AcuantCameraUI.start(callbacks, errorCallbackMushedTogetherWithOptions, options)There was a problem hiding this comment.
This is really helpful, thank you! I will try this approach.
|
|
||
| it('shows error if capture fails', async () => { | ||
| it('shows error if capture fails: legacy version of Acuant SDK', async () => { | ||
| const trackEvent = sinon.spy(); |
There was a problem hiding this comment.
Can you clarify how this is selecting the legacy version? I'm not seeing version number differences in the two specs.
There was a problem hiding this comment.
If we look at line 275, we can see that the second argument for the start function is the onFailure callback. If this were the more recent version of Acuant SDK, the onFailure callback would be included in the first argument for the start function, which are the AcuantCameraUICallbacks.
To give a more general answer, I decided to test that both version 11.8.2 and version 11.9.1 are supported by stubbing the start function as it would be called for the two different versions. I didn't put any direct references to version number in the specs.
🎫 Ticket
LG-10287
🛠 Summary of changes
📜 Testing Plan
As instructed in the runbook, I tested this on my droid and had a coworker test it on their iphone.