You are here:
InsurancePolicyTransactionService:reverseTransaction
Use this service to reverse an insurance policy transaction.
This service creates a Reversal transaction for an insurance policy transaction. It also recreates the policy based on a snapshot of the policy from the time the original transaction was created.
Class: InsurancePolicyTransactionService
Method: reverseTransaction
How It Works
To reverse an insurance policy transaction, this service:
-
Validates that the given input
Idis an instance of theInsurancePolicyTransactionobject. -
Retrieves the
InsurancePolicyTransactionrecord and validates that the transaction to reverse is:-
The policy's latest transaction.
-
Linked to an active (not reversed) policy.
-
Linked to the latest active policy version.
-
Linked to a policy snapshot.
Records linked to a policy snapshot have an attachment named
<policyId>_PolicySnapshot. Policy snapshots are enabled for services that create transactions, specifically InsPolicyService:createUpdatePolicy, InsPolicyService:createPolicyVersion, InsPolicyService:cancelPolicy, and InsPolicyService:createTransaction. -
Not a Reversal transaction.
-
-
Creates a Reversal transaction record with:
-
Negative amounts from the original transaction.
-
transactionDate and postDate values based on specified options.
-
Transaction type and name set to Reversal.
-
parentTransactionId equal to the transaction ID of the transaction getting reversed.
-
policyVersionId equal to the policy ID of the snapshot.
-
-
Sets the status of the current policy and the snapshot policy to Reversed.
-
Recreates the policy based on the snapshot. The service:
-
Removes existing IDs so that new records are created when saving.
-
Recreates Payment and Revenue schedules via delete-insert, preserving the original lookup to the transactions.
-
-
Calls
InsuranceCommissionDataService.reverseCommissionsto create and save a reversal commission for the commission related to the original transaction.
Inputs
Input |
Description |
|---|---|
|
The ID of the |
Remote Options
All remote options are optional.
Remote Option |
Description |
|---|---|
|
Value assigned to reversal transaction's transaction date |
|
Post date for the reversal transaction (Default: |
|
Omnistudio Data Mapper bundle for retrieving the |
|
Class for retrieving |
|
Data Mapper bundle for creating and updating |
|
Class for creating and updating |
|
Data Mapper bundle for creating and updating |
|
Class for creating and updating |
Output
Output |
Description |
|---|---|
|
ID of the reversal transaction record. This value matches the input |
|
ID of the reversal commission record |
|
Amount of the reversed commission |
Input JSON
Here's how to format input JSON.
{
"Id": <transaction id>
}Here's how to format options.
{
"effectiveDate": <Date>,
"postDate" : <Date>,
"getCustomClassname" : <String>,
"postPolicyCustomClassName" : <String>,
"postTxnCustomClassName" : <String>
}Here's a sample of input.
{
"Id": "0k9R000000003KjIAI"
}And here's a sample of input options.
{
"effectiveDate": "4/1/2021",
"postDate" : "4/5/2021",
"getCustomClassname" : "GetPolicyTransactionReversalFields",
"postPolicyCustomClassName" : "PostInsurancePolicy",
"postTxnCustomClassName" : "PostInsurancePolicyTransaction"
}Output JSON
Here's the format of output JSON.
{
"transactionIdForReversal": <transaction id>,
"reversalCommissionId": <commission id>,
"reversedCommissionAmount": <Decimal>
}Here's a sample of output.
{
"transactionIdForReversal": "0k9R000000003KjIAI",
"reversalCommissionId": "0k9R000000003KjIAI",
"reversedCommissionAmount": 123.00
}
