async void DoLogin(string email, string password)
        {
            var req = new LoginInfo()
            {
                UserID   = email,
                Password = password
            };
            var response = await OnBoardingService.LoginAfterOnboarding(req);

            if (!string.IsNullOrEmpty(response))
            {
                //Get Token and save token lifespan

                await LoginHelper.LogUserDetails(response, email);   // get user details in abstract class

                if (GlobalStaticFields.LoginTest == "Passed")
                {
                    Application.Current.MainPage = new AnimationNavigationPage(new Dashboard.Dashboard());
                }
                else
                {
                    MessageDialog.Show("OOPS", "Sorry, your login attempt failed. Kindly review your credentials and try again.", PopUps.DialogType.Error, "OK", null);
                    return;
                }
            }
        }
        private async void btnStep7_Clicked(object sender, EventArgs e)
        {
            List <CustomerAccount> listOfAcct = new List <CustomerAccount>();

            if (!string.IsNullOrEmpty(_vm.CountryCode) && !string.IsNullOrEmpty(_vm.PhoneNumber))
            {
                if (_vm.PhoneNumber.StartsWith("0"))
                {
                    _vm.PhoneNumber = _vm.PhoneNumber.Substring(1);
                }

                phone           = _vm.CountryCode + _vm.PhoneNumber;
                _vm.WalletPhone = phone;
                if (grdStep7.IsVisible == true)
                {
                    var pd = await ProgressDialog.Show("Processing Request..... Please wait.");

                    var accountlst = await OnBoardingService.GetAllCustomerAccountsByMobile(phone);

                    await pd.Dismiss();

                    if (!string.IsNullOrEmpty(accountlst))
                    {
                        listOfAcct = JsonConvert.DeserializeObject <List <CustomerAccount> >(accountlst);
                        if (listOfAcct.Count > 0)
                        {
                            GlobalStaticFields.Customer.ListOfAllAccounts = listOfAcct;
                            _vm.DefaultAccountNumber    = listOfAcct.FirstOrDefault().nuban;
                            lblAccountVerification.Text = _vm.DefaultAccountNumber.Substring(0, 5) + "#####";
                            grdStep7.Animate(new FadeOutAnimation());
                            grdStep7.IsVisible = false;
                            grdStep8.IsVisible = true;
                        }
                        else
                        {
                            var val = await DoAccountVerification();

                            if (val)
                            {
                                Navigation.PushAsync(new OtpVerification(_vm));
                            }
                        }
                    }
                }
            }
            else
            {
                MessageDialog.Show("OOPS", "Country code and phone number are required", DialogType.Error, "DISMISS", null);
                return;
            }
        }
Example #3
0
        private async void DoOTPVerification()
        {
            var pd = await ProgressDialog.Show("Processing Request..... Please wait.");

            try
            {
                Random r = new Random();
                r.Next(1000, 9999);
                var otpRequest = new ValOtpRequestMobile()
                {
                    mobile        = _vm.WalletPhone,
                    otp           = Pin,
                    Referenceid   = "00055" + DateTime.Now.ToString("yymmddHHmmss") + r.Next().ToString(),
                    RequestType   = "143",
                    Translocation = GlobalStaticFields.GetUserLocation
                };
                var response = await OnBoardingService.ValidateOTP(otpRequest);

                if (!string.IsNullOrEmpty(response))
                {
                    var data = JsonConvert.DeserializeObject <StatusMessage>(response);
                    if (data.response == "00")
                    {
                        await pd.Dismiss();

                        MessageDialog.Show("SUCCESS", "OTP Verification and wallet creation was successful.", DialogType.Success, "OK", null);
                        // before creating the pin, lets set some security questions
                        // Navigation.PushAsync(new AccountPinCreation(_vm));
                        Navigation.PushAsync(new SecurityQuestionPage(_vm));
                    }
                }
                else
                {
                    await pd.Dismiss();

                    MessageDialog.Show("OOPS", "OTP Verification was not successful. Kindly verify and try again", DialogType.Error, "OK", null);
                    return;
                }
                await pd.Dismiss();
            }
            catch (Exception ex)
            {
                await pd.Dismiss();

                string log = ex.Message;
            }
        }
