From ae7d44ea84795be4645f16b62ff6c0e59d56bda1 Mon Sep 17 00:00:00 2001 From: Peter NDENGO Date: Fri, 29 Sep 2023 10:57:08 +0100 Subject: [PATCH 01/14] Fix some issues --- components/atoms/MenuHolder/index.jsx | 4 +- components/molecules/Navbar/Drawer.js | 49 +++++++++++-------- .../molecules/OnboardingScreen/index.jsx | 6 +-- i18n.js | 2 +- utils/constants.js | 42 +++++++++------- 5 files changed, 57 insertions(+), 46 deletions(-) diff --git a/components/atoms/MenuHolder/index.jsx b/components/atoms/MenuHolder/index.jsx index 436f2144..e9e8c951 100644 --- a/components/atoms/MenuHolder/index.jsx +++ b/components/atoms/MenuHolder/index.jsx @@ -43,10 +43,10 @@ export default function MenuHolder({ href, label }) { -
  • +
  • - diff --git a/components/molecules/Navbar/Drawer.js b/components/molecules/Navbar/Drawer.js index b0f83d7c..e624c0ed 100644 --- a/components/molecules/Navbar/Drawer.js +++ b/components/molecules/Navbar/Drawer.js @@ -10,6 +10,7 @@ import { useMutation } from 'react-query'; import { sendMessage } from '../../../lib/helper'; import LoadingButton from '../../atoms/Loader/LoadingButton'; import Image from 'next/image'; +import Link from 'next/link'; export default function Drawer() { const [personalChat, setPersonalChat] = useState({ state: true }); @@ -127,28 +128,34 @@ function Conversation({ return (
    -
    - -
    - -

    - Odette de WiiQare{' '} - - -   - {' '} - En ligne - -

    +
    +
    + +
    + +

    + Odette de WiiQare{' '} + + +   + {' '} + En ligne + +

    +
    + + + Whatsapp logo +
    {isLoading ? ( diff --git a/components/molecules/OnboardingScreen/index.jsx b/components/molecules/OnboardingScreen/index.jsx index f8159237..0208cebc 100644 --- a/components/molecules/OnboardingScreen/index.jsx +++ b/components/molecules/OnboardingScreen/index.jsx @@ -17,10 +17,10 @@ const OnboardingScreen = ({ onStartClick }) => ( ...ONBOARDING_SLIDES, { img: '/images/Easy-payment-scan-QR-code.png', - title: 'Making a payment is ABC simple', - subtitle: 'To make a payment, simply scan a QR code.', + title: 'Faire un paiement est un ABC simple', + subtitle: 'Pour effectuer un paiement, Scannez simplement un QR Code', button: { - label: 'Get Started', + label: 'Commencez Maintenant', onClick: onStartClick, }, }, diff --git a/i18n.js b/i18n.js index 82222f68..6d3912eb 100644 --- a/i18n.js +++ b/i18n.js @@ -30,7 +30,7 @@ i18n buttons: { submit: 'SIGN IN', page: 'Register Now', - waiting: 'Wait a moment...', + waiting: 'En cours...', or: 'OR', google: 'Sign In with Google', linkedin: 'Sign In with LinkedIn', diff --git a/utils/constants.js b/utils/constants.js index 20af8562..72de54f5 100644 --- a/utils/constants.js +++ b/utils/constants.js @@ -2,27 +2,27 @@ export const LOGIN_SLIDES = [ { img: '/images/hospital-bed-.png', title: - 'Access to healthcare is one of the biggest challenges in Africa.', - subtitle: 'WiiQare empowers you to keep aside money in case you’re sick.', + 'L’accès aux soins de santé est l’un des plus grands défis en Afrique.', + subtitle: 'WiiQare vous permet de garder de l\'argent de côté au cas où vous seriez malade.', }, { img: '/images/WiiQare-is-secured.png', - title: 'Easy to create a secure account', - subtitle: 'Creating an account is simple and straightforward.', + title: 'Facile à créer un compte sécurisé', + subtitle: 'Créer un compte est simple et direct.', }, { img: '/images/set-your-savings- .png', title: - 'Define your saving goal and set aside money for your health', + 'Définissez votre objectif d’épargne et mettez de l’argent de côté pour votre santé', subtitle: - 'Decide how much you want to save for health, and we will help you achieve your goal.', + 'Décidez combien vous souhaitez épargner pour la santé et nous vous aiderons à atteindre votre objectif.', }, { img: '/images/Easy-payment-scan-QR-code.png', - title: 'Making a payment is ABC simple', - subtitle: 'To make a payment, simply scan a QR code.', + title: 'Faire un paiement est un ABC simple', + subtitle: 'Pour effectuer un paiement, scannez simplement un code QR.', button: { - label: 'Get Started', + label: 'Commencez Maintenant', onClick: () => null, }, }, @@ -32,14 +32,18 @@ export const REGISTER_SLIDES = [ { img: '/images/set-your-savings- .png', title: - 'Define your saving goal and set aside money for your health ', + 'Définissez votre objectif d’épargne et mettez de l’argent de côté pour votre santé', subtitle: - 'Decide how much you want to save for health, and we will help you achieve your goal.', + 'Décidez combien vous souhaitez épargner pour la santé et nous vous aiderons à atteindre votre objectif.', }, { img: '/images/Easy-payment-scan-QR-code.png', - title: 'Making a payment is ABC simple', - subtitle: 'To make a payment, simply scan a QR code.', + title: 'Faire un paiement est un ABC simple', + subtitle: 'Pour effectuer un paiement, scannez simplement un code QR.', + button: { + label: 'Commencez Maintenant', + onClick: () => null, + }, }, ]; @@ -47,19 +51,19 @@ export const ONBOARDING_SLIDES = [ { img: '/images/hospital-bed-.png', title: - 'Access to healthcare is one of the biggest challenges in Africa.', - subtitle: 'WiiQare empowers you to keep aside money in case you’re sick.', + 'L’accès aux soins de santé est l’un des plus grands défis en Afrique.', + subtitle: 'WiiQare vous permet de garder de l\'argent de côté au cas où vous seriez malade.', }, { img: '/images/WiiQare-is-secured.png', - title: 'Easy to create a secure account', - subtitle: 'Creating an account is simple and straightforward.', + title: 'Facile à créer un compte sécurisé', + subtitle: 'Créer un compte est simple et direct.', }, { img: '/images/set-your-savings- .png', title: - 'Define your saving goal and set aside money for your health', + 'Définissez votre objectif d’épargne et mettez de l’argent de côté pour votre santé', subtitle: - 'Decide how much you want to save for health, and we will help you achieve your goal.', + 'Décidez combien vous souhaitez épargner pour la santé et nous vous aiderons à atteindre votre objectif.', }, ]; From efa5541e583340ff4933341562ccb19e265e7f64 Mon Sep 17 00:00:00 2001 From: Peter NDENGO Date: Fri, 29 Sep 2023 11:26:41 +0100 Subject: [PATCH 02/14] Fix some issues --- .env | 2 +- components/organisms/Transaction/quickly.js | 30 +++++++++------------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.env b/.env index 4b601bd2..191397fd 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ NEXT_PUBLIC_API_URL="https://api.wiiqare.com" CALLBACK_URL="https://app.wiiqare.com" -NEXTAUTH_URL=https://app.wiiqare.com +NEXTAUTH_URL=http://localhost:3000 NEXT_PUBLIC_GOOGLE_CLIENT_ID=89089276805-85nh0ek1kac55o2t5lo0gn0jr77cppsb.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=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 diff --git a/components/organisms/Transaction/quickly.js b/components/organisms/Transaction/quickly.js index e6b7a145..99ef07fa 100644 --- a/components/organisms/Transaction/quickly.js +++ b/components/organisms/Transaction/quickly.js @@ -25,25 +25,24 @@ const Quickly = () => { console.log('quickly', data); return ( <> -
    -
    + +
    +

    Envoyer un pass santé

    -
    +

    Pass santé Envoyer

    -
    -
    -
    +

    @@ -62,13 +61,11 @@ const Quickly = () => {

    ) : data.length == 0 ? (
    - Box image Aucune bénéficiaire actuellement... @@ -115,9 +112,8 @@ const Quickly = () => { alt="Home" /> @@ -180,7 +176,7 @@ const Quickly = () => { )}
    -
    +

    @@ -201,13 +197,11 @@ const Quickly = () => {

    ) : transaction?.transaction?.length == 0 ? (
    - Box image Aucune transaction réalisé actuellement... From ae25ecfd49d7579a66061eae422a6085b6d17dac Mon Sep 17 00:00:00 2001 From: Peter NDENGO Date: Fri, 29 Sep 2023 11:27:08 +0100 Subject: [PATCH 03/14] Link to .env --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 191397fd..4b601bd2 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ NEXT_PUBLIC_API_URL="https://api.wiiqare.com" CALLBACK_URL="https://app.wiiqare.com" -NEXTAUTH_URL=http://localhost:3000 +NEXTAUTH_URL=https://app.wiiqare.com NEXT_PUBLIC_GOOGLE_CLIENT_ID=89089276805-85nh0ek1kac55o2t5lo0gn0jr77cppsb.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=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 From 93129a90dc75ad572dcb59ffe1e8593efc21d12e Mon Sep 17 00:00:00 2001 From: Peter NDENGO Date: Mon, 2 Oct 2023 13:50:09 +0100 Subject: [PATCH 04/14] Fix last part for send voucher --- components/atoms/Stepper/Forms/send.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/components/atoms/Stepper/Forms/send.js b/components/atoms/Stepper/Forms/send.js index b21cfeed..07128d0b 100644 --- a/components/atoms/Stepper/Forms/send.js +++ b/components/atoms/Stepper/Forms/send.js @@ -39,7 +39,7 @@ function Send() { const handleView = async () => { setLoadView(true); let response = await fetch( - `${process.env.NEXT_PUBLIC_BASE_URL}/api/v1/payment/voucher?paymentId=${payment_intent}`, + `${process.env.NEXT_PUBLIC_API_URL}/api/v1/payment/voucher?paymentId=${payment_intent}`, ); setLoadView(false); @@ -402,9 +402,8 @@ function Send() {
    @@ -415,9 +414,8 @@ function Send() { @@ -432,9 +430,8 @@ function Send() { @@ -445,9 +442,8 @@ function Send() { { setCopyLink(true); setTimeout(() => { From e9648362696e6aa8203a9760e5a4b6732aa77306 Mon Sep 17 00:00:00 2001 From: Peter NDENGO Date: Wed, 4 Oct 2023 13:03:12 +0100 Subject: [PATCH 05/14] Test when Scan Face Miss match --- components/atoms/Stepper/Forms/kyc.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/components/atoms/Stepper/Forms/kyc.js b/components/atoms/Stepper/Forms/kyc.js index 3dbb39a8..d1f94008 100644 --- a/components/atoms/Stepper/Forms/kyc.js +++ b/components/atoms/Stepper/Forms/kyc.js @@ -18,6 +18,7 @@ import { CurrencyFlag } from 'react-currency-flags/dist/components'; function KYC() { const [statusID, setStatusID] = useState('IN_PROGRESS'); + const [resultKYC, setResultKYC] = useState(null); const { activeStepIndex, setActiveStepIndex, @@ -46,7 +47,13 @@ function KYC() { if (data.status != 'FINISHED') { setTimeout(checkStatus, 8000); } else { - setKycTest(false); + console.log(data.result.identity.status != "FAILED"); + setStatusID("FINISHED") + if (data.result.identity.status != "FAILED") { + setKycTest(false) + } else { + setResultKYC(data.result) + } } }) .catch((e) => setTimeout(checkStatus, 8000)); @@ -88,7 +95,16 @@ function KYC() { {statusID != 'FINISHED' ? ( <>{'Identity vérification failed'} ) : ( - '' + <> + { + resultKYC?.identity?.status == "FAILED" ? ( +
    + Mismatch + {resultKYC?.identity?.errors.toString()} +
    + ) : '' + } + )} )} From b76501ebe574e97a1ecab246fa08301e8f5d3f69 Mon Sep 17 00:00:00 2001 From: Peter NDENGO Date: Fri, 6 Oct 2023 10:49:46 +0100 Subject: [PATCH 06/14] Fix all Snapshot and finished module KYC --- components/atoms/Stepper/Forms/identity2.js | 18 ++-- components/atoms/Stepper/Forms/kyc.js | 20 +++- components/atoms/Stepper/Forms/send.js | 24 ++--- components/atoms/Tab/ItemHistory.js | 57 +++++------ components/molecules/Navbar/Drawer/List.js | 2 +- .../Drawer/__snapshots__/List.test.js.snap | 6 +- .../Drawer/__snapshots__/index.test.js.snap | 6 +- .../Navbar/__snapshots__/Drawer.test.js.snap | 96 +++++++++++-------- .../Auth/Forms/__snapshots__/otp.test.js.snap | 4 +- .../__snapshots__/ForgotForm.test.js.snap | 2 +- .../Auth/__snapshots__/LoginForm.test.js.snap | 2 +- .../Auth/__snapshots__/ResetForm.test.js.snap | 2 +- components/organisms/Transaction/quickly.js | 2 +- lib/helper.js | 53 ++++++++++ next.config.js | 1 + pages/voucher/pass/[pass].js | 4 +- tests/pages/__snapshots__/login.test.js.snap | 26 ++--- .../pages/__snapshots__/register.test.js.snap | 35 +++++-- .../__snapshots__/password.test.js.snap | 26 ++--- .../__snapshots__/[token].test.js.snap | 26 ++--- .../__snapshots__/index.test.js.snap | 14 +-- 21 files changed, 256 insertions(+), 170 deletions(-) diff --git a/components/atoms/Stepper/Forms/identity2.js b/components/atoms/Stepper/Forms/identity2.js index 956b740c..0d168254 100644 --- a/components/atoms/Stepper/Forms/identity2.js +++ b/components/atoms/Stepper/Forms/identity2.js @@ -282,7 +282,7 @@ function Identity2() { onClick={() => handleSelect(item, index)} >
    - Beneficiare image @@ -401,9 +400,9 @@ function Identity2() { name="phoneNumber" /> {formik.values.phoneNumber.trim(' ') == '' || - formik.values.phoneNumber - .replace('+' + dial, ' ') - .trim(' ') == '' ? ( + formik.values.phoneNumber + .replace('+' + dial, ' ') + .trim(' ') == '' ? ( renderError('Entrez le numéro de téléphone') ) : ( <> @@ -412,11 +411,10 @@ function Identity2() { diff --git a/components/atoms/Stepper/Forms/kyc.js b/components/atoms/Stepper/Forms/kyc.js index d1f94008..2c2b9861 100644 --- a/components/atoms/Stepper/Forms/kyc.js +++ b/components/atoms/Stepper/Forms/kyc.js @@ -10,7 +10,7 @@ import { HiExclamation, HiLockClosed, HiOutlineEye } from 'react-icons/hi'; import { useRouter } from 'next/router'; import LoadingButton from '../../Loader/LoadingButton'; import { useMutation } from 'react-query'; -import { sendSMSHash } from '../../../../lib/helper'; +import { checkKyc, sendSMSHash, setKyc } from '../../../../lib/helper'; import { useFormik } from 'formik'; import { useSession } from 'next-auth/react'; import Toast from '../../Toast'; @@ -27,6 +27,7 @@ function KYC() { kycTest, setKycTest, } = useContext(FormContext); + const { data: session } = useSession(); const router = useRouter(); const checkStatus = async () => { @@ -47,9 +48,10 @@ function KYC() { if (data.status != 'FINISHED') { setTimeout(checkStatus, 8000); } else { - console.log(data.result.identity.status != "FAILED"); + console.log(data); setStatusID("FINISHED") if (data.result.identity.status != "FAILED") { + setKyc({ accessToken: session.accessToken, expire: "2023/05", cardID: "ABCD", birthday: "1990-01-01", kyc: true }) setKycTest(false) } else { setResultKYC(data.result) @@ -63,7 +65,7 @@ function KYC() { } }; - useEffect(() => { + const conversation = () => { if (!router.query.conversation) { fetch('/api/authologic', { method: 'POST', @@ -80,6 +82,18 @@ function KYC() { } else { checkStatus(); } + } + + useEffect(() => { + checkKyc({ accessToken: session.accessToken }).then((data) => { + if (data) { + setKycTest(false) + } else { + conversation() + } + }).catch((error) => conversation()) + + }, []); return ( diff --git a/components/atoms/Stepper/Forms/send.js b/components/atoms/Stepper/Forms/send.js index 07128d0b..a8e5ff60 100644 --- a/components/atoms/Stepper/Forms/send.js +++ b/components/atoms/Stepper/Forms/send.js @@ -204,12 +204,12 @@ function Send() {
    - Image Description - Image Description - + WhatsApp @@ -261,7 +261,7 @@ function Send() { target={'_blank'} > - - + {sendSMSMutation.isLoading ? ( ) : ( @@ -295,7 +295,7 @@ function Send() { type="button" className="text-gray-900 bg-white hover:bg-gray-100 border border-gray-200 focus:ring-4 focus:outline-none focus:ring-gray-100 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center gap-2 mr-2 mb-2" > - + {!copyLink ? 'Copier le lien' : 'Copié avec succès'} @@ -370,12 +370,12 @@ function Send() {
    - Image Description - Image Description - + WhatsApp @@ -420,7 +420,7 @@ function Send() { target={'_blank'} > - - + Message @@ -455,7 +455,7 @@ function Send() { type="button" className="text-gray-900 bg-white hover:bg-gray-100 border border-gray-200 focus:ring-4 focus:outline-none focus:ring-gray-100 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center gap-2 mr-2 mb-2" > - + {!copyLink ? 'Copy Link' : 'Successfully Copied'} diff --git a/components/atoms/Tab/ItemHistory.js b/components/atoms/Tab/ItemHistory.js index 183039b9..6eb165f7 100644 --- a/components/atoms/Tab/ItemHistory.js +++ b/components/atoms/Tab/ItemHistory.js @@ -103,17 +103,15 @@ const ItemHistory = ({ return (
    index + 1 ? 'border-b py-3' : '' - } collapse collapse-arrow text-gray-700 overflow-scroll md:overflow-hidden`} + className={`${total > index + 1 ? 'border-b py-3' : '' + } collapse collapse-arrow text-gray-700 overflow-scroll md:overflow-hidden`} >
  • diff --git a/components/molecules/Navbar/Drawer/List.js b/components/molecules/Navbar/Drawer/List.js index 1adfc802..258712af 100644 --- a/components/molecules/Navbar/Drawer/List.js +++ b/components/molecules/Navbar/Drawer/List.js @@ -42,7 +42,7 @@ const ListChat = () => {
    - Avatar
    diff --git a/components/molecules/Navbar/Drawer/__snapshots__/index.test.js.snap b/components/molecules/Navbar/Drawer/__snapshots__/index.test.js.snap index f06648e9..d0a8a454 100644 --- a/components/molecules/Navbar/Drawer/__snapshots__/index.test.js.snap +++ b/components/molecules/Navbar/Drawer/__snapshots__/index.test.js.snap @@ -77,13 +77,9 @@ exports[`Drawer should render the component 1`] = ` Avatar
    diff --git a/components/molecules/Navbar/__snapshots__/Drawer.test.js.snap b/components/molecules/Navbar/__snapshots__/Drawer.test.js.snap index 900c12fd..55419f78 100644 --- a/components/molecules/Navbar/__snapshots__/Drawer.test.js.snap +++ b/components/molecules/Navbar/__snapshots__/Drawer.test.js.snap @@ -24,56 +24,70 @@ exports[`Drawer should render the component 1`] = ` class="flex flex-col bg-gray-100 flex-auto md:w-96 w-full h-full relative" >
    -
    - -

    + + + + +
    - Odette de WiiQare - - +

    + Odette de WiiQare + -   + +   + + + En ligne - - En ligne - -

    +

    +
    +
    + Whatsapp logo +
    - 02 + 01 : - 00 + 58
    diff --git a/components/organisms/Auth/__snapshots__/ForgotForm.test.js.snap b/components/organisms/Auth/__snapshots__/ForgotForm.test.js.snap index 7acafc35..560c3a59 100644 --- a/components/organisms/Auth/__snapshots__/ForgotForm.test.js.snap +++ b/components/organisms/Auth/__snapshots__/ForgotForm.test.js.snap @@ -90,7 +90,7 @@ exports[`ForgotForm renders 1`] = ` href="/register" > + + @@ -238,7 +261,7 @@ exports[`register page should render empty page when fetch fails 1`] = ` href="/login" >