Exemple #1
0
 /// <summary>
 /// 调用生成兑换码服务
 /// </summary>
 /// <param name="pack"></param>
 /// <param name="quantity"></param>
 /// <param name="startTime"></param>
 /// <param name="endTime"></param>
 /// <param name="user"></param>
 /// <returns></returns>
 public static GenerateRedemptionCodeResult GenerateRedemptionCode(GenerateRedemptionCodeRequest request)
 {
     using (var client = new RedemptionCodeClient())
     {
         var serviceResult = client.GenerateRedemptionCode(request);
         serviceResult.ThrowIfException(true);
         return(serviceResult.Result);
     }
 }
Exemple #2
0
        public async Task <List <RedemptionCodeModel> > GetBatchRedemptionCodes(string batchCode)
        {
            using (var client = new RedemptionCodeClient())
            {
                var result = await client.GetBatchRedemptionCodesAsync(batchCode);

                result.ThrowIfException(true);
                return(result.Result);
            }
        }
Exemple #3
0
        /// <summary>
        /// 作废兑换码
        /// </summary>
        /// <param name="redeemCodes"></param>
        /// <param name="remark"></param>
        /// <returns></returns>
        public async Task <InvalidateRedemptionCodeResult> InvalidateRedemptionCode(List <string> redeemCodes, string remark)
        {
            using (var client = new RedemptionCodeClient())
            {
                var result = await client.InvalidateRedemptionCodeAsync(new InvalidateRedemptionCodeRequest
                {
                    Codes  = redeemCodes,
                    Remark = remark,
                });

                result.ThrowIfException(true);
                return(result.Result);
            }
        }
Exemple #4
0
        /// <summary>
        /// 查询通用兑换码
        /// </summary>
        /// <param name="redemptionCode"></param>
        /// <returns></returns>
        public static async Task <RedemptionResult> GetRedemptionCodeDetail(string redemptionCode)
        {
            RedemptionResult result = null;

            try
            {
                using (var client = new RedemptionCodeClient())
                {
                    var serviceResult = await client.GetRedemptionCodeDetailAsync(redemptionCode);

                    serviceResult.ThrowIfException(true);
                    result = serviceResult.Result;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GroupBuying查询通用兑换码接口异常", ex);
            }

            return(result);
        }
Exemple #5
0
        /// <summary>
        /// 作废通用兑换码
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <InvalidateRedemptionCodeResult> InvalidateRedemptionCode(InvalidateRedemptionCodeRequest request)
        {
            InvalidateRedemptionCodeResult result = null;

            try
            {
                using (var client = new RedemptionCodeClient())
                {
                    var serviceResult = await client.InvalidateRedemptionCodeAsync(request);

                    serviceResult.ThrowIfException(true);
                    result = serviceResult.Result;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GroupBuying作废通用兑换码接口异常", ex);
            }

            return(result);
        }
Exemple #6
0
        /// <summary>
        /// 兑换兑换码
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <RedeemRedemptionCodeResult> RedeemRedemptionCodeByChoice(ReedemRedemptionRequest request)
        {
            var result = new RedeemRedemptionCodeResult()
            {
                Success = false
            };

            try
            {
                using (var client = new RedemptionCodeClient())
                {
                    var serviceResult = await client.RedeemRedemptionCodeByChoiceAsync(request);

                    serviceResult.ThrowIfException(true);
                    result = serviceResult.Result;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GroupBuying兑换通用兑换码接口异常", ex);
            }

            return(result);
        }
Exemple #7
0
        /// <summary>
        /// 生成通用兑换码接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <ResultModel <RedemptionResult> > GenerateUSRedemptionCode(GenerateUSRedemptionCodeRequest request)
        {
            var result = new ResultModel <RedemptionResult>()
            {
                IsSuccess = false
            };

            try
            {
                using (var client = new RedemptionCodeClient())
                {
                    var serviceResult = await client.GenerateUSRedemptionCodeAsync(request);

                    serviceResult.ThrowIfException(true);
                    result = serviceResult.Result;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GroupBuying发通用兑换码接口异常", ex);
            }

            return(result);
        }