From 49948f17d802eba30ff31191b625c58cc44482b4 Mon Sep 17 00:00:00 2001 From: Basil Kotov Date: Fri, 15 Mar 2024 17:01:14 +0000 Subject: [PATCH] use two requests to get data --- src/VirtoCommerce.Skyflow.Data/Services/SkyflowClient.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/VirtoCommerce.Skyflow.Data/Services/SkyflowClient.cs b/src/VirtoCommerce.Skyflow.Data/Services/SkyflowClient.cs index 7aa4747..b30d397 100644 --- a/src/VirtoCommerce.Skyflow.Data/Services/SkyflowClient.cs +++ b/src/VirtoCommerce.Skyflow.Data/Services/SkyflowClient.cs @@ -59,9 +59,16 @@ public async Task> GetCards(SkyflowStoreConfig config, public async Task> GetCardTokens(SkyflowStoreConfig config, string skyflowId) { // required the Vault Owner permission + + // get escaped data to receive userId var url = $"{config.VaultUrl.TrimEnd('/')}/v1/vaults/{config.VaultId}/{config.TableName}/{skyflowId}"; var result = await GetSkyflowResponse(HttpMethod.Get, url, ModuleConstants.VaultOwnerRoleConfigName); - return result.Fields; + + // get tokenized data + var tokenUrl = $"{config.VaultUrl.TrimEnd('/')}/v1/vaults/{config.VaultId}/{config.TableName}/{skyflowId}?tokenization=true"; + var tokenResult = await GetSkyflowResponse(HttpMethod.Get, tokenUrl, ModuleConstants.VaultOwnerRoleConfigName); + tokenResult.Fields.Add("user_id", result.Fields["user_id"]); + return tokenResult.Fields; } public async Task DeleteCard(SkyflowStoreConfig config, string skyflowId)