Exemplo n.º 1
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);
        }
        public static async Task <string> CreateWalletAccount(CustomerWalletAccount customerWalletAccount)
        {
            string responseData = string.Empty;

            try
            {
                _apiService = new ApiRequest();
                var response = await _apiService.Post <CustomerWalletAccount>(customerWalletAccount, "", URLConstants.SwitchApiBaseUrl, "Spay/SBPMWalletAccountReq", "OnboardingOTPVerificationPage");

                if (response.IsSuccessStatusCode)
                {
                    responseData = await response.Content.ReadAsStringAsync();
                }
            }
            catch (Exception ex)
            {
                string log = ex.Message;
            }
            return(responseData);
        }