forked from thijooree/android
2.1 KiB
2.1 KiB
PayMV QR Screen
Handles both sides of PayMV/Favara QR payments: generating a receive-payment QR code and scanning a QR code to initiate a transfer.
Fragment — PayMvQrFragment
Two tabs: Receive (generate QR) and Send (scan QR).
Receive Tab — Generate QR
Generates a static PayMV QR code that others can scan to pay the user.
Fields
| Field | Notes |
|---|---|
| Source account | Dropdown of all visible accounts; determines acquirer BIC |
| Amount | Optional — leave blank for open-amount QR |
| Purpose | Optional free-text payment purpose |
| Name | Auto-filled from the selected account's holder name |
Generation
On tap Generate, the fragment builds a decimal TLV payload per the PayMV QR Format spec:
- Assembles all TLV fields (format indicator, point-of-initiation, tag 26 container, MCC, currency, amount if set, country, name, tag 62 container, tag 80 container)
- Selects the acquirer BIC from the source account's bank (
MALBMVMV/MADVMVMV/FAHIMVMV) - Appends
"6304"and computes CRC-16/CCITT-FALSE over the full string - Renders the complete string as a QR code bitmap using the ZXing encoder
- Displays the QR code full-screen with the account number and name below
Share
A Share button exports the QR bitmap via the system share sheet (image/png).
Send Tab — Scan QR
Scans a QR code and pre-fills the transfer screen.
Scanner
Opens the device camera with a QR viewfinder overlay. Supported QR formats:
| QR type | Handling |
|---|---|
| PayMV / Favara decimal TLV | Parse account number (tag 26→03), amount (tag 54), name (tag 59), purpose (tag 62→08); navigate to TransferFragment pre-filled |
BML plain URL (https://pay.bml.com.mv/app/...) |
Navigate to BmlQrPayFragment |
| BML embedded in combined QR (root tag 35 → sub 20 → sub-sub 01) | Extract URL; navigate to BmlQrPayFragment |
Error Handling
If the scanned code is not a recognized format, a Snackbar error is shown and the scanner remains open.
← OTP Screen Next → BML QR Pay