Fix grant type update method

remotes/1728937285237262521/tmp_refs/heads/master
commit b3a0d8e931

@ -62,7 +62,7 @@ public interface ConsumerRESTAPIServices {
throws APIServicesException, BadRequestException, UnexpectedResponseException; throws APIServicesException, BadRequestException, UnexpectedResponseException;
ApplicationKey updateGrantType(TokenInfo tokenInfo, String applicationId, String keyMapId, String keyManager, ApplicationKey updateGrantType(TokenInfo tokenInfo, String applicationId, String keyMapId, String keyManager,
String supportedGrantTypes, String callbackUrl) List<String> supportedGrantTypes, String callbackUrl)
throws APIServicesException, BadRequestException, UnexpectedResponseException; throws APIServicesException, BadRequestException, UnexpectedResponseException;
KeyManager[] getAllKeyManagers(TokenInfo tokenInfo) KeyManager[] getAllKeyManagers(TokenInfo tokenInfo)

@ -729,7 +729,7 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
@Override @Override
public ApplicationKey updateGrantType(TokenInfo tokenInfo, String applicationId, String keyMapId, String keyManager, public ApplicationKey updateGrantType(TokenInfo tokenInfo, String applicationId, String keyMapId, String keyManager,
String supportedGrantTypes, String callbackUrl) List<String> supportedGrantTypes, String callbackUrl)
throws APIServicesException, BadRequestException, UnexpectedResponseException { throws APIServicesException, BadRequestException, UnexpectedResponseException {
ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo(); ApiApplicationInfo apiApplicationInfo = tokenInfo.getApiApplicationInfo();
@ -746,16 +746,19 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
+ tokenInfo.getAccessToken()); + tokenInfo.getAccessToken());
} }
String payload = "{\n" + JSONArray supportedGrantTypeList = new JSONArray();
" \"keyMappingId\": \"" + keyMapId + "\",\n" + for (String string : supportedGrantTypes) {
" \"keyManager\": \"" + keyManager + "\",\n" + supportedGrantTypeList.put(string);
" \"supportedGrantTypes\": [\n" + }
" \"" + supportedGrantTypes + "\"\n" +
" ],\n" + JSONObject payload = new JSONObject();
" \"callbackUrl\": \"" + callbackUrl + "\",\n" + payload.put("keyMappingId", keyMapId);
" \"additionalProperties\": {}\n" + payload.put("keyManager", keyManager);
"}"; payload.put("supportedGrantTypes", supportedGrantTypeList);
RequestBody requestBody = RequestBody.create(JSON, payload); payload.put("callbackUrl", (callbackUrl != null ? callbackUrl : ""));
payload.put("additionalProperties", new JSONObject());
RequestBody requestBody = RequestBody.create(JSON, payload.toString());
builder.put(requestBody); builder.put(requestBody);
Request request = builder.build(); Request request = builder.build();

Loading…
Cancel
Save