AW-46-changePaymentForm

This commit is contained in:
Денис Катаев 2024-04-25 14:35:13 +00:00 committed by Daniil Chemerkin
parent 04254c4a83
commit b51fc34b7f
2 changed files with 9 additions and 13 deletions

View File

@ -46,22 +46,16 @@ function PaymentModal({
useState<string>(""); useState<string>("");
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [isError, setIsError] = useState<boolean>(false); const [isError, setIsError] = useState<boolean>(false);
const [isStripePaymentButtonEnabled, setIsStripePaymentButtonEnabled] =
useState<boolean>(false);
const paymentMethodsButtons = useMemo(() => { const paymentMethodsButtons = useMemo(() => {
if (!isStripePaymentButtonEnabled) { // return paymentMethods.filter(
return paymentMethods.filter( // (method) => method.id !== EPaymentMethod.PAYMENT_BUTTONS
(method) => method.id !== EPaymentMethod.PAYMENT_BUTTONS // );
);
}
return paymentMethods; return paymentMethods;
}, [isStripePaymentButtonEnabled]); }, []);
const [selectedPaymentMethod, setSelectedPaymentMethod] = useState( const [selectedPaymentMethod, setSelectedPaymentMethod] = useState(
isStripePaymentButtonEnabled EPaymentMethod.PAYMENT_BUTTONS
? EPaymentMethod.PAYMENT_BUTTONS
: EPaymentMethod.CREDIT_CARD
); );
const onSelectPaymentMethod = (method: EPaymentMethod) => { const onSelectPaymentMethod = (method: EPaymentMethod) => {
@ -170,7 +164,6 @@ function PaymentModal({
client_secret={clientSecret} client_secret={clientSecret}
subscriptionReceiptId={subscriptionReceiptId} subscriptionReceiptId={subscriptionReceiptId}
returnUrl={window.location.href} returnUrl={window.location.href}
setCanMakePayment={setIsStripePaymentButtonEnabled}
/> />
</div> </div>
)} )}

View File

@ -24,6 +24,9 @@
.payment-method-container { .payment-method-container {
width: 100%; width: 100%;
display: flex;
flex-direction: column;
gap: 24px;
} }
.address { .address {
@ -41,4 +44,4 @@
.address { .address {
color: gray; color: gray;
font-size: 10px; font-size: 10px;
} }