checking added
This commit is contained in:
parent
27938f75da
commit
f9f330d7ee
|
|
@ -1,13 +1,13 @@
|
|||
// IMPORT MODULES
|
||||
import React, { useState, useContext } from 'react';
|
||||
import { LanguageContext } from '../../backend/LanguageContext';
|
||||
import { UserContext } from '../../backend/UserContext';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { z } from 'zod';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import React, { useState, useContext } from "react";
|
||||
import { LanguageContext } from "../../backend/LanguageContext";
|
||||
import { UserContext } from "../../backend/UserContext";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
// IMPORT IMAGES
|
||||
import next from '../../icons/next.svg';
|
||||
import next_reverse from '../../icons/next-reverse.svg';
|
||||
import next from "../../icons/next.svg";
|
||||
import next_reverse from "../../icons/next-reverse.svg";
|
||||
// import arrow from "../../icons/arrow.svg";
|
||||
|
||||
const schema = z.object({
|
||||
|
|
@ -34,7 +34,7 @@ const AcceptStage = ({
|
|||
recipientWorkPosition,
|
||||
}) => {
|
||||
const { locale } = useContext(LanguageContext);
|
||||
const userToken = localStorage.getItem('userToken');
|
||||
const userToken = localStorage.getItem("userToken");
|
||||
const { user } = useContext(UserContext);
|
||||
const handleCardDetails = (e) => {
|
||||
setCardDetails(e.target.value);
|
||||
|
|
@ -42,7 +42,7 @@ const AcceptStage = ({
|
|||
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
const [errorMessage, setErrorMesage] = useState('');
|
||||
const [errorMessage, setErrorMesage] = useState("");
|
||||
|
||||
const {
|
||||
register,
|
||||
|
|
@ -51,8 +51,8 @@ const AcceptStage = ({
|
|||
} = useForm({
|
||||
resolver: zodResolver(schema),
|
||||
defaultValues: {
|
||||
amount: recepientAmount ? recepientAmount : 'Loading',
|
||||
duration: creditDuration ? creditDuration : 'loading',
|
||||
amount: recepientAmount ? recepientAmount : "Loading",
|
||||
duration: creditDuration ? creditDuration : "loading",
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -60,12 +60,12 @@ const AcceptStage = ({
|
|||
setIsLoading(true);
|
||||
try {
|
||||
const response = await fetch(
|
||||
'https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre/check',
|
||||
"https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre/check",
|
||||
{
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: 'application/json, text/plain',
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
Accept: "application/json, text/plain",
|
||||
"Content-Type": "application/json;charset=UTF-8",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
clientRecipient: {
|
||||
|
|
@ -76,7 +76,7 @@ const AcceptStage = ({
|
|||
surname: borrowerData.surname,
|
||||
lastname: borrowerData.lastname,
|
||||
availableAmount: borrowerData.availableAmount,
|
||||
clientType: 'recipient',
|
||||
clientType: "recipient",
|
||||
signRecipient: borrowerData.signRecipient,
|
||||
expDate: borrowerData.expDate,
|
||||
},
|
||||
|
|
@ -89,7 +89,7 @@ const AcceptStage = ({
|
|||
surname: guaranterData.surname,
|
||||
lastname: guaranterData.lastname,
|
||||
availableAmount: guaranterData.availableAmount,
|
||||
clientType: 'guarantor',
|
||||
clientType: "guarantor",
|
||||
signGuarantor: guaranterData.signGuarantor,
|
||||
expDate: guaranterData.expDate,
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ const AcceptStage = ({
|
|||
mrtIsInsuarance: isGuranter ? 0 : 1,
|
||||
termInYears: creditDuration,
|
||||
}),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
@ -126,9 +126,9 @@ const AcceptStage = ({
|
|||
const response = await fetch(
|
||||
`https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/loancre`,
|
||||
{
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
clientRecipient: {
|
||||
|
|
@ -139,7 +139,7 @@ const AcceptStage = ({
|
|||
surname: borrowerData.surname,
|
||||
lastname: borrowerData.lastname,
|
||||
availableAmount: borrowerData.availableAmount,
|
||||
clientType: 'recipient',
|
||||
clientType: "recipient",
|
||||
signRecipient: borrowerData.signRecipient,
|
||||
expDate: borrowerData.expDate,
|
||||
},
|
||||
|
|
@ -152,7 +152,7 @@ const AcceptStage = ({
|
|||
surname: guaranterData.surname,
|
||||
lastname: guaranterData.lastname,
|
||||
availableAmount: guaranterData.availableAmount,
|
||||
clientType: 'guarantor',
|
||||
clientType: "guarantor",
|
||||
signGuarantor: guaranterData.signGuarantor,
|
||||
expDate: guaranterData.expDate,
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ const AcceptStage = ({
|
|||
mrtIsInsuarance: isGuranter ? 0 : 1,
|
||||
termInYears: creditDuration,
|
||||
}),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
@ -172,8 +172,7 @@ const AcceptStage = ({
|
|||
const responseJson = await response.json();
|
||||
|
||||
if (responseJson.errCode === 0) {
|
||||
//sendData(responseJson);
|
||||
setStage(11);
|
||||
sendData(responseJson);
|
||||
} else {
|
||||
setErrMessage(responseJson.messageRu);
|
||||
setStage(10);
|
||||
|
|
@ -184,15 +183,52 @@ const AcceptStage = ({
|
|||
setError(true);
|
||||
}
|
||||
};
|
||||
|
||||
const sendData = async (requestBody) => {
|
||||
try {
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${userToken}`,
|
||||
};
|
||||
const response = await fetch(
|
||||
"https://shahsyotag.halkbank.gov.tm/app/api/quick_loans",
|
||||
{
|
||||
method: "POST",
|
||||
headers: headers,
|
||||
body: JSON.stringify({
|
||||
sign: requestBody.sign,
|
||||
where_works: recipientWorkPlace,
|
||||
position: recipientWorkPosition,
|
||||
mobile_phone: user.mobile_phone,
|
||||
name: borrowerData.name,
|
||||
surname: borrowerData.surname,
|
||||
lastname: borrowerData.lastname,
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
const jsonedResponse = await response.json();
|
||||
|
||||
setIsLoading(false);
|
||||
cardDetails ? setStage(11) : setStage(16);
|
||||
} catch (error) {
|
||||
console.error(error.toString());
|
||||
setError(true);
|
||||
}
|
||||
};
|
||||
const sendCode = async () => {
|
||||
try {
|
||||
const response = await fetch('https://shahsyotag.halkbank.gov.tm/sendOTP', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'aplication/json' },
|
||||
body: JSON.stringify({
|
||||
phone_number: user.mobile_phone,
|
||||
}),
|
||||
});
|
||||
const response = await fetch(
|
||||
"https://shahsyotag.halkbank.gov.tm/sendOTP",
|
||||
{
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "aplication/json" },
|
||||
body: JSON.stringify({
|
||||
phone_number: user.mobile_phone,
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
setError(true);
|
||||
|
|
@ -219,28 +255,32 @@ const AcceptStage = ({
|
|||
<section className="cs-1 err-section">
|
||||
<h1 className="cs-2-title">
|
||||
{errorMessage}
|
||||
{locale === 'TKM'
|
||||
? ' Bir zat ýalňyş ...'
|
||||
: locale === 'РУС'
|
||||
? ' Ошибка...'
|
||||
: locale === 'ENG'
|
||||
? 'Error...'
|
||||
: ' Bir zat ýalňyş ...'}
|
||||
{locale === "TKM"
|
||||
? " Bir zat ýalňyş ..."
|
||||
: locale === "РУС"
|
||||
? " Ошибка..."
|
||||
: locale === "ENG"
|
||||
? "Error..."
|
||||
: " Bir zat ýalňyş ..."}
|
||||
</h1>
|
||||
<br />
|
||||
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(7)}>
|
||||
<button
|
||||
type="button"
|
||||
className="sign-btn reg-btn"
|
||||
onClick={() => setStage(7)}
|
||||
>
|
||||
<div>
|
||||
<div className="btn-img">
|
||||
<img src={next_reverse} alt="logout" />
|
||||
</div>
|
||||
<h3>
|
||||
{locale === 'TKM'
|
||||
? 'Yza'
|
||||
: locale === 'РУС'
|
||||
? 'Назад'
|
||||
: locale === 'ENG'
|
||||
? 'Back'
|
||||
: 'Yza'}
|
||||
{locale === "TKM"
|
||||
? "Yza"
|
||||
: locale === "РУС"
|
||||
? "Назад"
|
||||
: locale === "ENG"
|
||||
? "Back"
|
||||
: "Yza"}
|
||||
</h3>
|
||||
</div>
|
||||
</button>
|
||||
|
|
@ -252,13 +292,13 @@ const AcceptStage = ({
|
|||
return (
|
||||
<section className="loading">
|
||||
<h1 className="cs-2-title">
|
||||
{locale === 'TKM'
|
||||
? 'Garaşmagyňyzy haýyş edýäris ...'
|
||||
: locale === 'РУС'
|
||||
? 'Пожалуйста, подождите...'
|
||||
: locale === 'ENG'
|
||||
? 'Please wait...'
|
||||
: 'Garaşmagyňyzy haýyş edýäris ...'}
|
||||
{locale === "TKM"
|
||||
? "Garaşmagyňyzy haýyş edýäris ..."
|
||||
: locale === "РУС"
|
||||
? "Пожалуйста, подождите..."
|
||||
: locale === "ENG"
|
||||
? "Please wait..."
|
||||
: "Garaşmagyňyzy haýyş edýäris ..."}
|
||||
</h1>
|
||||
</section>
|
||||
);
|
||||
|
|
@ -268,50 +308,55 @@ const AcceptStage = ({
|
|||
<section className="imm-cs-1 cs-1">
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<h2 className="cs-2-title">
|
||||
{locale === 'TKM'
|
||||
? 'Karzyň maglumatlaryny tassyklaň'
|
||||
: locale === 'РУС'
|
||||
? 'Подтвердите данные кредита'
|
||||
: locale === 'ENG'
|
||||
? 'Confirm the loan details'
|
||||
: 'Karzyň maglumatlaryny tassyklaň'}
|
||||
{locale === "TKM"
|
||||
? "Karzyň maglumatlaryny tassyklaň"
|
||||
: locale === "РУС"
|
||||
? "Подтвердите данные кредита"
|
||||
: locale === "ENG"
|
||||
? "Confirm the loan details"
|
||||
: "Karzyň maglumatlaryny tassyklaň"}
|
||||
</h2>
|
||||
<div className="imm-credit-form-wrapper">
|
||||
<div className="input-block">
|
||||
<label htmlFor="amount">
|
||||
{locale === 'TKM'
|
||||
? 'Karzyň möçberi'
|
||||
: locale === 'РУС'
|
||||
? 'Сумма кредита'
|
||||
: locale === 'ENG'
|
||||
? 'Amount of loan'
|
||||
: 'Karzyň möçberi'}
|
||||
{locale === "TKM"
|
||||
? "Karzyň möçberi"
|
||||
: locale === "РУС"
|
||||
? "Сумма кредита"
|
||||
: locale === "ENG"
|
||||
? "Amount of loan"
|
||||
: "Karzyň möçberi"}
|
||||
</label>
|
||||
<input {...register('amount')} type="text" id="amount" disabled />
|
||||
<input {...register("amount")} type="text" id="amount" disabled />
|
||||
{errors.amount && <span>{errors.amount.message}</span>}
|
||||
</div>
|
||||
<div className="input-block">
|
||||
<label htmlFor="duration">
|
||||
{locale === 'TKM'
|
||||
? 'Karzyň möhleti'
|
||||
: locale === 'РУС'
|
||||
? 'Срок кредита'
|
||||
: locale === 'ENG'
|
||||
? 'Term of loan'
|
||||
: 'Karzyň möhleti'}
|
||||
{locale === "TKM"
|
||||
? "Karzyň möhleti"
|
||||
: locale === "РУС"
|
||||
? "Срок кредита"
|
||||
: locale === "ENG"
|
||||
? "Term of loan"
|
||||
: "Karzyň möhleti"}
|
||||
</label>
|
||||
<input {...register('duration')} type="text" id="duration" disabled />
|
||||
<input
|
||||
{...register("duration")}
|
||||
type="text"
|
||||
id="duration"
|
||||
disabled
|
||||
/>
|
||||
{errors.duration && <span>{errors.duration.message}</span>}
|
||||
</div>
|
||||
<div className="input-block">
|
||||
<label htmlFor="code">
|
||||
{locale === 'TKM'
|
||||
? 'Karz kartynyň hasabyny dolduryň'
|
||||
: locale === 'РУС'
|
||||
? 'Заполните счет кредитной карты'
|
||||
: locale === 'ENG'
|
||||
? 'Fill the credit card account number'
|
||||
: 'Karz kartynyň hasabyny dolduryň'}
|
||||
{locale === "TKM"
|
||||
? "Karz kartynyň hasabyny dolduryň"
|
||||
: locale === "РУС"
|
||||
? "Заполните счет кредитной карты"
|
||||
: locale === "ENG"
|
||||
? "Fill the credit card account number"
|
||||
: "Karz kartynyň hasabyny dolduryň"}
|
||||
</label>
|
||||
<input
|
||||
value={cardDetails}
|
||||
|
|
@ -321,31 +366,35 @@ const AcceptStage = ({
|
|||
placeholder="6435980023168745"
|
||||
/>
|
||||
<span className="another-option" onClick={() => setStage(12)}>
|
||||
{locale === 'TKM'
|
||||
? 'Kartyňyz ýok bolsa, täze karty üçin ýüz tutuň'
|
||||
: locale === 'РУС'
|
||||
? 'Оформите новую карту, если она у вас отсувствует'
|
||||
: locale === 'ENG'
|
||||
? 'Apply for a new card if you do not have one'
|
||||
: 'Kartyňyz ýok bolsa, täze karty üçin ýüz tutuň'}
|
||||
{locale === "TKM"
|
||||
? "Kartyňyz ýok bolsa, täze karty üçin ýüz tutuň"
|
||||
: locale === "РУС"
|
||||
? "Оформите новую карту, если она у вас отсувствует"
|
||||
: locale === "ENG"
|
||||
? "Apply for a new card if you do not have one"
|
||||
: "Kartyňyz ýok bolsa, täze karty üçin ýüz tutuň"}
|
||||
</span>
|
||||
{/* {errors.code && <span>{errors.code.message}</span>} */}
|
||||
</div>
|
||||
</div>
|
||||
<div className="cu-bottom cd-2-title">
|
||||
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(7)}>
|
||||
<button
|
||||
type="button"
|
||||
className="sign-btn reg-btn"
|
||||
onClick={() => setStage(7)}
|
||||
>
|
||||
<div>
|
||||
<div className="btn-img">
|
||||
<img src={next_reverse} alt="logout" />
|
||||
</div>
|
||||
<h3>
|
||||
{locale === 'TKM'
|
||||
? 'Yza'
|
||||
: locale === 'РУС'
|
||||
? 'Назад'
|
||||
: locale === 'ENG'
|
||||
? 'Back'
|
||||
: 'Yza'}
|
||||
{locale === "TKM"
|
||||
? "Yza"
|
||||
: locale === "РУС"
|
||||
? "Назад"
|
||||
: locale === "ENG"
|
||||
? "Back"
|
||||
: "Yza"}
|
||||
</h3>
|
||||
</div>
|
||||
</button>
|
||||
|
|
@ -355,16 +404,17 @@ const AcceptStage = ({
|
|||
disabled={cardDetails.length !== 23 && !isLoading ? true : false}
|
||||
onClick={() => {
|
||||
onSubmit();
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
<h3>
|
||||
{locale === 'TKM'
|
||||
? 'Dowam et'
|
||||
: locale === 'РУС'
|
||||
? 'Подтвердить '
|
||||
: locale === 'ENG'
|
||||
? 'Proceed'
|
||||
: 'Dowam et'}
|
||||
{locale === "TKM"
|
||||
? "Dowam et"
|
||||
: locale === "РУС"
|
||||
? "Подтвердить "
|
||||
: locale === "ENG"
|
||||
? "Proceed"
|
||||
: "Dowam et"}
|
||||
</h3>
|
||||
<div className="btn-img">
|
||||
<img src={next} alt="logout" />
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
// IMPORT MODULES
|
||||
import React, { useState, useContext, useEffect } from 'react';
|
||||
import { LanguageContext } from '../../backend/LanguageContext';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { z } from 'zod';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import React, { useState, useContext, useEffect } from "react";
|
||||
import { LanguageContext } from "../../backend/LanguageContext";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
// IMPORT IMAGES
|
||||
import next from '../../icons/next.svg';
|
||||
import next_reverse from '../../icons/next-reverse.svg';
|
||||
import next from "../../icons/next.svg";
|
||||
import next_reverse from "../../icons/next-reverse.svg";
|
||||
// import arrow from "../../icons/arrow.svg";
|
||||
|
||||
const schema = z.object({
|
||||
|
|
@ -24,13 +24,15 @@ const PaymentDetails = ({
|
|||
}) => {
|
||||
const { locale } = useContext(LanguageContext);
|
||||
|
||||
const [timeLeft, setTimeLeft] = useState(paymentDetails['remaining-time']);
|
||||
const [timeLeft, setTimeLeft] = useState(paymentDetails["remaining-time"]);
|
||||
|
||||
const [paymentName, setPaymentName] = useState('');
|
||||
const [paymentCard, setPaymentCard] = useState('');
|
||||
const [paymentCv, setPaymentCv] = useState('');
|
||||
const [paymentCardDurationYear, setPaymentCardDurationYear] = useState('');
|
||||
const [paymentCardDurationMonth, setPaymentCardDurationMonth] = useState('');
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const [paymentName, setPaymentName] = useState("");
|
||||
const [paymentCard, setPaymentCard] = useState("");
|
||||
const [paymentCv, setPaymentCv] = useState("");
|
||||
const [paymentCardDurationYear, setPaymentCardDurationYear] = useState("");
|
||||
const [paymentCardDurationMonth, setPaymentCardDurationMonth] = useState("");
|
||||
|
||||
const handlePaymentCard = (e) => {
|
||||
setPaymentCard(e.target.value);
|
||||
|
|
@ -59,28 +61,34 @@ const PaymentDetails = ({
|
|||
}, [timeLeft]);
|
||||
|
||||
const sendPaymentRequest = async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
||||
};
|
||||
|
||||
const formData = new URLSearchParams();
|
||||
formData.append('app', 'sanlykarz');
|
||||
formData.append('id', borrowerData.idNo);
|
||||
formData.append('md-order', paymentDetails['md-order']);
|
||||
formData.append('card-number', paymentCard.toString());
|
||||
formData.append("app", "sanlykarz");
|
||||
formData.append("id", borrowerData.idNo);
|
||||
formData.append("md-order", paymentDetails["md-order"]);
|
||||
formData.append("card-number", paymentCard.toString());
|
||||
formData.append(
|
||||
'card-expiry',
|
||||
'20' + paymentCardDurationYear.toString() + paymentCardDurationMonth.toString(),
|
||||
"card-expiry",
|
||||
"20" +
|
||||
paymentCardDurationYear.toString() +
|
||||
paymentCardDurationMonth.toString()
|
||||
);
|
||||
formData.append('name-on-card', paymentName);
|
||||
formData.append('card-cvc', paymentCv.toString());
|
||||
formData.append("name-on-card", paymentName);
|
||||
formData.append("card-cvc", paymentCv.toString());
|
||||
|
||||
const response = await fetch('https://shahsyotag.halkbank.gov.tm/api/v1/submit-card', {
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: formData.toString(),
|
||||
});
|
||||
const response = await fetch(
|
||||
"https://shahsyotag.halkbank.gov.tm/api/v1/submit-card",
|
||||
{
|
||||
method: "POST",
|
||||
headers: headers,
|
||||
body: formData.toString(),
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
|
|
@ -88,9 +96,10 @@ const PaymentDetails = ({
|
|||
|
||||
const jsonedResponse = await response.json();
|
||||
|
||||
if (jsonedResponse.status === 'ok') {
|
||||
if (jsonedResponse.status === "ok") {
|
||||
setSumbitCardDetails(jsonedResponse);
|
||||
setInvalidData(false);
|
||||
setIsLoading(false);
|
||||
setStage(14);
|
||||
} else {
|
||||
setStage(12);
|
||||
|
|
@ -121,50 +130,66 @@ const PaymentDetails = ({
|
|||
setStage(12);
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<section className="loading">
|
||||
<h1 className="cs-2-title">
|
||||
{locale === "TKM"
|
||||
? "Garaşmagyňyzy haýyş edýäris ..."
|
||||
: locale === "РУС"
|
||||
? "Пожалуйста, подождите..."
|
||||
: locale === "ENG"
|
||||
? "Please wait..."
|
||||
: "Garaşmagyňyzy haýyş edýäris ..."}
|
||||
</h1>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="imm-cs-1 cs-1">
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<h2 className="cs-2-title">
|
||||
{locale === 'TKM'
|
||||
? 'Töleg üçin kartyň maglumatlaryny giriziň'
|
||||
: locale === 'РУС'
|
||||
? 'Введите данные карты для оплаты'
|
||||
: locale === 'ENG'
|
||||
? 'Enter card details for payment'
|
||||
: 'Töleg üçin kartyň maglumatlaryny giriziň'}
|
||||
{locale === "TKM"
|
||||
? "Töleg üçin kartyň maglumatlaryny giriziň"
|
||||
: locale === "РУС"
|
||||
? "Введите данные карты для оплаты"
|
||||
: locale === "ENG"
|
||||
? "Enter card details for payment"
|
||||
: "Töleg üçin kartyň maglumatlaryny giriziň"}
|
||||
</h2>
|
||||
<div className="payment-details">
|
||||
<h2>
|
||||
{locale === 'TKM'
|
||||
? 'Tölemeli mukdar:'
|
||||
: locale === 'РУС'
|
||||
? 'Сумма к оплате:'
|
||||
: locale === 'ENG'
|
||||
? 'Amount to pay:'
|
||||
: 'Tölemeli mukdar:'}
|
||||
{paymentDetails['amount-info']}
|
||||
{locale === "TKM"
|
||||
? "Tölemeli mukdar:"
|
||||
: locale === "РУС"
|
||||
? "Сумма к оплате:"
|
||||
: locale === "ENG"
|
||||
? "Amount to pay:"
|
||||
: "Tölemeli mukdar:"}
|
||||
{paymentDetails["amount-info"]}
|
||||
</h2>
|
||||
<h2>
|
||||
{locale === 'TKM'
|
||||
? 'Wagt galdy:'
|
||||
: locale === 'РУС'
|
||||
? 'Оставшееся время:'
|
||||
: locale === 'ENG'
|
||||
? 'Time left:'
|
||||
: 'Wagt galdy:'}
|
||||
{locale === "TKM"
|
||||
? "Wagt galdy:"
|
||||
: locale === "РУС"
|
||||
? "Оставшееся время:"
|
||||
: locale === "ENG"
|
||||
? "Time left:"
|
||||
: "Wagt galdy:"}
|
||||
{Math.floor((timeLeft % 3600) / 60)}:{timeLeft % 60}
|
||||
</h2>
|
||||
</div>
|
||||
<div className="imm-credit-form-wrapper">
|
||||
<div className="input-block">
|
||||
<label htmlFor="card">
|
||||
{locale === 'TKM'
|
||||
? 'Kartyň ýüzünde görkezilen ady, familiýasyny giriziň'
|
||||
: locale === 'РУС'
|
||||
? 'Имя и фамилия, указанные на карте'
|
||||
: locale === 'ENG'
|
||||
? 'Enter first name and last name indicated on the card'
|
||||
: 'Kartyň ýüzünde görkezilen ady, familiýasyny giriziň'}
|
||||
{locale === "TKM"
|
||||
? "Kartyň ýüzünde görkezilen ady, familiýasyny giriziň"
|
||||
: locale === "РУС"
|
||||
? "Имя и фамилия, указанные на карте"
|
||||
: locale === "ENG"
|
||||
? "Enter first name and last name indicated on the card"
|
||||
: "Kartyň ýüzünde görkezilen ady, familiýasyny giriziň"}
|
||||
</label>
|
||||
<input
|
||||
value={paymentName}
|
||||
|
|
@ -177,13 +202,13 @@ const PaymentDetails = ({
|
|||
</div>
|
||||
<div className="input-block">
|
||||
<label htmlFor="card">
|
||||
{locale === 'TKM'
|
||||
? 'Kart belgisi'
|
||||
: locale === 'РУС'
|
||||
? 'Номер карты'
|
||||
: locale === 'ENG'
|
||||
? 'Card number'
|
||||
: 'Kart belgisi'}
|
||||
{locale === "TKM"
|
||||
? "Kart belgisi"
|
||||
: locale === "РУС"
|
||||
? "Номер карты"
|
||||
: locale === "ENG"
|
||||
? "Card number"
|
||||
: "Kart belgisi"}
|
||||
</label>
|
||||
<input
|
||||
value={paymentCard}
|
||||
|
|
@ -194,16 +219,16 @@ const PaymentDetails = ({
|
|||
/>
|
||||
{/* {errors.code && <span>{errors.code.message}</span>} */}
|
||||
</div>
|
||||
{paymentDetails['is-cvc-required'] && (
|
||||
{paymentDetails["is-cvc-required"] && (
|
||||
<div className="input-block">
|
||||
<label htmlFor="cvc">
|
||||
{locale === 'TKM'
|
||||
? 'Kartyň CVC'
|
||||
: locale === 'РУС'
|
||||
? 'CVC карты'
|
||||
: locale === 'ENG'
|
||||
{locale === "TKM"
|
||||
? "Kartyň CVC"
|
||||
: locale === "РУС"
|
||||
? "CVC карты"
|
||||
: locale === "ENG"
|
||||
? "Card's CVC"
|
||||
: 'Kartyň CVC'}
|
||||
: "Kartyň CVC"}
|
||||
</label>
|
||||
<input
|
||||
value={paymentCv}
|
||||
|
|
@ -220,13 +245,13 @@ const PaymentDetails = ({
|
|||
|
||||
<div className="input-block">
|
||||
<label htmlFor="duration-month">
|
||||
{locale === 'TKM'
|
||||
? 'Kartyň möhleti (aý)'
|
||||
: locale === 'РУС'
|
||||
? 'Срок годности карты (месяц)'
|
||||
: locale === 'ENG'
|
||||
? 'Card expiration date (month)'
|
||||
: 'Kartyň möhleti (aý)'}
|
||||
{locale === "TKM"
|
||||
? "Kartyň möhleti (aý)"
|
||||
: locale === "РУС"
|
||||
? "Срок годности карты (месяц)"
|
||||
: locale === "ENG"
|
||||
? "Card expiration date (month)"
|
||||
: "Kartyň möhleti (aý)"}
|
||||
</label>
|
||||
<input
|
||||
value={paymentCardDurationMonth}
|
||||
|
|
@ -239,13 +264,13 @@ const PaymentDetails = ({
|
|||
</div>
|
||||
<div className="input-block">
|
||||
<label htmlFor="duration-year">
|
||||
{locale === 'TKM'
|
||||
? 'Kartyň möhleti (ýyl)'
|
||||
: locale === 'РУС'
|
||||
? 'Срок годности карты (год)'
|
||||
: locale === 'ENG'
|
||||
? 'Card expiration date (year)'
|
||||
: 'Kartyň möhleti (ýyl)'}
|
||||
{locale === "TKM"
|
||||
? "Kartyň möhleti (ýyl)"
|
||||
: locale === "РУС"
|
||||
? "Срок годности карты (год)"
|
||||
: locale === "ENG"
|
||||
? "Card expiration date (year)"
|
||||
: "Kartyň möhleti (ýyl)"}
|
||||
</label>
|
||||
<input
|
||||
value={paymentCardDurationYear}
|
||||
|
|
@ -259,19 +284,23 @@ const PaymentDetails = ({
|
|||
</div>
|
||||
|
||||
<div className="cu-bottom cd-2-title">
|
||||
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(12)}>
|
||||
<button
|
||||
type="button"
|
||||
className="sign-btn reg-btn"
|
||||
onClick={() => setStage(12)}
|
||||
>
|
||||
<div>
|
||||
<div className="btn-img">
|
||||
<img src={next_reverse} alt="logout" />
|
||||
</div>
|
||||
<h3>
|
||||
{locale === 'TKM'
|
||||
? 'Yza'
|
||||
: locale === 'РУС'
|
||||
? 'Назад'
|
||||
: locale === 'ENG'
|
||||
? 'Back'
|
||||
: 'Yza'}
|
||||
{locale === "TKM"
|
||||
? "Yza"
|
||||
: locale === "РУС"
|
||||
? "Назад"
|
||||
: locale === "ENG"
|
||||
? "Back"
|
||||
: "Yza"}
|
||||
</h3>
|
||||
</div>
|
||||
</button>
|
||||
|
|
@ -290,16 +319,17 @@ const PaymentDetails = ({
|
|||
}
|
||||
type="submit"
|
||||
className="sign-btn cu-btn"
|
||||
onClick={() => onSubmit()}>
|
||||
onClick={() => onSubmit()}
|
||||
>
|
||||
<div>
|
||||
<h3>
|
||||
{locale === 'TKM'
|
||||
? 'Dowam et'
|
||||
: locale === 'РУС'
|
||||
? 'Подтвердить '
|
||||
: locale === 'ENG'
|
||||
? 'Proceed'
|
||||
: 'Dowam et'}
|
||||
{locale === "TKM"
|
||||
? "Dowam et"
|
||||
: locale === "РУС"
|
||||
? "Подтвердить "
|
||||
: locale === "ENG"
|
||||
? "Proceed"
|
||||
: "Dowam et"}
|
||||
</h3>
|
||||
<div className="btn-img">
|
||||
<img src={next} alt="logout" />
|
||||
|
|
|
|||
|
|
@ -26,10 +26,12 @@ const PhoneAccept = ({
|
|||
recepientAmount,
|
||||
cardDetails,
|
||||
creditDuration,
|
||||
setAcceptedMessage,
|
||||
recipientWorkPlace,
|
||||
recipientWorkPosition,
|
||||
availableAmount,
|
||||
setAcceptedMessage,
|
||||
setAcceptedMessageEn,
|
||||
setAcceptedMessageTkm,
|
||||
}) => {
|
||||
const { locale } = useContext(LanguageContext);
|
||||
const { user } = useContext(UserContext);
|
||||
|
|
@ -59,6 +61,7 @@ const PhoneAccept = ({
|
|||
// ///////////////////Card registration
|
||||
|
||||
const confirmPayment = async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
||||
|
|
@ -180,7 +183,7 @@ const PhoneAccept = ({
|
|||
|
||||
if (jsonedResponse.errCode === 0) {
|
||||
// sendCode();
|
||||
setStage(15);
|
||||
loanCreate();
|
||||
} else {
|
||||
setStage(10);
|
||||
}
|
||||
|
|
@ -292,6 +295,9 @@ const PhoneAccept = ({
|
|||
|
||||
if (responseJson.errCode === 0) {
|
||||
sendData(responseJson);
|
||||
setAcceptedMessage(responseJson.messageRu);
|
||||
setAcceptedMessageEn(responseJson.messageEn);
|
||||
setAcceptedMessageTkm(responseJson.message);
|
||||
} else {
|
||||
setErrMessage(responseJson.messageRu);
|
||||
setStage(10);
|
||||
|
|
@ -328,13 +334,9 @@ const PhoneAccept = ({
|
|||
);
|
||||
|
||||
const jsonedResponse = await response.json();
|
||||
if (!cardDetails) {
|
||||
}
|
||||
|
||||
setAcceptedMessage(jsonedResponse.message);
|
||||
setIsLoading(false);
|
||||
|
||||
setStage(11);
|
||||
cardDetails ? setStage(11) : setStage(16);
|
||||
} catch (error) {
|
||||
console.error(error.toString());
|
||||
setError(true);
|
||||
|
|
@ -493,14 +495,16 @@ const PhoneAccept = ({
|
|||
type="text"
|
||||
id="code"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
disabled={messageSend}
|
||||
className="another-option"
|
||||
onClick={codeResend}
|
||||
>
|
||||
Отправить код снова
|
||||
</button>
|
||||
{cardDetails && (
|
||||
<button
|
||||
type="button"
|
||||
disabled={messageSend}
|
||||
className="another-option"
|
||||
onClick={codeResend}
|
||||
>
|
||||
Отправить код снова
|
||||
</button>
|
||||
)}
|
||||
{messageSend && <p>Time left: {timeLeft} seconds</p>}
|
||||
{/* {errors.code && <span>{errors.code.message}</span>} */}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -574,6 +574,9 @@ const ImmediateCreditModal = ({
|
|||
submitCardDetails={submitCardDetails}
|
||||
paymentLink={paymentLink}
|
||||
creditDuration={creditDuration}
|
||||
setAcceptedMessage={setAcceptedMessage}
|
||||
setAcceptedMessageEn={setAcceptedMessageEn}
|
||||
setAcceptedMessageTkm={setAcceptedMessageTkm}
|
||||
recepientAmount={recepientAmount}
|
||||
/>
|
||||
) : stage === 15 ? (
|
||||
|
|
|
|||
Loading…
Reference in New Issue