/// <summary>
        /// Saves the Token into UserData microservice
        /// </summary>
        public async Task <string> SaveTokenToUserData(string userId, SaveTokenData token)
        {
            var saveTokenRequest = new SaveCardTokenRequestDto
            {
                // TODO some more properties needed for storing card:
                // flag if treat card as stored
                // last 4 digits
                // username
                UserId = userId,
                Token  = token.Token
            };

            var result = await userClient.SaveCardToken(saveTokenRequest);

            if (result == null || !result.Success || string.IsNullOrWhiteSpace(result.Payload))
            {
                var error = "Failed to call UserData microservice to SaveToken. " + result?.ErrorMessages;
                logger.LogError("SaveToken", error);
                return(null);
            }

            logger.LogInfo("3DSi SaveToken", "info", "Token saved to User data microservice");
            return(result.Payload);
        }
Exemple #2
0
        public async Task <BaseResponseDto <string> > SaveCardToken(SaveCardTokenRequestDto request)
        {
            var url = $"{_properties.GetServiceUrl(_serviceUrlSettingKey)}/api/CardToken";

            return(await Post <string>(url, request).ConfigureAwait(false));
        }