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}