def test_createOrderByShoppingcart_twoDealer(self):
        update('update dlcompany.dl_store_base_info set isCOD = ? where store_id = ?', 1,self.Merch4.storeId)
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        ws.addShoppingcar(merchId=self.Merch1.goodsId, merchCount='1', sellerId=self.Merch1.seller_store_id, sellerName=self.Merch1.sellerName)
        shopcart1 = Shoppingcart.find_first('where user_id = ? and goods_id = ?', self.UserShop.userId, self.Merch1.goodsId)
        ws.addShoppingcar(merchId=self.Merch4.goodsId, merchCount='1', sellerId=self.Merch4.seller_store_id, sellerName=self.Merch4.sellerName)
        shopcart2 = Shoppingcart.find_first('where user_id = ? and goods_id = ?', self.UserShop.userId, self.Merch4.goodsId)
        invoice = {"invoiceId":self.UserShop.invoiceId, "invoiceType":"N011","needInvoice":"0","invoiceHeader":self.UserShop.invoiceHeader}
        deliverAddress = {"deliverAddress":self.UserShop.deliverAddress, "deliverMobile":self.UserShop.deliverMobile, "deliverPerson":self.UserShop.deliverPerson}
        sellerList = []
        sellerList.append({"sellerId":self.Merch1.shopcartSellerId,"sellerName":self.Merch1.sellerName,"isYijipayAccount":self.Merch1.isYijipayAccount,"codFlag":self.Merch1.codFlag,
                           "supportVatInvoice":self.Merch1.supportVatInvoice,"comment":"createOrderByShoppingcart comment.","merchList":
                               [{"id":shopcart1.id,"merchId":self.Merch1.goodsId,"merchBarCode":self.Merch1.productBarCode}]})
        sellerList.append({"sellerId":self.Merch4.shopcartSellerId,"sellerName":self.Merch4.sellerName,"isYijipayAccount":self.Merch4.isYijipayAccount,"codFlag":"0_split_0",
                           "supportVatInvoice":self.Merch4.supportVatInvoice,"comment":"createOrderByShoppingcart comment.","merchList":
                               [{"id":shopcart2.id,"merchId":self.Merch4.goodsId,"merchBarCode":self.Merch4.productBarCode}]})
        order = ws.createOrderByShoppingcart(payWay='2',invoice=invoice, deliverAddress=deliverAddress, sellerList=sellerList)
        self.assertEqual(order.model['success'], '0')

        # 校验订单号和交易号是否匹配
        orderInfoDb = select_one('select * from dlorder.dl_order_orderinfo where pay_no = ?', order.model['createOrderInfoModel']['cashOnDeliveryModelList'][0]['paymentNo'])
        # 支付方式为货到付款
        self.assertEqual(orderInfoDb.pay_type, '2')
        self.assertEqual(orderInfoDb.order_no, order.model['createOrderInfoModel']['cashOnDeliveryModelList'][0]['orderNo'])
        self.assertEqual(orderInfoDb.order_amount, int(order.model['createOrderInfoModel']['cashOnDeliveryModelList'][0]['price']))

        # 校验订单号和交易号是否匹配
        orderInfoDb = select_one('select * from dlorder.dl_order_orderinfo where pay_no = ?', order.model['createOrderInfoModel']['cashOnDeliveryModelList'][1]['paymentNo'])
        # 支付方式为货到付款
        self.assertEqual(orderInfoDb.pay_type, '2')
        self.assertEqual(orderInfoDb.order_no, order.model['createOrderInfoModel']['cashOnDeliveryModelList'][1]['orderNo'])
        self.assertEqual(orderInfoDb.order_amount, int(order.model['createOrderInfoModel']['cashOnDeliveryModelList'][1]['price']))
Example #2
0
def tearDown(self):
    update(
        'update dlorder.dl_order_orderinfo set order_status = ? where order_no = ?',
        'C020', self.UserShop.orderNo)
    update(
        'update dlorder.dl_order_orderinfo set order_status = ? where order_no = ?',
        'C011', self.UserShop2.orderNo)
