[fix]: request and response schemas

This commit is contained in:
VivianDee
2025-03-25 07:53:56 +01:00
parent f4c2e25025
commit 3e18c2b1cc
9 changed files with 34 additions and 108 deletions
+1 -1
View File
@@ -6,5 +6,5 @@ class EligibilityCheckSchema(Schema):
customerId = fields.Str(required=True)
accountId = fields.Str(required=True)
msisdn = fields.Str(required=True)
lienAmount = fields.Float(required=True)
accountId = fields.Str(required=True)
channel = fields.Str(required=True)
+23 -19
View File
@@ -22,30 +22,34 @@ class EligibilityCheckService:
schema = EligibilityCheckSchema()
validated_data = schema.load(data) # Raises an error if invalid
offers = [
{
"offerId": "Offer1",
"productId": "Product1",
"minAamount": 100,
"maxAamount": 1000,
"tenor": 12
},
{
"offerId": "Offer2",
"productId": "Product2",
"minAamount": 200,
"maxAamount": 2000,
"tenor": 24
}
]
# Simulate processing
response_data = {
"customerId": "CN621868",
"transactionId": "Tr201712RK9232P115",
"transactionId": "TX12345",
"countryCode": "NG",
"msisdn": "3451342",
"eligibleOffers": [
{
"minamount": 5000,
"maxamount": 20000,
"productId": 101,
"offerid": 101,
"Tenor": 30
},
{
"minamount": 20000,
"maxamount": 50000,
"productId": 102,
"offerid": 102,
"Tenor": 60
}
],
"eligibleOffers": offers,
"resultDescription": "Successful",
"resultCode": "00",
"resultDescription": "Successful"
}
"accountId": "ACN8263457"
}
# Return a success response
-32
View File
@@ -38,38 +38,6 @@ class SelectOfferService:
"recommendedRepaymentDates": ["2022-11-30"],
"installmentAmount": 11000.0,
"totalRepaymentAmount": 11000.0
},
{
"offerId": "16645",
"productId": "2060",
"amount": 10000.0,
"upfrontPayment": 0.0,
"interestRate": 3.0,
"managementRate": 1.0,
"managementFee": 1.0,
"insuranceRate": 1.0,
"insuranceFee": 100.0,
"VATRate": 7.5,
"VATAmount": 100.0,
"recommendedRepaymentDates": ["2022-11-30", "2023-12-30"],
"installmentAmount": 5761.9,
"totalRepaymentAmount": 11523.8
},
{
"offerId": "122212",
"productId": "2090",
"amount": 10000.0,
"upfrontPayment": 0.0,
"interestRate": 10.0,
"managementRate": 1.0,
"managementFee": 1.0,
"insuranceRate": 1.0,
"insuranceFee": 100.0,
"VATRate": 7.5,
"VATAmount": 100.0,
"recommendedRepaymentDates": ["2022-11-30", "2022-12-30", "2023-01-29"],
"installmentAmount": 4021.15,
"totalRepaymentAmount": 12063.45
}
]