Skip to content

Commit 50e2339

Browse files
Merge pull request #18 from phoenixmariepornstaractress/patch-3
Update PaymentInquiryRequest.kt
2 parents 7993760 + 0104d8d commit 50e2339

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed
Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
1-
21
package com.example.zarinpal.data.remote.dto.inquiry
32

43
import com.example.zarinpal.data.remote.dto.Config
54
import kotlinx.serialization.SerialName
65
import kotlinx.serialization.Serializable
76

87
/**
9-
* Represents the request data required to inquire about a payment.
8+
* Request data for inquiring about a payment.
109
*
11-
* @property merchantId The unique identifier for the merchant (nullable).
12-
* @property sandBox Indicates if the payment inquiry should be processed in sandbox mode (test mode).
13-
* @property authority The authorization code for the payment inquiry (required).
10+
* @property merchantId Optional merchant identifier.
11+
* @property sandBox Indicates whether to use sandbox (test) mode.
12+
* @property authority Required payment authority code.
1413
*/
1514
@Serializable
1615
data class PaymentInquiryRequest(
1716
@SerialName("merchant_id")
18-
val merchantId: String?=null,
19-
val sandBox :Boolean?=null,
20-
val authority :String,
21-
){
17+
val merchantId: String? = null,
18+
val sandBox: Boolean? = null,
19+
val authority: String
20+
) {
21+
2222
/**
23-
* Creates a copy of the request with the merchantId and sandBox values
24-
* replaced by the ones from the provided [Config] if they are null.
25-
*
26-
* @param config The [Config] object that provides default values for merchantId and sandBox.
27-
* @return A new instance of [PaymentInquiryRequest] with updated values.
23+
* Returns a copy of this request using fallback values from [config]
24+
* if [merchantId] or [sandBox] are null.
2825
*/
29-
fun copyWithConfig(config: Config): PaymentInquiryRequest {
30-
return this.copy(
31-
merchantId = this.merchantId ?: config.merchantId,
32-
sandBox = this.sandBox ?: config.sandBox
33-
)
34-
}
26+
fun copyWithConfig(config: Config): PaymentInquiryRequest = copy(
27+
merchantId = merchantId ?: config.merchantId,
28+
sandBox = sandBox ?: config.sandBox
29+
)
3530
}

0 commit comments

Comments
 (0)