Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [CHK-3256] remove all references to NPG switch business logic #2471

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 48 additions & 55 deletions src/domains/bizevents-app/api/lap-service/v1/_base_policy-jwt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,73 +16,66 @@
<!-- fragment to read user id from session token jwt claims. it return userId as sessionTokenUserId variable taken from jwt claims. if the session token
is an opaque token a "session-token-not-found" string is returned-->
<include-fragment fragment-id="pay-wallet-user-id-from-session-token" />
<include-fragment fragment-id="jwt-chk-wallet-session" />
<choose>
<when condition="@("PM".Equals("{{ecommerce-for-io-pm-npg-ff}}") || ("NPGFF".Equals("{{ecommerce-for-io-pm-npg-ff}}") && !"{{pay-wallet-family-friends-user-ids}}".Contains(((string)context.Variables["sessionTokenUserId"]))))">
<include-fragment fragment-id="pm-chk-wallet-session" />
</when>
<when condition="@("NPG".Equals("{{ecommerce-for-io-pm-npg-ff}}") || ("NPGFF".Equals("{{ecommerce-for-io-pm-npg-ff}}") && "{{pay-wallet-family-friends-user-ids}}".Contains(((string)context.Variables["sessionTokenUserId"]))))">
<include-fragment fragment-id="jwt-chk-wallet-session" />
<choose>
<when condition="@((string)context.Variables.GetValueOrDefault("xUserId","") != "")">

<!-- <trace source="transaction-service-IO-JWT-start" severity="information">transaction-service-IO-JWT-start</trace> -->
<when condition="@((string)context.Variables.GetValueOrDefault("xUserId","") != "")">

<!-- Post Token PDV : START Find PII -->
<send-request ignore-error="true" timeout="10" response-variable-name="pdvfindpii" mode="new">
<set-url>@(String.Format("${pdv_api_base_path}/tokens/{0}/pii", (string) context.Variables["xUserId"]))</set-url>
<set-method>GET</set-method>
<set-header name="x-api-key" exists-action="override">
<value>{{wallet-session-personal-data-vault-api-key}}</value>
</set-header>
</send-request>
<choose>
<when condition="@(((IResponse)context.Variables["pdvfindpii"]).StatusCode != 200)">
<return-response>
<set-status code="502" reason="Bad Gateway" />
</return-response>
</when>
</choose>

<set-variable name="pdvFindPII" value="@(((IResponse)context.Variables["pdvfindpii"]).Body.As<JObject>())" />
<set-variable name="fiscalCode" value="@((string)((JObject)context.Variables["pdvFindPII"])["pii"])" />
<choose>
<when condition="@(String.IsNullOrEmpty((string)context.Variables["fiscalCode"]))">
<return-response>
<set-status code="502" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("title", "Bad gateway - Invalid PDV response"),
new JProperty("status", 502),
new JProperty("detail", "Cannot find PII")
).ToString();
}</set-body>
</return-response>
</when>
</choose>
<!-- Post Token PDV : END Find PII -->
<!-- <trace source="transaction-service-IO-JWT-start" severity="information">transaction-service-IO-JWT-start</trace> -->

<!-- <trace source="transaction-service-IO-JWT-end" severity="information">transaction-service-IO-JWT-end</trace> -->
<!-- Post Token PDV : START Find PII -->
<send-request ignore-error="true" timeout="10" response-variable-name="pdvfindpii" mode="new">
<set-url>@(String.Format("${pdv_api_base_path}/tokens/{0}/pii", (string) context.Variables["xUserId"]))</set-url>
<set-method>GET</set-method>
<set-header name="x-api-key" exists-action="override">
<value>{{wallet-session-personal-data-vault-api-key}}</value>
</set-header>
</send-request>
<choose>
<when condition="@(((IResponse)context.Variables["pdvfindpii"]).StatusCode != 200)">
<return-response>
<set-status code="502" reason="Bad Gateway" />
</return-response>
</when>
<otherwise>
</choose>

<set-variable name="pdvFindPII" value="@(((IResponse)context.Variables["pdvfindpii"]).Body.As<JObject>())" />
<set-variable name="fiscalCode" value="@((string)((JObject)context.Variables["pdvFindPII"])["pii"])" />
<choose>
<when condition="@(String.IsNullOrEmpty((string)context.Variables["fiscalCode"]))">
<return-response>
<set-status code="502" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("title", "Bad gateway - Not call PDV"),
new JProperty("status", 502),
new JProperty("detail", "Cannot find xUserId")
).ToString();
}</set-body>
</return-response>
</otherwise>
return new JObject(
new JProperty("title", "Bad gateway - Invalid PDV response"),
new JProperty("status", 502),
new JProperty("detail", "Cannot find PII")
).ToString();
}</set-body>
</return-response>
</when>
</choose>
<!-- Post Token PDV : END Find PII -->

<!-- <trace source="transaction-service-IO-JWT-end" severity="information">transaction-service-IO-JWT-end</trace> -->
</when>
<otherwise>
<return-response>
<set-status code="502" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("title", "Bad gateway - Not call PDV"),
new JProperty("status", 502),
new JProperty("detail", "Cannot find xUserId")
).ToString();
}</set-body>
</return-response>
</otherwise>
</choose>

