I have been tasked with generating a QR code and pay button for statements in a Connect print template. I need to know if Connect is able to achieve this because reading some old documents/forum posts suggests it cannot be done unless a Web template is used. Can someone advise if this can be done? (in Workflow 32 bit or Connect Template or Connect Mapper or even the new Automate)
I think the script requires Crypo-JS library but everything I try returns errors such as “crypto is not defined”, “require is not defined”, “redeclaration of var crypto”.
I’m not well versed with this and just need to know if this can be acheived, and in which part of Connect it can be achieved, if at all.
Thank you for contacting us.
My question is why would you like to put a pay button on an output print, is there a reason behind that rather than stick with the QR code?
The “button” will have a hyperlink for the records that get the PDF via email. (Client requested it to be the same as prior except they used a much simpler payment portal before moving to Ozow.)
Will this ‘SHA512 Hashed String’ be used for both the QR code and pay button?
I assume that adding a QR code and pay button by a Print Template should be possible. However, I don’t think that you can create this ‘SHA512 Hashed String’ from within a Print Template.
Yes, from my understanding the hashed ID/string will be used for both. The hashed ID essentially populates a webform with variable data for payments.
I read an old post by Evie from 2015 where she states that this cannot be done in a Print template, but Connect has changed so much since then I was wondering if that info was still correct or not.
Is Workflow an option? (I see Automate should be able to do this via LINK, however since Automate is not officially released it is not an option right now.)
It’s possible to include the crypto-js library in your template as a control script and use it but you need an older version that does not rely on a browser/node-js crypto object. The latest version not using this is 3.3.0, available from here: Tags · brix/crypto-js · GitHub. Include the crypto-js.js file as a control script and then you can use
CryptoJS.SHA512('Hello World')
and so on. Just be aware that this older version uses Math.random() which is not crypto-safe.
I’m not sure how that sample script from Ozow could be made to work in Workflow as-is, since it relies on a Node package. Automate would be a perfect fit of course since that is entirely Node-based, but as mentioned that has not officially been released yet.
@jchamel Thanks. I’m running Connect 2021.1 and that post starts with “Starting with version 2023.1”. If I had 2023.1 (or better, the latest version) would I be able to reference the cryptoJS library from Workflow using that method described?
@GBoyland Thanks for the reply. Interesting. I would never have guessed an older version would work. AND as a control script. Thought it would need to be in the JavaScript resource and linked to my section via includes. The Math.random() you mention is a concern, but if this works, I will run this by Ozow to see if there are any unforceen issues. As mentioned, this crypto lib stuff is all new to me, so will heed your caution regarding that.
@Sander Will keep that in mind and run it by Ozow if they ever feel like getting back to me. I have 6 days to find a solution.
Thanks to everyone again for the replies. Wish I had asked sooner