[fix]: request and response schemas
This commit is contained in:
@@ -6,5 +6,5 @@ class EligibilityCheckSchema(Schema):
|
|||||||
customerId = fields.Str(required=True)
|
customerId = fields.Str(required=True)
|
||||||
accountId = fields.Str(required=True)
|
accountId = fields.Str(required=True)
|
||||||
msisdn = fields.Str(required=True)
|
msisdn = fields.Str(required=True)
|
||||||
lienAmount = fields.Float(required=True)
|
accountId = fields.Str(required=True)
|
||||||
channel = fields.Str(required=True)
|
channel = fields.Str(required=True)
|
||||||
|
|||||||
@@ -22,30 +22,34 @@ class EligibilityCheckService:
|
|||||||
schema = EligibilityCheckSchema()
|
schema = EligibilityCheckSchema()
|
||||||
validated_data = schema.load(data) # Raises an error if invalid
|
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
|
# Simulate processing
|
||||||
response_data = {
|
response_data = {
|
||||||
"customerId": "CN621868",
|
"customerId": "CN621868",
|
||||||
"transactionId": "Tr201712RK9232P115",
|
"transactionId": "TX12345",
|
||||||
|
"countryCode": "NG",
|
||||||
"msisdn": "3451342",
|
"msisdn": "3451342",
|
||||||
"eligibleOffers": [
|
"eligibleOffers": offers,
|
||||||
{
|
"resultDescription": "Successful",
|
||||||
"minamount": 5000,
|
|
||||||
"maxamount": 20000,
|
|
||||||
"productId": 101,
|
|
||||||
"offerid": 101,
|
|
||||||
"Tenor": 30
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"minamount": 20000,
|
|
||||||
"maxamount": 50000,
|
|
||||||
"productId": 102,
|
|
||||||
"offerid": 102,
|
|
||||||
"Tenor": 60
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resultCode": "00",
|
"resultCode": "00",
|
||||||
"resultDescription": "Successful"
|
"accountId": "ACN8263457"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Return a success response
|
# Return a success response
|
||||||
|
|||||||
@@ -38,38 +38,6 @@ class SelectOfferService:
|
|||||||
"recommendedRepaymentDates": ["2022-11-30"],
|
"recommendedRepaymentDates": ["2022-11-30"],
|
||||||
"installmentAmount": 11000.0,
|
"installmentAmount": 11000.0,
|
||||||
"totalRepaymentAmount": 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": {
|
"400": {
|
||||||
"description": "Invalid ID supplied"
|
"description": "Invalid ID supplied"
|
||||||
},
|
},
|
||||||
"404": {
|
|
||||||
"description": "Pet not found"
|
|
||||||
},
|
|
||||||
"422": {
|
"422": {
|
||||||
"description": "Validation exception"
|
"description": "Validation exception"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"petstore_auth": [
|
|
||||||
"write:pets",
|
|
||||||
"read:pets"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
],
|
],
|
||||||
"summary": "Loan Information Request ",
|
"summary": "Loan Information Request ",
|
||||||
"description": "Loan Information Request",
|
"description": "Loan Information Request",
|
||||||
"operationId": "startEligibilityCheck",
|
"operationId": "LoanInformation",
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Post JSON to conduct eligibility tests",
|
"description": "Post JSON to conduct eligibility tests",
|
||||||
"content": {
|
"content": {
|
||||||
@@ -52,14 +52,6 @@
|
|||||||
"422": {
|
"422": {
|
||||||
"description": "Validation exception"
|
"description": "Validation exception"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"petstore_auth": [
|
|
||||||
"write:pets",
|
|
||||||
"read:pets"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
],
|
],
|
||||||
"summary": "Loan Information Request ",
|
"summary": "Loan Information Request ",
|
||||||
"description": "Loan Information Request",
|
"description": "Loan Information Request",
|
||||||
"operationId": "startEligibilityCheck",
|
"operationId": "NotificationCallback",
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Post JSON to conduct eligibility tests",
|
"description": "Post JSON to conduct eligibility tests",
|
||||||
"content": {
|
"content": {
|
||||||
@@ -52,14 +52,6 @@
|
|||||||
"422": {
|
"422": {
|
||||||
"description": "Validation exception"
|
"description": "Validation exception"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"petstore_auth": [
|
|
||||||
"write:pets",
|
|
||||||
"read:pets"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
],
|
],
|
||||||
"summary": "Provide Loan Request ",
|
"summary": "Provide Loan Request ",
|
||||||
"description": "Provide Loan Request",
|
"description": "Provide Loan Request",
|
||||||
"operationId": "startEligibilityCheck",
|
"operationId": "ProvideLoan",
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Post JSON to conduct eligibility tests",
|
"description": "Post JSON to conduct eligibility tests",
|
||||||
"content": {
|
"content": {
|
||||||
@@ -46,20 +46,9 @@
|
|||||||
"400": {
|
"400": {
|
||||||
"description": "Invalid ID supplied"
|
"description": "Invalid ID supplied"
|
||||||
},
|
},
|
||||||
"404": {
|
|
||||||
"description": "Pet not found"
|
|
||||||
},
|
|
||||||
"422": {
|
"422": {
|
||||||
"description": "Validation exception"
|
"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 ",
|
"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",
|
"description": "This method is used the send the offer the customer selected to Simbrella",
|
||||||
"operationId": "startEligibilityCheck",
|
"operationId": "SelectOffer",
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Post JSON to conduct eligibility tests",
|
"description": "Post JSON to conduct eligibility tests",
|
||||||
"content": {
|
"content": {
|
||||||
@@ -52,14 +52,6 @@
|
|||||||
"422": {
|
"422": {
|
||||||
"description": "Validation exception"
|
"description": "Validation exception"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"petstore_auth": [
|
|
||||||
"write:pets",
|
|
||||||
"read:pets"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "ACN8263457"
|
"example": "ACN8263457"
|
||||||
},
|
},
|
||||||
"productid": {
|
"productId": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "101"
|
"example": "101"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user