<set-header name="Ocp-Apim-Subscription-Keykey" exists-action="override">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,73 +16,66 @@
<!-- fragment to read user id from session token jwt claims. it return userId as sessionTokenUserId variable taken from jwt claims. if the session token
is an opaque token a "session-token-not-found" string is returned-->
<include-fragment fragment-id="pay-wallet-user-id-from-session-token" />
<include-fragment fragment-id="jwt-chk-wallet-session" />
<choose>
<when condition="@("PM".Equals("{{ecommerce-for-io-pm-npg-ff}}") || ("NPGFF".Equals("{{ecommerce-for-io-pm-npg-ff}}") && !"{{pay-wallet-family-friends-user-ids}}".Contains(((string)context.Variables["sessionTokenUserId"]))))">
<include-fragment fragment-id="pm-chk-wallet-session" />
</when>
<when condition="@("NPG".Equals("{{ecommerce-for-io-pm-npg-ff}}") || ("NPGFF".Equals("{{ecommerce-for-io-pm-npg-ff}}") && "{{pay-wallet-family-friends-user-ids}}".Contains(((string)context.Variables["sessionTokenUserId"]))))">
<include-fragment fragment-id="jwt-chk-wallet-session" />
<choose>
<when condition="@((string)context.Variables.GetValueOrDefault("xUserId","") != "")">

<!-- <trace source="transaction-service-IO-JWT-start" severity="information">transaction-service-IO-JWT-start</trace> -->
<when condition="@((string)context.Variables.GetValueOrDefault("xUserId","") != "")">

<!-- Post Token PDV : START Find PII -->
<send-request ignore-error="true" timeout="10" response-variable-name="pdvfindpii" mode="new">
<set-url>@(String.Format("${pdv_api_base_path}/tokens/{0}/pii", (string) context.Variables["xUserId"]))</set-url>
<set-method>GET</set-method>
<set-header name="x-api-key" exists-action="override">
<value>{{wallet-session-personal-data-vault-api-key}}</value>
</set-header>
</send-request>
<choose>
<when condition="@(((IResponse)context.Variables["pdvfindpii"]).StatusCode != 200)">
<return-response>
<set-status code="502" reason="Bad Gateway" />
</return-response>
</when>
</choose>

<set-variable name="pdvFindPII" value="@(((IResponse)context.Variables["pdvfindpii"]).Body.As<JObject>())" />
<set-variable name="fiscalCode" value="@((string)((JObject)context.Variables["pdvFindPII"])["pii"])" />
<choose>
<when condition="@(String.IsNullOrEmpty((string)context.Variables["fiscalCode"]))">
<return-response>
<set-status code="502" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("title", "Bad gateway - Invalid PDV response"),
new JProperty("status", 502),
new JProperty("detail", "Cannot find PII")
).ToString();
}</set-body>
</return-response>
</when>
</choose>
<!-- Post Token PDV : END Find PII -->
<!-- <trace source="transaction-service-IO-JWT-start" severity="information">transaction-service-IO-JWT-start</trace> -->

<!-- <trace source="transaction-service-IO-JWT-end" severity="information">transaction-service-IO-JWT-end</trace> -->
<!-- Post Token PDV : START Find PII -->
<send-request ignore-error="true" timeout="10" response-variable-name="pdvfindpii" mode="new">
<set-url>@(String.Format("${pdv_api_base_path}/tokens/{0}/pii", (string) context.Variables["xUserId"]))</set-url>
<set-method>GET</set-method>
<set-header name="x-api-key" exists-action="override">
<value>{{wallet-session-personal-data-vault-api-key}}</value>
</set-header>
</send-request>
<choose>
<when condition="@(((IResponse)context.Variables["pdvfindpii"]).StatusCode != 200)">
<return-response>
<set-status code="502" reason="Bad Gateway" />
</return-response>
</when>
<otherwise>
</choose>

<set-variable name="pdvFindPII" value="@(((IResponse)context.Variables["pdvfindpii"]).Body.As<JObject>())" />
<set-variable name="fiscalCode" value="@((string)((JObject)context.Variables["pdvFindPII"])["pii"])" />
<choose>
<when condition="@(String.IsNullOrEmpty((string)context.Variables["fiscalCode"]))">
<return-response>
<set-status code="502" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("title", "Bad gateway - Not call PDV"),
new JProperty("status", 502),
new JProperty("detail", "Cannot find xUserId")
).ToString();
}</set-body>
</return-response>
</otherwise>
return new JObject(
new JProperty("title", "Bad gateway - Invalid PDV response"),
new JProperty("status", 502),
new JProperty("detail", "Cannot find PII")
).ToString();
}</set-body>
</return-response>
</when>
</choose>
<!-- Post Token PDV : END Find PII -->

<!-- <trace source="transaction-service-IO-JWT-end" severity="information">transaction-service-IO-JWT-end</trace> -->
</when>
<otherwise>
<return-response>
<set-status code="502" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("title", "Bad gateway - Not call PDV"),
new JProperty("status", 502),
new JProperty("detail", "Cannot find xUserId")
).ToString();
}</set-body>
</return-response>
</otherwise>
</choose>

<set-header name="Ocp-Apim-Subscription-Keykey" exists-action="override">
Expand Down
Loading
Loading