Skip to content

Commit

Permalink
feat: Display revoke button for recurring payments (#1438)
Browse files Browse the repository at this point in the history
* display revoke button for recurring payments

* Update [grantId].tsx

* Update [grantId].tsx

---------

Co-authored-by: Tymmmy <117268143+Tymmmy@users.noreply.github.com>
  • Loading branch information
rico191013 and Tymmmy authored Jul 17, 2024
1 parent 53028e3 commit 69ed580
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/boutique/backend/src/order/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IOrderService } from './service'
import { Order } from './model'
import {
BadRequest,
Unauthorized,
Controller,
InternalServerError,
toSuccessResponse
Expand All @@ -20,6 +21,7 @@ import {
setupFinishSchema,
oneClickSetupSchema
} from '@boutique/shared'
import { OpenPaymentsClientError } from '@interledger/open-payments'

interface GetParams {
id?: string
Expand Down Expand Up @@ -239,7 +241,11 @@ export class OrderController implements IOrderController {
})
)
} catch (err) {
next(err)
if (err instanceof OpenPaymentsClientError && err.status === 401)
next(
new Unauthorized('Instant-buy is not valid please initiate it again')
)
else next(err)
}
}
}
5 changes: 3 additions & 2 deletions packages/wallet/frontend/src/pages/grants/[grantId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ const GrantPage: NextPageWithLayout<GrantPageProps> = ({ grant }) => {
<PageHeader title="Grant details" />
<div className="flex flex-col items-start md:flex-col">
<GrantDetails grant={grant}></GrantDetails>
{grant.state !== 'FINALIZED' && (
{(grant.finalizationReason === 'ISSUED' ||
grant.state !== 'FINALIZED') && (
<Button
intent="secondary"
aria-label="revoke"
onClick={() => {
openDialog(
<ConfirmationDialog
confirmText="Revoke Grant"
message="Are you sure you want to revoke this grant?"
message="Revoking a grant will prevent future payments from this client. You will need to give the client access again to allow them to initiate further payments. Finalized payments will not change. Are you sure you want to revoke this grant?"
onConfirm={() => handleRevokeConfirmation(grant.id)}
onClose={closeDialog}
/>
Expand Down

0 comments on commit 69ed580

Please sign in to comment.