Add plan & latest product ver to licenses
This commit is contained in:
parent
f32a92fe54
commit
c6f968851a
@ -141,6 +141,8 @@ public final class LicenseClient {
|
||||
JsonElement description = json.get("description");
|
||||
JsonElement ownerSnowflake = json.get("ownerSnowflake");
|
||||
JsonElement ownerName = json.get("ownerName");
|
||||
JsonElement plan = json.get("plan");
|
||||
JsonElement latestVersion = json.get("latestVersion");
|
||||
|
||||
// Parsing the expiration date if we have one
|
||||
JsonElement expires = json.get("expires");
|
||||
@ -155,6 +157,8 @@ public final class LicenseClient {
|
||||
description.isJsonNull() ? null : description.getAsString(),
|
||||
ownerSnowflake.isJsonNull() ? -1 : ownerSnowflake.getAsLong(),
|
||||
ownerName.isJsonNull() ? null : ownerName.getAsString(),
|
||||
plan.getAsString(),
|
||||
latestVersion.getAsString(),
|
||||
expires.isJsonNull() ? null : expiresDate
|
||||
);
|
||||
} else {
|
||||
@ -292,6 +296,16 @@ public final class LicenseClient {
|
||||
*/
|
||||
private String ownerName;
|
||||
|
||||
/**
|
||||
* The plan for this license.
|
||||
*/
|
||||
@NonNull private String plan;
|
||||
|
||||
/**
|
||||
* The latest version of the product this license is for.
|
||||
*/
|
||||
@NonNull private String latestVersion;
|
||||
|
||||
/**
|
||||
* The optional expiration {@link Date} of the license.
|
||||
*/
|
||||
|
@ -18,10 +18,12 @@ public final class Main {
|
||||
System.err.println("Invalid license: " + response.getError());
|
||||
return;
|
||||
}
|
||||
System.out.println("response = " + response);
|
||||
|
||||
// License is valid
|
||||
System.out.println("License is valid!");
|
||||
if (response.getOwnerName() != null) {
|
||||
System.out.println("Welcome " + response.getOwnerName() + "!");
|
||||
System.out.println("Welcome " + response.getOwnerName() + "! Your plan is " + response.getPlan() + " and the latest version is " + response.getLatestVersion());
|
||||
}
|
||||
if (response.getDescription() != null) {
|
||||
System.out.println("Description: " + response.getDescription()); // License description
|
||||
|
@ -101,6 +101,8 @@ public final class LicenseController {
|
||||
license.getDescription(),
|
||||
license.getOwnerSnowflake(),
|
||||
license.getOwnerName(),
|
||||
license.getPlan(),
|
||||
license.getLatestVersion(),
|
||||
license.getExpires()
|
||||
));
|
||||
} catch (APIException ex) { // Handle the exception
|
||||
|
@ -7,6 +7,7 @@ package me.braydon.license.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import me.braydon.license.model.License;
|
||||
|
||||
@ -40,6 +41,16 @@ public class LicenseDTO {
|
||||
*/
|
||||
private String ownerName;
|
||||
|
||||
/**
|
||||
* The plan for this license.
|
||||
*/
|
||||
@NonNull private String plan;
|
||||
|
||||
/**
|
||||
* The latest version of the product this license is for.
|
||||
*/
|
||||
@NonNull private String latestVersion;
|
||||
|
||||
/**
|
||||
* The optional expiration {@link Date} of this license.
|
||||
*/
|
||||
|
@ -62,6 +62,16 @@ public class License {
|
||||
@Field("owner.name")
|
||||
private String ownerName;
|
||||
|
||||
/**
|
||||
* The plan for this license.
|
||||
*/
|
||||
@NonNull private String plan;
|
||||
|
||||
/**
|
||||
* The latest version of the product this license is for.
|
||||
*/
|
||||
@NonNull private String latestVersion;
|
||||
|
||||
/**
|
||||
* The amount of uses this license has.
|
||||
*/
|
||||
|
@ -63,7 +63,7 @@ public final class DiscordService {
|
||||
/**
|
||||
* The version of this Springboot application.
|
||||
*/
|
||||
@NonNull private String applicationVersion = "n/a";
|
||||
@NonNull private final String applicationVersion = "n/a";
|
||||
|
||||
/**
|
||||
* The salt to use for hashing license keys.
|
||||
@ -317,6 +317,7 @@ public final class DiscordService {
|
||||
expires == -1L ? "Never" : "<t:" + expires + ":R>",
|
||||
true
|
||||
)
|
||||
.addField("Plan", license.getPlan(), true)
|
||||
.addField("Uses", String.valueOf(license.getUses()), true)
|
||||
.addField("Last Used",
|
||||
lastUsed == -1L ? "Never" : "<t:" + lastUsed + ":R>",
|
||||
|
@ -106,6 +106,8 @@ public final class LicenseService {
|
||||
license.setDescription(description); // Use the given description, if any
|
||||
license.setOwnerSnowflake(ownerSnowflake);
|
||||
license.setOwnerName(ownerName);
|
||||
license.setPlan("Basic");
|
||||
license.setLatestVersion("1.0");
|
||||
license.setIps(new HashSet<>());
|
||||
license.setHwids(new HashSet<>());
|
||||
license.setIpLimit(ipLimit); // Use the given IP limit
|
||||
|
Loading…
x
Reference in New Issue
Block a user