From 9d0bc6fab139c1e5e2a507197fa5a1a0cdc41841 Mon Sep 17 00:00:00 2001 From: Bhavya Y Date: Thu, 1 Feb 2024 12:33:35 +0530 Subject: [PATCH] using constants --- src/main/java/com/razorpay/Constants.java | 4 ++-- src/main/java/com/razorpay/OAuthTokenClient.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/razorpay/Constants.java b/src/main/java/com/razorpay/Constants.java index f66ab8ff..98452716 100755 --- a/src/main/java/com/razorpay/Constants.java +++ b/src/main/java/com/razorpay/Constants.java @@ -167,7 +167,7 @@ public class Constants { // Auth constants static final String AUTHORIZE = "authorize"; - static final String TOKEN = "token"; - static final String REVOKE = "revoke"; + static final String TOKEN = "/token"; + static final String REVOKE = "/revoke"; } diff --git a/src/main/java/com/razorpay/OAuthTokenClient.java b/src/main/java/com/razorpay/OAuthTokenClient.java index ea06af7b..e37df9c7 100644 --- a/src/main/java/com/razorpay/OAuthTokenClient.java +++ b/src/main/java/com/razorpay/OAuthTokenClient.java @@ -45,7 +45,7 @@ public String getAuthURL(JSONObject request) throws RazorpayException { public OAuthToken getAccessToken(JSONObject request) throws RazorpayException { GetAccessTokenViaAuthCodeRequestDTO getAccessTokenViaAuthCodeRequestDTO = convertToGetAccessTokenViaAuthCodeRequestDTO(request); validateGetAccessTokenViaAuthCodeRequestDTO(getAccessTokenViaAuthCodeRequestDTO); - return post(null, "/token", request, Constants.AUTH); + return post(null, Constants.TOKEN, request, Constants.AUTH); } public OAuthToken getAccessTokenFromRefreshToken(JSONObject request) throws RazorpayException { @@ -53,14 +53,14 @@ public OAuthToken getAccessTokenFromRefreshToken(JSONObject request) throws Razo validateGetAccessTokenViaRefreshTokenRequestDTO(getAccessTokenViaRefreshTokenRequestDTO); request.put("grant_type", "refresh_token"); - return post(null, "/token", request, Constants.AUTH); + return post(null, Constants.TOKEN, request, Constants.AUTH); } public OAuthToken revokeToken(JSONObject request) throws RazorpayException { RevokeTokenRequestDTO revokeTokenRequestDTO = convertToRevokeTokenRequestDTORequestDTO(request); validateRevokeTokenRequestDTO(revokeTokenRequestDTO); - return patch(null, "/revoke", request, Constants.AUTH); + return patch(null, Constants.REVOKE, request, Constants.AUTH); } private AuthURLRequestDTO convertToAuthRequestDTO(JSONObject request) {