File History: src/main/java/com/paymentlink/util/IdGenerator.java

← View file content

File Content at Commit 9c24ca4

1 package com.paymentlink.util;
2
3 import java.security.SecureRandom;
4 import java.util.UUID;
5
6 public class IdGenerator {
7
8 private static final SecureRandom RANDOM = new SecureRandom();
9 private static final String ALPHA_NUMERIC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
10
11 /**
12 * Generate order ID in format: ORD-{timestamp}-{random}
13 */
14 public static String generateOrderId() {
15 long timestamp = System.currentTimeMillis();
16 String randomPart = generateRandomString(6);
17 return String.format("ORD-%d-%s", timestamp, randomPart);
18 }
19
20 /**
21 * Generate payment link ID (hex format, 32 characters)
22 */
23 public static String generatePaymentLinkId() {
24 return UUID.randomUUID().toString().replace("-", "");
25 }
26
27 /**
28 * Generate random alphanumeric string
29 */
30 private static String generateRandomString(int length) {
31 StringBuilder sb = new StringBuilder(length);
32 for (int i = 0; i < length; i++) {
33 sb.append(ALPHA_NUMERIC.charAt(RANDOM.nextInt(ALPHA_NUMERIC.length())));
34 }
35 return sb.toString();
36 }
37 }
38
39

Commits

Commit Author Date Message File SHA Actions
f0438c2 <f69e50@finnacloud.com> 1766443042 +0300 12/22/2025, 10:37:22 PM increment once more db583c9 View
188fc92 <f69e50@finnacloud.com> 1766442998 +0300 12/22/2025, 10:36:38 PM increment db583c9 View
4617f76 <f69e50@finnacloud.com> 1766442953 +0300 12/22/2025, 10:35:53 PM rename branch from main to master oops db583c9 View
e6d1548 <f69e50@finnacloud.com> 1766442769 +0300 12/22/2025, 10:32:49 PM add initial test workflow file db583c9 View
9c24ca4 <f69e50@finnacloud.com> 1766442705 +0300 12/22/2025, 10:31:45 PM add CI configuration and test script for Jenkins build db583c9 Hide
690c1f6 <f69e50@finnacloud.com> 1766368110 +0300 12/22/2025, 1:48:30 AM initialize backend structure with controllers, DTOs, and configuration files db583c9 View