-
-
Notifications
You must be signed in to change notification settings - Fork 186
Description
π Feature Title
Refactor task update api and actions to handle payments
β What problem does this solve?
We need to change how we handle payment updates for tasks, initially on the backend. Then, we need to update the related action that requests the API to return the updated task without executing extra actions.
Currently, we dispatch many actions after a task is updated (fetch task and sync task) to display the task after an update. We need to refactor this logic so that on the API, the task update handles everything and returns the updated task and the updated value of the bounty when the payment succeeds.
We have BE and FE tests for the taskUpdate on the API and taskActions.
π‘ Proposed Solution
Make the API return an updated task with the new order created when calling the API
https://github.com/worknenjoy/gitpay/blob/master/modules/tasks/taskUpdate.js#L123
Change the action that handles the update
https://github.com/worknenjoy/gitpay/blob/master/frontend/src/actions/taskActions.js#L336
You need to check if there is a new order on the request (as the commented code), and display a notification for this case,.
Remove the sync and fetch calls from this action, call the sync on the BE, and refactor the update action to return the task and update the state with the updated data.
** You will need Stripe development keys to test payments on the UI, you can request ([email protected]) or count with our tests **
Tests for these components can be found on
Task Actions: https://github.com/worknenjoy/gitpay/blob/master/frontend/tests/actions/taskActions.test.js
Task Update: https://github.com/worknenjoy/gitpay/blob/master/test/task.test.js#L161
_ Most of the Task Updates and actions are skiped and it should be fixed _
π Alternatives Considered
You can keep the Sync actions if is not possible to handle all in the back end, and only have the task update updating the response data so we update the status with the current task updated and call sync to get the bounty values and updates on the UI.
π¨ Does this feature affect the UI?
Yes
π οΈ Technical Notes (if any)
React, Redux, Express
π° Is there a bounty for this issue?
No
π΅ Bounty Amount (if any)
No bounty for this issue
π Bounty Details (if applicable)
There's no Bounty for this issue.
This issue is part of the Only Dust Hackathon: https://onlydust.notion.site/May-28th-Open-Source-Hackathon-1f244b682a80801890e5fda15b779746
Metadata
Metadata
Assignees
Labels
Type
Projects
Status