Beispiel #1
0
        public IHttpActionResult PostCharge(ChargeRequest model)
        {
            model.UserBaseId = _currentUserId;
            try
            {
                _chargeService.ChargeCustomer(model);
                return(Ok(new SuccessResponse()));
            }
            catch (Exception ex)
            {
                _chargeService.InsertTransactionFail(new TransactionFailAddRequest
                {
                    UserBaseId      = model.UserBaseId,
                    Amount          = model.Amount,
                    Currency        = model.Currency,
                    Name            = model.Name,
                    Email           = model.Email,
                    PlanId          = model.PlanId,
                    DurationTypeId  = model.DurationTypeId,
                    DiscountPercent = model.DiscountPercent,
                    ErrorMessage    = ex.Message
                });

                _appLogService.Insert(new AppLogAddRequest
                {
                    AppLogTypeId = 1,
                    Message      = ex.Message,
                    StackTrace   = ex.StackTrace,
                    Title        = "Error in " + GetType().Name + " " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                    UserBaseId   = _currentUserId
                });

                return(BadRequest(ex.Message));
            }
        }