phone changed
This commit is contained in:
parent
87d3b2c192
commit
af5a1ef35a
|
|
@ -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({
|
||||
|
|
@ -30,7 +30,8 @@ const AcceptStage = ({
|
|||
userDataRes,
|
||||
}) => {
|
||||
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);
|
||||
|
|
@ -46,20 +47,23 @@ const AcceptStage = ({
|
|||
} = useForm({
|
||||
resolver: zodResolver(schema),
|
||||
defaultValues: {
|
||||
amount: recepientAmount ? recepientAmount : 'Loading',
|
||||
duration: creditDuration ? creditDuration : 'loading',
|
||||
amount: recepientAmount ? recepientAmount : "Loading",
|
||||
duration: creditDuration ? creditDuration : "loading",
|
||||
},
|
||||
});
|
||||
|
||||
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: '+99361454210',
|
||||
}),
|
||||
});
|
||||
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) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
|
|
@ -81,19 +85,23 @@ const AcceptStage = ({
|
|||
<section className="imm-cs-1">
|
||||
<h1 className="cs-2-title">Error...</h1>
|
||||
<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>
|
||||
|
|
@ -114,50 +122,55 @@ const AcceptStage = ({
|
|||
<section className="imm-cs-1">
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<h2 className="cs-2-title">
|
||||
{locale === 'TKM'
|
||||
? 'Karzyň kalkulýatory'
|
||||
: locale === 'РУС'
|
||||
? 'Подтвердите данные'
|
||||
: locale === 'ENG'
|
||||
? 'Loan calculator'
|
||||
: 'Karzyň kalkulýatory'}
|
||||
{locale === "TKM"
|
||||
? "Karzyň kalkulýatory"
|
||||
: locale === "РУС"
|
||||
? "Подтвердите данные"
|
||||
: locale === "ENG"
|
||||
? "Loan calculator"
|
||||
: "Karzyň kalkulýatory"}
|
||||
</h2>
|
||||
<div className="imm-credit-form-wrapper">
|
||||
<div className="input-block">
|
||||
<label htmlFor="amount">
|
||||
{locale === 'TKM'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Сумма'
|
||||
: locale === 'ENG'
|
||||
? 'amount'
|
||||
: 'At'}
|
||||
{locale === "TKM"
|
||||
? "At"
|
||||
: locale === "РУС"
|
||||
? "Сумма"
|
||||
: locale === "ENG"
|
||||
? "amount"
|
||||
: "At"}
|
||||
</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="surname">
|
||||
{locale === 'TKM'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Срок'
|
||||
: locale === 'ENG'
|
||||
? 'duration'
|
||||
: 'At'}
|
||||
{locale === "TKM"
|
||||
? "At"
|
||||
: locale === "РУС"
|
||||
? "Срок"
|
||||
: locale === "ENG"
|
||||
? "duration"
|
||||
: "At"}
|
||||
</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'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Номер карты'
|
||||
: locale === 'ENG'
|
||||
? 'amount'
|
||||
: 'At'}
|
||||
{locale === "TKM"
|
||||
? "At"
|
||||
: locale === "РУС"
|
||||
? "Номер карты"
|
||||
: locale === "ENG"
|
||||
? "amount"
|
||||
: "At"}
|
||||
</label>
|
||||
<input
|
||||
value={cardDetails}
|
||||
|
|
@ -173,19 +186,23 @@ const AcceptStage = ({
|
|||
</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>
|
||||
|
|
@ -196,16 +213,17 @@ const AcceptStage = ({
|
|||
onClick={() => {
|
||||
onSubmit();
|
||||
setStage(9);
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<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,9 +1,9 @@
|
|||
import React, { useContext, useState } from 'react';
|
||||
import { LanguageContext } from '../../backend/LanguageContext';
|
||||
import React, { useContext, useState } from "react";
|
||||
import { LanguageContext } from "../../backend/LanguageContext";
|
||||
|
||||
import next from '../../icons/next.svg';
|
||||
import next_reverse from '../../icons/next-reverse.svg';
|
||||
import { UserContext } from '../../backend/UserContext';
|
||||
import next from "../../icons/next.svg";
|
||||
import next_reverse from "../../icons/next-reverse.svg";
|
||||
import { UserContext } from "../../backend/UserContext";
|
||||
|
||||
const PaymentSuccess = ({
|
||||
setStage,
|
||||
|
|
@ -18,7 +18,7 @@ const PaymentSuccess = ({
|
|||
const { locale } = useContext(LanguageContext);
|
||||
const { user } = useContext(UserContext);
|
||||
|
||||
const [codeValue, setPhoneValue] = useState('');
|
||||
const [codeValue, setPhoneValue] = useState("");
|
||||
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
|
|
@ -30,15 +30,18 @@ const PaymentSuccess = ({
|
|||
const confirmCode = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await fetch('https://shahsyotag.halkbank.gov.tm/validateOTP', {
|
||||
headers: { 'Content-Type': 'aplication/json' },
|
||||
method: 'POST',
|
||||
const response = await fetch(
|
||||
"https://shahsyotag.halkbank.gov.tm/validateOTP",
|
||||
{
|
||||
headers: { "Content-Type": "aplication/json" },
|
||||
method: "POST",
|
||||
|
||||
body: JSON.stringify({
|
||||
phone_number: '+99361454210',
|
||||
otp: codeValue,
|
||||
}),
|
||||
});
|
||||
body: JSON.stringify({
|
||||
phone_number: user.mobile_phone,
|
||||
otp: codeValue,
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
|
|
@ -46,7 +49,7 @@ const PaymentSuccess = ({
|
|||
|
||||
const jsonedResponse = await response.json();
|
||||
|
||||
if (jsonedResponse === 'OTP validated successfully') {
|
||||
if (jsonedResponse === "OTP validated successfully") {
|
||||
fetchData();
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
|
@ -58,9 +61,9 @@ const PaymentSuccess = ({
|
|||
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: {
|
||||
|
|
@ -70,7 +73,7 @@ const PaymentSuccess = ({
|
|||
name: borrowerData.name,
|
||||
surname: borrowerData.surname,
|
||||
availableAmount: borrowerData.availableAmount,
|
||||
clientType: 'recipient',
|
||||
clientType: "recipient",
|
||||
signRecipient: borrowerData.signRecipient,
|
||||
},
|
||||
clientGuarantor: isGuranter
|
||||
|
|
@ -81,7 +84,7 @@ const PaymentSuccess = ({
|
|||
name: guaranterData.name,
|
||||
surname: guaranterData.surname,
|
||||
availableAmount: guaranterData.availableAmount,
|
||||
clientType: 'guarantor',
|
||||
clientType: "guarantor",
|
||||
signGuarantor: guaranterData.signGuarantor,
|
||||
}
|
||||
: null,
|
||||
|
|
@ -90,7 +93,7 @@ const PaymentSuccess = ({
|
|||
mrtIsInsuarance: isGuranter ? 0 : 1,
|
||||
termInYears: creditDuration,
|
||||
}),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
@ -128,35 +131,40 @@ const PaymentSuccess = ({
|
|||
<section className="imm-cs-1">
|
||||
<form>
|
||||
<h2 className="succes-title">
|
||||
{locale === 'TKM'
|
||||
? 'Karzyň kalkulýatory'
|
||||
: locale === 'РУС'
|
||||
? 'Оплата прошла успешно, ваша заявка на оформление кредитной карты принята'
|
||||
: locale === 'ENG'
|
||||
? 'Loan calculator'
|
||||
: 'Karzyň kalkulýatory'}
|
||||
{locale === "TKM"
|
||||
? "Karzyň kalkulýatory"
|
||||
: locale === "РУС"
|
||||
? "Оплата прошла успешно, ваша заявка на оформление кредитной карты принята"
|
||||
: locale === "ENG"
|
||||
? "Loan calculator"
|
||||
: "Karzyň kalkulýatory"}
|
||||
</h2>
|
||||
<h3 className="succes-sub-title">
|
||||
{locale === 'TKM'
|
||||
? 'Karzyň kalkulýatory'
|
||||
: locale === 'РУС'
|
||||
? 'Завершите оформление онлайн кредита, введя СМС код, отправленный на ваш номер телефона '
|
||||
: locale === 'ENG'
|
||||
? 'Loan calculator'
|
||||
: 'Karzyň kalkulýatory'}
|
||||
{locale === "TKM"
|
||||
? "Karzyň kalkulýatory"
|
||||
: locale === "РУС"
|
||||
? "Завершите оформление онлайн кредита, введя СМС код, отправленный на ваш номер телефона "
|
||||
: locale === "ENG"
|
||||
? "Loan calculator"
|
||||
: "Karzyň kalkulýatory"}
|
||||
</h3>
|
||||
<div className="imm-credit-form-wrapper">
|
||||
<div className="input-block">
|
||||
<label htmlFor="code">
|
||||
{locale === 'TKM'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Код'
|
||||
: locale === 'ENG'
|
||||
? 'amount'
|
||||
: 'At'}
|
||||
{locale === "TKM"
|
||||
? "At"
|
||||
: locale === "РУС"
|
||||
? "Код"
|
||||
: locale === "ENG"
|
||||
? "amount"
|
||||
: "At"}
|
||||
</label>
|
||||
<input value={codeValue} onChange={handleCodeChange} type="text" id="code" />
|
||||
<input
|
||||
value={codeValue}
|
||||
onChange={handleCodeChange}
|
||||
type="text"
|
||||
id="code"
|
||||
/>
|
||||
{/* <span className="another-option" onClick={codeResend}>
|
||||
Отправить код снова
|
||||
</span> */}
|
||||
|
|
@ -164,19 +172,23 @@ const PaymentSuccess = ({
|
|||
</div>
|
||||
</div>
|
||||
<div className="cu-bottom cd-2-title">
|
||||
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(14)}>
|
||||
<button
|
||||
type="button"
|
||||
className="sign-btn reg-btn"
|
||||
onClick={() => setStage(14)}
|
||||
>
|
||||
<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>
|
||||
|
|
@ -184,16 +196,17 @@ const PaymentSuccess = ({
|
|||
disabled={codeValue.length !== 6 && !isLoading ? true : false}
|
||||
type="submit"
|
||||
onClick={onSubmit}
|
||||
className="sign-btn cu-btn">
|
||||
className="sign-btn cu-btn"
|
||||
>
|
||||
<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,13 +1,13 @@
|
|||
// IMPORT MODULES
|
||||
import React, { useState, useContext } 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 } 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 { UserContext } from '../../backend/UserContext';
|
||||
import next from "../../icons/next.svg";
|
||||
import next_reverse from "../../icons/next-reverse.svg";
|
||||
import { UserContext } from "../../backend/UserContext";
|
||||
// import arrow from "../../icons/arrow.svg";
|
||||
|
||||
const schema = z.object({
|
||||
|
|
@ -30,7 +30,7 @@ const PhoneAccept = ({
|
|||
}) => {
|
||||
const { locale } = useContext(LanguageContext);
|
||||
const { user } = useContext(UserContext);
|
||||
const userToken = localStorage.getItem('userToken');
|
||||
const userToken = localStorage.getItem("userToken");
|
||||
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
|
|
@ -38,7 +38,7 @@ const PhoneAccept = ({
|
|||
const [invalidData, setInvalidData] = useState(false);
|
||||
const [tryAgain, setTryAgain] = useState(false);
|
||||
|
||||
const [codeValue, setPhoneValue] = useState('');
|
||||
const [codeValue, setPhoneValue] = useState("");
|
||||
|
||||
const [errMesage, setErrMessage] = useState();
|
||||
|
||||
|
|
@ -53,23 +53,26 @@ const PhoneAccept = ({
|
|||
const confirmPayment = 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('acs-req-id', submitCardDetails['acs-request-id']);
|
||||
formData.append('acs-session-url', submitCardDetails['acs-session-url']);
|
||||
formData.append('otp', codeValue);
|
||||
formData.append('term-url', submitCardDetails['terminate-url']);
|
||||
formData.append("app", "sanlykarz");
|
||||
formData.append("id", borrowerData.idNo);
|
||||
formData.append("md-order", paymentDetails["md-order"]);
|
||||
formData.append("acs-req-id", submitCardDetails["acs-request-id"]);
|
||||
formData.append("acs-session-url", submitCardDetails["acs-session-url"]);
|
||||
formData.append("otp", codeValue);
|
||||
formData.append("term-url", submitCardDetails["terminate-url"]);
|
||||
|
||||
const response = await fetch('https://shahsyotag.halkbank.gov.tm/api/v1/confirm-payment', {
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: formData.toString(),
|
||||
});
|
||||
const response = await fetch(
|
||||
"https://shahsyotag.halkbank.gov.tm/api/v1/confirm-payment",
|
||||
{
|
||||
method: "POST",
|
||||
headers: headers,
|
||||
body: formData.toString(),
|
||||
}
|
||||
);
|
||||
|
||||
const jsonedResponse = await response.json();
|
||||
|
||||
|
|
@ -77,13 +80,16 @@ const PhoneAccept = ({
|
|||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
}
|
||||
|
||||
if (jsonedResponse.status === 'ok' && jsonedResponse['final-url'].includes('status=1')) {
|
||||
console.log(jsonedResponse['final-url']);
|
||||
if (
|
||||
jsonedResponse.status === "ok" &&
|
||||
jsonedResponse["final-url"].includes("status=1")
|
||||
) {
|
||||
console.log(jsonedResponse["final-url"]);
|
||||
setInvalidData(false);
|
||||
checkPayment();
|
||||
} else if (
|
||||
jsonedResponse.status === 'wrong-otp' ||
|
||||
!jsonedResponse['final-url'].includes('status=1')
|
||||
jsonedResponse.status === "wrong-otp" ||
|
||||
!jsonedResponse["final-url"].includes("status=1")
|
||||
) {
|
||||
setTryAgain(true);
|
||||
} else {
|
||||
|
|
@ -95,7 +101,7 @@ const PhoneAccept = ({
|
|||
const checkPayment = async () => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`https://shahsyotag.halkbank.gov.tm/app/api/check-payment-credit-card?paymentId=${paymentLink.id}&orderId=${paymentDetails['md-order']}&status=1`,
|
||||
`https://shahsyotag.halkbank.gov.tm/app/api/check-payment-credit-card?paymentId=${paymentLink.id}&orderId=${paymentDetails["md-order"]}&status=1`
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
@ -104,8 +110,8 @@ const PhoneAccept = ({
|
|||
|
||||
const jsonedResponse = await response.json();
|
||||
|
||||
if (jsonedResponse.status.ErrorCode === '0') {
|
||||
console.log('success');
|
||||
if (jsonedResponse.status.ErrorCode === "0") {
|
||||
console.log("success");
|
||||
|
||||
sendCode();
|
||||
}
|
||||
|
|
@ -115,16 +121,19 @@ const PhoneAccept = ({
|
|||
};
|
||||
|
||||
const sendCode = async () => {
|
||||
console.log('startred');
|
||||
console.log("startred");
|
||||
|
||||
try {
|
||||
const response = await fetch('https://shahsyotag.halkbank.gov.tm/sendOTP', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'aplication/json' },
|
||||
body: JSON.stringify({
|
||||
phone_number: '+99361454210',
|
||||
}),
|
||||
});
|
||||
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) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
|
|
@ -139,19 +148,22 @@ const PhoneAccept = ({
|
|||
const confirmCode = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await fetch('https://shahsyotag.halkbank.gov.tm/validateOTP', {
|
||||
headers: { 'Content-Type': 'aplication/json' },
|
||||
method: 'POST',
|
||||
const response = await fetch(
|
||||
"https://shahsyotag.halkbank.gov.tm/validateOTP",
|
||||
{
|
||||
headers: { "Content-Type": "aplication/json" },
|
||||
method: "POST",
|
||||
|
||||
body: JSON.stringify({
|
||||
phone_number: '+99361454210',
|
||||
otp: codeValue,
|
||||
}),
|
||||
});
|
||||
body: JSON.stringify({
|
||||
phone_number: user.mobile_phone,
|
||||
otp: codeValue,
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
const jsonedResponse = await response.json();
|
||||
|
||||
if (jsonedResponse === 'OTP validated successfully') {
|
||||
if (jsonedResponse === "OTP validated successfully") {
|
||||
fetchData();
|
||||
} else {
|
||||
setErrMessage(true);
|
||||
|
|
@ -164,9 +176,9 @@ const PhoneAccept = ({
|
|||
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: {
|
||||
|
|
@ -176,7 +188,7 @@ const PhoneAccept = ({
|
|||
name: borrowerData.name,
|
||||
surname: borrowerData.surname,
|
||||
availableAmount: borrowerData.availableAmount,
|
||||
clientType: 'recipient',
|
||||
clientType: "recipient",
|
||||
signRecipient: borrowerData.signRecipient,
|
||||
},
|
||||
clientGuarantor: isGuranter
|
||||
|
|
@ -187,7 +199,7 @@ const PhoneAccept = ({
|
|||
name: guaranterData.name,
|
||||
surname: guaranterData.surname,
|
||||
availableAmount: guaranterData.availableAmount,
|
||||
clientType: 'guarantor',
|
||||
clientType: "guarantor",
|
||||
signGuarantor: guaranterData.signGuarantor,
|
||||
}
|
||||
: null,
|
||||
|
|
@ -196,7 +208,7 @@ const PhoneAccept = ({
|
|||
mrtIsInsuarance: isGuranter ? 0 : 1,
|
||||
termInYears: creditDuration,
|
||||
}),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
@ -221,15 +233,18 @@ const PhoneAccept = ({
|
|||
const sendData = async (requestBody) => {
|
||||
try {
|
||||
const headers = {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
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(requestBody.sign),
|
||||
});
|
||||
const response = await fetch(
|
||||
"https://shahsyotag.halkbank.gov.tm/app/api/quick_loans",
|
||||
{
|
||||
method: "POST",
|
||||
headers: headers,
|
||||
body: JSON.stringify(requestBody.sign),
|
||||
}
|
||||
);
|
||||
|
||||
const jsonedResponse = await response.json();
|
||||
if (!cardDetails) {
|
||||
|
|
@ -265,19 +280,23 @@ const PhoneAccept = ({
|
|||
return (
|
||||
<section className="imm-cs-1">
|
||||
<h1 className="cs-2-title">Error...</h1>
|
||||
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(8)}>
|
||||
<button
|
||||
type="button"
|
||||
className="sign-btn reg-btn"
|
||||
onClick={() => setStage(8)}
|
||||
>
|
||||
<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>
|
||||
|
|
@ -289,27 +308,34 @@ const PhoneAccept = ({
|
|||
<section className="imm-cs-1">
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<h2 className="cs-2-title">
|
||||
{locale === 'TKM'
|
||||
? 'Karzyň kalkulýatory'
|
||||
: locale === 'РУС'
|
||||
? 'Введите код с СМС оповещения, отправленный на номер '
|
||||
: locale === 'ENG'
|
||||
? 'Loan calculator'
|
||||
: 'Karzyň kalkulýatory'}
|
||||
{cardDetails ? '+99361454210' : submitCardDetails['three-d-secure-number']}
|
||||
{locale === "TKM"
|
||||
? "Karzyň kalkulýatory"
|
||||
: locale === "РУС"
|
||||
? "Введите код с СМС оповещения, отправленный на номер "
|
||||
: locale === "ENG"
|
||||
? "Loan calculator"
|
||||
: "Karzyň kalkulýatory"}
|
||||
{cardDetails
|
||||
? user.mobile_phone
|
||||
: submitCardDetails["three-d-secure-number"]}
|
||||
</h2>
|
||||
<div className="imm-credit-form-wrapper">
|
||||
<div className="input-block">
|
||||
<label htmlFor="code">
|
||||
{locale === 'TKM'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Код'
|
||||
: locale === 'ENG'
|
||||
? 'amount'
|
||||
: 'At'}
|
||||
{locale === "TKM"
|
||||
? "At"
|
||||
: locale === "РУС"
|
||||
? "Код"
|
||||
: locale === "ENG"
|
||||
? "amount"
|
||||
: "At"}
|
||||
</label>
|
||||
<input value={codeValue} onChange={handleCodeChange} type="text" id="code" />
|
||||
<input
|
||||
value={codeValue}
|
||||
onChange={handleCodeChange}
|
||||
type="text"
|
||||
id="code"
|
||||
/>
|
||||
{/* <span className="another-option" onClick={codeResend}>
|
||||
Отправить код снова
|
||||
</span> */}
|
||||
|
|
@ -330,19 +356,20 @@ const PhoneAccept = ({
|
|||
<button
|
||||
type="submit"
|
||||
className="sign-btn reg-btn"
|
||||
onClick={() => (cardDetails ? setStage(8) : setStage(13))}>
|
||||
onClick={() => (cardDetails ? setStage(8) : setStage(13))}
|
||||
>
|
||||
<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>
|
||||
|
|
@ -358,16 +385,17 @@ const PhoneAccept = ({
|
|||
}
|
||||
type="submit"
|
||||
onClick={onSubmit}
|
||||
className="sign-btn cu-btn">
|
||||
className="sign-btn cu-btn"
|
||||
>
|
||||
<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