EditClaimCoveragePaymentDetail(EditClaimCoveragePaymentDetailInput, claimId, coverageId, paymentDetailId)

Modify a claim coverage payment detail record.

API Version 

66.0

Requires Chatter 

No

Signature 

public static ConnectApi.EditClaimCoveragePaymentDetailRep EditClaimCoveragePaymentDetail(ConnectApi.EditClaimCvrPaymentDetailInputRep EditClaimCoveragePaymentDetailInput, String claimId, String coverageId, String paymentDetailId)

Parameters 

claimId

  • Type: String
  • ID of the claim.

coverageId

  • Type: String
  • ID of the coverage that applies to the claim.

EditClaimCoveragePaymentDetailInput

paymentDetailId

  • Type: String
  • ID of the claim coverage payment detail.

Return Value 

Type: ConnectApi.EditClaimCoveragePaymentDetailRep

Example 

Class Definition

This is a sample Apex code to define the EditClaimCoveragePaymentDetail class before you can call it from Apex to edit a claim coverage payment detail.

1public with sharing class EditClaimCoveragePaymentDetailCallable implements System.Callable {
2
3    public Object call(String action, Map<String, Object> args) {
4        // Retrieve the input and output maps from the arguments
5        Map<String, Object> inputMap = (Map<String, Object>) args.get('input');
6        Map<String, Object> outputMap = (Map<String, Object>) args.get('output');
7
8        // Check the action type
9        if (action == 'editClaimCoveragePaymentDetail') {
10            // Retrieve the required parameters from the input map
11            String claimId = (String) inputMap.get('claimId');
12            String claimCoverageId = (String) inputMap.get('claimCoverageId');
13            String paymentDetailId = (String) inputMap.get('paymentDetailId');
14
15            ConnectApi.EditClaimCvrPaymentDetailInputRep editInputRep =
16                (ConnectApi.EditClaimCvrPaymentDetailInputRep) inputMap.get('EditClaimCoveragePaymentDetailInput');
17
18            System.debug('Start of connect API call to edit claim coverage payment detail');
19            System.debug('Claim ID: ' + claimId);
20            System.debug('Claim Coverage ID: ' + claimCoverageId);
21            System.debug('Payment Detail ID: ' + paymentDetailId);
22
23            // Initialize the output representation
24            ConnectApi.EditClaimCoveragePaymentDetailRep editResponse;
25
26            // Call the Connect API to edit claim coverage payment detail
27            try {
28                // Call the Connect API resource directly
29                // The endpoint is: /connect/insurance/claims/${claimId}/coverages/${coverageId}/payment-details/${paymentDetailId}
30                editResponse = ConnectApi.InsuranceClaimFamily.EditClaimCoveragePaymentDetail(
31                    editInputRep,
32                    claimId,
33                    claimCoverageId,
34                    paymentDetailId
35                );
36
37                System.debug('Edit claim coverage payment detail completed successfully: ' + editResponse);
38
39                // Put the editResponse in the output map
40                outputMap.put('editResponse', editResponse);
41                outputMap.put('isSuccess', editResponse.isSuccess);
42
43                // Check if there are any errors
44                if (editResponse.errors != null && !editResponse.errors.isEmpty()) {
45                    outputMap.put('errors', editResponse.errors);
46                    System.debug('Errors found: ' + editResponse.errors);
47                }
48            }
49            catch (Exception e) {
50                System.debug('Error while editing claim coverage payment detail: ' + e.getMessage());
51                outputMap.put('error', e.getMessage());
52                outputMap.put('isSuccess', false);
53            }
54
55            return editResponse;
56        }
57
58        // If the action is not recognized, return null
59        return null;
60    }
61}

Usage Example

This example shows how to call the EditClaimCoveragePaymentDetailCallable class and include the required input data.

1PayExGratiaClaimCvrPaymentDetailCallable callable = new PayExGratiaClaimCvrPaymentDetailCallable();
2
3// Prepare the input arguments
4Map<String, Object> input = new Map<String, Object>();
5
6// Set the required parameters
7input.put('claimId', '0ZkSB0000001AVH0A2');                    // Claim ID
8input.put('claimCoverageId', '0kPSB000000GHdu2AG');            // Claim Coverage ID
9input.put('paymentDetailId', '0l2SB000000CLsMYAW');           // Payment Detail ID
10
11// Create the input representation object
12// First create a Map with the properties
13Map<String, Object> payExGratiaInputMap = new Map<String, Object>();
14payExGratiaInputMap.put('reason', 'Customer service goodwill payment');
15
16// Convert the Map to ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep using JSON.deserialize
17String jsonString = JSON.serialize(payExGratiaInputMap);
18ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep payExGratiaInputRep =
19    (ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep) JSON.deserialize(jsonString, ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep.class);
20
21input.put('PayExGratiaClaimCvrPaymentDetailInput', payExGratiaInputRep);
22
23// Prepare the output map
24Map<String, Object> output = new Map<String, Object>();
25
26// Prepare the args map
27Map<String, Object> args = new Map<String, Object>();
28args.put('input', input);
29args.put('output', output);
30
31// Call the 'payExGratiaClaimCvrPaymentDetail' action
32Object result = callable.call('payExGratiaClaimCvrPaymentDetail', args);
33
34// Check the result
35if (result != null) {
36    System.debug('payExGratiaClaimCvrPaymentDetail processed successfully: ' + result);
37
38    // Access the processed payment data
39    ConnectApi.PayExGratiaClaimCvrPaymentDetailRep paymentData =
40        (ConnectApi.PayExGratiaClaimCvrPaymentDetailRep) result;
41
42    // Process the result as needed
43    System.debug('Pay Ex Gratia Payment Data: ' + paymentData);
44
45    // Check if the payment was successful
46    if (paymentData.isSuccess) {
47        System.debug('Pay Ex Gratia was successful');
48        System.debug('Paid Amount: ' + paymentData.paidAmount);
49        System.debug('Claim Payment Summary ID: ' + paymentData.claimPaymentSummaryId);
50        System.debug('Consumed Limit Count: ' + paymentData.consumedLimitCount);
51        System.debug('Exceeded Amount: ' + paymentData.exceededAmount);
52        System.debug('Exceeded Count: ' + paymentData.exceededCount);
53
54        if (paymentData.insPolicyLimitTrackingIds != null && !paymentData.insPolicyLimitTrackingIds.isEmpty()) {
55            System.debug('Insurance Policy Limit Tracking IDs: ' + paymentData.insPolicyLimitTrackingIds);
56        }
57    } else {
58        System.debug('Pay Ex Gratia failed');
59        if (paymentData.errors != null) {
60            System.debug('Error details: ' + paymentData.errors);
61        }
62    }
63} else {
64    System.debug('Error occurred: ' + output.get('error'));
65}