forked from DigiFi/digifi-BankToProductCore
[add]: Offer analysis
This commit is contained in:
@@ -64,12 +64,20 @@ class EligibilityCheckService(BaseService):
|
||||
if response.status_code != 200:
|
||||
return jsonify({"message": "RACCheck failed"}), 400
|
||||
|
||||
RACCheck.add_rac_check(
|
||||
response = response.json()
|
||||
|
||||
rac_check = RACCheck.add_rac_check(
|
||||
customer_id = customer_id,
|
||||
account_id = account_id,
|
||||
transaction_id = transaction.transaction_id,
|
||||
data = response.data
|
||||
data = response['RACResponse']
|
||||
)
|
||||
|
||||
if not rac_check:
|
||||
logger.error(f"Failed to save RACCheck")
|
||||
return jsonify({
|
||||
"message": "Failed to save RACCheck."
|
||||
}), 400
|
||||
|
||||
offers = Offer.get_all_offers()
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ from app.extensions import db
|
||||
from datetime import datetime, timezone
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from app.models import LoanRepaymentSchedule
|
||||
from app.api.services import OfferAnalysis
|
||||
|
||||
from app.api.services.offer_analysis import OfferAnalysis
|
||||
|
||||
class ProvideLoanService(BaseService):
|
||||
TRANSACTION_TYPE = TransactionType.PROVIDE_LOAN
|
||||
|
||||
@@ -8,7 +8,7 @@ from sqlalchemy.types import JSON
|
||||
class RACCheck(db.Model):
|
||||
__tablename__ = 'rac_checks'
|
||||
|
||||
id = db.Column(db.String, primary_key=True)
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
transaction_id = db.Column(db.String(50), nullable=False)
|
||||
customer_id = db.Column(db.String, nullable=False)
|
||||
account_id = db.Column(db.String, nullable=False)
|
||||
@@ -25,7 +25,6 @@ class RACCheck(db.Model):
|
||||
customer_id = customer_id,
|
||||
account_id = account_id,
|
||||
transaction_id = transaction_id,
|
||||
original_transaction = transaction_id,
|
||||
rac_response = data
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 3105abd795d4
|
||||
Revises: 95a52be203c4
|
||||
Create Date: 2025-05-07 11:44:18.483694
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3105abd795d4'
|
||||
down_revision = '95a52be203c4'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('rac_checks', schema=None) as batch_op:
|
||||
# Step 1: Drop the default value
|
||||
batch_op.alter_column('id',
|
||||
server_default=None,
|
||||
existing_type=sa.VARCHAR(),
|
||||
existing_nullable=False
|
||||
)
|
||||
|
||||
with op.batch_alter_table('rac_checks', schema=None) as batch_op:
|
||||
# Step 2: Change the column type
|
||||
batch_op.alter_column('id',
|
||||
existing_type=sa.VARCHAR(),
|
||||
type_=sa.Integer(),
|
||||
existing_nullable=False,
|
||||
autoincrement=True,
|
||||
postgresql_using='id::integer'
|
||||
)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('rac_checks', schema=None) as batch_op:
|
||||
batch_op.alter_column('id',
|
||||
existing_type=sa.Integer(),
|
||||
type_=sa.VARCHAR(),
|
||||
existing_nullable=False,
|
||||
autoincrement=True,
|
||||
existing_server_default=sa.text("''::character varying"))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user