diff --git a/app/integrations/simbrella.py b/app/integrations/simbrella.py index 3f74720..18b443e 100644 --- a/app/integrations/simbrella.py +++ b/app/integrations/simbrella.py @@ -71,7 +71,6 @@ class SimbrellaClient: except Exception as e: logger.info(f"Failed to call Disbursement endpoint: {e}") - #raise return 0 return 1 @@ -150,6 +149,18 @@ class SimbrellaClient: return data + except Exception as e: + logger.info(f"Failed to call Payment Callback endpoint: {e}") + raise + + @staticmethod + def penal_charge(data): + + try: + logger.info(f"Here is your Penal Charge Request data ***** : {data}") + + return data + except Exception as e: logger.info(f"Failed to call Payment Callback endpoint: {e}") raise \ No newline at end of file diff --git a/app/routes/authentication.py b/app/routes/authentication.py index 20cf323..cce54b5 100644 --- a/app/routes/authentication.py +++ b/app/routes/authentication.py @@ -15,7 +15,7 @@ def health(): @auth_bp.route("/login", methods=["POST"]) def login(): - data = request.json + data = request.get_json() api_url = f"{BASE_URL}/login" response = requests.post(api_url, json=data) @@ -26,7 +26,7 @@ def login(): @auth_bp.route("/status-call", methods=["POST"]) def status_call(): - data = request.json + data = request.get_json() api_url = f"{BASE_URL}/StatusCall" # response = requests.post(api_url, json=data, headers=get_headers()) @@ -49,7 +49,7 @@ def status_call(): @auth_bp.route("/sms", methods=["POST"]) def sms(): - data = request.json + data = request.get_json() api_url = f"{BASE_URL}/SMS" # response = requests.post(api_url, json=data, headers=get_headers()) @@ -66,7 +66,7 @@ def sms(): @auth_bp.route("/bulk-sms", methods=["POST"]) def bulk_sms(): - data = request.json + data = request.get_json() api_url = f"{BASE_URL}/BulkSMS" # response = requests.post(api_url, json=data, headers=get_headers()) diff --git a/app/routes/autocall.py b/app/routes/autocall.py index cc3036e..42335f3 100644 --- a/app/routes/autocall.py +++ b/app/routes/autocall.py @@ -28,9 +28,18 @@ def disbursement(): @autocall_bp.route("/payment-callback", methods=["POST"]) def payment_callback(): - data = request.json() + data = request.get_json() logger.info(f"Calling Callback Components") response = SimbrellaClient.payment_callback(data) + return jsonify(response), 200 + +@autocall_bp.route("/penal-charge", methods=["POST"]) +def penal_charge(): + data = request.get_json() + logger.info(f"Calling Penal Charge Endpoints") + + response = SimbrellaClient.penal_charge(data) + return jsonify(response), 200 \ No newline at end of file diff --git a/openapi.yml b/openapi.yml index c4bc462..761fbe2 100644 --- a/openapi.yml +++ b/openapi.yml @@ -113,6 +113,48 @@ paths: /autocall/payment-callback: get: summary: The Payment callback + responses: + 200: + description: A successful response + /autocall/penal-charge: + post: + summary: Penal Charge Request + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + type: object + properties: + transactionId: + type: string + example: "T004" + fbnTransactionId: + type: string + example: "Tr201712RK9232P115" + debtId: + type: string + example: "273194670" + customerId: + type: string + example: "CN621868" + accountId: + type: string + example: "2017821799" + penalCharge: + type: number + example: "1.2" + lienAmount: + type: number + example: "101.2" + countryId: + type: string + example: "01" + comment: + type: string + example: "Testing PenalCharge" responses: 200: description: A successful response \ No newline at end of file