Skip to content

Enhanced and organized. #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
945c22b
Update README.md
alirezabashi98 Feb 2, 2025
a7e14f8
fix conflict
alirezabashi98 Feb 4, 2025
c11bc70
Updating the document link
alirezabashi98 Apr 1, 2025
d38e5f4
The documented process for gateway creation had issues with correctly…
alirezabashi98 Apr 1, 2025
08c4e9b
Updating the version of the app
alirezabashi98 Apr 1, 2025
0d07eb7
Update README.md
alirezabashi98 Apr 1, 2025
a0e49c1
Update CreatePaymentRequest.kt
phoenixmariepornstaractress Apr 8, 2025
32771ea
Update CreatePaymentResponse.kt
phoenixmariepornstaractress Apr 8, 2025
76a9ef3
Update PaymentInquiryRequest.kt
phoenixmariepornstaractress Apr 8, 2025
fcebcf0
Update PaymentInquiryResponse.kt
phoenixmariepornstaractress Apr 8, 2025
0ad9350
Update GraphRefundModel.kt
phoenixmariepornstaractress Apr 8, 2025
bd875f1
Update PaymentRefundRequest.kt
phoenixmariepornstaractress Apr 8, 2025
709c44a
Update PaymentRefundResponse.kt
phoenixmariepornstaractress Apr 8, 2025
bd01da7
Update PaymentReverseRequest.kt
phoenixmariepornstaractress Apr 8, 2025
6c50221
Update PaymentReverseResponse.kt
phoenixmariepornstaractress Apr 8, 2025
4b9c38c
Update GraphTransactionModel.kt
phoenixmariepornstaractress Apr 8, 2025
ec6d915
Update TransactionRequest.kt
phoenixmariepornstaractress Apr 8, 2025
758ae36
Update TransactionResponse.kt
phoenixmariepornstaractress Apr 8, 2025
9d63c5d
Update PaymentUnVerifiedRequest.kt
phoenixmariepornstaractress Apr 8, 2025
804c217
Update PaymentUnVerifiedResponse.kt
phoenixmariepornstaractress Apr 8, 2025
d200983
Update PaymentVerifyRequest.kt
phoenixmariepornstaractress Apr 8, 2025
a4711d4
Update PaymentVerifyResponse.kt
phoenixmariepornstaractress Apr 8, 2025
0982f33
Update Config.kt
phoenixmariepornstaractress Apr 8, 2025
dcba5c5
Update FilterEnum.kt
phoenixmariepornstaractress Apr 8, 2025
8d7c11e
Update MethodEnum.kt
phoenixmariepornstaractress Apr 8, 2025
7d880f0
Update ReasonEnum.kt
phoenixmariepornstaractress Apr 8, 2025
98f439d
Update HttpRoutes.kt
phoenixmariepornstaractress Apr 8, 2025
53ef72f
Merge pull request #2 from phoenixmariepornstaractress/patch-17
alirezabashi98 Apr 23, 2025
df45fe0
Merge pull request #3 from phoenixmariepornstaractress/patch-14
alirezabashi98 Apr 23, 2025
772edda
Merge pull request #4 from phoenixmariepornstaractress/patch-13
alirezabashi98 Apr 23, 2025
c1e24cb
Merge pull request #5 from phoenixmariepornstaractress/patch-16
alirezabashi98 Apr 23, 2025
1147b0f
Merge pull request #6 from phoenixmariepornstaractress/patch-11
alirezabashi98 Apr 23, 2025
813fd63
Merge pull request #7 from phoenixmariepornstaractress/patch-10
alirezabashi98 Apr 23, 2025
6923f29
Merge pull request #8 from phoenixmariepornstaractress/patch-9
alirezabashi98 Apr 23, 2025
3882b90
Merge pull request #9 from phoenixmariepornstaractress/patch-15
alirezabashi98 Apr 23, 2025
8e3f63a
Merge pull request #10 from phoenixmariepornstaractress/patch-12
alirezabashi98 Apr 23, 2025
efdfe82
Merge pull request #11 from phoenixmariepornstaractress/patch-8
alirezabashi98 Apr 23, 2025
eea8e42
Merge pull request #12 from phoenixmariepornstaractress/patch-7
alirezabashi98 Apr 23, 2025
e3c27e9
Merge pull request #13 from phoenixmariepornstaractress/patch-4
alirezabashi98 Apr 23, 2025
dc95942
Merge pull request #14 from phoenixmariepornstaractress/patch-6
alirezabashi98 Apr 23, 2025
fa8b439
Merge pull request #15 from phoenixmariepornstaractress/patch-5
alirezabashi98 Apr 23, 2025
4c1c6b2
Merge pull request #16 from phoenixmariepornstaractress/patch-2
alirezabashi98 Apr 23, 2025
5fdf2eb
Merge pull request #17 from phoenixmariepornstaractress/patch-1
alirezabashi98 Apr 23, 2025
cd0c766
Merge pull request #18 from phoenixmariepornstaractress/patch-3
alirezabashi98 Apr 23, 2025
bfc915f
Merge branch 'ZarinPal:main' into main
phoenixmariepornstaractress Apr 23, 2025
4794b81
Update build.gradle.kts
phoenixmariepornstaractress Apr 26, 2025
0190e4e
Update ZarinPal.kt
phoenixmariepornstaractress Apr 26, 2025
2816b53
Update Validator.kt
phoenixmariepornstaractress Apr 26, 2025
660246d
Update PaymentServiceImpl.kt
phoenixmariepornstaractress Apr 26, 2025
beb5e9d
Update FilterEnum.kt
phoenixmariepornstaractress May 14, 2025
f059cc7
Update MethodEnum.kt
phoenixmariepornstaractress May 14, 2025
8716964
Update ReasonEnum.kt
phoenixmariepornstaractress May 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 65 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ZarinPal In App Billing - Purchase SDK | MPG
============================================
ZarinPal Purchase SDK Provides payment methods on your Android Application.
[پارسی](https://www.zarinpal.com/docs/sdkDocs/android/installation.html)
[پارسی](https://www.zarinpal.com/docs/sdk/android/installation.html)


Introduction
Expand Down Expand Up @@ -40,7 +40,7 @@ Add this to your root settings.gradle at the end of repositories.
Add the dependency:
```gradle
dependencies {
implementation("com.github.alirezabashi98:zarinpal-sdk:1.0.0")
implementation("com.github.ZarinPal:Android-SDK-Kotlin:1.0.1")
}
```

Expand Down Expand Up @@ -83,16 +83,17 @@ val request = CreatePaymentRequest(
description = "test"
)

try {
CoroutineScope(Dispatchers.IO).launch {
response =
CoroutineScope(Dispatchers.IO).launch {
try{
val response =
zarinPal.createPayment(request, redirectUrl = { paymentGatewayUri, status ->
if (status == 100)
print("paymentGatewayUri : $paymentGatewayUri")
Log.v("ZP_Log",paymentGatewayUri)
})
Log.v("ZP_Log","$response")
} catch (ex: Exception) {
ex.printStackTrace()
}
} catch (e: Exception) {
print(e.message)
}
```

Expand All @@ -107,13 +108,14 @@ val request = PaymentVerifyRequest(
amount = amount,
authority = "your authority"
)
try {
CoroutineScope(Dispatchers.IO).launch {
response = zarinPal.paymentVerify(request)
print(response)

CoroutineScope(Dispatchers.IO).launch {
try{
val response = zarinPal.paymentVerify(request)
Log.v("ZP_Log","$response")
} catch (ex: Exception) {
ex.printStackTrace()
}
} catch (e: Exception) {
print(e.message)
}
```

Expand All @@ -125,13 +127,14 @@ import com.example.zarinpal.data.remote.dto.inquiry.PaymentInquiryDataResponse
import com.example.zarinpal.data.remote.dto.inquiry.PaymentInquiryRequest

val request = PaymentInquiryRequest(authority = "authority")
try {
CoroutineScope(Dispatchers.IO).launch {
response = zarinPal.paymentInquiry(request)
print(response)

CoroutineScope(Dispatchers.IO).launch {
try{
val response = zarinPal.paymentInquiry(request)
Log.v("ZP_Log","$response")
} catch (ex: Exception) {
ex.printStackTrace()
}
} catch (e: Exception) {
print(e.message)
}
```

Expand All @@ -146,19 +149,19 @@ import com.example.zarinpal.data.remote.dto.unVerified.PaymentUnVerifiedRequest
import com.example.zarinpal.data.remote.dto.Config

val zarinPal = ZarinPal(
Config(
merchantId = "your-merchant-id",
)
Config(
merchantId = "your-merchant-id",
)
)

try {
CoroutineScope(Dispatchers.IO).launch {
response = zarinPal.paymentUnVerified()
print(response)
CoroutineScope(Dispatchers.IO).launch {
try{
val response = zarinPal.paymentUnVerified()
Log.v("ZP_Log","$response")
} catch (ex: Exception) {
ex.printStackTrace()
}
} catch (ex: Exception) {
print(ex.message)
}
}
```

**Transaction Reversal**
Expand All @@ -173,22 +176,23 @@ import com.example.zarinpal.data.remote.dto.reverse.PaymentReverseDataResponse
import com.example.zarinpal.data.remote.dto.reverse.PaymentReverseRequest

val zarinPal = ZarinPal(
Config(
merchantId = "your-merchant-id",
)
Config(
merchantId = "your-merchant-id",
)
)


try {
CoroutineScope(Dispatchers.IO).launch {
CoroutineScope(Dispatchers.IO).launch {
try{
val request = PaymentReverseRequest(
authority = "authority"
)
val response = zarinPal.paymentReverse(request)
print(response)
}
Log.v("ZP_Log","$response")
} catch (ex: Exception) {
print(ex.message)
ex.printStackTrace()
}
}
```

**Refund**
Expand All @@ -198,32 +202,26 @@ val zarinPal = ZarinPal(
```kotlin
import com.example.zarinpal.ZarinPal
import com.example.zarinpal.data.remote.dto.Config
import com.example.zarinpal.data.remote.dto.refund.PaymentRefundRequest
import com.example.zarinpal.data.remote.dto.refund.PaymentRefundResponse
import com.example.zarinpal.data.remote.dto.verification.PaymentVerificationDataResponse
import com.example.zarinpal.data.remote.enum.MethodEnum
import com.example.zarinpal.data.remote.enum.ReasonEnum
import com.example.zarinpal.data.remote.dto.reverse.PaymentReverseDataResponse
import com.example.zarinpal.data.remote.dto.reverse.PaymentReverseRequest

val zarinPal = ZarinPal(
Config(
merchantId = "your-merchant-id",
)
)

try {
CoroutineScope(Dispatchers.IO).launch {
val request = PaymentRefundRequest(
amount = 20000,
description = "des",
sessionId = "id",
method = MethodEnum.PAYA,
reason = ReasonEnum.OTHER,

CoroutineScope(Dispatchers.IO).launch {
try{
val request = PaymentReverseRequest(
authority = "authority"
)
val response = zarinPal.paymentRefund(request)
print(response)
val response = zarinPal.paymentReverse(request)
Log.v("ZP_Log","$response")
} catch (ex: Exception) {
ex.printStackTrace()
}
} catch (ex: Exception) {
print(ex.message)
}
```

Expand All @@ -240,23 +238,23 @@ import com.example.zarinpal.data.remote.dto.transaction.TransactionRequest
import com.example.zarinpal.data.remote.enum.FilterEnum

val zarinPal = ZarinPal(
Config(
token = "your-access-token",
)
Config(
token = "your-access-token",
)
)

try{
CoroutineScope(Dispatchers.IO).launch {
val request = TransactionRequest(
CoroutineScope(Dispatchers.IO).launch {
try{
val request = TransactionRequest(
terminalId = textFieldTerminalId.text,
filter = FilterEnum.ALL,
limit = 25,
offset = 0
)
val response = zarinPal.getTransactions(request)
print(response)
val response = zarinPal.getTransactions(request)
Log.v("ZP_Log","$response")
} catch (ex: Exception) {
ex.printStackTrace()
}
} catch (e: Exception) {
print(e.message)
}
```
}
```
65 changes: 37 additions & 28 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,19 @@ plugins {
}

val ktorVersion = "1.6.3"
val libraryVersion = "1.0.0"

val libraryVersion = "1.0.1"

android {
namespace = "com.example.zarinpal"
compileSdk = 34

publishing {
singleVariant("release") {
withSourcesJar()
}
}

defaultConfig {
aarMetadata {
minCompileSdk = 24
}
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
aarMetadata {
minCompileSdk = 24
}
}

buildTypes {
Expand All @@ -47,6 +40,12 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}
}

tasks.register<Jar>("javadocJar") {
Expand All @@ -64,20 +63,24 @@ publishing {
afterEvaluate {
from(components["release"])
}

artifact(tasks["javadocJar"]) {
classifier = "javadoc"
}

pom {
dependencies {
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-android:$ktorVersion")
implementation("io.ktor:ktor-client-serialization:$ktorVersion")
implementation("io.ktor:ktor-client-logging:$ktorVersion")
implementation("ch.qos.logback:logback-classic:1.2.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0")
listOf(
"io.ktor:ktor-client-core:$ktorVersion",
"io.ktor:ktor-client-android:$ktorVersion",
"io.ktor:ktor-client-serialization:$ktorVersion",
"io.ktor:ktor-client-logging:$ktorVersion",
"ch.qos.logback:logback-classic:1.2.3",
"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0"
).forEach {
implementation(it)
}
}

}
}
}
Expand All @@ -86,23 +89,29 @@ publishing {
maven {
url = uri("https://maven.pkg.github.com/alirezabashi98/zarinpal-sdk")
credentials {
credentials.username = System.getenv("GITHUB_USER")
credentials.password = System.getenv("GITHUB_TOKEN")
username = System.getenv("GITHUB_USER")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}

dependencies {
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-android:$ktorVersion")
implementation("io.ktor:ktor-client-serialization:$ktorVersion")
implementation("io.ktor:ktor-client-logging:$ktorVersion")
implementation("ch.qos.logback:logback-classic:1.2.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0")
implementation("androidx.core:core-ktx:1.13.0")
listOf(
"io.ktor:ktor-client-core:$ktorVersion",
"io.ktor:ktor-client-android:$ktorVersion",
"io.ktor:ktor-client-serialization:$ktorVersion",
"io.ktor:ktor-client-logging:$ktorVersion",
"ch.qos.logback:logback-classic:1.2.3",
"org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0",
"androidx.core:core-ktx:1.13.0"
).forEach {
implementation(it)
}
}

tasks.register<Copy>("copyLibs") {
from(configurations.getByName("implementation"))
into("libs")
}
}

Loading