Subversion Repositories SmartDukaan

Rev

Rev 854 | Rev 1120 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 854 Rev 859
Line 15... Line 15...
15
from shop2020.thriftpy.payments.ttypes import PaymentStatus
15
from shop2020.thriftpy.payments.ttypes import PaymentStatus
16
from shop2020.utils.Utils import to_py_date
16
from shop2020.utils.Utils import to_py_date
17
 
17
 
18
def create_payment(userId, txnId, amount, gatewayId):
18
def create_payment(userId, txnId, amount, gatewayId):
19
    if not userId:
19
    if not userId:
20
        raise PaymentException(101, "user cannot be null")
20
        raise PaymentException(101, "User cannot be null")
21
    if not txnId:
21
    if not txnId:
22
        raise PaymentException(101, "Transaction cannot be null")
22
        raise PaymentException(101, "Transaction cannot be null")
23
    if not amount:
23
    if not amount:
24
        raise PaymentException(101, "Amount cannot be null")
24
        raise PaymentException(101, "Amount cannot be null")
25
    if not gatewayId:
25
    if not gatewayId:
Line 80... Line 80...
80
    except:
80
    except:
81
        raise PaymentException(101, "No such payment")
81
        raise PaymentException(101, "No such payment")
82
        
82
        
83
def get_payment_for_txn(txnId):
83
def get_payment_for_txn(txnId):
84
    try:
84
    try:
85
        return Payment.query.filtery_by(merchantTxnId=txnId).one()
85
        return Payment.query.filter_by(merchantTxnId=txnId).one()
86
    except:
86
    except:
87
        raise PaymentException(103, "Unable to get payment for the given transaction")
87
        raise PaymentException(103, "Unable to get payment for the given transaction")
88
        
88
        
89
def update_payment_details(id, gatewayPaymentId, sessionId, gatewayTxnStatus, description, gatewayTxnId, authCode, referenceCode, errorCode, status, attributes):
89
def update_payment_details(id, gatewayPaymentId, sessionId, gatewayTxnStatus, description, gatewayTxnId, authCode, referenceCode, errorCode, status, attributes):
90
    if not id:
90
    if not id: