diff --git a/src/adapters/mochi-pay.ts b/src/adapters/mochi-pay.ts index 1399fc072..ef26eaa8c 100644 --- a/src/adapters/mochi-pay.ts +++ b/src/adapters/mochi-pay.ts @@ -257,15 +257,17 @@ class MochiPay extends Fetcher { async approveTransferRequest({ headers, + profileId, requestCode, appId = "1", }: { headers: Record + profileId: string requestCode: string appId?: string }) { return await this.jsonFetch( - `${MOCHI_PAY_API_BASE_URL}/applications/${appId}/requests/${requestCode}/approved`, + `${MOCHI_PAY_API_BASE_URL}/profiles/${profileId}/applications/${appId}/requests/${requestCode}/approved`, { method: "POST", headers, @@ -275,15 +277,17 @@ class MochiPay extends Fetcher { async rejectTransferRequest({ headers, + profileId, requestCode, appId = "1", }: { headers: Record + profileId: string requestCode: string appId?: string }) { return await this.jsonFetch( - `${MOCHI_PAY_API_BASE_URL}/applications/${appId}/requests/${requestCode}/rejected`, + `${MOCHI_PAY_API_BASE_URL}/profiles/${profileId}/applications/${appId}/requests/${requestCode}/rejected`, { method: "POST", headers, diff --git a/src/commands/transfer_request/index/processor.ts b/src/commands/transfer_request/index/processor.ts index e0e7f8053..160216f23 100644 --- a/src/commands/transfer_request/index/processor.ts +++ b/src/commands/transfer_request/index/processor.ts @@ -5,6 +5,7 @@ import * as ed25519 from "@noble/ed25519" import { sha512 } from "@noble/hashes/sha512" import { MOCHI_APP_PRIVATE_KEY } from "env" import { composeEmbedMessage, composeEmbedMessage2 } from "ui/discord/embed" +import { getProfileIdByDiscord } from "utils/profile" ed25519.etc.sha512Async = (...m) => Promise.resolve(sha512(ed25519.etc.concatBytes(...m))) @@ -29,9 +30,11 @@ export async function approveTransferReq(i: ButtonInteraction) { return } + const profileId = await getProfileIdByDiscord(i.user.id) const appHeaders = await getMochiApplicationHeaders() const { ok, status } = await mochiPay.approveTransferRequest({ headers: appHeaders, + profileId, appId, requestCode, }) @@ -56,9 +59,11 @@ export async function rejectTransferReq(i: ButtonInteraction) { return } + const profileId = await getProfileIdByDiscord(i.user.id) const appHeaders = await getMochiApplicationHeaders() const { ok, status } = await mochiPay.rejectTransferRequest({ headers: appHeaders, + profileId, appId, requestCode, })