Пример #1
0
        public IActionResult GetCustomer([FromBody] InputCustomer input)
        {
            var request = new CustomerGetRequest(input.CustomerId);

            customerGetUseCase.Execute(request);
            return(presenter.ViewModel);
        }
Пример #2
0
        public void ShouldNotGetCustomerByIdAndReturnNotFound()
        {
            var request = new CustomerGetRequest(Guid.NewGuid());

            customerGetUseCase.Execute(request);
            presenter.ViewModel.Should().BeOfType <NotFoundObjectResult>();
        }
Пример #3
0
        public void ShouldGetCustomerById()
        {
            var request = new CustomerGetRequest(CustomerId);

            customerGetUseCase.Execute(request);
            presenter.ViewModel.Should().BeOfType <OkObjectResult>();
        }
        public CustomerGetResponse GetCustomerList(CustomerGetRequest request)
        {
            var customerList = respository.GetCustomerList(request);

            return(new CustomerGetResponse
            {
                TotalCount = customerList.TotalCount,
                TotalPages = customerList.TotalPages,
                CustomerDetailList = customerList
            });
        }
        public async Task <IActionResult> Get([FromBody] CustomerGetRequest request)
        {
            try
            {
                var response = await _customerAppService.Get(request);

                return(Json(response));
            }
            catch (Exception e)
            {
                _logger.LogError(e, Common.Common.GetMethodName(), request);
                throw;
            }
        }
Пример #6
0
        /// <summary>
        /// Retrieves the details of an existing customer.
        /// </summary>
        /// <param name="identity">Unique identifier, beginning with "CU".</param>
        /// <param name="request">An optional `CustomerGetRequest` representing the query parameters for this get request.</param>
        /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param>
        /// <returns>A single customer resource</returns>
        public Task <CustomerResponse> GetAsync(string identity, CustomerGetRequest request = null, RequestSettings customiseRequestMessage = null)
        {
            request = request ?? new CustomerGetRequest();
            if (identity == null)
            {
                throw new ArgumentException(nameof(identity));
            }

            var urlParams = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>("identity", identity),
            };

            return(_goCardlessClient.ExecuteAsync <CustomerResponse>("GET", "/customers/:identity", urlParams, request, null, null, customiseRequestMessage));
        }
Пример #7
0
        public async Task <CustomerGetResponse> Get(CustomerGetRequest request)
        {
            CustomerGetResponse response = new CustomerGetResponse();
            var userLogin = await _context.GetCurrentCustomer();

            try
            {
                if (!string.IsNullOrEmpty(request.Id))
                {
                    var customer = await _customerService.GetFromDb(request.Id);

                    if (customer == null)
                    {
                        response.SetFail(BaseResponse.ErrorCodeEnum.UserNotFound);
                        return(response);
                    }
                    response.Customer = customer.ToModel();
                    foreach (var type in response.Types)
                    {
                        type.Checked = response.Customer.Type.HasFlag((EnumDefine.CustomerTypeEnum)type.Id);
                    }
                }
                else
                {
                    response.Customer = new CustomerViewModel()
                    {
                        LanguageId       = userLogin.CurrentLanguageId,
                        TwoFactorEnabled = EnumDefine.TwoFactorEnum.Disable,
                        Gender           = EnumDefine.GenderEnum.Male,
                        Status           = EnumDefine.CustomerStatusEnum.New,
                        Type             = EnumDefine.CustomerTypeEnum.IsCustomer,
                        Id          = string.Empty,
                        PhoneNumber = string.Empty,
                        Email       = string.Empty,
                        Password    = string.Empty
                    };
                }
                var langguages = await _languageService.Get();

                response.Languages = langguages?.Select(p => p.ToKeyValueModel()).ToArray();
            }
            catch (Exception e)
            {
                response.SetFail(e);
                _logger.LogError(e, e.Message, request);
            }
            return(response);
        }
        public CustomPagedList <CustomerDetailEntity> GetCustomerList(CustomerGetRequest request)
        {
            var sqlScript = DBScriptManager.GetScript(GetType(), "GetCustomerList");

            var paramTotal = new SqlParameter("@TotalCount", SqlDbType.Int);

            paramTotal.Direction = ParameterDirection.Output;

            var paramUserNo = new SqlParameter("@UserNo", SqlDbType.VarChar, 25);

            paramUserNo.Value = request.UserNo ?? string.Empty;

            var paramName = new SqlParameter("@Name", SqlDbType.NVarChar, 20);

            paramName.Value = request.Name ?? string.Empty;

            var paramSex = new SqlParameter("@Sex", SqlDbType.Int);

            if (!request.Sex.HasValue)
            {
                paramSex.Value = DBNull.Value;
            }
            else
            {
                paramSex.Value = request.Sex;
            }

            var paramPageIndex = new SqlParameter("@PageIndex", SqlDbType.Int);

            paramPageIndex.Value = request.PageIndex - 1;

            var paramPageSize = new SqlParameter("@PageSize", SqlDbType.Int);

            paramPageSize.Value = request.PageSize;

            var customerList = ExecuteSqlQuery <CustomerDetailEntity>(sqlScript, new SqlParameter[]
            {
                paramUserNo,
                paramName,
                paramSex,
                paramPageIndex,
                paramPageSize,
                paramTotal
            });

            return(new CustomPagedList <CustomerDetailEntity>(customerList, request.PageIndex, request.PageSize, Convert.ToInt32(paramTotal.Value)));
        }
