Skip to content

Commit

Permalink
fix: [IOBP-1082] Typo in Zendesk assistance json remote path (#6546)
Browse files Browse the repository at this point in the history
> [!NOTE]
> To test this PR [check
this](pagopa/io-dev-api-server#450)

## Short description
This pull request update the URL path and improve the handling of
Zendesk payment categories. The most important changes include modifying
the URL for the Zendesk payment configuration and refactoring the code
for checking and adding subcategories in the payment failure support
modal.

## List of changes proposed in this pull request
- Changed the URL path in the `getZendeskPaymentConfig` object from
`/assistanceTools/payment/zendeskOutcomeMapping.json` to
`/assistanceTools/payments/zendeskOutcomeMapping.json`
- Refactored the `zendeskAssistanceLogAndStart` function to improve the
handling of the `zendeskPaymentCategory` check and the addition of
subcategories to the ticket. The new code ensures that the subcategory
is only processed if `zendeskPaymentCategory` is ready and a subcategory
is found.
  • Loading branch information
LeleDallas authored Dec 12, 2024
1 parent 25f493a commit d385843
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ts/api/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ type GetZendeskPaymentConfigT = IGetApiRequestType<

const getZendeskPaymentConfig: GetZendeskPaymentConfigT = {
method: "get",
url: () => "/assistanceTools/payment/zendeskOutcomeMapping.json",
url: () => "/assistanceTools/payments/zendeskOutcomeMapping.json",
query: _ => ({}),
headers: () => ({}),
response_decoder: basicResponseDecoder(ZendeskSubcategoriesErrors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,24 @@ const usePaymentFailureSupportModal = ({
"";

const zendeskAssistanceLogAndStart = () => {
if (!isReady(zendeskPaymentCategory)) {
return;
}
const { payments } = zendeskPaymentCategory.value;
const subCategory = getSubCategoryFromFaultCode(payments, faultCodeDetail);

resetCustomFields();
// attach the main zendesk category to the ticket
addTicketCustomField(
zendeskCategoryId,
defaultZendeskPaymentCategory.value
);

if (subCategory) {
// if a subcategory is found, we attach its id and value to the ticket
const { value, zendeskSubCategoryId } = subCategory;
addTicketCustomField(zendeskSubCategoryId, value);
if (isReady(zendeskPaymentCategory)) {
const { payments } = zendeskPaymentCategory.value;
const subCategory = getSubCategoryFromFaultCode(
payments,
faultCodeDetail
);
if (subCategory) {
// if a subcategory is found, we attach its id and value to the ticket
const { value, zendeskSubCategoryId } = subCategory;
addTicketCustomField(zendeskSubCategoryId, value);
}
}

addTicketCustomField(zendeskPaymentOrgFiscalCode, organizationFiscalCode);
Expand Down

0 comments on commit d385843

Please sign in to comment.