public static ActivityDetails HandleResponse(AsymmetricCipherKeyPair keyPair, string responseContent) { if (string.IsNullOrEmpty(responseContent)) { throw new YotiProfileException(Properties.Resources.NullOrEmptyResponseContent); } ProfileDO parsedResponse = JsonConvert.DeserializeObject <ProfileDO>(responseContent); if (parsedResponse.Receipt == null) { throw new YotiProfileException(Properties.Resources.NullParsedResponse); } else if (parsedResponse.Receipt.SharingOutcome != "SUCCESS") { throw new YotiProfileException( $"The share was not successful, sharing_outcome: '{parsedResponse.Receipt.SharingOutcome}'"); } ReceiptDO receipt = parsedResponse.Receipt; var userProfile = new YotiProfile( ParseProfileContent(keyPair, receipt.WrappedReceiptKey, receipt.OtherPartyProfileContent)); SetAddressToBeFormattedAddressIfNull(userProfile); var applicationProfile = new ApplicationProfile( ParseProfileContent(keyPair, receipt.WrappedReceiptKey, receipt.ProfileContent)); ExtraData extraData = new ExtraData(); if (!string.IsNullOrEmpty(parsedResponse.Receipt.ExtraDataContent)) { extraData = CryptoEngine.DecryptExtraData( receipt.WrappedReceiptKey, parsedResponse.Receipt.ExtraDataContent, keyPair); } DateTime?timestamp = null; if (receipt.Timestamp != null && DateTime.TryParseExact( receipt.Timestamp, "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out DateTime parsedDate)) { timestamp = parsedDate; } return(new ActivityDetails(parsedResponse.Receipt.RememberMeId, parsedResponse.Receipt.ParentRememberMeId, timestamp, userProfile, applicationProfile, parsedResponse.Receipt.ReceiptId, extraData)); }