You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
319 lines
24 KiB
319 lines
24 KiB
*** Settings ***
|
|
Documentation 拼版下单
|
|
Test Teardown Run Keyword If Test Failed Fatal Error
|
|
Test Timeout
|
|
Library urllib3
|
|
Library String
|
|
Library demjson
|
|
Library Collections
|
|
Library HttpLibrary
|
|
Library JSONLibrary
|
|
Library RequestsLibrary
|
|
Library DatabaseLibrary
|
|
Library HttpLibrary.HTTP
|
|
|
|
*** Test Cases ***
|
|
spuDetail
|
|
#拼版订单
|
|
#获取spu列表
|
|
Create Session factory ${yytClient} ${ClientHeader}
|
|
${reps} GET On Session factory printing-packaging-factory-service/user/get/all-spu-list params=printingType=2&status=1
|
|
${records} Get From Dictionary ${reps.json()['data']} records #盒型列表
|
|
FOR ${SPUData} IN @{records}
|
|
${url} Get From Dictionary ${SPUData['imageUrlList'][0]} url #盒型图片
|
|
${name} Get From Dictionary ${SPUData} name #盒型名称
|
|
${spuId} Get From Dictionary ${SPUData} id #盒型id
|
|
${orgId} Get From Dictionary ${SPUData} orgId #盒子归属组织id
|
|
${factoryId} Get From Dictionary ${SPUData} factoryId #盒子归属工厂id
|
|
Exit For Loop If '${name}'=='内托'
|
|
END
|
|
Set Global Variable ${url}
|
|
Set Global Variable ${name}
|
|
Set Global Variable ${spuId}
|
|
Set Global Variable ${orgId}
|
|
Set Global Variable ${factoryId}
|
|
#盒型详情
|
|
${SPUDetail} Set Variable {"spuId":"${spuId}","basic":true}
|
|
${reps} POST On Session factory printing-packaging-factory-service/user/render/spu-detail ${SPUDetail.encode('utf-8')}
|
|
${quote} Get From Dictionary ${reps.json()['data']} quote #获取报价基础信息
|
|
${amount} Get From Dictionary ${quote} amount #获取盒型报价
|
|
${quantity} Get From Dictionary ${quote} count
|
|
#${quantity} evaluate random.choice(['1000','2000','3000','4000','5000']) random #数量随机数:1000~5000
|
|
${spuDetail} Get From Dictionary ${reps.json()['data']} spuDetail #获取盒型参数信息
|
|
${spuDetail} Update Value To Json ${spuDetail} $..value null #修改value字段key为null
|
|
${spuDetail} Update Value To Json ${spuDetail} $..remark null #修改remark字段key为null
|
|
${spuDetail} Update Value To Json ${spuDetail} $..partNum null #修改partNum字段key为null
|
|
${spuDetail} Update Value To Json ${spuDetail} $..displayName null #修改displayName字段key为null
|
|
${spuDetail} Update Value To Json ${spuDetail} $..spuCategoryName null #修改spuCategoryName字段key为null
|
|
${spuDetail} Update Value To Json ${spuDetail} $..measureFormulaId null #修改measureFormulaId字段key为null
|
|
${spuCategoryId} Get From Dictionary ${spuDetail} spuCategoryId
|
|
${SpuSize} Get From List ${spuDetail["spuSpecItemList"]} 1 #SPU尺寸参数
|
|
${SpuMaterial} Get From List ${spuDetail["spuSpecItemList"]} 0 #SPU材质参数
|
|
${SpuTechnology} Get From List ${spuDetail["spuSpecItemList"]} 2 #SPU工艺参数
|
|
${spuSpecItemList} Create List
|
|
Append To List ${spuSpecItemList} ${SpuMaterial} ${SpuSize} ${SpuTechnology}
|
|
${productMeasureDesc} Get From Dictionary ${quote} productMeasureDesc #计价尺寸
|
|
${Long} Set Variable ${productMeasureDesc[0:3]} #截取长
|
|
${Weight} Set Variable ${productMeasureDesc[4:7]} #截取宽
|
|
${Material} Evaluate ${Long}*${Weight}/1000000*1.85*${quantity} #材料费
|
|
${Technology} Evaluate round((${Long}+${Weight})/1000*2*18*2.5+(0.08*${quantity}/4),2) #工艺费
|
|
${TotalPrice} Evaluate round(${Material}+${Technology},2) #总价
|
|
${Price} Set Variable If '${TotalPrice}'<='125' 125 ${TotalPrice} #判断是否小于等于低消
|
|
${SpuSizeNormal} Update Value To Json ${SpuSize} $.value 1-211*256 #spu正常计价
|
|
${SpuSizeQuotation} Update Value To Json ${SpuSize} $.value 1-136*300 #spu低消计价
|
|
${Data} Evaluate 3 #修改
|
|
${SpuSizeNormal} Add Object To Json ${SpuSizeNormal} $.operateType ${Data}
|
|
${SpuSizeQuotation} Add Object To Json ${SpuSizeQuotation} $.operateType ${Data} #将对象data加入到json中
|
|
${Operate} Get Value From Json ${SpuSizeQuotation} $.operateType
|
|
${Value} Get Value From Json ${spuDetail} $..value
|
|
${remark} Get Value From Json ${spuDetail} $..remark
|
|
${partNum} Get Value From Json ${spuDetail} $..partNum
|
|
${displayName} Get Value From Json ${spuDetail} $..displayName
|
|
${spuCategoryName} Get Value From Json ${spuDetail} $..spuCategoryName
|
|
${measureFormulaId} Get Value From Json ${spuDetail} $..measureFormulaId
|
|
${spuDetail} Evaluate demjson.encode(${spuDetail}) demjson #字典转换字符串
|
|
${SpuSizeNormal} Evaluate demjson.encode(${SpuSizeNormal}) demjson
|
|
${SpuSizeQuotation} Evaluate demjson.encode(${SpuSizeQuotation}) demjson
|
|
log ${spuDetail}
|
|
Should Be Equal ${amount} ${TotalPrice}
|
|
Set Global Variable ${quote}
|
|
Set Global Variable ${SpuSize}
|
|
Set Global Variable ${spuDetail}
|
|
Set Global Variable ${SpuMaterial}
|
|
Set Global Variable ${spuCategoryId}
|
|
Set Global Variable ${SpuTechnology}
|
|
Set Global Variable ${SpuSizeNormal}
|
|
Set Global Variable ${spuSpecItemList}
|
|
Set Global Variable ${SpuSizeQuotation}
|
|
|
|
Quotation
|
|
#选择盒型参数-低消
|
|
Create Session factory ${yytClient} ${ClientHeader}
|
|
${spuQotation} Set Variable { \ \ \ \ "spuId":"${spuId}", \ \ \ \ "basic":false, \ \ \ \ "spuDetail":${spuDetail}, \ \ \ \ "operateRenderSpuItemList":[${SpuSizeQuotation}] }
|
|
${reps} POST On Session factory printing-packaging-factory-service/user/render/spu-detail ${spuQotation.encode('utf-8')}
|
|
${DATA} Get From Dictionary ${reps.json()} data
|
|
#${DATA} Update Value To Json ${DATA} $..value null #修改value字段key为null
|
|
#${DATA} Update Value To Json ${DATA} $..remark null #修改remark字段key为null
|
|
#${DATA} Update Value To Json ${DATA} $..cutNum null
|
|
#${DATA} Update Value To Json ${DATA} $..partNum null #修改partNum字段key为null
|
|
#${DATA} Update Value To Json ${DATA} $..attribute null
|
|
#${DATA} Update Value To Json ${DATA} $..nodeIdList null
|
|
#${DATA} Update Value To Json ${DATA} $..displayName null #修改displayName字段key为null
|
|
#${DATA} Update Value To Json ${DATA} $..spuSpecItemType null
|
|
#${DATA} Update Value To Json ${DATA} $..spuCategoryName null #修改spuCategoryName字段key为null
|
|
#${DATA} Update Value To Json ${DATA} $..measureFormulaId null #修改measureFormulaId字段key为null
|
|
${Quote} Get From Dictionary ${reps.json()['data']} quote #盒型基础参数
|
|
${desc} Get From Dictionary ${Quote} desc #盒型报价参数
|
|
${Amount} Get From Dictionary ${Quote} amount #获取合计金额
|
|
${quantity} Get From Dictionary ${Quote} count #获取计价数量
|
|
${productId} Get From Dictionary ${Quote['spuProductQuoteList'][0]} spuId #盒型id
|
|
${unitprice} Evaluate ${Amount}/${quantity} #计算单价
|
|
${productName} Get From Dictionary ${Quote['spuProductQuoteList'][0]} name #盒型name
|
|
${productArea} Get From Dictionary ${Quote} productArea #盒型报价尺寸
|
|
${productProcessDesc} Get From Dictionary ${Quote} productProcessDesc #盒型报价工艺
|
|
${productMaterialDesc} Get From Dictionary ${Quote} productMaterialDesc #盒型报价材质
|
|
${productMeasureDesc} Get From Dictionary ${Quote} productMeasureDesc #计价尺寸
|
|
${Long} Set Variable ${productMeasureDesc[0:3]} #截取长
|
|
${Weight} Set Variable ${productMeasureDesc[4:7]} #截取宽
|
|
${Material} Evaluate ${Long}*${Weight}/1000000*1.85*${quantity} #材料费
|
|
${Technology} Evaluate round((${Long}+${Weight})/1000*2*18*2.5+(0.08*${quantity}/8),2) #工艺费
|
|
${TotalPrice} Evaluate round(${Material}+${Technology},2) #总价
|
|
${Price} Set Variable If '${TotalPrice}'<='125' 125 ${TotalPrice} #比较价格
|
|
${DATA} Evaluate demjson.encode(${DATA}) demjson
|
|
${DATA} Replace String ${DATA} "None" null
|
|
#${DATA} Replace String ${DATA} "null" null
|
|
${DATA} Convert Json To String ${DATA}
|
|
Should Be Equal As Numbers ${Amount} ${Price}
|
|
Set Global Variable ${desc}
|
|
Set Global Variable ${DATA}
|
|
Set Global Variable ${Price}
|
|
Set Global Variable ${Amount}
|
|
Set Global Variable ${quantity}
|
|
Set Global Variable ${productId}
|
|
Set Global Variable ${unitprice}
|
|
Set Global Variable ${TotalPrice}
|
|
Set Global Variable ${productName}
|
|
Set Global Variable ${productArea}
|
|
Set Global Variable ${productProcessDesc}
|
|
Set Global Variable ${productMaterialDesc}
|
|
Set Global Variable ${productMeasureDesc}
|
|
|
|
Normal
|
|
#选择盒型参数-正常计算
|
|
Create Session factory ${yytClient} ${ClientHeader}
|
|
${spuNormal} Set Variable { \ \ \ \ "spuId":"${spuId}", \ \ \ \ "basic":false, \ \ \ \ "spuDetail":${spuDetail}, \ \ \ \ "operateRenderSpuItemList":[${SpuSizeNormal}] }
|
|
${reps} POST On Session factory printing-packaging-factory-service/user/render/spu-detail ${spuNormal.encode('utf-8')}
|
|
${Amount} Get From Dictionary ${reps.json()['data']['quote']} amount #获取合计金额
|
|
${quantity} Get From Dictionary ${reps.json()['data']['quote']} count #获取几家数量
|
|
${productMeasureDesc} Get From Dictionary ${reps.json()['data']['quote']} productMeasureDesc #计价尺寸
|
|
${Long} Set Variable ${productMeasureDesc[0:3]} #截取长
|
|
${Weight} Set Variable ${productMeasureDesc[4:7]} #截取宽
|
|
${Material} Evaluate ${Long}*${Weight}/1000000*1.85*${quantity} #材料费
|
|
${Technology} Evaluate round((${Long}+${Weight})/1000*2*18*2.5+(0.08*${quantity}/4),2) #工艺费
|
|
${TotalPrice} Evaluate round(${Material}+${Technology},2) #总价
|
|
${Price} Set Variable If '${TotalPrice}'<='125' 125 ${TotalPrice} #比较价格
|
|
Log ${Price}
|
|
Should Be Equal As Numbers ${Amount} ${Price}
|
|
Set Global Variable ${Price}
|
|
|
|
ConfirmOrder
|
|
#确认下单页面
|
|
#查询钱包
|
|
Create Session factory ${uecClient} ${ClientHeader}
|
|
${reps} GET On Session factory wallet-service/user/get/wallet-account
|
|
${amountGift} Get From Dictionary ${reps.json()['data']} amountGift #赠送金额
|
|
${totalBalance} Get From Dictionary ${reps.json()['data']} totalBalance #总金额
|
|
${frozenBalance} Get From Dictionary ${reps.json()['data']} frozenBalance #冻结金额
|
|
${availableBalance} Get From Dictionary ${reps.json()['data']} availableBalance #可用金额
|
|
Set Global Variable ${amountGift}
|
|
Set Global Variable ${totalBalance}
|
|
Set Global Variable ${frozenBalance}
|
|
Set Global Variable ${availableBalance}
|
|
#获取抬头数据
|
|
Create Session factory ${yytClient} ${ClientHeader}
|
|
${reps} Get On Session factory printing-package-mall-service/user/page/invoice-title params=pageNum=1&pageSize=100
|
|
${Title} Get From Dictionary ${reps.json()['data']} records #获取发票抬头列表
|
|
${InvoiceTitle} Evaluate random.choice(${Title}) random
|
|
Set Global Variable ${InvoiceTitle}
|
|
|
|
DeliveryOrder
|
|
#获取送货地址列表
|
|
Create Session factory ${yytClient} ${ClientHeader}
|
|
${reps} GET On Session factory printing-package-mall-service/user/page/user-shipping-address params=pageNum=1&pageSize=100
|
|
${AddressList} Get From Dictionary ${reps.json()['data']} records #地址列表
|
|
${Address} Evaluate random.choice(${AddressList}) random #随机获取送货地址
|
|
${CityId} Get From Dictionary ${Address} cityId #市id
|
|
${cityName} Get From Dictionary ${Address} cityName #市名
|
|
${AddressId} Get From Dictionary ${Address} id #地址id
|
|
${DistrictId} Get From Dictionary ${Address} districtId #区id
|
|
${ProvinceId} Get From Dictionary ${Address} provinceId #省id
|
|
${districtName} Get From Dictionary ${Address} districtName #区名
|
|
${provinceName} Get From Dictionary ${Address} provinceName #省名
|
|
${AddressDetail} Get From Dictionary ${Address} locDetails #送货详细地址
|
|
${consigneeName} Get From Dictionary ${Address} consigneeName #送货联系人
|
|
${consigneeMobile} Get From Dictionary ${Address} consigneeMobile #送货联系电话
|
|
Set Global Variable ${CityId}
|
|
Set Global Variable ${cityName}
|
|
Set Global Variable ${AddressId}
|
|
Set Global Variable ${DistrictId}
|
|
Set Global Variable ${ProvinceId}
|
|
Set Global Variable ${districtName}
|
|
Set Global Variable ${provinceName}
|
|
Set Global Variable ${AddressDetail}
|
|
Set Global Variable ${consigneeName}
|
|
Set Global Variable ${consigneeMobile}
|
|
#送货-获取税点
|
|
${reps} GET On Session factory printing-package-mall-service/user/get/sale-order/other-fees-config params=factoryId=${Fid}&orgId=${organizationId}&deliveryAddressProvinceId=${ProvinceId}&deliveryAddressCityId=${CityId}&deliveryAddressDistrictId=${DistrictId}
|
|
${Charges} Get From Dictionary ${reps.json()['data']} logisticsCharges #物流费用
|
|
${InvoiceList} Get From Dictionary ${reps.json()['data']} enterpriseInvoiceList #获取税点信息
|
|
FOR ${Invoice} IN @{InvoiceList}
|
|
${tax} Get From Dictionary ${Invoice} tax #税点
|
|
${type} Get From Dictionary ${Invoice} type #开票类型
|
|
END
|
|
${InvoiceData} Set Variable If '${type}'=='1' or '${type}'=='2' ${tax} 0
|
|
${Charges} Set Variable If '${Charges}'=='${None}' 0 ${Charges}
|
|
Set Global Variable ${Charges}
|
|
Set Global Variable ${InvoiceData}
|
|
#获取开票信息
|
|
${reps} GET On Session factory printing-package-mall-service/user/page/invoice-title params=pageNum=1&pageSize=100
|
|
${records} Get From Dictionary ${reps.json()['data']} records #发票抬头
|
|
${InvoiceList} Evaluate random.choice(${records}) random
|
|
${invoiceTitleId} Get From Dictionary ${InvoiceList} id #发票id
|
|
${invoicingOpenAccount} Get From Dictionary ${InvoiceList} bankAccountNumber #银行账号
|
|
${invoicingEnterpriseName} Get From Dictionary ${InvoiceList} enterpriseName #企业名称
|
|
${invoicingEnterprisePhone} Get From Dictionary ${InvoiceList} registerPhone #联系电话
|
|
${invoicingEnterpriseAddress} Get From Dictionary ${InvoiceList} registerAddress #注册地址
|
|
${taxpayerIdentificationNumber} Get From Dictionary ${InvoiceList} enterpriseTaxNumber #公司税号
|
|
${invoicingEnterpriseOpeningBank} Get From Dictionary ${InvoiceList} accountOpeningBank #开户行
|
|
Set Global Variable ${invoiceTitleId}
|
|
Set Global Variable ${invoicingOpenAccount}
|
|
Set Global Variable ${invoicingEnterpriseName}
|
|
Set Global Variable ${invoicingEnterprisePhone}
|
|
Set Global Variable ${invoicingEnterpriseAddress}
|
|
Set Global Variable ${taxpayerIdentificationNumber}
|
|
Set Global Variable ${invoicingEnterpriseOpeningBank}
|
|
#计算合计金额
|
|
#${Price} Evaluate 1250 #商品金额
|
|
${InvoicePrice} Evaluate round((${Price}+${Charges})*${InvoiceData},2) #开票费用
|
|
${TotalAmount} Evaluate round(${Price}+${InvoicePrice}+${Charges},2) #合计金额
|
|
#Set Global Variable ${Price}
|
|
Set Global Variable ${InvoicePrice}
|
|
Set Global Variable ${TotalAmount}
|
|
#获取优惠券列表
|
|
Create Session factory ${uecClient} ${ClientHeader}
|
|
${reps} Get On Session factory coupon-service/user/list/coupon/current-order-usable params=businessType=2&amount=${TotalAmount}
|
|
${CouponList} Get From Dictionary ${reps.json()['data']} currentOrderUsableCouponList #可用优惠券信息
|
|
${111} Evaluate type(${CouponList})
|
|
${CouponPrice} Run Keyword If '${CouponList}'=='[]' Evaluate 0
|
|
... ELSE Run Keyword Coupon
|
|
${TotalPrice} Evaluate round(${Price}+${InvoicePrice}-${CouponPrice}+${Charges},2) #下单金额=商品金额+开票费用+物流-优惠券
|
|
|
|
PickupOrder
|
|
#自提
|
|
${LocationCityId} Set Variable 120100
|
|
${LocationDistrictId} Set Variable 120102
|
|
${LocationProvinceId} Set Variable 120000
|
|
Set Global Variable ${LocationCityId}
|
|
Set Global Variable ${LocationDistrictId}
|
|
Set Global Variable ${LocationProvinceId}
|
|
#自提-获取税点
|
|
Create Session factory ${yytClient} ${ClientHeader}
|
|
${reps} GET On Session factory printing-package-mall-service/user/get/sale-order/other-fees-config params=factoryId=${Fid}&orgId=${organizationId}&deliveryAddressProvinceId=${LocationProvinceId}&deliveryAddressCityId=${LocationCityId}&deliveryAddressDistrictId=${LocationDistrictId}
|
|
${Charges} Get From Dictionary ${reps.json()['data']} logisticsCharges #物流费用
|
|
${InvoiceList} Get From Dictionary ${reps.json()['data']} enterpriseInvoiceList #获取税点信息
|
|
FOR ${Invoice} IN @{InvoiceList}
|
|
${tax} Get From Dictionary ${Invoice} tax #税点
|
|
${type} Get From Dictionary ${Invoice} type #开票类型
|
|
END
|
|
${LocationInvoiceData} Set Variable If '${type}'=='1' ${tax} '${type}'=='2' ${tax} 0
|
|
Set Global Variable ${Charges}
|
|
Set Global Variable ${LocationInvoiceData}
|
|
#计算合计金额
|
|
${Amount} Evaluate 125 #商品金额
|
|
${InvoicePrice} Evaluate (${Amount}+${Charges})*${LocationInvoiceData} #开票费用
|
|
${TotalAmount} Evaluate ${Amount}+${InvoicePrice} #合计金额
|
|
Set Global Variable ${Amount}
|
|
Set Global Variable ${InvoicePrice}
|
|
Set Global Variable ${TotalAmount}
|
|
#获取优惠券列表
|
|
Create Session factory ${uecClient} ${ClientHeader}
|
|
${reps} Get On Session factory coupon-service/user/list/coupon/current-order-usable params=businessType=2&amount=${TotalAmount}
|
|
${CouponList} Get From Dictionary ${reps.json()['data']} currentOrderUsableCouponList #可用优惠券信息
|
|
${CouponData} Run Keyword If '${CouponList}'=='[]' Evaluate 0 ElSE Run Keyword Coupon
|
|
|
|
CreateOrder
|
|
#确认订单
|
|
Create Session factory ${yytClient} ${ClientHeader}
|
|
${OrderData} Set Variable { \ \ \ \ "remark":"", \ \ \ \ "totalAmount":"${TotalAmount}", \ \ \ \ "taxFee":"${InvoicePrice}", \ \ \ \ "taxRate":"${InvoiceData}", \ \ \ \ "logisticsFee":"${Charges}", \ \ \ \ "supplierFactoryId":"${factoryId}", \ \ \ \ "supplierOrgId":"${orgId}", \ \ \ \ "customerContactsName":"${consigneeName}", \ \ \ \ "customerContactsPhone":"${consigneeMobile}", \ \ \ \ "deliveryAddressCityId":"${CityId}", \ \ \ \ "deliveryAddressCityName":"${cityName}", \ \ \ \ "deliveryAddressDistrictId":"${DistrictId}", \ \ \ \ "deliveryAddressDistrictName":"${districtName}", \ \ \ \ "shippingAddressId":"${AddressId}", \ \ \ \ "deliveryAddressLocDetails":"${AddressDetail}", \ \ \ \ "deliveryAddressProvinceId":"${ProvinceId}", \ \ \ \ "deliveryAddressProvinceName":"${provinceName}", \ \ \ \ "packingMethod":1, \ \ \ \ "salesOrderInvoice":{ \ \ \ \ \ \ \ \ "type":1, \ \ \ \ \ \ \ \ "invoiceTitleId":"${invoiceTitleId}", \ \ \ \ \ \ \ \ "entityType":"1", \ \ \ \ \ \ \ \ "invoicingEnterpriseAddress":"${invoicingEnterpriseAddress}", \ \ \ \ \ \ \ \ "invoicingEnterpriseName":"${invoicingEnterpriseName}", \ \ \ \ \ \ \ \ "invoicingEnterpriseOpeningBank":"${invoicingEnterpriseOpeningBank}", \ \ \ \ \ \ \ \ "invoicingEnterprisePhone":"${invoicingEnterprisePhone}", \ \ \ \ \ \ \ \ "invoicingOpenAccount":"${invoicingOpenAccount}", \ \ \ \ \ \ \ \ "taxpayerIdentificationNumber":"${taxpayerIdentificationNumber}" \ \ \ \ }, \ \ \ \ "salesOrderItemProduct":{ \ \ \ \ \ \ \ \ "productName":"${productName}", \ \ \ \ \ \ \ \ "productId":"${productId}", \ \ \ \ \ \ \ \ "amount":"${Amount}", \ \ \ \ \ \ \ \ "quantity":"${quantity}", \ \ \ \ \ \ \ \ "price":"${unitprice}", \ \ \ \ \ \ \ \ "productImgUrl":"${url}", \ \ \ \ \ \ \ \ "factoryId":"${factoryId}", \ \ \ \ \ \ \ \ "orgId":"${orgId}", \ \ \ \ \ \ \ \ "orderSource":1, \ \ \ \ \ \ \ \ "desc":"${desc}", \ \ \ \ \ \ \ \ "productMeasureDesc":"${productArea}", \ \ \ \ \ \ \ \ "productMaterialDesc":"${productMaterialDesc}", \ \ \ \ \ \ \ \ "productProcessDesc":"${productProcessDesc}", \ \ \ \ \ \ \ \ "copyFromId":null, \ \ \ \ \ \ \ \ "productSpecDetailJson":${DATA}, \ \ \ \ \ \ \ \ "productSpecDetail":"${desc}" \ \ \ \ }, \ \ \ \ "orderSource":1 }
|
|
log ${OrderData}
|
|
${reps} POST On Session factory printing-package-mall-service/user/create/sales-order ${OrderData.encode('utf-8')}
|
|
${orderid} Get From Dictionary ${reps.json()} data #订单id
|
|
Set Global Variable ${orderid}
|
|
#支付订单
|
|
${OrderPay} Set Variable {"businessType":202,"tradeOrderId":"${orderid}"}
|
|
${reps} POST On Session factory wallet-service/user/prepay/wallet-bill ${OrderPay.encode('utf-8')}
|
|
${PayId} Get From Dictionary ${reps.json()['data']} id #获取支付id
|
|
${IdData} Set Variable {"id":"${PayId}"}
|
|
${reps} POST On Session factory /wallet-service/user/confirm/wallet-account-pay ${IdData.encode('utf-8')}
|
|
${message} Get From Dictionary ${reps.json()} message
|
|
Should Be Equal ${message} successful #校验是否一致
|
|
|
|
TestCase
|
|
${Data} Set Variable { \ \ \ \ \ \ \ \ "amount":0.28, \ \ \ \ \ \ \ \ "detailItemName":"测试", \ \ \ \ \ \ \ \ "discountAmount":0, \ \ \ \ \ \ \ \ "formula":"None", \ \ \ \ \ \ \ \ "nodeIdList":"None", \ \ \ \ \ \ \ \ "originalAmount":0.28, \ \ \ \ \ \ \ \ "settlementName":"小小", \ \ \ \ \ \ \ \ "settlementNameEnum":1, \ \ \ \ \ \ \ \ "spuSpecItemType":"None", \ \ \ \ \ \ \ \ "topic":"开心麻花" }
|
|
${Value} Replace String ${Data} None null
|
|
|
|
*** Keywords ***
|
|
Coupon
|
|
#获取优惠券列表
|
|
Create Session factory ${uecClient} ${ClientHeader}
|
|
${reps} Get On Session factory coupon-service/user/list/coupon/current-order-usable params=businessType=2&amount=${TotalAmount}
|
|
${CouponList} Get From Dictionary ${reps.json()['data']} currentOrderUsableCouponList #可用优惠券信息
|
|
${CouponData} Evaluate random.choice(${CouponList}) random
|
|
${couponType} Get From Dictionary ${CouponData} couponType #优惠类型,3:折扣,2:满减
|
|
${discountAmount} Get From Dictionary ${CouponData} discountAmount #优惠金额/折扣
|
|
${orderAmountLowerLimit} Get From Dictionary ${CouponData} orderAmountLowerLimit #优惠条件金额
|
|
${discountAmountUpperLimit} Get From Dictionary ${CouponData} discountAmountUpperLimit #优惠封顶金额
|
|
${CouponPrice} Run Keyword If '${couponType}'==3 Evaluate ${orderAmountLowerLimit}*(1-${discountAmount})
|
|
... ELSE Evaluate ${discountAmount}
|
|
${Coupon} Set Variable If '${CouponPrice}'>'${discountAmountUpperLimit}' ${discountAmountUpperLimit} ${CouponPrice}
|
|
Set Global Variable ${Coupon}
|