From 84992e33502d8a13c479445563f9bd14a6a9e27e Mon Sep 17 00:00:00 2001 From: Alex Burt Date: Fri, 27 Sep 2024 17:11:18 +0100 Subject: [PATCH] NA: Inline JSON property name in IDV classes --- .../docs/session/create/IbvOptions.java | 16 +---- .../client/docs/session/create/SdkConfig.java | 52 +++++------------ .../docs/session/create/SessionSpec.java | 58 ++++++------------- .../client/docs/session/create/UserPrice.java | 13 +---- .../session/retrieve/GetSessionResult.java | 46 +++++---------- .../retrieve/IdentityProfileResponse.java | 19 ++---- .../session/retrieve/ImportTokenResponse.java | 13 +---- .../spi/remote/call/ProfileResponse.java | 16 +---- 8 files changed, 59 insertions(+), 174 deletions(-) diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/IbvOptions.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/IbvOptions.java index 669697fd..3551278e 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/IbvOptions.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/IbvOptions.java @@ -6,13 +6,13 @@ public class IbvOptions { - @JsonProperty(Property.SUPPORT) + @JsonProperty("support") private final String support; - @JsonProperty(Property.GUIDANCE_URL) + @JsonProperty("guidance_url") private final String guidanceUrl; - @JsonProperty(Property.USER_PRICE) + @JsonProperty("user_price") private final UserPrice userPrice; private IbvOptions(String support, String guidanceUrl, UserPrice userPrice) { @@ -102,14 +102,4 @@ public IbvOptions build() { } - private static final class Property { - - private static final String SUPPORT = "support"; - private static final String GUIDANCE_URL = "guidance_url"; - private static final String USER_PRICE = "user_price"; - - private Property() { } - - } - } diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SdkConfig.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SdkConfig.java index 776b9d51..972f94fc 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SdkConfig.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SdkConfig.java @@ -9,49 +9,49 @@ */ public class SdkConfig { - @JsonProperty(Property.ALLOWED_CAPTURE_METHODS) + @JsonProperty("allowed_capture_methods") private final String allowedCaptureMethods; - @JsonProperty(Property.PRIMARY_COLOUR) + @JsonProperty("primary_colour") private final String primaryColour; - @JsonProperty(Property.PRIMARY_COLOUR_DARK_MODE) + @JsonProperty("primary_colour_dark_mode") private final String primaryColourDarkMode; - @JsonProperty(Property.SECONDARY_COLOUR) + @JsonProperty("secondary_colour") private final String secondaryColour; - @JsonProperty(Property.FONT_COLOUR) + @JsonProperty("font_colour") private final String fontColour; - @JsonProperty(Property.DARK_MODE) + @JsonProperty("dark_mode") private final String darkMode; - @JsonProperty(Property.LOCALE) + @JsonProperty("locale") private final String locale; - @JsonProperty(Property.PRESET_ISSUING_COUNTRY) + @JsonProperty("preset_issuing_country") private final String presetIssuingCountry; - @JsonProperty(Property.SUCCESS_URL) + @JsonProperty("success_url") private final String successUrl; - @JsonProperty(Property.ERROR_URL) + @JsonProperty("error_url") private final String errorUrl; - @JsonProperty(Property.PRIVACY_POLICY_URL) + @JsonProperty("privacy_policy_url") private final String privacyPolicyUrl; - @JsonProperty(Property.ALLOW_HANDOFF) + @JsonProperty("allow_handoff") private final Boolean allowHandoff; - @JsonProperty(Property.ATTEMPTS_CONFIGURATION) + @JsonProperty("attempts_configuration") private final AttemptsConfiguration attemptsConfiguration; - @JsonProperty(Property.BRAND_ID) + @JsonProperty("brand_id") private final String brandId; - @JsonProperty(Property.BIOMETRIC_CONSENT_FLOW) + @JsonProperty("biometric_consent_flow") private final String biometricConsentFlow; SdkConfig(String allowedCaptureMethods, @@ -502,26 +502,4 @@ public SdkConfig build() { } } - private static final class Property { - - private static final String ALLOWED_CAPTURE_METHODS = "allowed_capture_methods"; - private static final String PRIMARY_COLOUR = "primary_colour"; - private static final String PRIMARY_COLOUR_DARK_MODE = "primary_colour_dark_mode"; - private static final String SECONDARY_COLOUR = "secondary_colour"; - private static final String FONT_COLOUR = "font_colour"; - private static final String DARK_MODE = "dark_mode"; - private static final String LOCALE = "locale"; - private static final String PRESET_ISSUING_COUNTRY = "preset_issuing_country"; - private static final String SUCCESS_URL = "success_url"; - private static final String ERROR_URL = "error_url"; - private static final String PRIVACY_POLICY_URL = "privacy_policy_url"; - private static final String ALLOW_HANDOFF = "allow_handoff"; - private static final String ATTEMPTS_CONFIGURATION = "attempts_configuration"; - private static final String BRAND_ID = "brand_id"; - private static final String BIOMETRIC_CONSENT_FLOW = "biometric_consent_flow"; - - private Property() {} - - } - } diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SessionSpec.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SessionSpec.java index ef5a52a1..834bbbb1 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SessionSpec.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SessionSpec.java @@ -18,55 +18,55 @@ */ public class SessionSpec { - @JsonProperty(Property.CLIENT_SESSION_TOKEN_TTL) + @JsonProperty("client_session_token_ttl") private final Integer clientSessionTokenTtl; - @JsonProperty(Property.SESSION_DEADLINE) + @JsonProperty("session_deadline") private final ZonedDateTime sessionDeadline; - @JsonProperty(Property.RESOURCES_TTL) + @JsonProperty("resources_ttl") private final Integer resourcesTtl; - @JsonProperty(Property.IMPORT_TOKEN) + @JsonProperty("import_token") private final ImportTokenPayload importToken; - @JsonProperty(Property.USER_TRACKING_ID) + @JsonProperty("user_tracking_id") private final String userTrackingId; - @JsonProperty(Property.NOTIFICATIONS) + @JsonProperty("notifications") private final NotificationConfig notifications; - @JsonProperty(Property.REQUESTED_CHECKS) + @JsonProperty("requested_checks") private final List> requestedChecks; - @JsonProperty(Property.REQUESTED_TASKS) + @JsonProperty("requested_tasks") private final List> requestedTasks; - @JsonProperty(Property.SDK_CONFIG) + @JsonProperty("sdk_config") private final SdkConfig sdkConfig; - @JsonProperty(Property.REQUIRED_DOCUMENTS) + @JsonProperty("required_documents") private final List requiredDocuments; - @JsonProperty(Property.BLOCK_BIOMETRIC_CONSENT) + @JsonProperty("block_biometric_consent") private final Boolean blockBiometricConsent; - @JsonProperty(Property.IBV_OPTIONS) + @JsonProperty("ibv_options") private final IbvOptions ibvOptions; - @JsonProperty(Property.IDENTITY_PROFILE_REQUIREMENTS) + @JsonProperty("identity_profile_requirements") private final IdentityProfileRequirementsPayload identityProfile; - @JsonProperty(Property.ADVANCED_IDENTITY_PROFILE_REQUIREMENTS) + @JsonProperty("advanced_identity_profile_requirements") private final AdvancedIdentityProfileRequirementsPayload advancedIdentityProfileRequirements; - @JsonProperty(Property.SUBJECT) + @JsonProperty("subject") private final SubjectPayload subject; - @JsonProperty(Property.RESOURCES) + @JsonProperty("resources") private final ResourceCreationContainer resources; - @JsonProperty(Property.CREATE_IDENTITY_PROFILE_PREVIEW) + @JsonProperty("create_identity_profile_preview") private final Boolean createIdentityProfilePreview; SessionSpec(Integer clientSessionTokenTtl, @@ -504,28 +504,4 @@ public SessionSpec build() { } } - private static final class Property { - - private static final String CLIENT_SESSION_TOKEN_TTL = "client_session_token_ttl"; - private static final String SESSION_DEADLINE = "session_deadline"; - private static final String RESOURCES_TTL = "resources_ttl"; - private static final String USER_TRACKING_ID = "user_tracking_id"; - private static final String NOTIFICATIONS = "notifications"; - private static final String REQUESTED_CHECKS = "requested_checks"; - private static final String REQUESTED_TASKS = "requested_tasks"; - private static final String SDK_CONFIG = "sdk_config"; - private static final String REQUIRED_DOCUMENTS = "required_documents"; - private static final String BLOCK_BIOMETRIC_CONSENT = "block_biometric_consent"; - private static final String IBV_OPTIONS = "ibv_options"; - private static final String IDENTITY_PROFILE_REQUIREMENTS = "identity_profile_requirements"; - private static final String ADVANCED_IDENTITY_PROFILE_REQUIREMENTS = "advanced_identity_profile_requirements"; - private static final String SUBJECT = "subject"; - private static final String RESOURCES = "resources"; - private static final String CREATE_IDENTITY_PROFILE_PREVIEW = "create_identity_profile_preview"; - private static final String IMPORT_TOKEN = "import_token"; - - private Property() { } - - } - } diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/UserPrice.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/UserPrice.java index 38d1a745..90c651a7 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/UserPrice.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/UserPrice.java @@ -6,10 +6,10 @@ public class UserPrice { - @JsonProperty(Property.AMOUNT) + @JsonProperty("amount") private final String amount; - @JsonProperty(Property.CURRENCY) + @JsonProperty("currency") private final String currency; private UserPrice(String amount, String currency) { @@ -78,13 +78,4 @@ public UserPrice build() { } - private static final class Property { - - private static final String AMOUNT = "amount"; - private static final String CURRENCY = "currency"; - - private Property() { } - - } - } diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/GetSessionResult.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/GetSessionResult.java index 87e2f233..6be4325d 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/GetSessionResult.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/GetSessionResult.java @@ -9,43 +9,43 @@ public class GetSessionResult { - @JsonProperty(Property.CLIENT_SESSION_TOKEN_TTL) + @JsonProperty("client_session_token_ttl") private long clientSessionTokenTtl; - @JsonProperty(Property.SESSION_ID) + @JsonProperty("session_id") private String sessionId; - @JsonProperty(Property.USER_TRACKING_ID) + @JsonProperty("user_tracking_id") private String userTrackingId; - @JsonProperty(Property.STATE) + @JsonProperty("state") private String state; - @JsonProperty(Property.CLIENT_SESSION_TOKEN) + @JsonProperty("client_session_token") private String clientSessionToken; - @JsonProperty(Property.BIOMETRIC_CONSENT) + @JsonProperty("biometric_consent") private String biometricConsent; - @JsonProperty(Property.CHECKS) + @JsonProperty("checks") private List checks; - @JsonProperty(Property.RESOURCES) + @JsonProperty("resources") private ResourceContainer resources; - @JsonProperty(Property.IDENTITY_PROFILE) + @JsonProperty("identity_profile") private IdentityProfileResponse identityProfile; - @JsonProperty(Property.ADVANCED_IDENTITY_PROFILE) + @JsonProperty("advanced_identity_profile") private AdvancedIdentityProfileResponse advancedIdentityProfile; - @JsonProperty(Property.IDENTITY_PROFILE_PREVIEW) + @JsonProperty("identity_profile_preview") private IdentityProfilePreviewResponse identityProfilePreview; - @JsonProperty(Property.ADVANCED_IDENTITY_PROFILE_PREVIEW) + @JsonProperty("advanced_identity_profile_preview") private IdentityProfilePreviewResponse advancedIdentityProfilePreview; - @JsonProperty(Property.IMPORT_TOKEN) + @JsonProperty("import_token") private ImportTokenResponse importToken; public long getClientSessionTokenTtl() { @@ -175,24 +175,4 @@ private List filterChecksByType(Class clazz) { .collect(Collectors.toList()); } - private static final class Property { - - private static final String CLIENT_SESSION_TOKEN_TTL = "client_session_token_ttl"; - private static final String SESSION_ID = "session_id"; - private static final String USER_TRACKING_ID = "user_tracking_id"; - private static final String STATE = "state"; - private static final String CLIENT_SESSION_TOKEN = "client_session_token"; - private static final String BIOMETRIC_CONSENT = "biometric_consent"; - private static final String CHECKS = "checks"; - private static final String RESOURCES = "resources"; - private static final String IDENTITY_PROFILE = "identity_profile"; - private static final String ADVANCED_IDENTITY_PROFILE = "advanced_identity_profile"; - private static final String IDENTITY_PROFILE_PREVIEW = "identity_profile_preview"; - private static final String ADVANCED_IDENTITY_PROFILE_PREVIEW = "advanced_identity_profile_preview"; - private static final String IMPORT_TOKEN = "import_token"; - - private Property() { } - - } - } diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/IdentityProfileResponse.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/IdentityProfileResponse.java index ba4b09d7..8cb52cc3 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/IdentityProfileResponse.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/IdentityProfileResponse.java @@ -4,16 +4,16 @@ public class IdentityProfileResponse { - @JsonProperty(Property.SUBJECT_ID) + @JsonProperty("subject_id") private String subjectId; - @JsonProperty(Property.RESULT) + @JsonProperty("result") private String result; - @JsonProperty(Property.FAILURE_REASON) + @JsonProperty("failure_reason") private IdentityProfileFailureResponse failureReason; - @JsonProperty(Property.IDENTITY_PROFILE_REPORT) + @JsonProperty("identity_profile_report") private IdentityProfileReportResponse identityProfileReport; public String getSubjectId() { @@ -32,15 +32,4 @@ public IdentityProfileReportResponse getIdentityProfileReport() { return identityProfileReport; } - private static final class Property { - - private static final String SUBJECT_ID = "subject_id"; - private static final String RESULT = "result"; - private static final String FAILURE_REASON = "failure_reason"; - private static final String IDENTITY_PROFILE_REPORT = "identity_profile_report"; - - private Property() { } - - } - } diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/ImportTokenResponse.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/ImportTokenResponse.java index 73e30650..2cffb878 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/ImportTokenResponse.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/retrieve/ImportTokenResponse.java @@ -4,10 +4,10 @@ public class ImportTokenResponse { - @JsonProperty(Property.MEDIA) + @JsonProperty("media") private MediaResponse media; - @JsonProperty(Property.FAILURE_REASON) + @JsonProperty("failure_reason") private String failureReason; public MediaResponse getMedia() { @@ -18,13 +18,4 @@ public String getFailureReason() { return failureReason; } - private static final class Property { - - private static final String MEDIA = "media"; - private static final String FAILURE_REASON = "failure_reason"; - - private Property() { } - - } - } diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/spi/remote/call/ProfileResponse.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/spi/remote/call/ProfileResponse.java index b3dcc319..53c9ed8c 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/spi/remote/call/ProfileResponse.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/spi/remote/call/ProfileResponse.java @@ -6,13 +6,13 @@ public class ProfileResponse { - @JsonProperty(Property.SESSION_DATA) + @JsonProperty("session_data") private String sessionData; - @JsonProperty(Property.RECEIPT) + @JsonProperty("receipt") private Receipt receipt; - @JsonProperty(Property.ERROR_DETAILS) + @JsonProperty("error_details") private ErrorDetails error; public ProfileResponse() { } @@ -105,14 +105,4 @@ public ProfileResponse build() { } - private static final class Property { - - private static final String SESSION_DATA = "session_data"; - private static final String RECEIPT = "receipt"; - private static final String ERROR_DETAILS = "error_details"; - - private Property() { } - - } - }