public async Task <IActionResult> UpdateUser([FromBody] UserDto user)
        {
            try
            {
                Users users = new Users();
                if (user.UserType == "C")
                {
                    CustomerRegistration customerRegistration = _customerRegistrationService.GetCustomer(user.Id);
                    users = await _usersService.GetUser(customerRegistration.UsersID.Value);
                }
                else if (user.UserType == "M")
                {
                    Merchant merchant = await _merchantService.GetMerchant(user.Id);

                    users = await _usersService.GetUser(merchant.UsersID.Value);
                }
                else if (user.UserType == "N")
                {
                    NaqelUsers naqelUsers = await _naqelUsersService.GetNaqelUser(user.Id);

                    users = await _usersService.GetUser(naqelUsers.UsersID.Value);

                    naqelUsers.FirstName = user.FirstName;
                    naqelUsers.LastName  = user.LastName;
                    naqelUsers.Email     = user.Email;
                    naqelUsers.Address   = user.Address;
                    naqelUsers.Country   = Convert.ToInt32(user.Country);
                    naqelUsers.UserType  = user.NaqelUserType;
                    naqelUsers.Mobile    = user.Mobile;
                    await _naqelUsersService.UpdateNaqelUser(naqelUsers);

                    string _getNaqelUsertypedec = await _lookupTypeValuesService.Getlookupdec(Convert.ToInt32(user.NaqelUserType));

                    await _usersService.UpdateUserType(user.Email, _getNaqelUsertypedec);
                }
                if (users != null)
                {
                    users.Status = user.IsActive == "1" ? 1 : 0;
                }
                await _usersService.UpdateUser(users);

                return(Ok(new GenericResultDto <string> {
                    Result = "User updated successfully"
                }));
            }

            catch (Exception err)
            {
                return(BadRequest(new GenericResultDto <string> {
                    Result = err.Message
                }));
            }
            return(Ok(new GenericResultDto <string> {
                Result = "User updated successfully"
            }));
        }
        public void TestMerchantProperties()
        {
            var m = _merchantService.GetMerchant();

            Assert.IsNotNull(m);
            Assert.IsNotNull(m.Id);
            Assert.IsNotNull(m.Created);
            Assert.IsNotNull(m.Modified);
            Assert.IsNotNull(m.Name);
            Assert.IsNotNull(m.ContactName);
            Assert.IsNotNull(m.ContactEmail);
            Assert.IsNotNull(m.ContactPhone);
            Assert.IsNotNull(m.Address1);
            Assert.IsNotNull(m.City);
            Assert.IsNotNull(m.State);
            Assert.IsNotNull(m.PostalCode);
            Assert.IsNotNull(m.Country);
            Assert.IsNotNull(m.Timezone);

            var a = m.MerchantAccounts[0];

            Assert.IsNotNull(a);
            Assert.IsNotNull(a.Id);
            Assert.IsNotNull(a.Created);
            Assert.IsNotNull(a.Modified);
            Assert.IsNotNull(a.Status);
            Assert.IsNotNull(a.Name);
            Assert.IsNotNull(a.Primary);
            Assert.IsNotNull(a.Currency);
            Assert.IsNotNull(a.CVVPolicy);
            Assert.IsNotNull(a.AVSPolicy);
            Assert.IsNotNull(a.IgnoreAVSFailureIfCVVMatch);
            Assert.IsNotNull(a.RequiredPaymentFields);
            Assert.IsNotNull(a.SwipeCVVPolicy);
            Assert.IsNotNull(a.SwipeAVSPolicy);
            Assert.IsNotNull(a.SwipeIgnoreAVSFailureIfCVVMatch);
            Assert.IsNotNull(a.SwipeRequiredPaymentFields);
            Assert.IsNotNull(a.TransactionAllowedCountries);
            Assert.IsNotNull(a.AcceptedCardTypes);
        }
Example #3
0
        public ActionResult EditMerchData()
        {
            String MerchantID = GetFromMerchantIDCookie();

            if (MerchantID == null)
            {
                return(RedirectToAction("MerchantLogOn", "Account"));
            }
            IMerchantService   MerchantServiceInstance = new MerchantService();
            EditMerchDataModel WebMerchant             = MerchantServiceInstance.GetMerchant(MerchantID);

            return(View(WebMerchant));
        }
Example #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Run(async context =>
            {
                var service = new MerchantService(null);
                try
                {
                    //TODO: try out API calls here
                    var merchant = service.GetMerchant();
                    await context.Response.WriteAsync(JObject.FromObject(merchant).ToString());
                }
                catch (Exception exception)
                {
                    await context.Response.WriteAsync(exception.Message);
                }
            });
        }