QR Code With SHA512 Hashed String

Hi Everyone,

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)

Link to their API

The script under “Hash check example”, if you pass it a value of:

tstste0001zazar25.00123abc123[http://demo.ozow.com/cancel.aspxhttp://demo.ozow.com/cancel.aspxht]http://demo.ozow.com/success.aspx(http://demo.ozow.com/notify.aspxfalse[your private key]

It should return:

 1. eedcba106cd8fef3ba6cec5ec80de7d7d7fc90343028bf95b908718c671d0fe885ca08b206d788de009d237a93c18e66edf6ede3f5ca7057e23474106465dcc6

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.

Regards,
S

PS: Forum update looks great!

Hi Sharne,

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?

Hi jmandende,

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.)

Regards,
S

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.

Hi Marten,

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.)

Regards,
S

You could do your Hash String in Worklow and pass it as a runtime parameters.

If you need multiple Hash Strings per job, then you could still do it in Workflow and add the resulting string into your data prior to the Datamapper.

Hi jchamel,

I will try Workflow then using a Run Script set to EnhancedJScript.

  • Grab the required fields via metadata
  • Hash them via a script
  • Then inject the hashed value to an empty field in the mapper per record.

Something like that :slight_smile: , will have to look into it a bit more as my main focus was achieving this via the template or mapper.

Regards,
S

You might want to consult the following blog post from a guru of ours: OL Resource Center (uplandsoftware.com)

1 Like

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.

3 Likes

That looks like a neat solution.

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 :slight_smile:

Regards,
S

I would assume so but as I gave you a link to a post that wasn’t mine, I would rely on my colleague knowledge.

@GBoyland Thank you, this works.

@jchamel Thanks for the info posted. Will look at that once we update.

Regards,
S