| | |
| | | * |
| | | * */ |
| | | public without sharing class AWSServiceTool { |
| | | public static List<Contact> getNoPIContact(String searchContactName,String accountId){ |
| | | if(searchContactName!='' || accountId!=''){ |
| | | String noPISQL = 'select Id,Name,Email,Phone,Account.Name,MobilePhone from Contact where Account_Record_Type_DeveloperName__c in('+'\'Agency\''+','+'\'Office\''+',\'AgencyContact\''+')'; |
| | | if(String.isNotEmpty(accountId)){ |
| | | noPISQL += ' and AccountId=\''+accountId+'\''; |
| | | } |
| | | if(String.isNotEmpty(searchContactName)){ |
| | | noPISQL += ' and Name like \'%'+searchContactName+'%\''; |
| | | } |
| | | system.debug('noPISQL = ' + noPISQL); |
| | | List<Contact> partnerContactList = Database.query(noPISQL); |
| | | return partnerContactList; |
| | | } |
| | | return new List<Contact>(); |
| | | } |
| | | public static String getAWSToken(){ |
| | | AWS_Integration_Info__mdt awsConfiguration = [SELECT App_Id__c,Token_URL__c,App_Secret__c,Host_URL__c FROM AWS_Integration_Info__mdt WHERE DeveloperName = 'AWS_Default_Configuration']; |
| | | if (awsConfiguration == null) { |
| | |
| | | String url = awsConfiguration.Token_URL__c; |
| | | request.setEndpoint(url); |
| | | request.setMethod('GET'); |
| | | if(Test.isRunningTest()){ |
| | | return 'UTToken'; |
| | | } |
| | | HttpResponse response = http.send(request); |
| | | Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody()); |
| | | String token = (String)results.get('object'); |