Newer Version Available
PayExGratiaClaimCvrPaymentDetail(claimId, coverageId, paymentDetailId, PayExGratiaClaimCvrPaymentDetailInput)
Process an ex gratia payment for a claim coverage payment detail record.
API Version
66.0
Requires Chatter
No
Signature
public static ConnectApi.PayExGratiaClaimCvrPaymentDetailRep PayExGratiaClaimCvrPaymentDetail(String claimId, String coverageId, String paymentDetailId, ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep PayExGratiaClaimCvrPaymentDetailInput)
Parameters
- claimId
- Type: String
- ID of the claim.
- coverageId
- Type: String
- ID of the coverage.
- paymentDetailId
- Type: String
- ID of the payment detail.
- PayExGratiaClaimCvrPaymentDetailInput
- Type: ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep
- Details to process the ex gratia payment.
Return Value
Example
- Class Definition
- This is a sample Apex code to define the PayExGratiaClaimCvrPaymentDetail class before you can call it from Apex to process ex gratia payment.
-
1 2public with sharing class PayExGratiaClaimCvrPaymentDetailCallable implements System.Callable { 3 4 public Object call(String action, Map<String, Object> args) { 5 // Retrieve the input and output maps from the arguments 6 Map<String, Object> inputMap = (Map<String, Object>) args.get('input'); 7 Map<String, Object> outputMap = (Map<String, Object>) args.get('output'); 8 9 // Check the action type 10 if (action == 'payExGratiaClaimCvrPaymentDetail') { 11 // Retrieve the required parameters from the input map 12 String claimId = (String) inputMap.get('claimId'); 13 String claimCoverageId = (String) inputMap.get('claimCoverageId'); 14 String paymentDetailId = (String) inputMap.get('paymentDetailId'); 15 16 ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep payExGratiaInputRep = 17 (ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep) inputMap.get('PayExGratiaClaimCvrPaymentDetailInput'); 18 19 System.debug('Start of connect API call to pay ex gratia claim coverage payment detail'); 20 System.debug('Claim ID: ' + claimId); 21 System.debug('Claim Coverage ID: ' + claimCoverageId); 22 System.debug('Payment Detail ID: ' + paymentDetailId); 23 24 // Initialize the output representation 25 ConnectApi.PayExGratiaClaimCvrPaymentDetailRep payExGratiaResponse; 26 27 // Call the Connect API to pay ex gratia 28 try { 29 // Call the Connect API resource directly 30 // The endpoint is: /connect/insurance/claims/${claimId}/coverages/${coverageId}/payment-details/${paymentDetailId}/pay-ex-gratia 31 payExGratiaResponse = ConnectApi.InsuranceClaimFamily.PayExGratiaClaimCvrPaymentDetail( 32 payExGratiaInputRep, 33 claimId, 34 claimCoverageId, 35 paymentDetailId 36 ); 37 38 System.debug('Pay ex gratia completed successfully: ' + payExGratiaResponse); 39 40 // Put the payExGratiaResponse in the output map 41 outputMap.put('payExGratiaResponse', payExGratiaResponse); 42 outputMap.put('isSuccess', payExGratiaResponse.isSuccess); 43 44 // Check if there are any errors 45 if (payExGratiaResponse.errors != null && !payExGratiaResponse.errors.isEmpty()) { 46 outputMap.put('errors', payExGratiaResponse.errors); 47 System.debug('Errors found: ' + payExGratiaResponse.errors); 48 } 49 } 50 catch (Exception e) { 51 System.debug('Error while paying ex gratia: ' + e.getMessage()); 52 outputMap.put('error', e.getMessage()); 53 outputMap.put('isSuccess', false); 54 } 55 56 return payExGratiaResponse; 57 } 58 59 // If the action is not recognized, return null 60 return null; 61 } 62} - Usage Example
- This example shows how to call the EditClaimCoveragePaymentDetailCallable class from Apex and include the required input data.
-
1 2EditClaimCoveragePaymentDetailCallable callable = new EditClaimCoveragePaymentDetailCallable(); 3 4// Prepare the input arguments 5Map<String, Object> input = new Map<String, Object>(); 6 7// Set the required parameters 8input.put('claimId', '0ZkSB0000001AVH0A2'); // Claim ID 9input.put('claimCoverageId', '0kPSB000000GHdu2AG'); // Claim Coverage ID 10input.put('paymentDetailId', '0l2SB000000CLsMYAW'); // Payment Detail ID 11 12// Create the input representation object 13// First create a Map with the properties you want to update 14Map<String, Object> editInputMap = new Map<String, Object>(); 15 16// Set the fields you want to edit (all fields are optional) 17editInputMap.put('claimedAmount', 5000.00); // Update claimed amount 18editInputMap.put('adjustedAmount', 4500.00); // Update adjusted amount 19editInputMap.put('name', 'Updated Payment Detail Name'); // Update name 20editInputMap.put('description', 'Updated description for payment detail'); // Update description 21editInputMap.put('limitUnitCount', 10); // Update limit unit count 22editInputMap.put('status', 'Paid'); // Update status 23// editInputMap.put('recipientId', '003000000000000AAA'); // Update recipient ID if needed 24// editInputMap.put('additionalFields', new Map<String, Object>()); // Additional fields if needed 25 26// Convert the Map to ConnectApi.EditClaimCvrPaymentDetailInputRep using JSON.deserialize 27String jsonString = JSON.serialize(editInputMap); 28ConnectApi.EditClaimCvrPaymentDetailInputRep editInputRep = 29 (ConnectApi.EditClaimCvrPaymentDetailInputRep) JSON.deserialize(jsonString, ConnectApi.EditClaimCvrPaymentDetailInputRep.class); 30 31input.put('EditClaimCoveragePaymentDetailInput', editInputRep); 32 33// Prepare the output map 34Map<String, Object> output = new Map<String, Object>(); 35 36// Prepare the args map 37Map<String, Object> args = new Map<String, Object>(); 38args.put('input', input); 39args.put('output', output); 40 41// Call the 'editClaimCoveragePaymentDetail' action 42Object result = callable.call('editClaimCoveragePaymentDetail', args); 43 44// Check the result 45if (result != null) { 46 System.debug('editClaimCoveragePaymentDetail processed successfully: ' + result); 47 48 // Access the processed edit data 49 ConnectApi.EditClaimCoveragePaymentDetailRep editData = 50 (ConnectApi.EditClaimCoveragePaymentDetailRep) result; 51 52 // Process the result as needed 53 System.debug('Edit Claim Coverage Payment Detail Data: ' + editData); 54 55 // Check if the edit was successful 56 if (editData.isSuccess) { 57 System.debug('Edit Claim Coverage Payment Detail was successful'); 58 System.debug('Adjusted Amount: ' + editData.adjustedAmount); 59 System.debug('Adjusted Reason: ' + editData.adjustedReason); 60 61 if (editData.insurancePolicyLimitTrackingIds != null && !editData.insurancePolicyLimitTrackingIds.isEmpty()) { 62 System.debug('Insurance Policy Limit Tracking IDs: ' + editData.insurancePolicyLimitTrackingIds); 63 } 64 } else { 65 System.debug('Edit Claim Coverage Payment Detail failed'); 66 if (editData.errors != null) { 67 System.debug('Error details: ' + editData.errors); 68 } 69 } 70} else { 71 System.debug('Error occurred: ' + output.get('error')); 72}