|
1 |
| - |
2 | 1 | package com.example.zarinpal.data.remote.dto.inquiry
|
3 | 2 |
|
4 | 3 | import com.example.zarinpal.data.remote.dto.Config
|
5 | 4 | import kotlinx.serialization.SerialName
|
6 | 5 | import kotlinx.serialization.Serializable
|
7 | 6 |
|
8 | 7 | /**
|
9 |
| - * Represents the request data required to inquire about a payment. |
| 8 | + * Request data for inquiring about a payment. |
10 | 9 | *
|
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. |
14 | 13 | */
|
15 | 14 | @Serializable
|
16 | 15 | data class PaymentInquiryRequest(
|
17 | 16 | @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 | + |
22 | 22 | /**
|
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. |
28 | 25 | */
|
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 | + ) |
35 | 30 | }
|
0 commit comments