QR code is used to simplify intrabank transfers (aka transfers between SaFi accounts).

The related functionality consists of 2 parts:

  1. Generating the beneficiary QR code, to be presented to the sender.

  2. Scanning the beneficiary QR code to fill in the required data for sender.

Generating the QR code

Figma: https://www.figma.com/file/dkDQHRa1zq7tU58MiL6hBR/SaFi---UI---MVP-(Shared)?node-id=11304%3A65995&t=YVoaquMXRo2x9QXh-0

The QR code is generated according to the following algorithm.

  1. We fetch the account number and user name by customer id from local Hive database or hitting the endpoint /v2/main-account/by-customer/$customerId

  2. Use the fetched values to generate the custom URL of type safi://v2/<payload> , where payload is generated as follows:

    1. generate salt as a random letters-only string, consisting of 6 letters;

    2. we make a string of /<account_number>/<beneficiary_name>/<salt>

    3. use AES algorithm to encrypt the string from step b and pass it as a payload.

    4. create a QR code from the final URL safi://v2/<payload>

For more details on encryption/decryption, please check the QrCodeEncrypter class.

The entry point for the QR code generation is account details.

Scanning the QR code

Figma: https://www.figma.com/file/dkDQHRa1zq7tU58MiL6hBR/SaFi---UI---MVP-(Shared)?node-id=3145%3A57621&t=YVoaquMXRo2x9QXh-0

The user can scan the QR code, provided by the beneficiary, to autofill the name and account number while conducting the intrabank transfer.

Here’s what’s happening under the hood:

  1. The app scans the QR code, gets the URL in the format safi://v2/<payload>.

  2. QrCodeEncrypter decrypts the payload and extracts the account number and user name from it.

  3. Extracted values auto populate corresponding text inputs, tab is switched to Account number.

  4. User can proceed with the rest of the intrabank flow.