Exemplo n.º 1
0
        public void if_packages_are_null_show_no_packages_found_error()
        {
            //arrange
            var noPackageResponse = new CustomerDetailsResponse
            {
                Account = new AccountInfo
                {
                    AccountStatus = "ACTIVE"
                },
                ServiceAddress = new ServiceAddressInfo(),
                Packages       = null
            };

            //act
            A.CallTo(
                () =>
                _autoFakeContainer.Resolve <ICustomerRepository>()
                .GetCustomerInformation(A <string> .Ignored, A <string> .Ignored)).Returns(noPackageResponse);

            var result = _sut.Index("11970203") as RedirectToRouteResult;

            //assert
            Assert.That(result.RouteValues["controller"], Is.EqualTo("Customer"));
            Assert.That(result.RouteValues["action"], Is.EqualTo("NoPackagesFound"));
        }
Exemplo n.º 2
0
 // Initialize the dataset of the Adapter
 public ProductComponentsAdapter(ProductComponentsResponse productComponentsResponse, Context context, SwapProduct product, CustomerDetailsResponse customerDetailsResponse)
 {
     this._productComponentsResponse  = productComponentsResponse;
     this._productComponentsList      = productComponentsResponse.ProductComponents;
     ProductComponentsAdapter.context = context;
     this._product = product;
     this._customerDetailsResponse = customerDetailsResponse;
 }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Bundle extras = Intent.Extras;

            _customerDetailsResponse = JsonConvert.DeserializeObject <CustomerDetailsResponse>(extras.GetString("customerDetailsResponse"));
            InitializeScreen();
        }
Exemplo n.º 4
0
 // Initialize the dataset of the Adapter
 public SwappableComponentsAdapter(ProductComponentsResponse swappableProductComponentsResponse, Context context, ProductComponent selectedProductComponent,
                                   CustomerDetailsResponse customerDetailsResponse, SwapProduct product, ProductComponentsResponse productComponentsResponse)
 {
     _swappableProductComponentsResponse = swappableProductComponentsResponse;
     _swappableProductComponentsList     = swappableProductComponentsResponse.ProductComponents;
     _selectedProductComponent           = selectedProductComponent;
     _customerDetailsResponse            = customerDetailsResponse;
     _product = product;
     _productComponentsResponse         = productComponentsResponse;
     SwappableComponentsAdapter.context = context;
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Bundle extras = Intent.Extras;

            _selectedProductComponent           = JsonConvert.DeserializeObject <ProductComponent>(extras.GetString("productComponent"));
            _swappableProductComponentsResponse = JsonConvert.DeserializeObject <ProductComponentsResponse>(extras.GetString("swappableProductComponentsResponse"));

            _product = JsonConvert.DeserializeObject <SwapProduct>(extras.GetString("product"));
            _customerDetailsResponse   = JsonConvert.DeserializeObject <CustomerDetailsResponse>(extras.GetString("customerDetailsResponse"));
            _productComponentsResponse = JsonConvert.DeserializeObject <ProductComponentsResponse>(extras.GetString("productComponentsResponse"));
            InitializeScreen();
        }
Exemplo n.º 6
0
        public void TestFixtureSetUp()
        {
            var json = "~/AppData/ALFKI.json".MapProjectPath().ReadAllText();

            response = JsonSerializer.DeserializeFromString <CustomerDetailsResponse>(json);

            appHost = new BasicAppHost
            {
                WebHostPhysicalPath = "~".MapProjectPath(),
                Plugins             = { new MarkdownFormat() },
            }.Init();
            markdownFormat = appHost.GetPlugin <MarkdownFormat>();
        }
Exemplo n.º 7
0
        public CustomerDetailsResponse GetCustomerDetailsByMobileNumber(JObject input)
        {
            CustomerDetailsResponse objresponse = new CustomerDetailsResponse();

            try
            {
                objresponse = objBookingBal.GetCustomerDetailsByMobileNumber(input);
            }
            catch (Exception ex)
            {
                objresponse.StatusId      = 0;
                objresponse.StatusMessage = ex.Message;
            }
            return(objresponse);
        }
Exemplo n.º 8
0
        public void TestFixtureSetUp()
        {
            var json = "~/AppData/ALFKI.json".MapProjectPath().ReadAllText();

            response = JsonSerializer.DeserializeFromString <CustomerDetailsResponse>(json);

            appHost = new BasicAppHost
            {
                ConfigFilter = config => {
                    //Files aren't copied, set RootDirectory to ProjectPath instead.
                    config.WebHostPhysicalPath = "~".MapProjectPath();
                }
            }.Init();
            markdownFormat = appHost.GetPlugin <MarkdownFormat>();
        }
