fix: Stripe payment integration

This commit is contained in:
Ahmed Bouhuolia
2024-09-23 13:21:54 +02:00
parent 9ba651decb
commit 8109236e72
19 changed files with 287 additions and 369 deletions

View File

@@ -2,7 +2,9 @@
import React from 'react';
import intl from 'react-intl-universal';
import styled from 'styled-components';
import { isEmpty } from 'lodash';
import { Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
import {
FFormGroup,
FEditableText,
@@ -18,6 +20,11 @@ import { PaymentOptionsButtonPopver } from '@/containers/PaymentMethods/SelectPa
export function InvoiceFormFooterLeft() {
const { paymentServices } = useInvoiceFormContext();
const history = useHistory();
const handleSetupPaymentsClick = () => {
history.push('/preferences/payment-methods');
};
return (
<Stack spacing={20}>
@@ -60,11 +67,22 @@ export function InvoiceFormFooterLeft() {
<VisaIcon />
<MastercardIcon />
</Group>
<PaymentOptionsButtonPopver paymentMethods={paymentServices}>
<PaymentOptionsButton intent={Intent.PRIMARY} small minimal>
Payment Options
{isEmpty(paymentServices) ? (
<PaymentOptionsButton
intent={Intent.PRIMARY}
onClick={handleSetupPaymentsClick}
small
minimal
>
Setup payment gateways
</PaymentOptionsButton>
</PaymentOptionsButtonPopver>
) : (
<PaymentOptionsButtonPopver paymentMethods={paymentServices}>
<PaymentOptionsButton intent={Intent.PRIMARY} small minimal>
Payment Options
</PaymentOptionsButton>
</PaymentOptionsButtonPopver>
)}
</PaymentOptionsText>
</PaymentOptionsFormGroup>
</Stack>