Example #4
0
        private async Task <bool> DoWalletCreation()
        {
            bool   isWalletCreated = false;
            Random rnd             = new Random();

            rnd.Next(1000, 9999);
            var walletAccount = new CustomerWalletAccount()
            {
                Referenceid    = "00055" + DateTime.Now.ToString("yymmddHHmmss") + rnd.Next().ToString(),
                RequestType    = "117",
                BIRTHDATE      = _vm.DateOfBirth.ToString(),
                FIRSTNAME      = _vm.Firstname,
                LASTNAME       = _vm.Lastname,
                GENDER         = _vm.Gender.Substring(0, 1),
                EMAIL          = _vm.Email,
                MARITAL_STATUS = "",
                MOBILE         = _vm.PhoneNumber,
                CUST_STATUS    = "1",
                CUST_TYPE      = "1",
                CATEGORYCODE   = "10001",
                RESIDENCE      = "NG",
                NATIONALITY    = "Nigerian",
                TARGET         = "1111",
                SECTOR         = 1,
                TITLE          = "",
                ADDR_LINE1     = "",
                ADDR_LINE2     = ""
            };

            var response = await OnBoardingService.CreateWalletAccount(walletAccount);

            if (!string.IsNullOrEmpty(response))
            {
                var data = JsonConvert.DeserializeObject <CreateWalletResponse>(response);
                if (data.response == "00")
                {
                    isWalletCreated = true;
                }
                else
                {
                    isWalletCreated = false;
                }
            }
            return(isWalletCreated);
        }
        async Task <bool> DoAccountVerification()
        {
            bool status = false;
            var  pd     = await ProgressDialog.Show("Processing Request..... Please wait.");

            Random r = new Random();

            r.Next(1000, 9999);
            var otpRequest = new OTPRequestMobile()
            {
                mobile        = _vm.WalletPhone,
                Referenceid   = "00055" + DateTime.Now.ToString("yymmddHHmmss") + r.Next().ToString(),
                RequestType   = 142,
                Translocation = GlobalStaticFields.GetUserLocation,
                email         = _vm.Email
            };
            // lets check if the user exist before now.
            var user = new UserAlreadyExist()
            {
                Phone     = _vm.WalletPhone,
                UserEmail = _vm.Email
            };
            var userResponse = await OnBoardingService.VerifyRegistrationStatus(user);

            if (userResponse == true) // value should be compared against true. this condition was changed on purpose for test
            {
                await pd.Dismiss();

                MessageDialog.Show("OOPS", "Sorry, It appears that you already onboarded. Kindly review your details and try again, or contact our switch support.", DialogType.Error, "DISMISS", null);
            }
            else
            {
                var otpresponse = await OnBoardingService.IsOtpSent(otpRequest);

                if (otpresponse)
                {
                    await pd.Dismiss();

                    MessageDialog.Show("SUCCESS", $"An OTP has been sent to your mobile number {phone} and Email {_vm.Email}", DialogType.Success, "OK", null);

                    status = true;
                }
            }
            return(status);
        }
        async void DoAccountCreation()
        {
            string password = _crypto.Encrypt(Pin);

            try
            {
                if (Pin != PinTracker)
                {
                    MessageDialog.Show("OOPS", "PIN and Confirm PIN Mismatch. Kindly review and try again.", DialogType.Error, "OK", null);
                    return;
                }
                else
                {
                    var key = await Microsoft.AppCenter.AppCenter.GetInstallIdAsync();

                    DateTime _dob  = _vm.DateOfBirth;
                    var      model = new SwitchUser()
                    {
                        UserEmail                  = _vm.Email,
                        Password                   = password,
                        Gender                     = _vm.Gender == "Male" ? "M" : "F",
                        DateOfBirth                = _dob,
                        FirstName                  = _vm.Firstname.Trim(),
                        LastName                   = _vm.Lastname.Trim(),
                        MiddleName                 = "N/A",
                        Title                      = _vm.Gender == "Male" ? "Mr" : "Mrs",
                        TPIN                       = password,
                        PhoneNumber                = _vm.WalletPhone,
                        RefferedBy                 = _vm.ReferralCode,
                        ReferralCode               = GlobalStaticFields.RandomString(8),
                        Device                     = GlobalStaticFields.Device(),
                        IMEI                       = GlobalStaticFields.DeviceIMEI(),
                        OS                         = GlobalStaticFields.DeviceOS(),
                        UniqueKey                  = key?.ToString() ?? Guid.NewGuid().ToString(),
                        AddressLine1               = string.Empty,
                        AddressLine2               = string.Empty,
                        Nationality                = 0,
                        AccessLocation             = GlobalStaticFields.GetUserLocation,
                        AccountType                = "",
                        CustomerTimeZone           = DateTime.Now.ToString("yymmddHHmmss"),
                        HomeAddress                = "",
                        IsTPIN                     = false,
                        SignupVerificationCode     = "",
                        SecurityQuestionAndAnswers = _qanda //new List<SecurityQuestionViewModel> {_qanda }
                    };
                    var pd = await ProgressDialog.Show("Sending Request..... Please wait.");

                    var response = await OnBoardingService.DoSwitchAccountCreation(model);

                    if (!string.IsNullOrEmpty(response))
                    {
                        var dt = JsonConvert.DeserializeObject <NewStatusMessage>(response);
                        if (dt.Status == true)
                        {
                            MessageDialog.Show("SUCCESS", "Account registration was successful.", DialogType.Success, "OK", null);
                            var upgradeModel = new UpgradeAccountForT24()
                            {
                                BVN         = GlobalStaticFields.Customer.ListOfAllAccounts.FirstOrDefault(g => g.BVN != null || g.BVN != String.Empty)?.BVN ?? "",
                                CUSNUM      = GlobalStaticFields.Customer.ListOfAllAccounts.FirstOrDefault(g => g.CustomerId != null || g.CustomerId != String.Empty)?.CustomerId ?? "",
                                HomeAddress = "",
                                NUBAN       = GlobalStaticFields.Customer.ListOfAllAccounts.FirstOrDefault(g => g.nuban != null || g.nuban != string.Empty)?.nuban ?? "",
                                PhoneNumber = _vm.PhoneNumber
                            };
                            var upgraded = await OnBoardingService.UpgradeAccountForT24(upgradeModel);

                            if (!string.IsNullOrEmpty(upgraded))
                            {
                                if (upgraded.Contains("true"))
                                {
                                    string message = $"Dear Customer You have successfully Onboarded on Switch. kindly ignore this message if it was you, or report to the nearest Sterling bank office if otherwise.";
                                    DoLogin(_vm.Email, password);  // loguser in and navigate to dashboard.
                                    SendMail(message, _vm.Email);  // send mail to the specified email address
                                    // registration was successful
                                    await pd.Dismiss();
                                }
                            }
                        }
                        else
                        {
                            await pd.Dismiss();

                            MessageDialog.Show("OOPS", "Sorry, an error occured at our end. Kindly try again later.", DialogType.Error, "OK", null);
                            return;
                        }
                    }
                    else
                    {
                        await pd.Dismiss();

                        MessageDialog.Show("OOPS", "Sorry, we are unable to create your account at the moment. Kindly try again.", DialogType.Error, "OK", null);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                string log = ex.Message;
            }
        }