actually this works only if we have covers. I got into another problem now. I am pasting INPUT and OUTPUT here. could you please on how we can transform this. I used json generator to transform but no luck.
@AleksandarAngelevski
INPUT:
{
“summary”: {
“airtimeEnabledInsuranceProductCode”: {
“cover”: [
{
“needCode”: “Illness”,
“needKindName”: “Hospital Illness”,
“autoBoostCoverAmount”: {
“amount”: 25,
“currencyCode”: “XAF”
},
“coverAmount”: {
“amount”: 0,
“currencyCode”: “XAF”
}
},
{
“needCode”: “Accident”,
“needKindName”: “Hospital Accident”,
“autoBoostCoverAmount”: {
“amount”: 25,
“currencyCode”: “XAF”
},
“coverAmount”: {
“amount”: 0,
“currencyCode”: “XAF”
}
},
{
“needCode”: “Life”,
“needKindName”: “Life”,
“autoBoostCoverAmount”: {
“amount”: 25,
“currencyCode”: “XAF”
},
“coverAmount”: {
“amount”: 0,
“currencyCode”: “XAF”
}
}
],
“policyNumber”: “1234567”,
“policyStatus”: “Not Taken Up”,
“productCode”: “Airtime Enabled”,
“coverAmountSegments”: [
{
“startDate”:“2022-03-20T00:00:00”,
“endDate”:“2022-09-19T00:00:00”,
“sumAssured”:{
“amount”:10000.0,
“currencyCode”:“XAF”
}
},
{
“startDate”:“2022-03-20T00:00:00”,
“endDate”:“2022-09-19T00:00:00”,
“sumAssured”:{
“amount”:5000.0,
“currencyCode”:“XAF”
}
}],
“coverStatus”: {
“loyalty”: “ACTIVE”,
“autoBoost”: “ACTIVE”,
“prepaid”: “ACTIVE”
}
},
“bonusAmount”: {
“amount”: 2.50,
“currencyCode”: “GHS”
},
“bonusAmountRequiredToConvert”: {
“amount”: -155.50,
“currencyCode”: “XAF”
},
“consents”: [
{
“agreementReference”: “0006978665”,
“content”: “Recharge With Care”,
“reference”: “2150000059599412”,
“response”: “NO-RESPONSE”,
“type”: “Recharge With Care Policy Change”
}
],
“memberId”: “2320000000000”,
“kycInfo”: {
“kycStatus”: true,
“kycConfirmation”: false
},
“language”: “English”
}
}
OUTPUT:
{
“products”: [
{
“type”: “aYo Airtime Enabled”,
“policyNumber”: “1234567”,
“policyStatus”: “Not Taken Up”,
“attributes”: [
{
“name”: “Game Level”,
“value”: “1”
}
],
“postPaidCover”: [
{
“needCode”: “Illness”,
“needKindName”: “Hospital Illness”,
“rates”: [
{
“type”: “autoBoostCoverAmount”,
“amount”: {
“value”: 25,
“currencyCode”: “XAF”
}
},
{
“type”: “Cover Amount”,
“amount”: {
“value”: 0.00,
“currencyCode”: “XAF”
}
}
]
},
{
“needCode”: “Accident”,
“needKindName”: “Hospital Accident”,
“rates”: [
{
“type”: “autoBoostCoverAmount”,
“amount”: {
“value”: 25,
“currencyCode”: “XAF”
}
},
{
“type”: “Cover Amount”,
“amount”: {
“value”: 0.00,
“currencyCode”: “XAF”
}
}
]
},
{
“needCode”: “Life”,
“needKindName”: “Life”,
“rates”: [
{
“type”: “autoBoostCoverAmount”,
“amount”: {
“value”: 25,
“currencyCode”: “XAF”
}
},
{
“type”: “Cover Amount”,
“amount”: {
“value”: 0.00,
“currencyCode”: “XAF”
}
}
]
}
],
“prepaidCover”: [
{
“startDate”: “2022-03-20T00:00:00”,
“endDate”: “2022-09-19T00:00:00”,
“amount”: {
“value”: 100000.0,
“currencyCode”: “GHS”
}
}
]
}
],
“consents”: [
{
“agreementReference”: “0006978665”,
“content”: “Recharge With Care”,
“reference”: “2150000059599412”,
“response”: “NO-RESPONSE”,
“type”: “Recharge With Care Policy Change”
}
],
“bonus”: [
{
“type”: “bonusAmount”,
“amount”: 2.50,
“currencyCode”: “GHS”
},
{
“type”: “requiredToConvert”,
“amount”: -155.50,
“currencyCode”: “GHS”
}
],
“memberId”: “2320000000000”,
“kycInfo”: {
“kycStatus”: true,
“kycConfirmation”: false
},
“language”: “English”
}