| | |
| | | } |
| | | } |
| | | // confirm file transaction |
| | | @future(callout =true) |
| | | // @future(callout =true) |
| | | public static void confirmFileTrans(String module,Integer isSuccess, String sfRecordId ,String transId ,String token,String transUrl){ |
| | | Boolean result =false; |
| | | Transaction_Log__c traLog = new Transaction_Log__c(); |
| | | traLog.Module__c = 'ConfirmFileTransaction '+module; |
| | | traLog.Interface_URL__c = transUrl; |
| | | traLog.TransId__c = transId; |
| | | traLog.SFRecordId__c=sfRecordId; |
| | | // traLog.SFRecordId__c=sfRecordId; |
| | | Integer MaxLogColumnLength = 131072; |
| | | try { |
| | | Http http = new Http(); |
| | | HttpRequest request = new HttpRequest(); |
| | | request.setEndpoint(transUrl); |
| | | request.setMethod('POST'); |
| | | request.setHeader('pi-token',token); |
| | | request.setHeader('Content-Type', 'application/json'); |
| | | TransRequestBody requestBody =new TransRequestBody(); |
| | | requestBody.isSuccess=isSuccess; |
| | | requestBody.sfRecordId=sfRecordId; |
| | |
| | | result = (Boolean)results.get('success'); |
| | | System.debug('result = ' + result); |
| | | traLog.Status__c = 'success'; |
| | | traLog.Response__c=response.getBody(); |
| | | String res=response.getBody(); |
| | | traLog.Response__c=res.substring(0, (res.length() > MaxLogColumnLength ? MaxLogColumnLength : res.length())); |
| | | |
| | | } catch (Exception e) { |
| | | traLog.Status__c = 'fail'; |
| | | traLog.Response__c = e.getMessage(); |
| | |
| | | traLog.Module__c = 'Confirm Transaction '+module; |
| | | traLog.Interface_URL__c = transUrl; |
| | | traLog.TransId__c = transId; |
| | | Integer MaxLogColumnLength = 131072; |
| | | if (!String.isEmpty(sfRecordId)) { |
| | | traLog.SFRecordId__c=sfRecordId; |
| | | }else { |
| | |
| | | HttpRequest request = new HttpRequest(); |
| | | request.setEndpoint(transUrl); |
| | | request.setMethod('POST'); |
| | | request.setHeader('pi-token',token); |
| | | request.setHeader('Content-Type', 'application/json'); |
| | | TransactionRequestBody requestBody =new TransactionRequestBody(); |
| | | requestBody.isSuccess=isSuccess; |
| | | requestBody.sfRecordId=sfRecordId; |
| | |
| | | result = (Boolean)results.get('success'); |
| | | System.debug('result = ' + result); |
| | | traLog.Status__c = 'success'; |
| | | traLog.Response__c=response.getBody(); |
| | | String res=response.getBody(); |
| | | traLog.Response__c=res.substring(0, (res.length() > MaxLogColumnLength ? MaxLogColumnLength : res.length())); |
| | | } catch (Exception e) { |
| | | traLog.Status__c = 'fail'; |
| | | traLog.Response__c = e.getMessage(); |