Subversion Repositories SmartDukaan

Rev

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

Rev 6735 Rev 6736
Line 221... Line 221...
221
    emiCharge = 0
221
    emiCharge = 0
222
    if emiScheme.chargeType == EmiChargeType.FIXED:
222
    if emiScheme.chargeType == EmiChargeType.FIXED:
223
        emiCharge = ceil(emiScheme.chargeValue)
223
        emiCharge = ceil(emiScheme.chargeValue)
224
    if emiScheme.chargeType == EmiChargeType.PERCENTAGE:
224
    if emiScheme.chargeType == EmiChargeType.PERCENTAGE:
225
        emiCharge = ceil(totalAmount*(emiScheme.chargeValue)/100)
225
        emiCharge = ceil(totalAmount*(emiScheme.chargeValue)/100)
-
 
226
    
-
 
227
    if transaction.coupon_code is not None and transaction.coupon_code != "":    
226
        
228
        try:
-
 
229
            promotion_client = PromotionClient().get_client()
-
 
230
            emis = promotion_client.getEmiDiscount(transaction.shopping_cart_id)
-
 
231
            if emis.has_key(emiSchemeId):
-
 
232
                discount = emis.get(emiSchemeId)
-
 
233
                if emiCharge > discount:
-
 
234
                    emiCharge -= discount
-
 
235
                else:
-
 
236
                    emiCharge = 0
-
 
237
        except:
-
 
238
            print "Could not get emi discounts from promotion"
-
 
239
    
227
    miscCharge = MiscCharges()
240
    miscCharge = MiscCharges()
228
    miscCharge.transaction = transaction
241
    miscCharge.transaction = transaction
229
    miscCharge.chargeType = 1 ##EMI charges
242
    miscCharge.chargeType = 1 ##EMI charges
230
    miscCharge.chargeAmount = emiCharge
243
    miscCharge.chargeAmount = emiCharge
231
    session.commit()
244
    session.commit()