-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
1,320 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
"extends": "next/core-web-vitals", | ||
"rules": { | ||
"react/no-unescaped-entities": "off", | ||
"@next/next/no-img-element": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Metehan Alp Saral | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,20 @@ | ||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). | ||
# Istanbulkart | ||
|
||
## Getting Started | ||
Kişiye Özel Istanbulkart Uygulaması; kendi bilgisayarınızda kullanabileceğiniz ve özelleştirebileceğiniz bir arayüz sağlamaktadır. Tarayıcı tarafından takip edilmediğiniz sürece kişisel verileriniz iştahlı gözlerden uzak bir şekilde Istanbulkart'ınıza girebilirsiniz, en son nerede kullandığınızı görebilirsiniz. | ||
|
||
First, run the development server: | ||
## Gereksinimler | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
# or | ||
pnpm dev | ||
# or | ||
bun dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | ||
|
||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. | ||
|
||
## Learn More | ||
* [Node.js](https://nodejs.org/) | ||
* bir İstanbulkart | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
## Kurulum | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! | ||
|
||
## Deploy on Vercel | ||
```bash | ||
npm install | ||
``` | ||
|
||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
## Geliştirme | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. | ||
```bash | ||
npm run dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
$bg-color: #1C1D2B; | ||
$box-color: #0D0E17; | ||
$theme-color: #1581be; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import getRequest from "@/helpers/getRequest"; | ||
import { cookies } from "next/headers"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
export async function POST(req: NextRequest) { | ||
const cookieStore = cookies(); | ||
const token = String(cookieStore.get("IstKart_Token")?.value); | ||
const customerNumber = String(cookieStore.get("IstKart_ID")?.value); | ||
const sessionToken = String(cookieStore.get("IstKart_SToken")?.value); | ||
|
||
try { | ||
const getCardList = await getRequest({ | ||
token, | ||
command: "RI.OnGetCardList", | ||
data: { | ||
CustomerNumber: customerNumber, | ||
SessionToken: sessionToken, | ||
}, | ||
}); | ||
|
||
const cardListData = await getCardList.json(); | ||
|
||
if (cardListData.data.ResponseCode === "0") { | ||
return NextResponse.json({ | ||
status: true, | ||
list: cardListData.data.CardList, | ||
}); | ||
} | ||
} catch (error) { | ||
console.error("Error fetching card list:", error); | ||
} | ||
|
||
return NextResponse.json({ | ||
status: false, | ||
list: [], | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import getRequest from "@/helpers/getRequest"; | ||
import getThreeMonthsAgoDate from "@/utils/getThreeMonthsAgoDate"; | ||
import { cookies } from "next/headers"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
export async function POST(req: NextRequest) { | ||
const cookieStore = cookies(); | ||
const body: CardTransaction = await req.json(); | ||
|
||
if (!body.cardId) { | ||
return NextResponse.json({ | ||
status: false, | ||
list: [], | ||
}); | ||
} | ||
|
||
const token = String(cookieStore.get("IstKart_Token")?.value); | ||
const customerNumber = Number(String(cookieStore.get("IstKart_ID")?.value)); | ||
const sessionToken = String(cookieStore.get("IstKart_SToken")?.value); | ||
|
||
const getTransactionList = await getRequest({ | ||
token, | ||
command: "RI.OnGetCardTransactionList", | ||
data: { | ||
CustomerNumber: customerNumber, | ||
SessionToken: sessionToken, | ||
CardId: body.cardId, | ||
TrnType: 0, | ||
PageIndex: 1, | ||
PageSize: 30, | ||
StartDate: getThreeMonthsAgoDate(), | ||
EndDate: new Date().toISOString().slice(0, 10), | ||
}, | ||
}); | ||
|
||
try { | ||
const transactionListData = await getTransactionList.json(); | ||
|
||
if (transactionListData.data.ResponseCode === "0") { | ||
return NextResponse.json({ | ||
status: true, | ||
list: transactionListData.data.TransactionList, | ||
}); | ||
} | ||
} catch (error) { | ||
console.error("Error fetching transaction list:", error); | ||
} | ||
|
||
return NextResponse.json({ | ||
status: false, | ||
list: [], | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
interface CardTransaction { | ||
cardId: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import getRequest from "@/helpers/getRequest"; | ||
import getToken from "@/helpers/getToken"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
export async function POST(req: NextRequest) { | ||
const body: LoginBody = await req.json(); | ||
|
||
if (body.type === "SEND_SMS" && body.phone_number && body.password) { | ||
try { | ||
const tokenResponse = await getToken(); | ||
const token = await tokenResponse.json(); | ||
|
||
const loginResponse = await getRequest({ | ||
token: token.token, | ||
command: "RI.OnLogin", | ||
data: { | ||
CountryCode: "90", | ||
CellPhone: String(body.phone_number), | ||
Password: String(body.password), | ||
DeviceId: "1.1.1.1", | ||
OSType: 10, | ||
IPAdress: "1.1.1.1", | ||
Port: "", | ||
}, | ||
}); | ||
|
||
const loginData = await loginResponse.json(); | ||
|
||
if (loginData.data.ResponseCode === "0") { | ||
return NextResponse.json({ | ||
status: true, | ||
message: "SMS_SENT", | ||
token, | ||
login: loginData, | ||
}); | ||
} else { | ||
return NextResponse.json({ | ||
status: false, | ||
message: "ERROR", | ||
}); | ||
} | ||
} catch (error) { | ||
console.error("Error during login process:", error); | ||
return NextResponse.json({ | ||
status: false, | ||
message: "ERROR", | ||
}); | ||
} | ||
} else if (body.type === "SMS_CONTROL") { | ||
const smsControlResponse = await getRequest({ | ||
token: body.token, | ||
command: "RI.OnConfirmLoginSms", | ||
data: { | ||
CountryCode: "90", | ||
CellPhone: body.phone_number, | ||
SmsToken: body.sms_code, | ||
OSType: 10, | ||
AppVersion: "0.1.0", | ||
IPAdress: "", | ||
Port: "", | ||
}, | ||
}); | ||
|
||
const smsData = await smsControlResponse.json(); | ||
|
||
if (smsData.data.ResponseCode === "1020") { | ||
return NextResponse.json({ | ||
status: false, | ||
message: "WRONG_CODE", | ||
}); | ||
} else if (smsData.data.ResponseCode === "0") { | ||
return NextResponse.json({ | ||
status: true, | ||
message: "OK", | ||
data: smsData.data, | ||
}); | ||
} | ||
} | ||
|
||
return NextResponse.json({ | ||
status: false, | ||
message: "WTF", | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
interface LoginBody { | ||
phone_number: string | ||
password: string | ||
sms_code: string | ||
token: string | ||
type: "SEND_SMS" | "SMS_CONTROL" | ||
} |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
* { | ||
box-sizing: border-box; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
html, | ||
body { | ||
max-width: 100vw; | ||
overflow-x: hidden; | ||
} | ||
|
||
a { | ||
color: inherit; | ||
text-decoration: none; | ||
} |
Oops, something went wrong.