Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d38e5f4

Browse files
committedApr 1, 2025
The documented process for gateway creation had issues with correctly sending emails and phone numbers. This bug has been fixed.
1 parent c11bc70 commit d38e5f4

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed
 

‎build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
}
88

99
val ktorVersion = "1.6.3"
10-
val libraryVersion = "1.0.0"
10+
val libraryVersion = "1.0.1"
1111

1212

1313
android {

‎src/main/java/com/example/zarinpal/data/remote/PaymentService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ interface PaymentService {
115115
)
116116
}
117117
defaultRequest {
118-
header("User-Agent", "ZarinPalSdk/v.1.0.0 (android kotlin)")
118+
header("User-Agent", "ZarinPalSdk/v.1.0.1 (android kotlin)")
119119
header("Content-Type", "application/json")
120120
contentType(ContentType.Application.Json)
121121
}

‎src/main/java/com/example/zarinpal/data/remote/dto/create/CreatePaymentRequest.kt

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ data class CreatePaymentRequest(
2424
@SerialName("callback_url")
2525
val callbackUrl: String,
2626
val amount: Int,
27-
val mobile: String?=null,
28-
val email: String?=null,
27+
val metadata: Metadata? = null,
2928
@SerialName("referrer_id")
30-
val referrerId: String?=null,
31-
val currency: String?=null,
32-
val cardPan: String?=null,
33-
val wages: List<WagesPaymentRequest>?=null,
29+
val referrerId: String? = null,
30+
val currency: String? = null,
31+
val cardPan: String? = null,
32+
val wages: List<WagesPaymentRequest>? = null,
3433
) {
3534
/**
3635
* Creates a copy of the request with the merchantId and sandBox values
@@ -42,8 +41,41 @@ data class CreatePaymentRequest(
4241
sandBox = this.sandBox ?: config.sandBox
4342
)
4443
}
44+
45+
constructor(
46+
merchantId: String,
47+
sandBox: Boolean? = null,
48+
description: String,
49+
callbackUrl: String,
50+
amount: Int,
51+
mobile: String? = null,
52+
email: String? = null,
53+
referrerId: String? = null,
54+
currency: String? = null,
55+
cardPan: String? = null,
56+
wages: List<WagesPaymentRequest>? = null
57+
) : this(
58+
merchantId = merchantId,
59+
sandBox = sandBox,
60+
description = description,
61+
callbackUrl = callbackUrl,
62+
amount = amount,
63+
metadata = if (!mobile.isNullOrBlank() || !email.isNullOrBlank()) Metadata(mobile, email) else null,
64+
referrerId = referrerId,
65+
currency = currency,
66+
cardPan = cardPan,
67+
wages = wages
68+
)
69+
4570
}
4671

72+
@Keep
73+
@Serializable
74+
data class Metadata(
75+
val mobile: String? = null,
76+
val email: String? = null
77+
)
78+
4779

4880
@Keep
4981
@Serializable

0 commit comments

Comments
 (0)
Please sign in to comment.