Merge branch 'payment-response' into 'staging'
Payment response See merge request frontend/marketplace!128
This commit is contained in:
commit
b2de52aa02
@ -49,12 +49,13 @@ export async function sendPayment({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sendRSPayment = async (): Promise<string | null> => {
|
export const sendRSPayment = async (money: number): Promise<string | null> => {
|
||||||
try {
|
try {
|
||||||
await makeRequest<never, string>({
|
await makeRequest<unknown, string>({
|
||||||
url: apiUrl + "/wallet/rspay",
|
url: apiUrl + "/wallet/rspay",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
useToken: true,
|
useToken: true,
|
||||||
|
body: {money: money},
|
||||||
withCredentials: false,
|
withCredentials: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ import Oferta from "@root/docs/content/oferta"
|
|||||||
import PrivacyPolicy from "@root/docs/content/PrivacyPolicy"
|
import PrivacyPolicy from "@root/docs/content/PrivacyPolicy"
|
||||||
import RecoverPassword from "@root/pages/auth/RecoverPassword"
|
import RecoverPassword from "@root/pages/auth/RecoverPassword"
|
||||||
import OutdatedLink from "@root/pages/auth/OutdatedLink"
|
import OutdatedLink from "@root/pages/auth/OutdatedLink"
|
||||||
|
import { verify } from "./pages/AccountSettings/helper"
|
||||||
|
|
||||||
pdfjs.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.js", import.meta.url).toString()
|
pdfjs.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.min.js", import.meta.url).toString()
|
||||||
|
|
||||||
@ -42,6 +43,7 @@ const App = () => {
|
|||||||
const userId = useUserStore((state) => state.userId)
|
const userId = useUserStore((state) => state.userId)
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
console.log(userId)
|
||||||
useUserFetcher({
|
useUserFetcher({
|
||||||
url: process.env.REACT_APP_DOMAIN + `/user/${userId}`,
|
url: process.env.REACT_APP_DOMAIN + `/user/${userId}`,
|
||||||
userId,
|
userId,
|
||||||
@ -71,6 +73,8 @@ const App = () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
verify(userId)
|
||||||
|
|
||||||
console.log(location)
|
console.log(location)
|
||||||
if (location.state?.redirectTo)
|
if (location.state?.redirectTo)
|
||||||
return <Navigate to={location.state.redirectTo} replace state={{ backgroundLocation: location }} />
|
return <Navigate to={location.state.redirectTo} replace state={{ backgroundLocation: location }} />
|
||||||
|
@ -30,9 +30,9 @@ function AccountSettings() {
|
|||||||
const comment = useUserStore((state) => state.comment)
|
const comment = useUserStore((state) => state.comment)
|
||||||
const userId = useUserStore((state) => state.userId) ?? ""
|
const userId = useUserStore((state) => state.userId) ?? ""
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
verify(userId)
|
// verify(userId)
|
||||||
}, [])
|
// }, [])
|
||||||
|
|
||||||
const textFieldProps = {
|
const textFieldProps = {
|
||||||
gap: upMd ? "16px" : "10px",
|
gap: upMd ? "16px" : "10px",
|
||||||
|
@ -44,7 +44,8 @@ const updateVerificationStatus = (verification: Verification) => {
|
|||||||
setVerificationStatus(VerificationStatus.NOT_VERIFICATED)
|
setVerificationStatus(VerificationStatus.NOT_VERIFICATED)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const verify = async (id: string) => {
|
export const verify = async (id: string | null) => {
|
||||||
|
if (id !== null && id.length > 0) {
|
||||||
const [verificationResult, verificationError] = await verification(id)
|
const [verificationResult, verificationError] = await verification(id)
|
||||||
|
|
||||||
if (verificationError) {
|
if (verificationError) {
|
||||||
@ -68,4 +69,6 @@ export const verify = async (id: string) => {
|
|||||||
|
|
||||||
devlog("User", verificationResult)
|
devlog("User", verificationResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,8 +185,14 @@ export default function Payment() {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log(paymentValueField)
|
||||||
|
if (Number(paymentValueField) < 900){
|
||||||
|
enqueueSnackbar("Минимальная сумма 900р")
|
||||||
|
|
||||||
const sendRSPaymentError = await sendRSPayment();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendRSPaymentError = await sendRSPayment(Number(paymentValueField));
|
||||||
|
|
||||||
if (sendRSPaymentError) {
|
if (sendRSPaymentError) {
|
||||||
return enqueueSnackbar(sendRSPaymentError);
|
return enqueueSnackbar(sendRSPaymentError);
|
||||||
|
Loading…
Reference in New Issue
Block a user