Merge branch 'dev' into 'staging'
Dev See merge request frontend/marketplace!146
BIN
src/assets/bank-logo/b2b.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.6 KiB |
BIN
src/assets/bank-logo/sberpay.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
src/assets/bank-logo/spb.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
src/assets/bank-logo/umaney.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
@ -1,4 +1,4 @@
|
|||||||
import { useState, forwardRef } from "react";
|
import { useState, useEffect, forwardRef } from "react";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Fab,
|
Fab,
|
||||||
@ -38,6 +38,7 @@ const Transition = forwardRef(function Transition(
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default function FloatingSupportChat() {
|
export default function FloatingSupportChat() {
|
||||||
|
const [monitorType, setMonitorType] = useState<"desktop" | "mobile" | "">("");
|
||||||
const [isChatOpened, setIsChatOpened] = useState<boolean>(false);
|
const [isChatOpened, setIsChatOpened] = useState<boolean>(false);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(800));
|
const isMobile = useMediaQuery(theme.breakpoints.down(800));
|
||||||
@ -71,6 +72,24 @@ export default function FloatingSupportChat() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const onResize = () => {
|
||||||
|
if (document.fullscreenElement) {
|
||||||
|
setMonitorType(isMobile ? "mobile" : "desktop");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMonitorType("");
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("resize", onResize);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("resize", onResize);
|
||||||
|
};
|
||||||
|
}, [isMobile]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -85,17 +104,17 @@ export default function FloatingSupportChat() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Chat
|
<Chat
|
||||||
open={isChatOpened && !isMobile}
|
open={isChatOpened && (monitorType === "desktop" || !isMobile)}
|
||||||
sx={{ alignSelf: "start", width: "clamp(200px, 100%, 400px)" }}
|
sx={{ alignSelf: "start", width: "clamp(200px, 100%, 400px)" }}
|
||||||
/>
|
/>
|
||||||
<Dialog
|
<Dialog
|
||||||
fullScreen
|
fullScreen
|
||||||
open={isChatOpened && isMobile}
|
open={isChatOpened && (monitorType === "mobile" || isMobile)}
|
||||||
onClose={() => setIsChatOpened(false)}
|
onClose={() => setIsChatOpened(false)}
|
||||||
TransitionComponent={Transition}
|
TransitionComponent={Transition}
|
||||||
>
|
>
|
||||||
<Chat
|
<Chat
|
||||||
open={isChatOpened && isMobile}
|
open={isChatOpened && (monitorType === "mobile" || isMobile)}
|
||||||
onclickArrow={() => setIsChatOpened(false)}
|
onclickArrow={() => setIsChatOpened(false)}
|
||||||
/>
|
/>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export interface SendPaymentRequest {
|
export interface SendPaymentRequest {
|
||||||
type: "bankCard";
|
type: string;
|
||||||
currency: string;
|
currency: string;
|
||||||
amount: number;
|
amount: number;
|
||||||
bankCard: {
|
bankCard: {
|
||||||
|
@ -9,10 +9,10 @@ import {
|
|||||||
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
||||||
import SectionWrapper from "@components/SectionWrapper";
|
import SectionWrapper from "@components/SectionWrapper";
|
||||||
import PaymentMethodCard from "./PaymentMethodCard";
|
import PaymentMethodCard from "./PaymentMethodCard";
|
||||||
import mastercardLogo from "@root/assets/bank-logo/logo-mastercard.png";
|
import umoneyLogo from "@root/assets/bank-logo/umaney.png";
|
||||||
import visaLogo from "@root/assets/bank-logo/logo-visa.png";
|
import b2bLogo from "@root/assets/bank-logo/b2b.png";
|
||||||
import qiwiLogo from "@root/assets/bank-logo/logo-qiwi.png";
|
import spbLogo from "@root/assets/bank-logo/spb.png";
|
||||||
import mirLogo from "@root/assets/bank-logo/logo-mir.png";
|
import sberpayLogo from "@root/assets/bank-logo/sberpay.png";
|
||||||
import tinkoffLogo from "@root/assets/bank-logo/logo-tinkoff.png";
|
import tinkoffLogo from "@root/assets/bank-logo/logo-tinkoff.png";
|
||||||
import rsPayLogo from "@root/assets/bank-logo/rs-pay.png";
|
import rsPayLogo from "@root/assets/bank-logo/rs-pay.png";
|
||||||
import { cardShadow } from "@root/utils/theme";
|
import { cardShadow } from "@root/utils/theme";
|
||||||
@ -37,11 +37,11 @@ type PaymentMethod = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const paymentMethods: PaymentMethod[] = [
|
const paymentMethods: PaymentMethod[] = [
|
||||||
{ label: "Mastercard", name: "mastercard", image: mastercardLogo },
|
{ label: "Тинькофф", name: "tinkoffBank", image: tinkoffLogo },
|
||||||
{ label: "Visa", name: "visa", image: visaLogo },
|
{ label: "СБП", name: "sbp", image: spbLogo },
|
||||||
{ label: "QIWI Кошелек", name: "qiwi", image: qiwiLogo },
|
{ label: "SberPay", name: "sberbank", image: sberpayLogo },
|
||||||
{ label: "Мир", name: "mir", image: mirLogo },
|
{ label: "B2B Сбербанк", name: "b2bSperbank", image: b2bLogo },
|
||||||
{ label: "Тинькофф", name: "tinkoff", image: tinkoffLogo },
|
{ label: "ЮMoney", name: "yoomoney", image: umoneyLogo },
|
||||||
];
|
];
|
||||||
|
|
||||||
type PaymentMethodType = (typeof paymentMethods)[number]["name"];
|
type PaymentMethodType = (typeof paymentMethods)[number]["name"];
|
||||||
@ -53,7 +53,7 @@ export default function Payment() {
|
|||||||
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
||||||
|
|
||||||
const [selectedPaymentMethod, setSelectedPaymentMethod] =
|
const [selectedPaymentMethod, setSelectedPaymentMethod] =
|
||||||
useState<PaymentMethodType | null>("rspay");
|
useState<PaymentMethodType | null>("");
|
||||||
const [warnModalOpen, setWarnModalOpen] = useState<boolean>(false);
|
const [warnModalOpen, setWarnModalOpen] = useState<boolean>(false);
|
||||||
const [sorryModalOpen, setSorryModalOpen] = useState<boolean>(false);
|
const [sorryModalOpen, setSorryModalOpen] = useState<boolean>(false);
|
||||||
const [paymentValueField, setPaymentValueField] = useState<string>("0");
|
const [paymentValueField, setPaymentValueField] = useState<string>("0");
|
||||||
@ -96,8 +96,49 @@ export default function Payment() {
|
|||||||
if (selectedPaymentMethod !== "rspay") {
|
if (selectedPaymentMethod !== "rspay") {
|
||||||
const [sendPaymentResponse, sendPaymentError] = await sendPayment({
|
const [sendPaymentResponse, sendPaymentError] = await sendPayment({
|
||||||
fromSquiz,
|
fromSquiz,
|
||||||
|
body: {
|
||||||
|
type: selectedPaymentMethod,
|
||||||
|
amount: Number(paymentValueField),
|
||||||
|
currency: "RUB",
|
||||||
|
bankCard: {
|
||||||
|
number: "RUB",
|
||||||
|
expiryYear: "2021",
|
||||||
|
expiryMonth: "05",
|
||||||
|
csc: "05",
|
||||||
|
cardholder: "IVAN IVANOV",
|
||||||
|
},
|
||||||
|
phoneNumber: "79000000000",
|
||||||
|
login: "login_test",
|
||||||
|
returnUrl: window.location.origin + "/wallet",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (selectedPaymentMethod === "rspay") {
|
||||||
|
if (verificationStatus !== VerificationStatus.VERIFICATED) {
|
||||||
|
setWarnModalOpen(true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(paymentValueField)
|
||||||
|
if (Number(paymentValueField) < 900){
|
||||||
|
enqueueSnackbar("Минимальная сумма 900р")
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendRSPaymentError = await sendRSPayment(Number(paymentValueField));
|
||||||
|
|
||||||
|
if (sendRSPaymentError) {
|
||||||
|
return enqueueSnackbar(sendRSPaymentError);
|
||||||
|
}
|
||||||
|
|
||||||
|
enqueueSnackbar(
|
||||||
|
"Cпасибо за заявку, в течении 24 часов вам будет выставлен счёт для оплаты услуг."
|
||||||
|
);
|
||||||
|
|
||||||
|
navigate("/settings");
|
||||||
|
}
|
||||||
|
|
||||||
if (sendPaymentError) {
|
if (sendPaymentError) {
|
||||||
return enqueueSnackbar(sendPaymentError);
|
return enqueueSnackbar(sendPaymentError);
|
||||||
}
|
}
|
||||||
@ -172,10 +213,9 @@ export default function Payment() {
|
|||||||
label={label}
|
label={label}
|
||||||
image={image}
|
image={image}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSorryModalOpen(true)
|
setSelectedPaymentMethod(name)
|
||||||
// setSelectedPaymentMethod(name)
|
|
||||||
}}
|
}}
|
||||||
unpopular={true}
|
unpopular={false}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<PaymentMethodCard
|
<PaymentMethodCard
|
||||||
@ -183,30 +223,7 @@ export default function Payment() {
|
|||||||
label={"Расчётный счёт"}
|
label={"Расчётный счёт"}
|
||||||
image={rsPayLogo}
|
image={rsPayLogo}
|
||||||
onClick={async() => {
|
onClick={async() => {
|
||||||
|
setSelectedPaymentMethod("rspay")
|
||||||
if (verificationStatus !== VerificationStatus.VERIFICATED) {
|
|
||||||
setWarnModalOpen(true);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log(paymentValueField)
|
|
||||||
if (Number(paymentValueField) < 900){
|
|
||||||
enqueueSnackbar("Минимальная сумма 900р")
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const sendRSPaymentError = await sendRSPayment(Number(paymentValueField));
|
|
||||||
|
|
||||||
if (sendRSPaymentError) {
|
|
||||||
return enqueueSnackbar(sendRSPaymentError);
|
|
||||||
}
|
|
||||||
|
|
||||||
enqueueSnackbar(
|
|
||||||
"Cпасибо за заявку, в течении 24 часов вам будет выставлен счёт для оплаты услуг."
|
|
||||||
);
|
|
||||||
|
|
||||||
navigate("/settings");
|
|
||||||
}}
|
}}
|
||||||
unpopular={false}
|
unpopular={false}
|
||||||
/>
|
/>
|
||||||
@ -262,49 +279,7 @@ export default function Payment() {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<Button
|
{paymentLink ? (
|
||||||
variant="pena-outlined-light"
|
|
||||||
onClick={async () => {
|
|
||||||
|
|
||||||
|
|
||||||
if (verificationStatus !== VerificationStatus.VERIFICATED) {
|
|
||||||
setWarnModalOpen(true);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log(paymentValueField)
|
|
||||||
if (Number(paymentValueField) < 900){
|
|
||||||
enqueueSnackbar("Минимальная сумма 900р")
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const sendRSPaymentError = await sendRSPayment(Number(paymentValueField));
|
|
||||||
|
|
||||||
if (sendRSPaymentError) {
|
|
||||||
return enqueueSnackbar(sendRSPaymentError);
|
|
||||||
}
|
|
||||||
|
|
||||||
enqueueSnackbar(
|
|
||||||
"Cпасибо за заявку, в течении 24 часов вам будет выставлен счёт для оплаты услуг."
|
|
||||||
);
|
|
||||||
|
|
||||||
navigate("/settings");
|
|
||||||
|
|
||||||
}}
|
|
||||||
sx={{
|
|
||||||
mt: "auto",
|
|
||||||
color: "black",
|
|
||||||
border: `1px solid ${theme.palette.purple.main}`,
|
|
||||||
"&:hover": {
|
|
||||||
backgroundColor: theme.palette.purple.dark,
|
|
||||||
border: `1px solid ${theme.palette.purple.dark}`,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Оплатить
|
|
||||||
</Button>
|
|
||||||
{/* {paymentLink ? (
|
|
||||||
<Button
|
<Button
|
||||||
variant="pena-outlined-light"
|
variant="pena-outlined-light"
|
||||||
component="a"
|
component="a"
|
||||||
@ -340,7 +315,7 @@ export default function Payment() {
|
|||||||
>
|
>
|
||||||
Выбрать
|
Выбрать
|
||||||
</Button>
|
</Button>
|
||||||
)} */}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<WarnModal open={warnModalOpen} setOpen={setWarnModalOpen} />
|
<WarnModal open={warnModalOpen} setOpen={setWarnModalOpen} />
|
||||||
|