package com.ruoyi.app.omgpay;

import org.springframework.stereotype.Component;

import java.security.SecureRandom;

@Component
public class OmgMerchantTradeNoGenerator {
    private static final String ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private final SecureRandom random = new SecureRandom();

    public String generate() {
        StringBuilder value = new StringBuilder("OMG");
        while (value.length() < 20) {
            value.append(ALPHABET.charAt(random.nextInt(ALPHABET.length())));
        }
        return value.toString();
    }
}