Example #3
0
 def tearDown(self):
     update(
         'update dlmerchandise.dl_goods set on_hand_inventory = ? where goods_id = ?',
         self.Merch1.onHandInventory, self.Merch1.goodsId)
     update(
         'update dlmerchandise.dl_goods set goods_status = \'01\' where goods_id = ?',
         self.Merch1.goodsId)
Example #4
0
    def test_AddChangeOrderPrice_Onlinepayment(self):
        ws = webservice()
        ws.login(self.UserShop2.username, self.UserShop2.password)
        update(
            'update dlorder.dl_order_orderinfo set order_status = ? where order_no = ?',
            'C011', self.UserShop2.orderNo)
        RstDb = select_one(
            'select * from dlorder.dl_order_orderinfo where order_no = ?',
            self.UserShop2.orderNo)
        # 在线支付订单加价调用接口
        ChangePriceRst = ws.changeOrderPrice(
            orderNo=self.UserShop2.orderNo,
            orderDiscountAmount='-100',
            orderChangeAmount=str(int(RstDb.order_retail_amount) + 100),
            orderStatus=RstDb.order_status)
        self.assertEquals(ChangePriceRst.code, 200)
        self.assertEquals(ChangePriceRst.model['success'], '0')

        # 检验订单加价后是否修改成功
        RstDb1 = select_one(
            'select * from dlorder.dl_order_orderinfo where order_no = ?',
            self.UserShop2.orderNo)
        self.assertEquals(RstDb1.order_amount, RstDb.order_retail_amount + 100)
        update(
            'update dlorder.dl_order_orderinfo set order_amount = ? where order_no = ?',
            RstDb.order_retail_amount, self.UserShop2.orderNo)
Example #5
0
 def setUp(self):
     update(
         'delete from danlu_cd_database.dl_shoppingcart where user_id = ?',
         self.UserShop.userId)
     update(
         'update dlmerchandise.dl_goods set on_hand_inventory = ? where goods_id = ?',
         self.Merch1.onHandInventory, self.Merch1.goodsId)
Example #6
0
 def test_getMerchDetail_stockout(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     update(
         'update dlmerchandise.dl_goods set on_hand_inventory = 0 where goods_id = ?',
         self.Merch1.goodsId)
     merchDetail = ws.getMerchDetail(merchId=self.Merch1.goodsId)
     self.assertEqual(merchDetail.model['merchDetail']['merchStatus'], '1')
Example #7
0
    def test_getMerchList_null(self):
        # 修改终端店2的采购区域为香港CHNP032C342D2995
        update('update dlcompany.dl_biz_purchase set purchase_area_code = ? where company_id = ?', 'CHNP032C342D2995', self.UserShop2.companyId)

        ws = webservice()
        ws.login(self.UserShop2.username, self.UserShop2.password)
        MerchList = ws.getPromotionList(rows='999')
        self.assertEqual(MerchList.model['promotionListModel'],[])
Example #8
0
 def test_getMerchDetail_lock(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     update(
         'update dlmerchandise.dl_goods set goods_status = \'03\' where goods_id = ?',
         self.Merch1.goodsId)
     merchDetail = ws.getMerchDetail(merchId=self.Merch1.goodsId)
     self.assertEqual(merchDetail.model['merchDetail']['merchStatus'], '2')
Example #9
0
    def test_checkSwitch_modify(self):
        update('update dlpromotionx.dl_promotionx_rule set rule_desc = ?,coupon_amount = ? where id = ?', '0', '5', '9')

        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        checkSwitch = ws.checkSwitch()
        self.assertEqual(checkSwitch.model['success'], '0')
        self.assertEqual(checkSwitch.model['bigCouponFlag'], '0')
        self.assertEqual(checkSwitch.model['amount'], '500')
Example #10
0
 def tearDown(self):
     # 还原终端店2的采购区域
     update(
         'update dlcompany.dl_biz_purchase set purchase_area_code = ? where company_id = ?',
         self.UserShop2.areaCode, self.UserShop2.companyId)
     # 还原商品1为上架状态
     update(
         'update dlmerchandise.dl_goods set goods_status = ? where goods_id = ?',
         '01', self.Merch1.goodsId)
Example #11
0
 def test_addShoppingcart_addMerchNoSold(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     update(
         'update dlmerchandise.dl_goods set on_hand_inventory = ? where goods_id = ?',
         '0', self.Merch1.goodsId)
     addMerch = ws.addShoppingcar(merchId=self.Merch1.goodsId,
                                  merchCount='1',
                                  sellerId=self.Merch1.seller_store_id,
                                  sellerName=self.Merch1.sellerName)
     self.assertEqual(addMerch.model['success'], '2')
Example #12
0
 def test_getCouponList_All(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     merchList = [self.Merch1.goodsId]
     couponList = ws.getCouponList(companyId=self.UserShop.companyId,
                                   merchList=merchList)
     self.assertEquals(couponList.code, 200)
     self.assertEquals(couponList.model['success'], '0')
     self.assertEquals(len(couponList.model['useablecouponList']), 10)
     self.assertEquals(len(couponList.model['unUseablecouponList']), 2)
     update(
         'update dlpromotionx.dl_promotionx_coupon_issue_record set issue_person = ? where issue_person = ? ',
         self.UserShop.companyId, 'testapp')
Example #13
0
 def setUp(self):
     update('update dlsms.dl_message set read_status = ? where id = ? ',
            '01', '00DCEE2C6A5942BBA097C3ACFFC47A8A')
     update('update dlsms.dl_message set read_status = ? where id = ? ',
            '01', '1FAFB941460847F0B96A9FFEA182A28F')
     update('update dlsms.dl_message set read_status = ? where id = ? ',
            '01', '0001486CC5724CD7A9B1B4AA085B3B69')
     update('update dlsms.dl_message set read_status = ? where id = ? ',
            '01', '09CCB8DBF42E41E583C9B76423941271')
    def test_createOrderByShoppingcart_outStock(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        ws.addShoppingcar(merchId=self.Merch1.goodsId, merchCount='1', sellerId=self.Merch1.seller_store_id, sellerName=self.Merch1.sellerName)
        shopcart = Shoppingcart.find_first('where user_id = ? and goods_id = ?', self.UserShop.userId, self.Merch1.goodsId)
        # 设置库存为空
        update('update dlmerchandise.dl_goods set on_hand_inventory = ? where goods_id = ?', 0, self.Merch1.goodsId)

        invoice = {"invoiceId":self.UserShop.invoiceId, "invoiceType":"N011","needInvoice":"0","invoiceHeader":self.UserShop.invoiceHeader}
        deliverAddress = {"deliverAddress":self.UserShop.deliverAddress, "deliverMobile":self.UserShop.deliverMobile, "deliverPerson":self.UserShop.deliverPerson}
        sellerList = []
        sellerList.append({"sellerId":self.Merch1.shopcartSellerId,"sellerName":self.Merch1.sellerName,"isYijipayAccount":self.Merch1.isYijipayAccount,"codFlag":self.Merch1.codFlag,
                           "supportVatInvoice":self.Merch1.supportVatInvoice,"comment":"createOrderByShoppingcart comment.","merchList":
                               [{"id":shopcart.id,"merchId":self.Merch1.goodsId,"merchBarCode":self.Merch1.productBarCode}]})
        order = ws.createOrderByShoppingcart(payWay='2',invoice=invoice, deliverAddress=deliverAddress, sellerList=sellerList)
        self.assertEqual(order.model['success'], '2')
        self.assertEqual(order.model['failedReasons']['noInventoryList'][0],self.Merch1.fullName)
    def test_createOrderByShoppingcart_noSalerright(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        ws.addShoppingcar(merchId=self.Merch1.goodsId, merchCount='1', sellerId=self.Merch1.seller_store_id, sellerName=self.Merch1.sellerName)
        shopcart = Shoppingcart.find_first('where user_id = ? and goods_id = ?', self.UserShop.userId, self.Merch1.goodsId)
        # 设置为无售卖权
        update('update dlsaleright.dl_one2many_salesright set buyer_type = ? where firstTier_salesRight_code = ? and buyer_type = ?', 'S016',self.Merch1.SalesrightCode, 'S011')
        #update('update dlsaleright.dl_firsttier_salesright set firstTier_salesRight_status = ? where seller_id = ? and product_barCode = ?', 99, self.Merch1.sellerId, self.Merch1.productBarCode)

        invoice = {"invoiceId":self.UserShop.invoiceId, "invoiceType":"N011","needInvoice":"0","invoiceHeader":self.UserShop.invoiceHeader}
        deliverAddress = {"deliverAddress":self.UserShop.deliverAddress, "deliverMobile":self.UserShop.deliverMobile, "deliverPerson":self.UserShop.deliverPerson}
        sellerList = []
        sellerList.append({"sellerId":self.Merch1.shopcartSellerId,"sellerName":self.Merch1.sellerName,"isYijipayAccount":self.Merch1.isYijipayAccount,"codFlag":self.Merch1.codFlag,
                           "supportVatInvoice":self.Merch1.supportVatInvoice,"comment":"createOrderByShoppingcart comment.","merchList":
                               [{"id":shopcart.id,"merchId":self.Merch1.goodsId,"merchBarCode":self.Merch1.productBarCode}]})
        time.sleep(2)

        order = ws.createOrderByShoppingcart(payWay='2',invoice=invoice, deliverAddress=deliverAddress, sellerList=sellerList)
        self.assertEqual(order.model['success'], '2')
        # 无售卖权invalidList,但实际是shelvesOffList
        self.assertEqual(order.model['failedReasons']['但实际是shelvesOffList'][0],self.Merch1.fullName)
Example #16
0
    def test_getOftenMerchList_soldOut(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        update(
            'update dlmerchandise.dl_goods set goods_status = ? where goods_id = ?',
            '02', self.Merch1.goodsId)
        # 获取下架商品,商品1存在
        merchList = ws.getOftenBuyList(saleFlag="1", rows="999")
        # 下架后商品无促销无推荐
        self.assertGetMerchList(merchList,
                                self.Merch1,
                                isPromotion='1',
                                isRecommended='1')

        # 获取上架商品,商品1不在列表
        merchList = ws.getOftenBuyList(saleFlag="1", rows="999")
        for i in range(0, len(merchList.model['oftenBuyListModel'])):
            if merchList.model['oftenBuyListModel'][i] == self.Merch1.goodsId:
                self.assertEqual(
                    False, True,
                    self.Merch1.fullName + 'is found in oftenBuyList')
Example #17
0
    def test_AlreadypaidChangeOrderPrice_Onlinepayment(self):
        ws = webservice()
        ws.login(self.UserShop2.username, self.UserShop2.password)
        update(
            'update dlorder.dl_order_orderinfo set order_status = ? where order_no = ?',
            'C011', self.UserShop2.orderNo)
        RstDb = select_one(
            'select * from dlorder.dl_order_orderinfo where order_no = ?',
            self.UserShop2.orderNo)

        # 从数据库中修改订单状态为已付款(C019)
        update(
            'update dlorder.dl_order_orderinfo set order_status = ? where order_no = ?',
            'C019', self.UserShop2.orderNo)
        ChangePriceRst = ws.changeOrderPrice(
            orderNo=self.UserShop2.orderNo,
            orderDiscountAmount='100',
            orderChangeAmount=str(int(RstDb.order_retail_amount) - 100),
            orderStatus=RstDb.order_status)

        # 校验已完成的订单改价失败
        self.assertEquals(ChangePriceRst.model['success'], '1')
        update(
            'update dlorder.dl_order_orderinfo set order_status = ? where order_no = ?',
            'C011', self.UserShop2.orderNo)
Example #18
0
    def test_changeOrderPrice_cashondelivery(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        RstDb = select_one(
            'select * from dlorder.dl_order_orderinfo where order_no = ?',
            self.UserShop.orderNo)
        # 货到付款订单减价调用接口
        ChangePriceRst = ws.changeOrderPrice(
            orderNo=self.UserShop.orderNo,
            orderDiscountAmount='100',
            orderChangeAmount=str(int(RstDb.order_retail_amount) - 100),
            orderStatus=RstDb.order_status)
        self.assertEquals(ChangePriceRst.code, 200)
        self.assertEquals(ChangePriceRst.model['success'], '0')

        # 检验订单减价后是否修改成功
        RstDb1 = select_one(
            'select * from dlorder.dl_order_orderinfo where order_no = ?',
            self.UserShop.orderNo)
        self.assertEquals(RstDb1.order_amount, RstDb.order_retail_amount - 100)

        #货到付款订单加价
        ChangePriceRst1 = ws.changeOrderPrice(
            orderNo=self.UserShop.orderNo,
            orderDiscountAmount='-200',
            orderChangeAmount=str(RstDb1.order_retail_amount + 200),
            orderStatus=RstDb1.order_status)

        self.assertEquals(ChangePriceRst1.code, 200)
        self.assertEquals(ChangePriceRst1.model['success'], '0')

        #检验订单加价
        RstDb2 = select_one(
            'select * from dlorder.dl_order_orderinfo where order_no = ?',
            self.UserShop.orderNo)
        self.assertEquals(RstDb2.order_amount, RstDb.order_amount + 200)
        update(
            'update dlorder.dl_order_orderinfo set order_amount = ? where order_no = ?',
            RstDb.order_retail_amount, self.UserShop.orderNo)
Example #19
0
    def test_AlreadCancelChangeOrderPrice_cashondelivery(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        RstDb = select_one(
            'select * from dlorder.dl_order_orderinfo where order_no = ?',
            self.UserShop.orderNo)

        # 从数据库中修改订单状态为已取消(C012)
        update(
            'update dlorder.dl_order_orderinfo set order_status = ? where order_no = ?',
            'C012', self.UserShop.orderNo)
        ChangePriceRst = ws.changeOrderPrice(
            orderNo=self.UserShop.orderNo,
            orderDiscountAmount='100',
            orderChangeAmount=str(int(RstDb.order_retail_amount) - 100),
            orderStatus=RstDb.order_status)

        #校验已取消的订单改价失败
        self.assertEquals(ChangePriceRst.model['success'], '1')
        update(
            'update dlorder.dl_order_orderinfo set order_status = ? where order_no = ?',
            'C020', self.UserShop.orderNo)
 def tearDown(self):
     # 清空购物车、恢复库存
     update('delete from danlu_cd_database.dl_shoppingcart where user_id = ?', self.UserShop.userId)
     update('update dlmerchandise.dl_goods set on_hand_inventory = ? where goods_id = ?', self.Merch1.onHandInventory, self.Merch1.goodsId)
     update('update dlmerchandise.dl_goods set on_hand_inventory = ? where goods_id = ?', self.Merch2.onHandInventory, self.Merch2.goodsId)
     update('update dlmerchandise.dl_goods set on_hand_inventory = ? where goods_id = ?', self.Merch4.onHandInventory, self.Merch4.goodsId)
     # 恢复经销商2为不支持货到付款
     update('update dlcompany.dl_store_base_info set isCOD = ? where store_id = ?', 0,self.Merch4.storeId)
     # 恢复商品1的售卖权
     #update('update dlsaleright.dl_firsttier_salesright set firstTier_salesRight_status = ? where seller_id = ? and product_barCode = ?', 0, self.Merch1.sellerId, self.Merch1.productBarCode)
     update('update dlsaleright.dl_one2many_salesright set buyer_type = ? where firstTier_salesRight_code = ? and buyer_type = ?', 'S011',self.Merch1.SalesrightCode, 'S016')
Example #21
0
 def tearDown(self):
     # 还原终端店2的采购区域
     update(
         'update dlcompany.dl_biz_purchase set purchase_area_code = ? where company_id = ?',
         self.UserShop2.areaCode, self.UserShop2.companyId)
Example #22
0
 def tearDown(self):
     update('update dlpromotionx.dl_promotionx_rule set rule_desc = ?,coupon_amount = ? where id = ?', self.Param.bigCouponFlag, str(int(self.Param.amount)/100), '9')
Example #23
0
 def setUp(self):
     update(
         'delete from danlu_cd_database.dl_shoppingcart where user_id = ?',
         self.UserShop.userId)
Example #24
0
def initOrder():
    UserShop = eData('TmlShop')
    Merch = eData('Merch1')
    #Merch4 = eData('Merch4')
    DealMgr = eData('DealMager')

    ws = webservice()
    ws.login(DealMgr.username, DealMgr.password)

    #在线支付待付款订单(C011)
    orderOnlineWaitPay = createOrder(UserShop, Merch, payWay='1')
    orderOnlineWaitPay.pop('ws')
    write_excel(sheetname='TmlShop',
                rowkey='orderOnlineWaitPay',
                rowvalue=str(orderOnlineWaitPay))
    import datetime
    update(
        'update dlorder.dl_order_orderinfo SET gmt_created = ? WHERE order_no = ?',
        datetime.datetime.strptime('2099-01-01 00:00:00', "%Y-%m-%d %H:%M:%S"),
        orderOnlineWaitPay.orderNo)

    #在线支付待发货订单
    #在线支付待收货订单
    #在线支付交易完成订单

    #在线支付已取消订单(C012)
    orderOnlienCancel = createOrder(UserShop, Merch, payWay='1')
    orderOnlienCancelWS = orderOnlienCancel.pop('ws')
    write_excel(sheetname='TmlShop',
                rowkey='orderOnlienCancel',
                rowvalue=str(orderOnlienCancel))
    orderOnlienCancelWS.cancel(paymentNo=orderOnlienCancel.paymentNo,
                               payType='1',
                               cancelType='1')

    #货到付款待发货订单(C020)
    orderCodWaitDeliver = createOrder(UserShop, Merch)
    orderCodWaitDeliver.pop('ws')
    write_excel(sheetname='TmlShop',
                rowkey='orderCodWaitDeliver',
                rowvalue=str(orderCodWaitDeliver))

    #货到付款待收货订单(C017)
    orderCodWaitReceive = createOrder(UserShop, Merch)
    orderCodWaitReceive.pop('ws')
    write_excel(sheetname='TmlShop',
                rowkey='orderCodWaitReceive',
                rowvalue=str(orderCodWaitReceive))
    ws.deliver(orderNo=orderCodWaitReceive.orderNo)

    #货到付款已完成订单(C019)
    orderCodComplete = createOrder(UserShop, Merch)
    orderCodComplete.pop('ws')
    write_excel(sheetname='TmlShop',
                rowkey='orderCodComplete',
                rowvalue=str(orderCodComplete))
    ws.deliver(orderNo=orderCodComplete.orderNo)
    codPay(orderNo=orderCodComplete.orderNo)

    #货到付款已取消订单(C012)
    orderCodCancel = createOrder(UserShop, Merch)
    orderCodCancelWS = orderCodCancel.pop('ws')
    write_excel(sheetname='TmlShop',
                rowkey='orderCodCancel',
                rowvalue=str(orderCodCancel))
    orderCodCancelWS.cancel(paymentNo=orderCodCancel.paymentNo)
Example #25
0
def tearDown(self):
    update(
        'update dlpromotionx.dl_promotionx_coupon_issue_record set issue_person = ? where issue_person = ? ',
        self.UserShop.companyId, 'testapp')
Example #26
0
 def tearDown(self):
     update('update dluser.dl_user set user_passwd= ? where user_id = ?', hashlib.md5(self.UserShop.password).hexdigest(), self.UserShop.userId)
Example #27
0
 def tearDown(self):
     update(
         'delete from danlu_cd_database.dl_shoppingcart where user_id = ?',
         self.UserShop2.userId)