Generates 27-digit QR payment references with modulo-10 recursive check digit.
Summary
Functions
Computes the modulo-10 recursive check digit for a numeric string.
Generates a QR payment reference from an optional customer identification number and a reference number.
Functions
@spec compute_check_digit(String.t()) :: non_neg_integer()
Computes the modulo-10 recursive check digit for a numeric string.
Generates a QR payment reference from an optional customer identification number and a reference number.
Parameters
customer_id— optional BESR-ID from bank (numeric, max 11 digits), can be nil or ""reference_number— the reference number (numeric, required)
Returns
{:ok, reference} with the 27-digit reference, or {:error, reason}.
Example
iex> SwissQrBill.Reference.QrReferenceGenerator.generate("210000", "313947143000901")
{:ok, "210000000003139471430009017"}