diff --git a/src/domains/pay-wallet-app/04_apim_io_payment_wallet.tf b/src/domains/pay-wallet-app/04_apim_io_payment_wallet.tf index d8aa7797f0..27a2cac43c 100644 --- a/src/domains/pay-wallet-app/04_apim_io_payment_wallet.tf +++ b/src/domains/pay-wallet-app/04_apim_io_payment_wallet.tf @@ -69,15 +69,6 @@ module "apim_io_payment_wallet_api_v1" { }) } -resource "azurerm_api_management_api_operation_policy" "delete_io_wallets" { - api_name = "${local.project}-io-payment-wallet-api-v1" - resource_group_name = local.pagopa_apim_rg - api_management_name = local.pagopa_apim_name - operation_id = "deleteIOPaymentWalletById" - - xml_content = file("./api/io-payment-wallet/v1/_delete_wallet.xml.tpl") -} - resource "azurerm_api_management_api_operation_policy" "get_payment_methods_for_io" { api_name = "${local.project}-io-payment-wallet-api-v1" resource_group_name = local.pagopa_apim_rg @@ -92,24 +83,6 @@ resource "azurerm_api_management_api_operation_policy" "get_payment_methods_for_ ) } -resource "azurerm_api_management_api_operation_policy" "get_wallets_by_user_and_walletId_for_io" { - api_name = "${local.project}-io-payment-wallet-api-v1" - resource_group_name = local.pagopa_apim_rg - api_management_name = local.pagopa_apim_name - operation_id = "getIOPaymentWalletById" - - xml_content = templatefile("./api/io-payment-wallet/v1/_get_wallets_by_user_and_walletId.xml.tpl", { ecommerce_hostname = local.ecommerce_hostname }) -} - -resource "azurerm_api_management_api_operation_policy" "get_wallets_by_user_for_io" { - api_name = "${local.project}-io-payment-wallet-api-v1" - resource_group_name = local.pagopa_apim_rg - api_management_name = local.pagopa_apim_name - operation_id = "getIOPaymentWalletsByIdUser" - - xml_content = templatefile("./api/io-payment-wallet/v1/_get_wallets_by_user.xml.tpl", { ecommerce_hostname = local.ecommerce_hostname }) -} - resource "azurerm_api_management_api_operation_policy" "post_io_wallets" { api_name = "${local.project}-io-payment-wallet-api-v1" resource_group_name = local.pagopa_apim_rg @@ -122,15 +95,6 @@ resource "azurerm_api_management_api_operation_policy" "post_io_wallets" { }) } -resource "azurerm_api_management_api_operation_policy" "update_applications_for_io" { - api_name = "${local.project}-io-payment-wallet-api-v1" - resource_group_name = local.pagopa_apim_rg - api_management_name = local.pagopa_apim_name - operation_id = "updateIOPaymentWalletApplicationsById" - - xml_content = file("./api/io-payment-wallet/v1/_update_applications.xml.tpl") -} - resource "azurerm_api_management_named_value" "pay_wallet_family_friends_user_ids" { name = "pay-wallet-family-friends-user-ids" diff --git a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_base_policy.xml.tpl b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_base_policy.xml.tpl index 6880befc75..f523a9af6e 100644 --- a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_base_policy.xml.tpl +++ b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_base_policy.xml.tpl @@ -4,11 +4,7 @@ - - - - - + @@ -24,8 +20,7 @@ - - + IO diff --git a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_delete_wallet.xml.tpl b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_delete_wallet.xml.tpl index 1269b9139c..92bfb2ad6e 100644 --- a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_delete_wallet.xml.tpl +++ b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_delete_wallet.xml.tpl @@ -1,76 +1,6 @@ - - - - - - @($"{{pm-host}}/pp-restapi-CD/v1/wallet/{(string)context.Variables["idWalletPM"]}") - DELETE - - @($"Bearer {((String)context.Variables["sessionToken"])}") - - - - - - - - - - - - - - - application/json - - - { - "title": "Unauthorized", - "status": 401, - "detail": "Unauthorized" - } - - - - - - - - application/json - - - { - "title": "Not Found", - "status": 404, - "detail": "Wallet not found" - } - - - - - - - - application/json - - - { - "title": "Error deleting wallet", - "status": 502, - "detail": "There was an error deleting wallet" - } - - - - - - diff --git a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_payment_methods.xml.tpl b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_payment_methods.xml.tpl index 477c1e999b..51da1c328d 100644 --- a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_payment_methods.xml.tpl +++ b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_payment_methods.xml.tpl @@ -1,43 +1,10 @@ - - - - - - - - @{ - JObject response = context.Response.Body.As(); - - if (context.Response.StatusCode != 200) { - return response.ToString(); - } - - string enabled_payment_wallet_method_ids_pm = "${enabled_payment_wallet_method_ids_pm}"; - string[] values = enabled_payment_wallet_method_ids_pm.Split(','); - HashSet pmEnabledMethods = new HashSet(values); - - foreach (var method in ((JArray) response["paymentMethods"])) { - string id = (string) method["id"]; - if (pmEnabledMethods.Contains(id)) { - method["status"] = "ENABLED"; - method["methodManagement"] = "ONBOARDABLE_ONLY"; - } else { - method["status"] = "DISABLED"; - } - } - - return response.ToString(); - } - - - diff --git a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_wallets_by_user.xml.tpl b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_wallets_by_user.xml.tpl index 9014a33d5b..59ce29e724 100644 --- a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_wallets_by_user.xml.tpl +++ b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_wallets_by_user.xml.tpl @@ -1,199 +1,6 @@ - - - - - - {{pm-host}}/pp-restapi-CD/v3/wallet - GET - - @($"Bearer {((String)context.Variables["sessionToken"])}") - - - - - - - - application/json - - { - "title": "Unauthorized", - "status": 401, - "detail": "Unauthorized" - } - - - - - - - application/json - - - { - "title": "Error retrieving user wallet data", - "status": 502, - "detail": "There was an error retrieving user wallet data" - } - - - - - ())" /> - - - - - - - application/json - - - { - "title": "Wallet not found", - "status": 404, - "detail": "No wallet found for input wallet token" - } - - - - - - - - https://${ecommerce_hostname}/pagopa-ecommerce-payment-methods-service/payment-methods - GET - - IO - - - - - - - - application/json - - - { - "title": "Error retrieving eCommerce payment methods", - "status": 502, - "detail": "There was an error retrieving eCommerce payment methods" - } - - - - - ())" /> - - - - - application/json - - - @{ - JObject pmWalletResponse = (JObject)context.Variables["pmUserWalletResponseBody"]; - var walletApplications = new List{"PAGOPA"}; - var eCommerceWalletTypes = new Dictionary - { - { "Card", "CARDS" }, - { "BPay", "BANCOMATPAY" }, - { "PayPal", "PAYPAL" } - }; - var eCommercePaymentMethodIds = new Dictionary(); - JObject paymentMethods = (JObject)context.Variables["paymentMethodsResponseBody"]; - foreach(JObject paymentMethod in (JArray)paymentMethods["paymentMethods"]){ - eCommercePaymentMethodIds[paymentMethod["name"].ToString()] = paymentMethod["id"].ToString(); - } - Object[] wallets = pmWalletResponse["data"] - .Where(wallet =>{ - return eCommerceWalletTypes.ContainsKey((string) wallet["walletType"]); - }) - .Select(wallet =>{ - JObject result = new JObject(); - //convert wallet id (long) to UUID v4 with all bit set to 0 (except for the version). - //wallet id long value is stored into UUID latest 8 byte - string walletIdHex = ((long)wallet["idWallet"]).ToString("X").PadLeft(16,'0'); - string walletIdToUuid = "00000000-0000-4000-"+walletIdHex.Substring(0,4)+"-"+walletIdHex.Substring(4); - result["walletId"] = walletIdToUuid; - string pmWalletType = (string) wallet["walletType"]; - string eCommerceWalletType = eCommerceWalletTypes[pmWalletType]; - result["paymentMethodId"] = eCommercePaymentMethodIds[eCommerceWalletType]; - result["status"] = "VALIDATED"; - - TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"); - - DateTime creationDateTime = DateTime.Parse(((string)wallet["createDate"]).Replace(" ","T")); - DateTime utcCreationDateTime = TimeZoneInfo.ConvertTimeToUtc(creationDateTime, zone); - DateTimeOffset creationDateTimeOffset = new DateTimeOffset(utcCreationDateTime); - result["creationDate"] = creationDateTimeOffset.ToString("o"); - result["updateDate"] = result["creationDate"]; - - var convertedApplications = new List(); - foreach(JValue application in wallet["enableableFunctions"]){ - string applicationName = application.ToString().ToUpper(); - if(walletApplications.Contains(applicationName) && wallet[application.ToString()] != null){ - JObject converted = new JObject(); - converted["name"] = applicationName; - converted["status"] = Convert.ToBoolean(wallet[application.ToString()]) == true ? "ENABLED" : "DISABLED"; - converted["updateDate"] = result["creationDate"]; - convertedApplications.Add(converted); - } - } - result["applications"] = JArray.FromObject(convertedApplications); - JObject details = new JObject(); - details["type"] = eCommerceWalletType; - string paymentMethodAsset = null; - if (eCommerceWalletType == "CARDS") { - details["lastFourDigits"] = $"{wallet["info"]["blurredNumber"]}"; - details["expiryDate"] = $"{(string)wallet["info"]["expireYear"]}{(string)wallet["info"]["expireMonth"]}"; - details["brand"] = wallet["info"]["brand"]; - paymentMethodAsset = (string)wallet["info"]["brandLogo"]; - } - if (eCommerceWalletType == "PAYPAL") { - var info = (JObject)(wallet["info"]); - var pspArray = (JArray)(info["pspInfo"]); - var pspInfo = (JObject)(pspArray[0]); - details["pspId"] = pspInfo["abi"]; - details["maskedEmail"] = pspInfo["email"]; - details["pspBusinessName"] = pspInfo["ragioneSociale"]; - paymentMethodAsset = "https://assets.cdn.platform.pagopa.it/apm/paypal.png"; - } - if (eCommerceWalletType == "BANCOMATPAY") { - details["maskedNumber"] = wallet["info"]["numberObfuscated"]; - details["instituteCode"] = wallet["info"]["instituteCode"]; - details["bankName"] = wallet["info"]["bankName"]; - paymentMethodAsset = (string)wallet["info"]["brandLogo"]; - } - result["details"] = details; - result["paymentMethodAsset"] = paymentMethodAsset; - - Boolean favourite = (Boolean) wallet["favourite"]; - JObject clients = new JObject(); - JObject clientIO = new JObject(); - clientIO["status"] = "ENABLED"; - if(favourite == true) { - DateTime localDateUtc = DateTime.UtcNow; - DateTimeOffset lastUsageDateTimeOffset = new DateTimeOffset(localDateUtc); - clientIO["lastUsage"] = lastUsageDateTimeOffset.ToString("o"); - } - clients["IO"] = clientIO; - result["clients"] = clients; - - return result; - }).ToArray(); - - JObject response = new JObject(); - response["wallets"] = JArray.FromObject(wallets); - return response.ToString(); - } - - - - + diff --git a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_wallets_by_user_and_walletId.xml.tpl b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_wallets_by_user_and_walletId.xml.tpl index b5baa8f973..92bfb2ad6e 100644 --- a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_wallets_by_user_and_walletId.xml.tpl +++ b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_get_wallets_by_user_and_walletId.xml.tpl @@ -1,213 +1,6 @@ - - - - - - {{pm-host}}/pp-restapi-CD/v3/wallet - GET - - @($"Bearer {((String)context.Variables["sessionToken"])}") - - - - - - - - application/json - - { - "title": "Unauthorized", - "status": 401, - "detail": "Unauthorized" - } - - - - - - - application/json - - { - "title": "Error retrieving user wallet data", - "status": 502, - "detail": "There was an error retrieving user wallet data" - } - - - - ())" /> - - - - - - - application/json - - { - "title": "Wallet not found", - "status": 404, - "detail": "No wallet found for input wallet token" - } - - - - - - - https://${ecommerce_hostname}/pagopa-ecommerce-payment-methods-service/payment-methods - GET - - IO - - - - - - - - application/json - - { - "title": "Error retrieving eCommerce payment methods", - "status": 502, - "detail": "There was an error retrieving eCommerce payment methods" - } - - - - ())" /> - - {"PAGOPA"}; - var eCommerceWalletTypes = new Dictionary - { - { "Card", "CARDS" }, - { "BPay", "BANCOMATPAY" }, - { "PayPal", "PAYPAL" } - }; - var eCommercePaymentMethodIds = new Dictionary(); - JObject paymentMethods = (JObject)context.Variables["paymentMethodsResponseBody"]; - foreach(JObject paymentMethod in (JArray)paymentMethods["paymentMethods"]){ - eCommercePaymentMethodIds[paymentMethod["name"].ToString()] = paymentMethod["id"].ToString(); - } - JObject walletResult = (JObject) pmWalletResponse["data"] - .Where(wallet =>{ - return eCommerceWalletTypes.ContainsKey((string) wallet["walletType"]) && (((string)context.Variables["walletId"]).Equals((string)wallet["idWallet"])); - }) - .Select(wallet =>{ - - JObject result = new JObject(); - //convert wallet id (long) to UUID v4 with all bit set to 0 (except for the version). - //wallet id long value is stored into UUID latest 8 byte - string walletIdHex = ((long)wallet["idWallet"]).ToString("X").PadLeft(16,'0'); - string walletIdToUuid = "00000000-0000-4000-"+walletIdHex.Substring(0,4)+"-"+walletIdHex.Substring(4); - result["walletId"] = walletIdToUuid; - string pmWalletType = (string) wallet["walletType"]; - string eCommerceWalletType = eCommerceWalletTypes[pmWalletType]; - result["paymentMethodId"] = eCommercePaymentMethodIds[eCommerceWalletType]; - result["status"] = "VALIDATED"; - - TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"); - - DateTime creationDateTime = DateTime.Parse(((string)wallet["createDate"]).Replace(" ","T")); - DateTime utcCreationDateTime = TimeZoneInfo.ConvertTimeToUtc(creationDateTime, zone); - DateTimeOffset creationDateTimeOffset = new DateTimeOffset(utcCreationDateTime); - result["creationDate"] = creationDateTimeOffset.ToString("o"); - result["updateDate"] = result["creationDate"]; - - string paymentMethodAsset=null; - var convertedApplications = new List(); - foreach(JValue application in wallet["enableableFunctions"]){ - string applicationName = application.ToString().ToUpper(); - if(walletApplications.Contains(applicationName) && wallet[application.ToString()] != null){ - JObject converted = new JObject(); - converted["name"] = applicationName; - converted["status"] = Convert.ToBoolean(wallet[application.ToString()]) == true ? "ENABLED" : "DISABLED"; - converted["updateDate"] = result["creationDate"]; - convertedApplications.Add(converted); - } - } - result["applications"] = JArray.FromObject(convertedApplications); - JObject details = new JObject(); - details["type"] = eCommerceWalletType; - if (eCommerceWalletType == "CARDS") { - details["lastFourDigits"] = $"{wallet["info"]["blurredNumber"]}"; - details["expiryDate"] = $"{(string)wallet["info"]["expireYear"]}{(string)wallet["info"]["expireMonth"]}"; - details["brand"] = wallet["info"]["brand"]; - paymentMethodAsset = (string)wallet["info"]["brandLogo"]; - } - if (eCommerceWalletType == "PAYPAL") { - var info = (JObject)(wallet["info"]); - var pspArray = (JArray)(info["pspInfo"]); - var pspInfo = (JObject)(pspArray[0]); - details["pspId"] = pspInfo["abi"]; - details["maskedEmail"] = pspInfo["email"]; - details["pspBusinessName"] = pspInfo["ragioneSociale"]; - paymentMethodAsset = "https://assets.cdn.platform.pagopa.it/apm/paypal.png"; - } - if (eCommerceWalletType == "BANCOMATPAY") { - details["maskedNumber"] = wallet["info"]["numberObfuscated"]; - details["instituteCode"] = wallet["info"]["instituteCode"]; - details["bankName"] = wallet["info"]["bankName"]; - paymentMethodAsset = (string)wallet["info"]["brandLogo"]; - } - result["details"] = details; - result["paymentMethodAsset"] = paymentMethodAsset; - - Boolean favourite = (Boolean) wallet["favourite"]; - JObject clients = new JObject(); - JObject clientIO = new JObject(); - clientIO["status"] = "ENABLED"; - if(favourite == true) { - DateTime localDateUtc = DateTime.UtcNow; - DateTimeOffset lastUsageDateTimeOffset = new DateTimeOffset(localDateUtc); - clientIO["lastUsage"] = lastUsageDateTimeOffset.ToString("o"); - } - clients["IO"] = clientIO; - result["clients"] = clients; - - return result; - - }).SingleOrDefault(); - return walletResult; - }" /> - - - - - - application/json - - @(((JObject)context.Variables["walletResponseBody"]).ToString()) - - - - - - - application/json - - { - "title": "Wallet not found", - "status": 404, - "detail": "Wallet not found" - } - - - - - diff --git a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_post_wallets.xml.tpl b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_post_wallets.xml.tpl index b29a028442..12e5f0f3d2 100644 --- a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_post_wallets.xml.tpl +++ b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_post_wallets.xml.tpl @@ -1,82 +1,6 @@ - - - - - - - - @("https://${ecommerce_hostname}/pagopa-ecommerce-payment-methods-service/payment-methods/" + context.Variables["paymentMethodId"]) - GET - - IO - - - - - - - - application/json - - - { - "title": "Error retrieving eCommerce payment methods", - "status": 502, - "detail": "There was an error retrieving eCommerce payment methods" - } - - - - - ())" /> - - - { - { "CP", "pm-onboarding/creditcard" }, - { "BPAY", "pm-onboarding/bpay" }, - { "PPAL", "pm-onboarding/paypal" } - }; - - string redirectUrlPrefix; - paymentMethodTypeCodes.TryGetValue(returnedPaymentMethodTypeCode, out redirectUrlPrefix); - return redirectUrlPrefix; - }" /> - - - - - - application/json - - - { - "title": "Error retrieving eCommerce payment methods", - "status": 502, - "detail": "Invalid payment method name" - } - - - - - - - - - application/json - - @{ - return new JObject( - new JProperty("redirectUrl", $"https://${env}payment-wallet.pagopa.it/{(string)context.Variables["redirectUrlPrefix"]}#sessionToken={((string) context.Variables["sessionToken"])}") - ).ToString(); - } - - - - + diff --git a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_update_applications.xml.tpl b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_update_applications.xml.tpl index 499271f8f1..41bc62d1f6 100644 --- a/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_update_applications.xml.tpl +++ b/src/domains/pay-wallet-app/api/io-payment-wallet/v1/_update_applications.xml.tpl @@ -1,111 +1,6 @@ - - - - - - - - @($"{{pm-host}}/pp-restapi-CD/v2/wallet/{(string)context.Variables["idWalletPM"]}/payment-status") - PUT - - application/json - - - @($"Bearer {((String)context.Variables["sessionToken"])}") - - @{ - JObject requestBody = (JObject)context.Variables["requestBody"]; - JArray applications = (JArray)requestBody["applications"]; - foreach(JObject application in applications){ - String name = application["name"].ToString(); - String status = application["status"].ToString(); - if(name.Equals("PAGOPA")) { - return new JObject( - new JProperty("data", new JObject( - new JProperty("pagoPA", status.Equals("ENABLED")) - )) - ).ToString(); - } - } - return new JObject().ToString(); - } - - - - - - - - - - - - - - application/json - - - { - "title": "Unauthorized", - "status": 401, - "detail": "Unauthorized" - } - - - - - - - - application/json - - - { - "title": "Forbidden", - "status": 403, - "detail": "Forbidden" - } - - - - - - - - application/json - - - { - "title": "Not Found", - "status": 404, - "detail": "Wallet not found" - } - - - - - - - - application/json - - - { - "title": "Error changing wallet status", - "status": 502, - "detail": "There was an error changing wallet status" - } - - - - - - + diff --git a/src/domains/shared-app/api/session-wallet/v1/_base_policy.xml.tpl b/src/domains/shared-app/api/session-wallet/v1/_base_policy.xml.tpl index b7128af459..1e1e6ffa02 100644 --- a/src/domains/shared-app/api/session-wallet/v1/_base_policy.xml.tpl +++ b/src/domains/shared-app/api/session-wallet/v1/_base_policy.xml.tpl @@ -1,225 +1,164 @@ - - - - - @($"{{pm-host}}/pp-restapi-CD/v1/users/actions/start-session?token={(string)context.Variables["walletToken"]}") - GET + + + + + + ${pdv_api_base_path}/tokens + PUT + + {{wallet-session-personal-data-vault-api-key}} + + @{ + return new JObject( + new JProperty("pii", (string)context.Variables["userFiscalCode"]) + ).ToString(); + } - - - - - - application/json - - - { - "title": "Unauthorized", - "status": 401, - "detail": "Invalid session token" - } - - - + + + + + { + "title": "Error starting session", + "status": 502, + "detail": "Error during fiscal code tokenization" + } + + + - ())" /> - - - + + ())" /> + + - - + + + + + application/json + + @{ + return new JObject( + new JProperty("title", "Bad gateway - Invalid PDV response"), + new JProperty("status", 502), + new JProperty("detail", "Cannot tokenize fiscal code") + ).ToString(); + } + + + + + + + + + @("${io_backend_base_path}/pagopa/api/v1/user?version=20200114") + GET + + application/json + + + @("Bearer " + (string)context.Variables.GetValueOrDefault("walletToken")) + + + + + + + + application/json + + + { + "title": "Unauthorized", + "status": 401, + "detail": "Invalid session token" + } + + + + + - application/json + application/json { "title": "Error starting session", "status": 502, - "detail": "Cannot tokenize user fiscal code: PM start-session fiscalCode is null" + "detail": "There was an error while getting user info" } - - - - - - ${pdv_api_base_path}/tokens - PUT - - {{wallet-session-personal-data-vault-api-key}} - - @{ - return new JObject( - new JProperty("pii", (string)context.Variables["userFiscalCode"]) - ).ToString(); - } - - - - - - - { - "title": "Error starting session", - "status": 502, - "detail": "Error during fiscal code tokenization" - } - - - - - - ())" /> - - - - - - - - application/json - - @{ - return new JObject( - new JProperty("title", "Bad gateway - Invalid PDV response"), - new JProperty("status", 502), - new JProperty("detail", "Cannot tokenize fiscal code") - ).ToString(); - } - - - - - + + - + ())" /> + + + + + ${pdv_api_base_path}/tokens + PUT + + {{ecommerce-personal-data-vault-api-key}} + + @{ + JObject userAuthBody = (JObject)context.Variables["userAuthBody"]; + string spidEmail = (String)userAuthBody["spid_email"]; + string noticeEmail = (String)userAuthBody["notice_email"]; + string email = String.IsNullOrEmpty(noticeEmail) ? spidEmail : noticeEmail; + return new JObject( + new JProperty("pii", email) + ).ToString(); + } + - - - - + + + + - - - - @("${io_backend_base_path}/pagopa/api/v1/user?version=20200114") - GET - - application/json - - - @("Bearer " + (string)context.Variables.GetValueOrDefault("walletToken")) - - - - - - - - application/json - - - { - "title": "Unauthorized", - "status": 401, - "detail": "Invalid session token" - } - - - - - - - - application/json - - - { - "title": "Error starting session", - "status": 502, - "detail": "There was an error while getting user info" - } - - - - - ())" /> - - - - - ${pdv_api_base_path}/tokens - PUT - - {{ecommerce-personal-data-vault-api-key}} - - @{ - JObject userAuthBody = (JObject)context.Variables["userAuthBody"]; - string spidEmail = (String)userAuthBody["spid_email"]; - string noticeEmail = (String)userAuthBody["notice_email"]; - string email = String.IsNullOrEmpty(noticeEmail) ? spidEmail : noticeEmail; - return new JObject( - new JProperty("pii", email) - ).ToString(); - } - - - - - - - - + - ())" /> - - + ())" /> + + - - - + + - - - - + // Return the HMAC SHA512-signed JWT as the value for the Authorization header + return $"{jwtHeaderBase64UrlEncoded}.{jwtPayloadBase64UrlEncoded}.{jwtSignatureBase64UrlEncoded}"; + }" /> + +