public void CardApiTest_Add() { using (var fs = GetInputFile("qrcode.jpg")) { var result = _weChatApi.UploadImage("qrcode.jpg", fs); if (!result.IsSuccess()) { Assert.Fail("上传图片失败,返回结果如下:" + result.DetailResult + ";Msg:" + result.GetFriendlyMessage()); } CardInfo cardInfo = new Groupon() { Groupon_ = new Groupon.GrouponInfo() { BaseInfo = new BaseInfo() { LogoUrl = result.Url, BrandName = "Test", CodeType = CodeTypes.CODE_TYPE_TEXT, Title = "艾唯特会员", Color = "Color010", Notice = "使用时向服务员出示此卡", ServicePhone = "020-88888888", Description = "不可与其他优惠同享\n如需团购券发票,请在消费时向商户提出\n店内均可使用,仅限堂食", DateInfo = new FixTimeRangeDateInfo() { BeginTime = DateTime.Now, EndTime = DateTime.Now.AddMonths(1), }, Sku = new Sku() { Quantity = 1000 }, GetLimit = 1, UseCustomCode = false, BindOpenId = false, CanShare = true, CanGiveFriend = true, LocationIdList = new int[] { 123, 12321, 345345 }, CenterTitle = "快速买单", CenterSubTitle = "点击按钮快速买单", CenterUrl = "http://i-wit.net", CustomUrlName = "立即使用", CustomUrl = "http://i-wit.net", CustomUrlSubTitle = "官网", PromotionUrlName = "更多优惠", PromotionUrl = "http://i-wit.net", Source = "PDA" }, //AdvancedInfo = new AdvancedInfo() //{ // UseCondition = new UseCondition() // { // AcceptCategory = "Test类", // RejectCategory = "Test", // CanUseWithOtherDiscount = true // }, // Abstract = new Abstract() // { // AbstractInfo = "多种新季菜品,期待您的光临", // IconUrlList = new string[] { result.Url } // }, // TextImageList = new TextImageList[] // { // new TextImageList() { ImageUrl=result.Url,Text="此菜品精选食材,以独特的烹饪方法,最大程度地刺激食 客的味蕾" }, // new TextImageList() { ImageUrl=result.Url,Text="此菜品迎合大众口味,老少皆宜,营养均衡" }, // }, // TimeLimit = new TimeLimit[]{ // new TimeLimit() // { // Type = TimeLimitTypes.MONDAY, // BeginHour = 0, // EndHour = 10, // BeginMinute = 10, // EndMinute = 59 // }, // new TimeLimit() // { // Type = TimeLimitTypes.HOLIDAY // } // }, // BusinessService = new string[] { // "BIZ_SERVICE_FREE_WIFI", // "BIZ_SERVICE_WITH_PET", // "BIZ_SERVICE_FREE_PARK", // "BIZ_SERVICE_DELIVER" // } //}, DealDetail = "以下锅底2选1(有菌王锅、麻辣锅、大骨锅、番茄锅、清补 凉锅、酸菜鱼锅可选):\n大锅1份 12元\n小锅2份 16元" } }; var cardResult = _weChatApi.Add(cardInfo); if (!cardResult.IsSuccess()) { Assert.Fail("创建卡券失败,返回结果如下:" + cardResult.DetailResult + ";Msg:" + cardResult.GetFriendlyMessage()); } } }