Skip to content

Commit 69ed580

Browse files
domin191013Tymmmy
andauthored
feat: Display revoke button for recurring payments (#1438)
* display revoke button for recurring payments * Update [grantId].tsx * Update [grantId].tsx --------- Co-authored-by: Tymmmy <[email protected]>
1 parent 53028e3 commit 69ed580

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/boutique/backend/src/order/controller.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { IOrderService } from './service'
33
import { Order } from './model'
44
import {
55
BadRequest,
6+
Unauthorized,
67
Controller,
78
InternalServerError,
89
toSuccessResponse
@@ -20,6 +21,7 @@ import {
2021
setupFinishSchema,
2122
oneClickSetupSchema
2223
} from '@boutique/shared'
24+
import { OpenPaymentsClientError } from '@interledger/open-payments'
2325

2426
interface GetParams {
2527
id?: string
@@ -239,7 +241,11 @@ export class OrderController implements IOrderController {
239241
})
240242
)
241243
} catch (err) {
242-
next(err)
244+
if (err instanceof OpenPaymentsClientError && err.status === 401)
245+
next(
246+
new Unauthorized('Instant-buy is not valid please initiate it again')
247+
)
248+
else next(err)
243249
}
244250
}
245251
}

packages/wallet/frontend/src/pages/grants/[grantId].tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ const GrantPage: NextPageWithLayout<GrantPageProps> = ({ grant }) => {
5151
<PageHeader title="Grant details" />
5252
<div className="flex flex-col items-start md:flex-col">
5353
<GrantDetails grant={grant}></GrantDetails>
54-
{grant.state !== 'FINALIZED' && (
54+
{(grant.finalizationReason === 'ISSUED' ||
55+
grant.state !== 'FINALIZED') && (
5556
<Button
5657
intent="secondary"
5758
aria-label="revoke"
5859
onClick={() => {
5960
openDialog(
6061
<ConfirmationDialog
6162
confirmText="Revoke Grant"
62-
message="Are you sure you want to revoke this grant?"
63+
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?"
6364
onConfirm={() => handleRevokeConfirmation(grant.id)}
6465
onClose={closeDialog}
6566
/>

0 commit comments

Comments
 (0)