[fix]: request and response schemas
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -46,20 +46,9 @@
|
||||
"400": {
|
||||
"description": "Invalid ID supplied"
|
||||
},
|
||||
"404": {
|
||||
"description": "Pet not found"
|
||||
},
|
||||
"422": {
|
||||
"description": "Validation exception"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
],
|
||||
"summary": "Loan Information Request ",
|
||||
"description": "Loan Information Request",
|
||||
"operationId": "startEligibilityCheck",
|
||||
"operationId": "LoanInformation",
|
||||
"requestBody": {
|
||||
"description": "Post JSON to conduct eligibility tests",
|
||||
"content": {
|
||||
@@ -52,14 +52,6 @@
|
||||
"422": {
|
||||
"description": "Validation exception"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
],
|
||||
"summary": "Loan Information Request ",
|
||||
"description": "Loan Information Request",
|
||||
"operationId": "startEligibilityCheck",
|
||||
"operationId": "NotificationCallback",
|
||||
"requestBody": {
|
||||
"description": "Post JSON to conduct eligibility tests",
|
||||
"content": {
|
||||
@@ -52,14 +52,6 @@
|
||||
"422": {
|
||||
"description": "Validation exception"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
],
|
||||
"summary": "Provide Loan Request ",
|
||||
"description": "Provide Loan Request",
|
||||
"operationId": "startEligibilityCheck",
|
||||
"operationId": "ProvideLoan",
|
||||
"requestBody": {
|
||||
"description": "Post JSON to conduct eligibility tests",
|
||||
"content": {
|
||||
@@ -46,20 +46,9 @@
|
||||
"400": {
|
||||
"description": "Invalid ID supplied"
|
||||
},
|
||||
"404": {
|
||||
"description": "Pet not found"
|
||||
},
|
||||
"422": {
|
||||
"description": "Validation exception"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
],
|
||||
"summary": "This method is used the send the offer the customer selected to Simbrella ",
|
||||
"description": "This method is used the send the offer the customer selected to Simbrella",
|
||||
"operationId": "startEligibilityCheck",
|
||||
"operationId": "SelectOffer",
|
||||
"requestBody": {
|
||||
"description": "Post JSON to conduct eligibility tests",
|
||||
"content": {
|
||||
@@ -52,14 +52,6 @@
|
||||
"422": {
|
||||
"description": "Validation exception"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
"type": "string",
|
||||
"example": "ACN8263457"
|
||||
},
|
||||
"productid": {
|
||||
"productId": {
|
||||
"type": "string",
|
||||
"example": "101"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user