transaction_id
This commit is contained in:
@@ -48,7 +48,7 @@ class BaseService:
|
|||||||
Create a new transaction.
|
Create a new transaction.
|
||||||
"""
|
"""
|
||||||
return Transaction.create_transaction(
|
return Transaction.create_transaction(
|
||||||
id=validated_data.get("transactionId"),
|
transaction_id =validated_data.get("transactionId"),
|
||||||
account_id=validated_data.get("accountId"),
|
account_id=validated_data.get("accountId"),
|
||||||
type=cls.TRANSACTION_TYPE,
|
type=cls.TRANSACTION_TYPE,
|
||||||
channel=validated_data.get("channel"),
|
channel=validated_data.get("channel"),
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class ProvideLoanService(BaseService):
|
|||||||
account_id = validated_data.get('accountId')
|
account_id = validated_data.get('accountId')
|
||||||
customer_id = validated_data.get('customerId')
|
customer_id = validated_data.get('customerId')
|
||||||
request_id = validated_data.get('requestId')
|
request_id = validated_data.get('requestId')
|
||||||
|
transaction_id = validated_data.get('transactionId')
|
||||||
|
|
||||||
if (ProvideLoanService.validate_account_ownership(account_id = account_id, customer_id = customer_id)):
|
if (ProvideLoanService.validate_account_ownership(account_id = account_id, customer_id = customer_id)):
|
||||||
transaction = ProvideLoanService.log_transaction(validated_data = validated_data)
|
transaction = ProvideLoanService.log_transaction(validated_data = validated_data)
|
||||||
@@ -46,7 +47,7 @@ class ProvideLoanService(BaseService):
|
|||||||
|
|
||||||
response_data = {
|
response_data = {
|
||||||
"requestId": request_id,
|
"requestId": request_id,
|
||||||
"transactionId": "Tr201712RK9232P115",
|
"transactionId": transaction_id,
|
||||||
"customerId": customer_id,
|
"customerId": customer_id,
|
||||||
"accountId": account_id,
|
"accountId": account_id,
|
||||||
"msisdn": "3451342",
|
"msisdn": "3451342",
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ class Transaction(db.Model):
|
|||||||
return f'<Transaction {self.id}>'
|
return f'<Transaction {self.id}>'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_transaction(cls, id, account_id, type, channel):
|
def create_transaction(cls, transaction_id, account_id, type, channel):
|
||||||
|
|
||||||
if cls.query.filter_by(transaction_id=id).first():
|
if cls.query.filter_by(transaction_id=transaction_id).first():
|
||||||
raise ValueError("Duplicate Transaction")
|
raise ValueError("Duplicate Transaction")
|
||||||
|
|
||||||
transaction = cls(
|
transaction = cls(
|
||||||
transaction_id=id,
|
transaction_id=transaction_id,
|
||||||
account_id=account_id,
|
account_id=account_id,
|
||||||
type=type,
|
type=type,
|
||||||
channel=channel
|
channel=channel
|
||||||
|
|||||||
Reference in New Issue
Block a user