Skip to content

Conversation

@LeleDallas
Copy link
Contributor

Short description

Include a summary of the changes.
This pull request includes changes to the payment route to support a new endpoint for disabling user notices.

List of changes proposed in this pull request

  • Add paids/:eventId/disable route
  • Update global config with hideReceiptResponseCode field

@codecov
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.

Project coverage is 64.24%. Comparing base (a64bf42) to head (c138e72).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/features/payments/routers/notices.ts 44.44% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #430      +/-   ##
==========================================
- Coverage   64.28%   64.24%   -0.04%     
==========================================
  Files         167      167              
  Lines        5364     5372       +8     
  Branches      731      731              
==========================================
+ Hits         3448     3451       +3     
- Misses       1915     1920       +5     
  Partials        1        1              
Files with missing lines Coverage Δ
src/config.ts 96.29% <ø> (ø)
src/types/config.ts 100.00% <ø> (ø)
src/features/payments/routers/notices.ts 26.53% <44.44%> (+2.14%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1323b3b...c138e72. Read the comment docs.

Copy link
Contributor

@Hantex9 Hantex9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Just a small note, and it’s good to go from my side.

Comment on lines 93 to 109
addNoticesHandler("post", "/paids/:eventId/disable", (req, res) => {
pipe(
req.params.eventId,
O.fromNullable,
O.fold(
() => res.sendStatus(400),
eventId =>
pipe(
O.fromNullable(NoticesDB.removeUserNotice(eventId)),
O.fold(
() => res.sendStatus(hideReceiptResponseCode),
() => res.sendStatus(hideReceiptResponseCode)
)
)
)
);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't really need two nested fold that have the same behavior, what do you think of replacing with the following suggestion?

Suggested change
addNoticesHandler("post", "/paids/:eventId/disable", (req, res) => {
pipe(
req.params.eventId,
O.fromNullable,
O.fold(
() => res.sendStatus(400),
eventId =>
pipe(
O.fromNullable(NoticesDB.removeUserNotice(eventId)),
O.fold(
() => res.sendStatus(hideReceiptResponseCode),
() => res.sendStatus(hideReceiptResponseCode)
)
)
)
);
});
addNoticesHandler("post", "/paids/:eventId/disable", (req, res) => {
pipe(
req.params.eventId,
O.fromNullable,
O.fold(
() => res.sendStatus(400),
eventId => {
NoticesDB.removeUserNotice(eventId);
return res.sendStatus(hideReceiptResponseCode);
}
)
);
});

Copy link
Contributor

@Hantex9 Hantex9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@LeleDallas LeleDallas merged commit e69fe64 into master Oct 30, 2024
8 checks passed
LeleDallas added a commit to pagopa/io-app that referenced this pull request Nov 11, 2024
This PR depends on 
## ⚠️ This PR depends on
[#430](pagopa/io-dev-api-server#430) -> Please
review the dependent PR before reviewing this ⚠️



## Short description
This pull request introduces a new feature to hide receipts from the
list

## List of changes proposed in this pull request
- Add hide button at the bottom of
`PaymentsTransactionBizEventsDetailsScreen`
- Update payment navigation route and saga
- Apply optimistic UI logic to hide elements 

## How to test
### Dev-server
- In `config.ts` set a delay and edit the `hideReceiptResponseCode`
property

###
- Go to payments section
- Tap on an element
- Scroll to the bottom and tap on `Nascondi dalla lista`
- Verify if the element disappears after the redirect.


## Preview


https://github.com/user-attachments/assets/060ef264-39c0-4616-bd4b-8a01a87c6ed0



https://github.com/user-attachments/assets/e364022f-af3c-45b2-b0db-f748ff654bbf



https://github.com/user-attachments/assets/5af9588d-4380-4b60-8bd8-c22a8e0f165a




@thisisjp would it make sense to set a minimum delay before displaying
the Loading component? This could help avoid the component flashing on
screen for very short loading times, leading to a smoother user
experience.

---------

Co-authored-by: Alessandro <alessandro.izzo998@gmail.com>
@Vangaorth Vangaorth deleted the IOBP-838-remove-receipt-from-list branch February 13, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants