Subversion Repositories SmartDukaan

Rev

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

Rev 6481 Rev 6487
Line 64... Line 64...
64
    transaction_client = TransactionClient().get_client()
64
    transaction_client = TransactionClient().get_client()
65
    txn_id = transaction_client.createTransaction(txn)
65
    txn_id = transaction_client.createTransaction(txn)
66
    return txn_id
66
    return txn_id
67
 
67
 
68
def create_payment(user, amount , txn_id, rtgs_id, rtgs_bank, rtgs_branch, ifsc):
68
def create_payment(user, amount , txn_id, rtgs_id, rtgs_bank, rtgs_branch, ifsc):
69
    payment_id = payment_client.createPayment(user.userId, amount, RTGS_GATEWAY_ID, txn_id)
69
    payment_id = payment_client.createPayment(user.userId, amount, RTGS_GATEWAY_ID, txn_id, False)
70
    payment_client.getPayment(payment_id)
70
    payment_client.getPayment(payment_id)
71
    attributes = []
71
    attributes = []
72
    attributes.append(Attribute(PAYMETHOD_ATTR, '4000'))
72
    attributes.append(Attribute(PAYMETHOD_ATTR, '4000'))
73
    attributes.append(Attribute(RTGS_ID_ATTR, str(rtgs_id)))
73
    attributes.append(Attribute(RTGS_ID_ATTR, str(rtgs_id)))
74
    attributes.append(Attribute(RTGS_BANK_ATTR, rtgs_bank))
74
    attributes.append(Attribute(RTGS_BANK_ATTR, rtgs_bank))
Line 100... Line 100...
100
        address = Address()
100
        address = Address()
101
        address.name = name
101
        address.name = name
102
        address.line1 = line1
102
        address.line1 = line1
103
        address.city = city
103
        address.city = city
104
        address.state = state
104
        address.state = state
105
        address.pin = str(pin)
105
        address.pin = str(int(pin))
106
        address.phone = str(phone)
106
        address.phone = str(int(phone))
107
        item[ADDRESS_KEY] = address
107
        item[ADDRESS_KEY] = address
108
        
108
        
109
    if amount != total_amount:
109
    if amount != total_amount:
110
        print "Amount paid is not equal to the total amount of bulk order."
110
        print "Amount paid is not equal to the total amount of bulk order."
111
        return
111
        return
112
    
112
    
113
    txn_id = create_transaction(user, items)
113
    txn_id = create_transaction(user, items)
114
    create_payment(user, amount, txn_id, rtgs_id, rtgs_bank, rtgs_branch, ifsc)
114
    create_payment(user, amount, txn_id, rtgs_id, rtgs_bank, rtgs_branch, ifsc)
115
    transaction_client.changeTransactionStatus(txn_id, TransactionStatus.AUTHORIZED, "Payment received for the order");
115
    transaction_client.changeTransactionStatus(txn_id, TransactionStatus.AUTHORIZED, "Payment received for the order", 0, 0);
116
    transaction_client.changeTransactionStatus(txn_id, TransactionStatus.IN_PROCESS, "RTGS Payment accepted");
116
    transaction_client.changeTransactionStatus(txn_id, TransactionStatus.IN_PROCESS, "RTGS Payment accepted", 0, 0);
117
 
117
 
118
def main():
118
def main():
119
    parser = optparse.OptionParser()
119
    parser = optparse.OptionParser()
120
    parser.add_option("-f", "--file", dest="file",
120
    parser.add_option("-f", "--file", dest="file",
121
                   help="Excel file with bulk orders.")
121
                   help="Excel file with bulk orders.")