Пример #9
0
        public static void Main(string[] args)
        {
            ISoouuClient soouuClient = new DefaultSoouuClient("http://test.ccapi.soouu.cn/Interface/Method", "803683", "CC11F561EBF14204089A5C64DE61C8DF");
            //获取用户信息
            CustomerGetRequest  customerGetRequest  = new CustomerGetRequest();
            CustomerGetResponse customerGetResponse = soouuClient.Execute(customerGetRequest);

            Console.WriteLine(customerGetResponse.ToJson());
            //获取商品类目
            CatalogsGetRequest         catalogsGetRequest  = new CatalogsGetRequest();
            List <CatalogsGetResponse> catalogsGetResponse = soouuClient.QueryList(catalogsGetRequest);

            Console.WriteLine(catalogsGetResponse.ToJson());
            //获取商品列表
            GoodsGetRequest goodsGetRequest = new GoodsGetRequest {
                goodscatalogid = 1005
            };
            List <GoodsGetResponse> goodsGetResponse = soouuClient.QueryList(goodsGetRequest);

            Console.WriteLine(goodsGetResponse.ToJson());
            //话费直充
            PhoneOrderAddRequest phoneOrderAddRequest = new PhoneOrderAddRequest {
                chargephone     = "18888888888",
                chargeparvalue  = "50",
                customerorderno = "XXX2Q3111",
                notifyurl       = "http://www.baidu.com"
            };
            OrderAddResponse phoneOrderAddResponse = soouuClient.Execute(phoneOrderAddRequest);

            Console.WriteLine(phoneOrderAddResponse.ToJson());
            //流量直充
            TrafficGoodsAddRequest trafficGoodsAddRequest = new TrafficGoodsAddRequest {
                chargephone     = "18888888888",
                chargeparvalue  = "1024",
                areatype        = "1",
                customerorderno = "123456",
                notifyurl       = "http://www.baidu.com"
            };
            OrderAddResponse trafficGoodsAddResponse = soouuClient.Execute(phoneOrderAddRequest);

            Console.WriteLine(trafficGoodsAddResponse.ToJson());
            //网游直充
            OrderAddRequest orderAddRequest = new OrderAddRequest {
                customerorderno = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
                productid       = 1204405,
                buyerip         = HttpUtils.GetAddressIP(),
                chargeaccount   = "18888888888",
                buynum          = 1
            };
            OrderAddResponse orderAddResponse = soouuClient.Execute(orderAddRequest);

            Console.WriteLine(orderAddResponse.ToJson());
            //卡密提卡
            CardOrderAddRequest cardOrderAddRequest = new CardOrderAddRequest {
                customerorderno = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
                productid       = 1204406,
                buynum          = 1
            };
            CardOrderAddResponse cardOrderAddResponse = soouuClient.Execute(cardOrderAddRequest);

            Console.WriteLine(cardOrderAddResponse.ToJson());
        }
Пример #10
0
 public CustomerGetResponse GetCustomerList([FromQuery] CustomerGetRequest request)
 {
     return(customerService.GetCustomerList(request));
 }