Subversion Repositories SmartDukaan

Rev

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

Rev 2245 Rev 2246
Line 31... Line 31...
31
    
31
    
32
    try:
32
    try:
33
        userServiceClient.get_client().resetCart(transaction.shopping_cart_id, items);
33
        userServiceClient.get_client().resetCart(transaction.shopping_cart_id, items);
34
    except ShoppingCartException, TException:
34
    except ShoppingCartException, TException:
35
        print "Error while resetting the cart in the cart database"
35
        print "Error while resetting the cart in the cart database"
36
        print sys.exc_info()
36
        print sys.exc_info()[2]
37
    except:
37
    except:
38
        print "Unexpected exception"
38
        print "Unexpected exception"
39
        print sys.exc_info()
39
        print sys.exc_info()[2]
40
 
40
 
41
def track_coupon_usage(transaction, userServiceClient):
41
def track_coupon_usage(transaction, userServiceClient):
42
    try:
42
    try:
43
        cart = userServiceClient.get_client().getCart(transaction.shopping_cart_id)
43
        cart = userServiceClient.get_client().getCart(transaction.shopping_cart_id)
44
        coupon_code = cart.couponCode
44
        coupon_code = cart.couponCode
45
        
45
        
46
        if coupon_code is not None and coupon_code != '':
46
        if coupon_code is not None and coupon_code != '':
47
            PromotionClient().get_client().trackCouponUsage(coupon_code, transaction.id, transaction.customer_id);
47
            PromotionClient().get_client().trackCouponUsage(coupon_code, transaction.id, transaction.customer_id);
48
    except ShoppingCartException:
48
    except ShoppingCartException:
49
        print "Error occurred in reading CardId for transaction"
49
        print "Error occurred in reading CardId for transaction"
50
        print sys.exc_info()
50
        print sys.exc_info()[2]
51
    except PromotionException:
51
    except PromotionException:
52
        print "Promotion Exception: "
52
        print "Promotion Exception: "
53
        print sys.exc_info()
53
        print sys.exc_info()[2]
54
    except TException:
54
    except TException:
55
        print "Transport from Promotion Service failed:"
55
        print "Transport from Promotion Service failed:"
56
        print sys.exc_info()
56
        print sys.exc_info()[2]
57
    except Exception:
57
    except Exception:
58
        print "Unexpected exception:"
58
        print "Unexpected exception:"
59
        print sys.exc_info()
59
        print sys.exc_info()[2]
60
 
60
 
61
def main():
61
def main():
62
    parser = optparse.OptionParser()
62
    parser = optparse.OptionParser()
63
    parser.add_option("-t", "--txn-id", dest="txn_id",
63
    parser.add_option("-t", "--txn-id", dest="txn_id",
64
                   type="int",
64
                   type="int",