translations
This commit is contained in:
parent
dfa03b2cc2
commit
82615986ca
|
|
@ -131,12 +131,12 @@ const BorrowerInfo = ({
|
|||
<div className="input-block">
|
||||
<label htmlFor="birthDate">
|
||||
{locale === "TKM"
|
||||
? "Doglan ýyly"
|
||||
? "Doglan senesi"
|
||||
: locale === "РУС"
|
||||
? "Год рождения"
|
||||
: locale === "ENG"
|
||||
? "Year of birth"
|
||||
: "Doglan ýyly"}
|
||||
: "Doglan senesi"}
|
||||
</label>
|
||||
<input
|
||||
{...register("birthDate")}
|
||||
|
|
|
|||
|
|
@ -245,12 +245,12 @@ const CardRegistration = ({
|
|||
<div className="input-block">
|
||||
<label htmlFor="birthDate">
|
||||
{locale === "TKM"
|
||||
? "Doglan ýyly"
|
||||
? "Doglan senesi"
|
||||
: locale === "РУС"
|
||||
? "Год рождения"
|
||||
: locale === "ENG"
|
||||
? "Year of birth"
|
||||
: "Doglan ýyly"}
|
||||
: "Doglan senesi"}
|
||||
</label>
|
||||
<input
|
||||
{...register("birthDate")}
|
||||
|
|
|
|||
|
|
@ -116,12 +116,12 @@ const GuaranterInfo = ({ setStage, isGuranter, guaranterData }) => {
|
|||
<div className="input-block">
|
||||
<label htmlFor="birthDate">
|
||||
{locale === "TKM"
|
||||
? "Doglan ýyly"
|
||||
? "Doglan senesi"
|
||||
: locale === "РУС"
|
||||
? "Год рождения"
|
||||
: locale === "ENG"
|
||||
? "Year of birth"
|
||||
: "Doglan ýyly"}
|
||||
: "Doglan senesi"}
|
||||
</label>
|
||||
<input
|
||||
{...register("birthDate")}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
// 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 CardDetails from './CardDetails';
|
||||
import next from "../../icons/next.svg";
|
||||
import next_reverse from "../../icons/next-reverse.svg";
|
||||
import CardDetails from "./CardDetails";
|
||||
// import arrow from "../../icons/arrow.svg";
|
||||
|
||||
const schema = z.object({
|
||||
|
|
@ -25,13 +25,13 @@ const PaymentDetails = ({
|
|||
const { locale } = useContext(LanguageContext);
|
||||
|
||||
const [invalidData, setInvalidData] = useState(false);
|
||||
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 [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);
|
||||
|
|
@ -62,26 +62,31 @@ const PaymentDetails = ({
|
|||
const sendPaymentRequest = async () => {
|
||||
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}`);
|
||||
|
|
@ -89,9 +94,9 @@ const PaymentDetails = ({
|
|||
|
||||
const jsonedResponse = await response.json();
|
||||
|
||||
if (jsonedResponse.status === 'other-error') {
|
||||
if (jsonedResponse.status === "other-error") {
|
||||
setInvalidData(true);
|
||||
} else if (jsonedResponse.status === 'ok') {
|
||||
} else if (jsonedResponse.status === "ok") {
|
||||
setSumbitCardDetails(jsonedResponse);
|
||||
setInvalidData(false);
|
||||
setStage(14);
|
||||
|
|
@ -126,46 +131,46 @@ const PaymentDetails = ({
|
|||
<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}
|
||||
|
|
@ -178,13 +183,13 @@ const PaymentDetails = ({
|
|||
</div>
|
||||
<div className="input-block">
|
||||
<label htmlFor="card">
|
||||
{locale === 'TKM'
|
||||
? 'Kart belgesi'
|
||||
: locale === 'РУС'
|
||||
? 'Номер карты'
|
||||
: locale === 'ENG'
|
||||
? 'Card number'
|
||||
: 'Kart belgesi'}
|
||||
{locale === "TKM"
|
||||
? "Kart belgisi"
|
||||
: locale === "РУС"
|
||||
? "Номер карты"
|
||||
: locale === "ENG"
|
||||
? "Card number"
|
||||
: "Kart belgisi"}
|
||||
</label>
|
||||
<input
|
||||
value={paymentCard}
|
||||
|
|
@ -195,16 +200,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}
|
||||
|
|
@ -221,13 +226,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}
|
||||
|
|
@ -240,13 +245,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}
|
||||
|
|
@ -261,30 +266,34 @@ const PaymentDetails = ({
|
|||
{invalidData && (
|
||||
<section className="imm-cs-1 cs-1">
|
||||
<h1 className="cs-2-title">
|
||||
{locale === 'TKM'
|
||||
? 'Roralňyşlyk, maglumatlary barlaň'
|
||||
: locale === 'РУС'
|
||||
? 'Ошибка, проверьте данные'
|
||||
: locale === 'ENG'
|
||||
? 'Card expiration date (year)'
|
||||
: 'Roralňyşlyk, maglumatlary barlaň'}
|
||||
{locale === "TKM"
|
||||
? "Roralňyşlyk, maglumatlary barlaň"
|
||||
: locale === "РУС"
|
||||
? "Ошибка, проверьте данные"
|
||||
: locale === "ENG"
|
||||
? "Card expiration date (year)"
|
||||
: "Roralňyşlyk, maglumatlary barlaň"}
|
||||
</h1>
|
||||
</section>
|
||||
)}
|
||||
<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>
|
||||
|
|
@ -303,16 +312,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" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue