Exemplo n.º 1
0
 def test_1(self, login_fix, merchant_login_fix):
     '''确认充值订单'''
     s = login_fix
     ms = merchant_login_fix
     sf = SF()
     channelOrderNumber = sf.channelOrderNumber()
     DM = Drg_merchant(ms)
     DF = DRG_func(s)
     paytime = time.strftime("%Y" + "-" + "%m" + "-" + "%d" + " " + "%H" +
                             ":" + "%M" + ":" + "%S")
     #查询是否有未确认订单
     r1 = DF.all_wait_order()
     #如果等于0
     if r1 == 0:
         #商户端新增充值
         DM.merchant_recharge(channelOrderNumber)
         #运营端确认订单
         sysnb = DF.wait_order()
         sysnumber = sysnb["data"]["resultList"]["dataList"][0][
             "systemOrderNumber"]
         result = DF.sucess_order(paytime, sysnumber)
         assert result["message"]["content"] == "确认成功"
     else:
         #不等于0查询系统单号,确认订单
         sysnb = DF.wait_order()
         sysnumber = sysnb["data"]["resultList"]["dataList"][0][
             "systemOrderNumber"]
         result = DF.sucess_order(paytime, sysnumber)
         assert result["message"]["content"] == "确认成功"
Exemplo n.º 2
0
    def test_1(self, merchant_login_fix, login_fix):
        '''开票申请'''
        sf = SF()
        channelOrderNumber = sf.channelOrderNumber()
        amount = sf.day()
        s = login_fix
        DF = DRG_func(s)
        paytime = time.strftime("%Y" + "-" + "%m" + "-" + "%d" + " " + "%H" +
                                ":" + "%M" + ":" + "%S")
        ms = merchant_login_fix
        DM = Drg_merchant(ms)
        #查询是否有开票充值记录
        r = DM.rechargeOrder_wait()
        rechargeCount = r["data"]["rechargeCount"]
        #判断充值记录为0的情况下
        if rechargeCount == 0:
            #新增充值记录
            print("新增充值")
            DM.merchant_recharge(amount, channelOrderNumber)
            #运营端确认
            sysnumber1 = DF.wait_order()
            sysnumber = sysnumber1["data"]["resultList"]["dataList"][0][
                "systemOrderNumber"]
            DF.sucess_order(paytime, sysnumber)
            print("运营端确认充值记录")
            # 查询开票充值几率不为0的情况下开票申请,先查询出开票充值记录里面的充值金额和系统单号
            recharge_detail = DM.rechargeOrder_wait()
            totalAmount = recharge_detail["data"]["resultList"]["dataList"][0][
                "amountStr"]
            s_totalAmount = recharge_detail["data"]["resultList"]["dataList"][
                0]["amountStr"]
            systemOrderNumbers = recharge_detail["data"]["resultList"][
                "dataList"][0]["systemOrderNumber"]
            print("查询开票充值记录,返回税价合计金额、放款单号")
            # 提交开票申请
            result = DM.invoice_apply(totalAmount, systemOrderNumbers,
                                      s_totalAmount)
            print("提交开票申请成功")
            assert result["message"]["content"] == "操作成功"

        else:
            #不为0的情况下开票申请,先查询出开票充值记录里面的充值金额和系统单号
            print("查询开票充值记录,返回税价合计金额、放款单号")
            recharge_detail = DM.rechargeOrder_wait()
            totalAmount = recharge_detail["data"]["resultList"]["dataList"][0][
                "amountStr"]
            s_totalAmount = recharge_detail["data"]["resultList"]["dataList"][
                0]["amountStr"]
            systemOrderNumbers = recharge_detail["data"]["resultList"][
                "dataList"][0]["systemOrderNumber"]
            #提交开票申请
            result = DM.invoice_apply(totalAmount, systemOrderNumbers,
                                      s_totalAmount)
            print("提交开票申请成功")
            assert result["message"]["content"] == "操作成功"
