• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atlp-rwanda / hackers-ec-Fe / #1136

23 Jul 2024 01:45PM UTC coverage: 92.72% (-0.004%) from 92.724%
#1136

Pull #44

Angemichel12
feat:(stripe payment): implementation of stripe payment 187419028
Pull Request #44: #187419028 implementation of stripe payment API

753 of 926 branches covered (81.32%)

Branch coverage included in aggregate %.

342 of 357 new or added lines in 8 files covered. (95.8%)

3 existing lines in 2 files now uncovered.

8634 of 9198 relevant lines covered (93.87%)

15.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.15
/src/components/payment/PaymentToggleModel.tsx
1
import { useEffect } from 'react';
1✔
2
import momoIcon from '../../assets/momo.png';
1✔
3
import PaymentButton from '../buttons/PaymentButton';
1✔
4
import { useAppSelector, useAppDispatch } from '../../redux/hooks/hooks';
1✔
5
import { stripePayment } from '../../redux/features/StripePaymentSlice';
1✔
6
import stripeIcon from '../../assets/stripe icon.png';
1✔
7
import cancel from '../../assets/cancel.png';
1✔
8
import { payModel } from '../../redux/features/toggleSlice';
1✔
9
import useToast from '../../hooks/useToast';
1✔
10

1✔
11
function PaymentToggleModel() {
2✔
12
        const { data, isLoading, error } = useAppSelector((state) => state.stripe);
2✔
13
        const paymentToggleModel = (): boolean => {
2✔
14
                dispatch(payModel());
1✔
15
                return true;
1✔
16
        };
1✔
17
        const { showErrorMessage } = useToast();
2✔
18
        const dispatch = useAppDispatch();
2✔
19
        useEffect(() => {
2✔
20
                if (!data) {
2!
NEW
21
                        dispatch(stripePayment()).unwrap();
×
NEW
22
                }
×
23
        }, [data, dispatch]);
2✔
24
        if (error) {
2!
NEW
25
                showErrorMessage(error);
×
NEW
26
        }
×
27
        const handleStripePayment = () => {
2✔
NEW
28
                const url: string = data?.data.sessionUrl || '';
×
NEW
29
                window.location.href = url;
×
NEW
30
        };
×
31
        return (
2✔
32
                <div className="flex fixed bg-neutral-grey justify-center items-center bg-fixed bg-opacity-[0.8] w-screen h-screen z-50">
2✔
33
                        <div className="w-[90%] tablet:w-[60%] h-[50%] rounded-[2rem] shadow-bottom-left-right bg-neutral-white opacity-1 flex justify-around items-center flex-col tablet:py-12">
2✔
34
                                <h1 className="text-xl font-semibold">Continue payment with:</h1>
2✔
35
                                <PaymentButton
2✔
36
                                        bgColor="bg-action-warning text-neutral-white"
2✔
37
                                        icon={momoIcon}
2✔
38
                                        title="Mobile Money"
2✔
39
                                />
2✔
40
                                <PaymentButton
2✔
41
                                        handlePayment={handleStripePayment}
2✔
42
                                        bgColor="bg-[#6A39BA] text-neutral-white"
2✔
43
                                        icon={stripeIcon}
2✔
44
                                        title="Stripe"
2✔
45
                                        disable={isLoading}
2✔
46
                                />
2✔
47
                                <PaymentButton
2✔
48
                                        handlePayment={paymentToggleModel}
2✔
49
                                        bgColor="bg-neutral-white"
2✔
50
                                        icon={cancel}
2✔
51
                                        title="Cancel"
2✔
52
                                        iconSize="w-[1rem]"
2✔
53
                                />
2✔
54
                        </div>
2✔
55
                </div>
2✔
56
        );
2✔
57
}
2✔
58

1✔
59
export default PaymentToggleModel;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc