Skip to main content

Appendix 8

QR Generation

Embed Code

A 6-digit PIN protects the invoice from being claimed by an unauthorised person. The PIN may be customer-chosen at the point of sale, randomly generated, or set to 000000 if PIN protection is disabled. When randomly generated, a UUID-seeded pseudo-random number generator is used to produce a 6-digit value.

import java.util.UUID;

public class RandomPinGenerator {

public static String generatePin() {
UUID uuid = UUID.randomUUID();
long seed = uuid.getMostSignificantBits() ^ uuid.getLeastSignificantBits();
java.util.Random random = new java.util.Random(seed);
int pin = random.nextInt(900000) + 100000;
return String.format("%06d", pin);
}

public static void main(String[] args) {
System.out.println("Generated PIN: " + generatePin());
}
}