Subversion Repositories SmartDukaan

Rev

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

Rev 766 Rev 854
Line 24... Line 24...
24
        raise PaymentException(101, "Amount cannot be null")
24
        raise PaymentException(101, "Amount cannot be null")
25
    if not gatewayId:
25
    if not gatewayId:
26
        raise PaymentException(101, "Gateway cannot be null")
26
        raise PaymentException(101, "Gateway cannot be null")
27
 
27
 
28
    payment = Payment()
28
    payment = Payment()
-
 
29
    payment.gatewayId = gatewayId
29
    payment.userId = userId
30
    payment.userId = userId
30
    payment.merchantTxnId = txnId
31
    payment.merchantTxnId = txnId
31
    payment.amount = amount
32
    payment.amount = amount
32
    payment.initTimestamp = datetime.datetime.now()
33
    payment.initTimestamp = datetime.datetime.now()
33
    payment.ps = PaymentStatus.INIT
34
    payment.ps = PaymentStatus.INIT
Line 108... Line 109...
108
            payment.errorCode = errorCode
109
            payment.errorCode = errorCode
109
        if status:
110
        if status:
110
            payment.status = status
111
            payment.status = status
111
        if attributes: 
112
        if attributes: 
112
            for attr in attributes:
113
            for attr in attributes:
113
                payment_attr =  PaymentAttribute.query.filter_by(payment=payment, name=attr.name)
114
                payment_attr =  PaymentAttribute.query.filter_by(payment=payment, name=attr.name).first()
114
                if payment_attr:
115
                if payment_attr:
115
                    payment_attr.value = attr.value
116
                    payment_attr.value = attr.value
116
                else:
117
                else:
117
                    payment_attr = PaymentAttribute(payment=payment, name = attr.name, value = attr.value)
118
                    payment_attr = PaymentAttribute(payment=payment, name = attr.name, value = attr.value)
118
        session.commit()
119
        session.commit()