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: add fees to admin UI #2050

Merged
merged 15 commits into from
Oct 23, 2023
Merged

feat: add fees to admin UI #2050

merged 15 commits into from
Oct 23, 2023

Conversation

JoblersTune
Copy link
Collaborator

@JoblersTune JoblersTune commented Oct 18, 2023

Changes proposed in this pull request

  • added a query to fetch all historic fees associated with a particular asset
  • added current fee to asset overview on admin UI
  • added the ability to set a new fee on asset overview
  • displays a table of all historic fees for a particular asset (this view can be filtered by fee type)

Context

fixes #1834

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Documentation added
  • Make sure that all checks pass
  • Postman collection updated

@JoblersTune JoblersTune self-assigned this Oct 18, 2023
@netlify
Copy link

netlify bot commented Oct 18, 2023

Deploy Preview for brilliant-pasca-3e80ec canceled.

Name Link
🔨 Latest commit fd040cb
🔍 Latest deploy log https://app.netlify.com/sites/brilliant-pasca-3e80ec/deploys/65362703b70d03000778ab18

@github-actions github-actions bot added type: tests Testing related pkg: backend Changes in the backend package. pkg: frontend Changes in the frontend package. type: source Changes business logic pkg: mock-ase labels Oct 18, 2023
@JoblersTune JoblersTune modified the milestone: v1.0.0-alpha.4 Oct 18, 2023
@sabineschaller sabineschaller changed the title Sj/1834/add fees to admin UI feat: add fees to admin UI Oct 19, 2023
Copy link
Member

@sabineschaller sabineschaller left a comment

Choose a reason for hiding this comment

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

Rafiki currently does not handle receiving fees (even though we have that fee type included). Can we just gray out that entire section? Or should we remove it for now?

@sabineschaller
Copy link
Member

@mkurapov @BlairCurrey how should we deal with receiving fees?

@JoblersTune
Copy link
Collaborator Author

I can easily remove all the receiving fees code for now. And we can go with this
image

@sabineschaller
Copy link
Member

I can easily remove all the receiving fees code for now. And we can go with this

I think that looks good.

@JoblersTune JoblersTune force-pushed the sj/1834/add-fees-to-admin-ui branch from 1cbdddd to 50a48de Compare October 19, 2023 13:18
error={response?.errors.sendingFee.fieldErrors.basisPoints}
/>
<p className='text-gray-500 text-sm mt-2'>
A single basis point is equal to 0.01% of the total fee.
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that makes it clear. Should we say "A basis point equals 0.01% or 0.0001"? Or maybe add an example? "A fee of 1 basis point on $100 equals 0.0001*$100 = $0.01." Or both?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a stretch, but it could also be nice to make it response to user input. For example they type in 50 and see "50 basis points is equal to 0.50% of the total fee" (or the worked example Sabine is suggesting).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How about "A single basis point is a fee equal to 0.01% of the total amount. A fee of 1 basis point on $100 is $0.01."

Copy link
Member

Choose a reason for hiding this comment

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

That works. Maybe we should create an issue to make this line adapt like @BlairCurrey suggested. That could even be a last minute hacktoberfest contribution.

@BlairCurrey
Copy link
Contributor

BlairCurrey commented Oct 19, 2023

@mkurapov @BlairCurrey how should we deal with receiving fees?

Last I knew there was a chance that Mojaloop payments might need them. Any more insight on that? If they wont need them then I'd be in favor of removing the type and implicitly treating all fees as sending. The type was added with the expectation that receiving fees would be implemented but they were scrapped.

@sabineschaller
Copy link
Member

Last I knew there was a chance that Mojaloop payments might need them. Any more insight on that? If they wont need them then I'd be in favor of removing the type and implicitly treating all fees as sending. The type was added with the expectation that receiving fees would be implemented but they were scrapped.

I think this is still the case, but not for the PoC we are working on right now with PCH but for the general MJL peer-to-peer payment method.

@@ -160,6 +160,31 @@ export const getAssetReceivingFee: AssetResolvers<ApolloContext>['receivingFee']
return feeToGraphql(fee)
}

export const getFees: AssetResolvers<ApolloContext>['fees'] = async (
Copy link
Member

Choose a reason for hiding this comment

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

Can we sort the fees by createdAt in a descending order? This way we will have latest fee at the top when showing the fees table.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I also thought about this. But wasn't sure it was worth writing a new getPage function to do that. But I can.

Copy link
Member

Choose a reason for hiding this comment

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

I think it makes sense to also display the payments and webhooks in descending order tbh. Can we pass a sorting option to the getPage function?

Copy link
Collaborator Author

@JoblersTune JoblersTune Oct 23, 2023

Choose a reason for hiding this comment

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

Will do. Moving this out into a separate issue - Add a sorting option to the getPage function #2088.

@JoblersTune JoblersTune force-pushed the sj/1834/add-fees-to-admin-ui branch from 0eb8bb9 to fd040cb Compare October 23, 2023 07:55
Copy link
Member

@sabineschaller sabineschaller left a comment

Choose a reason for hiding this comment

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

LGTM

@JoblersTune JoblersTune merged commit 111a504 into main Oct 23, 2023
21 checks passed
@JoblersTune JoblersTune deleted the sj/1834/add-fees-to-admin-ui branch October 23, 2023 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: backend Changes in the backend package. pkg: frontend Changes in the frontend package. pkg: mock-ase type: source Changes business logic type: tests Testing related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add fees to Admin UI
4 participants