Exemplo n.º 3
0
 def test_5(self, login_fix, merchant_login_fix):
     '''开票申请'''
     s = login_fix
     ms = merchant_login_fix
     sj = SF()
     DF = DRG_func(s)
     DM = Drg_merchant(ms)
     #运营端开票时间
     invoiceDate = time.strftime("%Y" + "-" + "%m" + "-" + "%d" + " " +
                                 "%H" + ":" + "%M" + ":" + "%S")
     #发票代码
     invoiceCode = sj.phone()
     #发票号码
     invoiceNumber = sj.phone()
     #快递单号
     emsOrderNumber = sj.phone()
     #商户端充值通道单号(随机生成)
     channelOrderNumber = sj.channelOrderNumber()
     #商户端充值金额
     recharge_amount = sj.day()
     #---------运营端确认充值订单,查询放款单号-------------------------------------------------
     sysnumber1 = DF.wait_order()
     sysnumber = sysnumber1["data"]["resultList"]["dataList"][0][
         "systemOrderNumber"]
     # ----------商户端,查询出开票充值记录里面的充值金额和系统单号---------------------------------
     recharge_detail = DM.rechargeOrder_wait()
     m_totalAmount = recharge_detail["data"]["resultList"]["dataList"][0][
         "amountStr"]
     s_totalAmount = recharge_detail["data"]["resultList"]["dataList"][0][
         "amountStr"]  #格式化输出,将字典里面的值参数化
     systemOrderNumbers = recharge_detail["data"]["resultList"]["dataList"][
         0]["systemOrderNumber"]
     #-------查询是否有待处理开票订单-------------------------------------------------------------------------------------
     applyStatus = 'WAIT'
     apply = DF.invoice_apply_list(applyStatus)
     apply_result = apply["data"]["count"]
     if apply_result == 0:
         #新增开票申请
         # ------查询是否有开票充值记录-----
         r = DM.rechargeOrder_wait()
         rechargeCount = r["data"]["rechargeCount"]
         # 判断充值记录为0的情况下
         if rechargeCount == 0:
             # 新增充值记录
             DM.merchant_recharge(recharge_amount, channelOrderNumber)
             # 运营端确认
             DF.sucess_order(invoiceDate, sysnumber)
             # 商户端提交开票申请
             DM.invoice_apply(m_totalAmount, systemOrderNumbers,
                              s_totalAmount)
             # 运营端新增开票信息
             # --------运营端查询,返回税价合计金额、批次号、用户编号、根据税价合计计算出 金额和 税额-----------
             applyStatus = 'WAIT'
             r2 = DF.invoice_apply_list(applyStatus)
             totalAmount1 = r2["data"]["resultList"]["dataList"][0][
                 "totalAmount"]  # 获取税价合计金额,类型为 str
             batchNumber = r2["data"]["resultList"]["dataList"][0][
                 "batchNumber"]  # 获取批次号
             merchantNumber = r2["data"]["resultList"]["dataList"][0][
                 "merchantNumber"]  # 获取用户编号
             f_totalAmount = float(totalAmount1)  # 类型为str的金额转化为 浮点型
             y_totalAmount = round(f_totalAmount, 2)  # 浮点型 税价合计金额 四舍五入
             f_amount = y_totalAmount / (1 + 0.1)  # 税率10%
             amount = round(f_amount, 2)  # 金额
             f_taxAmount = y_totalAmount - amount
             taxAmount = round(f_taxAmount, 2)  # 税额
             # 申请合并开票
             r3 = DF.invoice_merger(batchNumber, merchantNumber)
             # 查询开票中订单
             applyStatus = 'HANDLE'
             r4 = DF.invoice_apply_list(applyStatus)
             # 返回合并开票批次号 invoiceBatchNumber
             invoiceBatchNumber = r4["data"]["resultList"]["dataList"][0][
                 "invoiceBatchNumber"]
             DF.invoice_add(invoiceCode, invoiceDate, invoiceNumber,
                            taxAmount, y_totalAmount, amount,
                            invoiceBatchNumber, merchantNumber)
             # 填写快递单号,确认开票申请
             result = DF.invoice_addEmsInfo(batchNumber, merchantNumber,
                                            invoiceBatchNumber,
                                            emsOrderNumber)
             assert result["message"]["content"] == "操作成功"
         else:
             # 商户端提交开票申请
             DM.invoice_apply(m_totalAmount, systemOrderNumbers,
                              s_totalAmount)
             # 运营端新增开票信息
             # --------运营端查询,返回税价合计金额、批次号、用户编号、根据税价合计计算出 金额和 税额-----------
             applyStatus = 'WAIT'
             r2 = DF.invoice_apply_list(applyStatus)
             totalAmount1 = r2["data"]["resultList"]["dataList"][0][
                 "totalAmount"]  # 获取税价合计金额,类型为 str
             batchNumber = r2["data"]["resultList"]["dataList"][0][
                 "batchNumber"]  # 获取批次号
             merchantNumber = r2["data"]["resultList"]["dataList"][0][
                 "merchantNumber"]  # 获取用户编号
             f_totalAmount = float(totalAmount1)  # 类型为str的金额转化为 浮点型
             y_totalAmount = round(f_totalAmount, 2)  # 浮点型 税价合计金额 四舍五入
             f_amount = y_totalAmount / (1 + 0.1)  # 税率10%
             amount = round(f_amount, 2)  # 金额
             f_taxAmount = y_totalAmount - amount
             taxAmount = round(f_taxAmount, 2)  # 税额
             # 申请合并开票
             r3 = DF.invoice_merger(batchNumber, merchantNumber)
             # 查询开票中订单
             applyStatus = 'HANDLE'
             r4 = DF.invoice_apply_list(applyStatus)
             # 返回合并开票批次号 invoiceBatchNumber
             invoiceBatchNumber = r4["data"]["resultList"]["dataList"][0][
                 "invoiceBatchNumber"]
             DF.invoice_add(invoiceCode, invoiceDate, invoiceNumber,
                            taxAmount, y_totalAmount, amount,
                            invoiceBatchNumber, merchantNumber)
             # 填写快递单号,确认开票申请
             result = DF.invoice_addEmsInfo(batchNumber, merchantNumber,
                                            invoiceBatchNumber,
                                            emsOrderNumber)
             assert result["message"]["content"] == "操作成功"
     else:
         # 运营端新增开票信息
         # --------运营端查询,返回税价合计金额、批次号、用户编号、根据税价合计计算出 金额和 税额-----------
         applyStatus = 'WAIT'
         r2 = DF.invoice_apply_list(applyStatus)
         totalAmount1 = r2["data"]["resultList"]["dataList"][0][
             "totalAmount"]  # 获取税价合计金额,类型为 str
         batchNumber = r2["data"]["resultList"]["dataList"][0][
             "batchNumber"]  # 获取批次号
         merchantNumber = r2["data"]["resultList"]["dataList"][0][
             "merchantNumber"]  # 获取用户编号
         f_totalAmount = float(totalAmount1)  # 类型为str的金额转化为 浮点型
         y_totalAmount = round(f_totalAmount, 2)  # 浮点型 税价合计金额 四舍五入
         f_amount = y_totalAmount / (1 + 0.1)  # 税率10%
         amount = round(f_amount, 2)  # 金额
         f_taxAmount = y_totalAmount - amount
         taxAmount = round(f_taxAmount, 2)  # 税额
         # 申请合并开票
         r3 = DF.invoice_merger(batchNumber, merchantNumber)
         # 查询开票中订单
         applyStatus = 'HANDLE'
         r4 = DF.invoice_apply_list(applyStatus)
         # 返回合并开票批次号 invoiceBatchNumber
         invoiceBatchNumber = r4["data"]["resultList"]["dataList"][0][
             "invoiceBatchNumber"]
         DF.invoice_add(invoiceCode, invoiceDate, invoiceNumber, taxAmount,
                        y_totalAmount, amount, invoiceBatchNumber,
                        merchantNumber)
         # 填写快递单号,确认开票申请
         result = DF.invoice_addEmsInfo(batchNumber, merchantNumber,
                                        invoiceBatchNumber, emsOrderNumber)
         assert result["message"]["content"] == "操作成功"
Exemplo n.º 4
0
    def test_6(self, login_fix, merchant_login_fix):
        '''驳回开票申请'''
        s = login_fix
        ms = merchant_login_fix
        sj = SF()
        DF = DRG_func(s)
        DM = Drg_merchant(ms)
        #--------------充值订单确认时间-------------------------------------------------------
        invoiceDate = time.strftime("%Y" + "-" + "%m" + "-" + "%d" + " " +
                                    "%H" + ":" + "%M" + ":" + "%S")
        # ---------运营端确认充值订单,查询放款单号-------------------------------------------------
        sysnumber1 = DF.wait_order()
        sysnumber = sysnumber1["data"]["resultList"]["dataList"][0][
            "systemOrderNumber"]
        # 商户端充值通道单号(随机生成)
        channelOrderNumber = sj.channelOrderNumber()
        # 商户端充值金额
        recharge_amount = sj.day()
        #------查询是否有待处理开票订单----------------
        applyStatus = 'WAIT'
        apply = DF.invoice_apply_list(applyStatus)
        apply_result = apply["data"]["count"]
        if apply_result == 0:
            # 新增开票申请
            # ------查询是否有开票充值记录-----
            r = DM.rechargeOrder_wait()
            rechargeCount = r["data"]["rechargeCount"]
            # 判断充值记录为0的情况下
            if rechargeCount == 0:
                # 新增充值记录
                DM.merchant_recharge(recharge_amount, channelOrderNumber)
                # 运营端确认
                DF.sucess_order(invoiceDate, sysnumber)
                # ----------商户端,查询出开票充值记录里面的充值金额和系统单号
                recharge_detail = DM.rechargeOrder_wait()
                m_totalAmount = recharge_detail["data"]["resultList"][
                    "dataList"][0]["amountStr"]
                s_totalAmount = recharge_detail["data"]["resultList"][
                    "dataList"][0]["amountStr"]  # 格式化输出,将字典里面的值参数化
                systemOrderNumbers = recharge_detail["data"]["resultList"][
                    "dataList"][0]["systemOrderNumber"]
                # 商户端提交开票申请
                DM.invoice_apply(m_totalAmount, systemOrderNumbers,
                                 s_totalAmount)
                # --------查询待处理订单,返回批次号和用户编号---------------
                applyStatus = 'WAIT'
                result = DF.invoice_apply_list(applyStatus)
                merchantNumber = result["data"]["resultList"]["dataList"][0][
                    "merchantNumber"]
                batchNumber = result["data"]["resultList"]["dataList"][0][
                    "batchNumber"]
                # 驳回开票申请
                respnose = DF.unpass_invoice(batchNumber, merchantNumber)
                assert respnose["message"]["content"] == "操作成功"

            else:
                # ----------商户端,查询出开票充值记录里面的充值金额和系统单号
                recharge_detail = DM.rechargeOrder_wait()
                m_totalAmount = recharge_detail["data"]["resultList"][
                    "dataList"][0]["amountStr"]
                s_totalAmount = recharge_detail["data"]["resultList"][
                    "dataList"][0]["amountStr"]  # 格式化输出,将字典里面的值参数化
                systemOrderNumbers = recharge_detail["data"]["resultList"][
                    "dataList"][0]["systemOrderNumber"]
                # 商户端提交开票申请
                DM.invoice_apply(m_totalAmount, systemOrderNumbers,
                                 s_totalAmount)
                # --------查询待处理订单,返回批次号和用户编号---------------
                applyStatus = 'WAIT'
                result = DF.invoice_apply_list(applyStatus)
                merchantNumber = result["data"]["resultList"]["dataList"][0][
                    "merchantNumber"]
                batchNumber = result["data"]["resultList"]["dataList"][0][
                    "batchNumber"]
                # 驳回开票申请
                respnose = DF.unpass_invoice(batchNumber, merchantNumber)
                assert respnose["message"]["content"] == "操作成功"

        else:
            # --------查询待处理订单,返回批次号和用户编号---------------
            applyStatus = 'WAIT'
            result = DF.invoice_apply_list(applyStatus)
            merchantNumber = result["data"]["resultList"]["dataList"][0][
                "merchantNumber"]
            batchNumber = result["data"]["resultList"]["dataList"][0][
                "batchNumber"]
            # 驳回开票申请
            respnose = DF.unpass_invoice(batchNumber, merchantNumber)
            assert respnose["message"]["content"] == "操作成功"