Subversion Repositories SmartDukaan

Rev

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

Rev 7278 Rev 7285
Line 25... Line 25...
25
    OrderType
25
    OrderType
26
from shop2020.model.v1.order.impl.DataAccessors import get_recharge_orders_for_status, update_recharge_order_status,\
26
from shop2020.model.v1.order.impl.DataAccessors import get_recharge_orders_for_status, update_recharge_order_status,\
27
    update_recharge_transaction_status, get_next_invoice_number
27
    update_recharge_transaction_status, get_next_invoice_number
28
from shop2020.model.v1.order.impl import DataService
28
from shop2020.model.v1.order.impl import DataService
29
from shop2020.model.v1.order.impl.DataService import RechargeTransaction, HotspotStore,\
29
from shop2020.model.v1.order.impl.DataService import RechargeTransaction, HotspotStore,\
30
    WalletForCompany, WalletHistoryForCompany, RechargeCollection
30
    WalletForCompany, WalletHistoryForCompany, RechargeCollection, Company
31
from shop2020.model.v1.order.impl.model.RechargeOrder import RechargeOrder
31
from shop2020.model.v1.order.impl.model.RechargeOrder import RechargeOrder
32
from shop2020.model.v1.order.impl.RechargeService import checkTransactionStatus, getRefunds
32
from shop2020.model.v1.order.impl.RechargeService import checkTransactionStatus, getRefunds
33
 
33
 
34
 
34
 
35
def main():
35
def main():
Line 278... Line 278...
278
        
278
        
279
 
279
 
280
 
280
 
281
def topup_company_wallet(companyId, amount):
281
def topup_company_wallet(companyId, amount):
282
    wallet = WalletForCompany.query.filter(WalletForCompany.id == companyId).with_lockmode("update").one()
282
    wallet = WalletForCompany.query.filter(WalletForCompany.id == companyId).with_lockmode("update").one()
283
 
-
 
-
 
283
    company = Company.get_by(id = companyId)
284
    wh = WalletHistoryForCompany()
284
    wh = WalletHistoryForCompany()
285
    wh.walletId = wallet.id
285
    wh.walletId = wallet.id
286
    wh.openingBal = wallet.amount
286
    wh.openingBal = wallet.amount
287
    wh.closingBal = wallet.amount +  amount
287
    wh.closingBal = wallet.amount +  amount
288
    wh.amount = amount
288
    wh.amount = amount
Line 290... Line 290...
290
    wh.referenceNumber =  get_next_invoice_number(OrderType.WALLETCREDIT)
290
    wh.referenceNumber =  get_next_invoice_number(OrderType.WALLETCREDIT)
291
    wh.description = "Wallet Credited"
291
    wh.description = "Wallet Credited"
292
    
292
    
293
    wallet.amount += amount
293
    wallet.amount += amount
294
    session.commit()
294
    session.commit()
295
    mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "Ashwani.Kumar@spiceretail.co.in","parveen.mittal@spiceretail.co.in","pardeep.panwar@spiceretail.co.in","gagan.sharma@spiceretail.co.in","j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in", "amit.tyagi@spiceretail.co.in"] , "Spice Retail wallet topped up by " +  str(amount) + " rupees.", "", [], [], [])
295
    mail("cnc.center@shop2020.in", "5h0p2o2o", ["rajveer.singh@shop2020.in", "anupam.singh@shop2020.in", "Ashwani.Kumar@spiceretail.co.in","parveen.mittal@spiceretail.co.in","pardeep.panwar@spiceretail.co.in","gagan.sharma@spiceretail.co.in","j.p.gupta@shop2020.in", "rajneesh.arora@shop2020.in", "amit.tyagi@spiceretail.co.in"] , company.name + " wallet topped up by " +  str(amount) + " rupees.", "", [], [], [])
296
    
296
    
297
if __name__ == '__main__':
297
if __name__ == '__main__':
298
    main()
298
    main()
299
299