Skip to content

Commit 0acba60

Browse files
domin191013Tymmmy
andauthored
feat: fix grant message fix when it is NOT withdraw (#1406)
* Fix grant message fix when it is NOT withdraw * Fix wallet frontend * Fix wallet grant test * fix format * fix fetch grant types * Change back separation of one click payment, and add universal message for ACCESS to account * Update use-setup-one-click-mutation.ts --------- Co-authored-by: Tymmmy <[email protected]>
1 parent fba91aa commit 0acba60

File tree

8 files changed

+27
-15
lines changed

8 files changed

+27
-15
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@ export class OrderController implements IOrderController {
154154

155155
const redirectUrl = await this.openPayments.setupOneClick(
156156
walletAddressUrl,
157-
amount
157+
Number(amount)
158158
)
159-
160159
res.status(200).json(toSuccessResponse({ redirectUrl }))
161160
} catch (err) {
162161
next(err)

packages/boutique/frontend/src/hooks/use-setup-one-click-mutation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { oneClickSetupSchema } from '@boutique/shared'
77

88
interface SetupOneClickMutationParams {
99
walletAddressUrl: string
10-
amount: number
10+
amount: number | string
1111
}
1212

1313
interface SetupOneClickMutationResponse {

packages/boutique/shared/src/validation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@ export const setupFinishSchema = finishOrderSchema.extend({
3434

3535
export const oneClickSetupSchema = z.object({
3636
walletAddressUrl: walletAddressUrlSchema,
37-
amount: z.number()
37+
amount: z
38+
.union([z.string(), z.number()])
39+
.refine((value) => !isNaN(Number(value)), {
40+
message: 'Must be a valid number'
41+
})
3842
})

packages/wallet/backend/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export class App {
277277
router.get('/grants/:id', isAuth, grantController.getById)
278278
router.delete('/grants/:id', isAuth, grantController.revoke)
279279
router.get(
280-
'/grant-interactions/:interactionId/:nonce',
280+
'/grant-interactions/:interactionId/:nonce/',
281281
isAuth,
282282
grantController.getByInteraction
283283
)

packages/wallet/backend/src/user/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class UserService implements IUserService {
156156
const boutiqueWallet = await this.walletAddressService.create({
157157
accountId: boutiqueInfo.defaultAccount.id,
158158
walletAddressName: 'boutique',
159-
publicName: 'Default Payment Pointer',
159+
publicName: 'Rafiki Boutique',
160160
userId: boutiqueInfo.createdUser.id,
161161
isWM: false
162162
})

packages/wallet/frontend/src/lib/api/grants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const createGrantsService = (): GrantsService => ({
121121
...(cookies ? { Cookie: cookies } : {})
122122
}
123123
})
124-
.json<GetGrantResult>()
124+
.json<GetGrantResponse>()
125125
return response
126126
} catch (error) {
127127
return getError(error, 'Unable to fetch grant request details.')

packages/wallet/frontend/src/pages/grant-interactions/index.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,21 @@ const GrantInteractionPage = ({
5858
width={500}
5959
height={150}
6060
/>
61-
<div className="mt-20 text-xl text-green">
62-
<span className="font-semibold">{client}</span> wants to access your
63-
wallet account and withdraw{' '}
64-
{access?.limits?.debitAmount?.formattedAmount}.
61+
<div className="mt-20 text-base">
62+
<div>
63+
<span className="font-semibold">{client}</span> is requesting access
64+
to make a payment on your behalf.
65+
</div>
66+
<div>
67+
Wallet Address client:{' '}
68+
<span className="font-semibold">{grant.client}</span>
69+
</div>
70+
<div>
71+
Total amount to debit:{' '}
72+
<span className="font-semibold">
73+
{access?.limits?.debitAmount?.formattedAmount}
74+
</span>
75+
</div>
6576
</div>
6677
<div className="mx-auto mt-10 flex w-full max-w-xl justify-evenly">
6778
<Button
@@ -97,8 +108,8 @@ const GrantInteractionPage = ({
97108
/>
98109
<div className="mt-20 text-xl text-green">
99110
The request from <span className="font-semibold">{client}</span> to
100-
access your wallet account and withdraw{' '}
101-
{access?.limits?.debitAmount?.formattedAmount} was previously
111+
make a payment on your behalf for the amount of
112+
{access?.limits?.debitAmount?.formattedAmount}, was previously
102113
processed.
103114
</div>
104115
<div className="mx-auto mt-10 flex w-full max-w-xl justify-evenly">

packages/wallet/frontend/src/pages/settings/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const AccountSettingsPage: NextPageWithLayout<AccountSettingsProps> = ({
2121
<SettingsTabs />
2222
<div className="flex w-full flex-col md:max-w-lg">
2323
<PersonalSettingsForm user={user} />
24-
{/* <Divider />
25-
<ChangePasswordForm /> */}
2624
</div>
2725
<SmallBubbles className="mt-10 block w-full md:hidden" />
2826
<Image

0 commit comments

Comments
 (0)