public async Task <IHttpActionResult> GetDigitalWalletSsoRequestPayload(long accountNumber, string accountIdentifier, string deviceIdentifier)
        {
            if (!_settings.MobileConfiguration.DigitalWallet.Enabled)
            {
                return(Ok("no access"));
            }

            // endPointAddress for testing: = "https://cte-cardvalet-ws.fiservapps.com";
            var endPointAddress = _settings.MobileConfiguration.DigitalWallet.EndpointAddress;

            var userId      = _settings.MobileConfiguration.DigitalWallet.userId;
            var decryptedPW = _cryptoProvider.DecryptString(_securityKey, _settings.MobileConfiguration.DigitalWallet.password, EncryptionType.Des);

            // refId example = "9999e999e99999e9e9eee99ee9e9999-9-9-0-9";
            var refId = accountIdentifier;

            // deviceId example = "yahd7864823bjn048pakln";
            var deviceId = deviceIdentifier;

            // testing: "99993576"   production: "99993575"
            var clientId = _settings.MobileConfiguration.DigitalWallet.clientId;

            // Log account number, account identifier and device identifier:
            _logger.Trace($"GetDigitalWalletSsoRequestPayload for {accountNumber}. AccountIdentifier: {accountIdentifier}. DeviceIdentifier: {deviceIdentifier}");

            var request = new DigitalWalletHeaderSignature
            {
                schemaVersion         = _settings.MobileConfiguration.DigitalWallet.schemaVersion,
                clientId              = clientId,
                system                = _settings.MobileConfiguration.DigitalWallet.system.FirstOrDefault(),
                clientApplicationName = _settings.MobileConfiguration.DigitalWallet.clientApplicationName,
                clientVersion         = _settings.MobileConfiguration.DigitalWallet.clientVersion,
                clientVendorName      = _settings.MobileConfiguration.DigitalWallet.clientVendorName,
                clientAuditId         = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 12),
                subscriberRefID       = refId,
                ssoDeviceId           = deviceId
            };

            var resultString = await MakeSsoRequest(endPointAddress, userId, decryptedPW, request).ConfigureAwait(false);

            _logger.Trace($" ----- DigitalWalletController ------- resultString : {resultString}");

            if (resultString != null)
            {
                var result = JsonConvert.DeserializeObject <DigitalWalletSsoResponse>(resultString);

                var cardValetSsoResponse = new CardValetSsoResponse();

                if (result.CsStatus.StatusCode == "0")
                {
                    cardValetSsoResponse.SsoPayload      = result.SsoPayload;
                    cardValetSsoResponse.AndroidStoreUrl = _settings.MobileConfiguration.DigitalWallet.AndroidStoreUrl;
                    cardValetSsoResponse.IosStoreUrl     = _settings.MobileConfiguration.DigitalWallet.IosStoreUrl;
                    cardValetSsoResponse.UrlScheme       = _settings.MobileConfiguration.DigitalWallet.UrlScheme;
                    cardValetSsoResponse.PackageName     = _settings.MobileConfiguration.DigitalWallet.PackageName;
                }
                else
                {
                    cardValetSsoResponse.StatusDescription = result.CsStatus.StatusDesc;
                }

                return(Ok(cardValetSsoResponse));
            }

            return(BadRequest());
        }
#pragma warning disable CA1054 // Uri parameters should not be strings except in controller methods
#pragma warning disable CA1822 // Controller methods must not be static

        /// <summary>
        ///     Make Async Restful call:
        /// </summary>
        private async Task <string> MakeSsoRequest(string url, string userId, string password, DigitalWalletHeaderSignature data)
#pragma warning restore CA1054 // Uri parameters should not be strings
#pragma warning restore CA1822 // Controller methods must not be static
        {
            var certificatePW     = _settings.MobileConfiguration.DigitalWallet.CertificatePassword;
            var clientCertificate = GetCertificate(_settings.MobileConfiguration.DigitalWallet.CertificateName);

            try
            {
                var client = new RestClient(url)
                {
                    ClientCertificates = new X509CertificateCollection {
                        clientCertificate
                    }
                };
                var rqst = new RestRequest("rws/CardControlRWS_V0103/getSSOInfo", Method.POST);

                _logger.Trace($" ----- DigitalWalletController ------- DigitalWalletController -> MakeSsoRequest(). userId : {userId}. decrypted password: {password}");
                client.Authenticator = new HttpBasicAuthenticator(userId, password);
                client.Proxy         = new WebProxy();
                rqst.AddHeader("Accept", "application/json");
                rqst.AddHeader("Content-Type", "application/json");

                rqst.AddJsonBody(data);

                var response = await client.ExecuteTaskAsync(rqst).ConfigureAwait(false);

                _logger.Trace($" ----- DigitalWalletController ------- DigitalWalletController -> MakeSsoRequest(). Response: {response.Content}.");

                return(response.Content);

                // the response object should look like this:
                // {
                // schemaVersion = "2.0.0",
                // clientId = "999999",
                // system = "EPOC_CM",
                // clientApplicationName = "Connect Banking",
                // clientVersion = "1.0",
                // clientVendorName = "Connect FSS",
                // clientAuditId = "1234",
                // systemRecordIdentifier: null,
                // csStatus: {
                // statusCode = "0",
                // statusDesc = "SUCCESSFUL"
                // },
                // subscriberRefId = "9999e999e99999e9e9eee99ee9e9999-9-9-0-0",
                // ssoPayload = "lcG6qbAYu07WETKDENJDhlGi3dsVRbvxnBMXQVByhS 1A="
                // }
            }
            catch (Exception ex)
            {
                _logger.Error($" ----- DigitalWalletController ------- Error Calling DigitalWalletController -> MakeSsoRequest(). Error: {ex}.");
                return("{ \"csStatus\" : { \"statusCode\" : \"1\", \"statusDesc\" : \"failure\"} }");
            }
        }