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');
15Map<String, Object> optionsMap = new Map<String, Object>();
16optionsMap.put('shouldCheckFinancialAuthority', true);
17optionsMap.put('shouldVerifyReserveLimit', true);
18payExGratiaInputMap.put('options', optionsMap);
19
20// Convert the Map to ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep using JSON.deserialize
21String jsonString = JSON.serialize(payExGratiaInputMap);
22ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep payExGratiaInputRep =
23 (ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep) JSON.deserialize(jsonString, ConnectApi.PayExGratiaClaimCvrPaymentDetailInputRep.class);
24
25input.put('PayExGratiaClaimCvrPaymentDetailInput', payExGratiaInputRep);
26
27// Prepare the output map
28Map<String, Object> output = new Map<String, Object>();
29
30// Prepare the args map
31Map<String, Object> args = new Map<String, Object>();
32args.put('input', input);
33args.put('output', output);
34
35// Call the 'payExGratiaClaimCvrPaymentDetail' action
36Object result = callable.call('payExGratiaClaimCvrPaymentDetail', args);
37
38// Check the result
39if (result != null) {
40 System.debug('payExGratiaClaimCvrPaymentDetail processed successfully: ' + result);
41
42 // Access the processed payment data
43 ConnectApi.PayExGratiaClaimCvrPaymentDetailRep paymentData =
44 (ConnectApi.PayExGratiaClaimCvrPaymentDetailRep) result;
45
46 // Process the result as needed
47 System.debug('Pay Ex Gratia Payment Data: ' + paymentData);
48
49 // Check if the payment was successful
50 if (paymentData.isSuccess) {
51 System.debug('Pay Ex Gratia was successful');
52 System.debug('Paid Amount: ' + paymentData.paidAmount);
53 System.debug('Remaining Reserves: ' + paymentData.remainingReserves);
54 System.debug('Claim Payment Summary ID: ' + paymentData.claimPaymentSummaryId);
55 System.debug('Consumed Limit Count: ' + paymentData.consumedLimitCount);
56 System.debug('Exceeded Amount: ' + paymentData.exceededAmount);
57 System.debug('Exceeded Count: ' + paymentData.exceededCount);
58 System.debug('Has Financial Authority: ' + paymentData.hasFinancialAuthority);
59 System.debug('Is Financial Authority Configured: ' + paymentData.isFinancialAuthorityConfigured);
60 if (paymentData.warnings != null && !paymentData.warnings.isEmpty()) {
61 System.debug('Warnings: ' + paymentData.warnings);
62 }
63
64 if (paymentData.insPolicyLimitTrackingIds != null && !paymentData.insPolicyLimitTrackingIds.isEmpty()) {
65 System.debug('Insurance Policy Limit Tracking IDs: ' + paymentData.insPolicyLimitTrackingIds);
66 }
67 } else {
68 System.debug('Pay Ex Gratia failed');
69 if (paymentData.errors != null) {
70 System.debug('Error details: ' + paymentData.errors);
71 }
72 }
73} else {
74 System.debug('Error occurred: ' + output.get('error'));
75}