done with status call
This commit is contained in:
@@ -1,19 +1,44 @@
|
||||
from flask import Blueprint, request, jsonify
|
||||
from flask import Blueprint, request, jsonify, current_app
|
||||
import requests
|
||||
from app.utils.auth import get_headers
|
||||
|
||||
auth_bp = Blueprint("auth", __name__)
|
||||
|
||||
|
||||
@auth_bp.route("/health", methods=["GET"])
|
||||
def health():
|
||||
return jsonify({"status": "Up"})
|
||||
|
||||
|
||||
@auth_bp.route("/login", methods=["POST"])
|
||||
def login():
|
||||
data = request.json
|
||||
api_url = "https://coreapi.dev.simbrellang.net/api/auth/login"
|
||||
|
||||
|
||||
response = requests.post(api_url, json=data)
|
||||
if response.status_code == 200:
|
||||
return jsonify(response.json()), 200
|
||||
return jsonify({"error": "Invalid credentials"}), response.status_code
|
||||
return jsonify({"error": "Invalid credentials"}), response.status_code
|
||||
|
||||
|
||||
@auth_bp.route("/status-call", methods=["POST"])
|
||||
def status_call():
|
||||
data = request.json
|
||||
api_url = f"{current_app.config['API_BASE_URL']}/StatusCall"
|
||||
|
||||
# response = requests.post(api_url, json=data, headers=get_headers())
|
||||
# return jsonify(response.json()), response.status_code
|
||||
response = {
|
||||
"transactionId": "24110114545374721",
|
||||
"data": {
|
||||
"transactionId": "241101",
|
||||
"providedAmount": 1000,
|
||||
"collectedAmount": 0,
|
||||
"resultCode": "00",
|
||||
"resultDescription": "Loan Provision is successful",
|
||||
},
|
||||
"resultCode": "00",
|
||||
"resultDescription": "SUCCESS",
|
||||
}
|
||||
|
||||
return jsonify(response), 200
|
||||
|
||||
Reference in New Issue
Block a user