Exemplo n.º 9
0
        public CustomerDetailsResponse GetCustomerDetailsByMobileNumber(JObject input)
        {
            CustomerDetailsResponse objresponse = new CustomerDetailsResponse();

            try
            {
                string mobilenumber = Convert.ToString(input["MobileNumber"]);

                objresponse = objBookingDal.GetCustomerDetailsByMobileNumber(mobilenumber);
            }
            catch (Exception ex)
            {
                objresponse.StatusId      = 0;
                objresponse.StatusMessage = ex.Message;
            }
            return(objresponse);
        }
Exemplo n.º 10
0
        public static async Task <HttpResponseMessage> CustomerDetails([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log)
        {
            // Get request body
            var body = await req.Content.ReadAsStringAsync();

            var request = JsonConvert.DeserializeObject <CustomerDetailsRequest>(body);

            if (request == null)
            {
                return(req.CreateResponse(HttpStatusCode.BadRequest, "No Valid Data submitted."));
            }

            var response = new CustomerDetailsResponse();

            response.Customer = CosmosClient.Instance.GetCustomerByID(request.CustomerId);
            if (request.OrderHistoryTotal > 0)
            {
                response.OrderHistory = CosmosClient.Instance.GetCustomerOrders(request.CustomerId, request.OrderHistoryTotal);
            }

            return(req.CreateResponse(HttpStatusCode.OK, response));
        }
Exemplo n.º 11
0
        public void TestFixtureSetUp()
        {
            var json = "~/AppData/ALFKI.json".MapProjectPath().ReadAllText();

            response = JsonSerializer.DeserializeFromString <CustomerDetailsResponse>(json);
        }
Exemplo n.º 12
0
        public async Task SendCustomerAddNotifyEmailAsync(string templateName, string subject, CustomerDetailsResponse custoemr)
        {
            var email       = custoemr.Email;
            var builder     = new BodyBuilder();
            var _pathToFile = GetTemplateFilePathAsync(templateName);

            using (StreamReader SourceReader = System.IO.File.OpenText(_pathToFile))
            {
                builder.HtmlBody = SourceReader.ReadToEnd();
            }

            //{0} : Customer.Name
            //{1} : Customer.LastName
            //{2} : Customer.PhoneNum
            //{3} : Customer.Email
            //{4} : Customer.City
            //{5} : Customer.PostCode

            string messageBody = string.Format(builder.HtmlBody,
                                               custoemr.Name,
                                               custoemr.LastName,
                                               custoemr.PhoneNum,
                                               custoemr.Email,
                                               custoemr.City,
                                               custoemr.PostCode
                                               );

            await SendEmailAsync(email, subject, messageBody);
        }
Exemplo n.º 13
0
        private async void GetCustomerDetails()
        {
            Log.Verbose("Get details of a customer.");
            var progressDialog = ProgressDialog.Show(context, GetString(Resource.String.please_wait), GetString(Resource.String.loading_customer_details), true);

            api = new SwapComponentApi();
            string parameters = "/customer?id=" + _identifier + "&RequestType=" + _identifierType;
            bool   isOnline   = Resolver.Instance.Get <IConnectivityService>().HasConnection();

            if (!isOnline)
            {
                Toast.MakeText(context, GetString(Resource.String.unable_to_continue_net),
                               ToastLength.Long).Show();
                errorTextView.Visibility = ViewStates.Invisible;
                progressDialog.Hide();
            }
            else
            {
                CustomerDetailsResponse customerDetailsResponse = await api.GetCustomerDetails(parameters);

                progressDialog.Hide();
                if (customerDetailsResponse.Successful)
                {
                    Log.Verbose("API Call successful");
                    if (!customerDetailsResponse.CustomerFound)
                    {
                        findCustomerButton.Enabled = false;
                        errorTextView.Text         = GetString(Resource.String.customer_not_exist_reenter) + " " + identifierTypeMessage;
                        errorTextView.Visibility   = ViewStates.Visible;
                    }
                    else if (customerDetailsResponse.AccountStatus == AccountStatus.Blocked)
                    {
                        findCustomerButton.Enabled = false;
                        errorTextView.Text         = GetString(Resource.String.blocked_customer_account);
                        errorTextView.Visibility   = ViewStates.Visible;
                    }
                    else if (customerDetailsResponse.AccountStatus == AccountStatus.Cancelled)
                    {
                        findCustomerButton.Enabled = false;
                        errorTextView.Text         = GetString(Resource.String.cancelled_customer_account);
                        errorTextView.Visibility   = ViewStates.Visible;
                    }
                    else
                    {
                        customerDetailsResponse.IdentifierType = _identifierType;
                        customerDetailsResponse.Identifier     = _identifier;
                        Bundle extras = new Bundle();
                        extras.PutString("customerDetailsResponse", JsonConvert.SerializeObject(customerDetailsResponse));
                        Intent intent = new Intent(context, typeof(CustomerDetailsActivity));
                        intent.PutExtras(extras);
                        StartActivity(intent);
                    }
                }
                else
                {
                    Log.Verbose("something went wrong");
                    errorTextView.Text       = GetString(Resource.String.connection_error);
                    errorTextView.Visibility = ViewStates.Visible;
                }
            }
        }