Skip to content

Commit

Permalink
using constants
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavyay committed Feb 1, 2024
1 parent 13fbf2b commit 9d0bc6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/razorpay/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";

}
6 changes: 3 additions & 3 deletions src/main/java/com/razorpay/OAuthTokenClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ 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 {
GetAccessTokenViaRefreshTokenRequestDTO getAccessTokenViaRefreshTokenRequestDTO = convertToGetAccessTokenViaRefreshTokenRequestDTO(request);
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) {
Expand Down

0 comments on commit 9d0bc6f

Please sign in to comment.