diff --git a/src/main/java/com/example/zarinpal/data/remote/dto/unVerified/PaymentUnVerifiedRequest.kt b/src/main/java/com/example/zarinpal/data/remote/dto/unVerified/PaymentUnVerifiedRequest.kt index 2641356..d5aa62e 100644 --- a/src/main/java/com/example/zarinpal/data/remote/dto/unVerified/PaymentUnVerifiedRequest.kt +++ b/src/main/java/com/example/zarinpal/data/remote/dto/unVerified/PaymentUnVerifiedRequest.kt @@ -1,3 +1,4 @@ + package com.example.zarinpal.data.remote.dto.unVerified import com.example.zarinpal.data.remote.dto.Config @@ -5,25 +6,28 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable /** - * Request payload for unverified payment operations. + * Represents the request data required for unverified payment transactions. * - * @property merchantId Optional merchant ID; identifies the merchant making the request. - * @property sandBox Optional flag to indicate if the request is in sandbox (test) mode. + * @property merchantId The unique identifier for the merchant (nullable). + * @property sandBox Indicates if the request should be processed in sandbox mode (test mode). */ @Serializable data class PaymentUnVerifiedRequest( @SerialName("merchant_id") - val merchantId: String? = null, - val sandBox: Boolean? = null -) { + val merchantId: String?=null, + val sandBox :Boolean?=null, +){ /** - * Returns a new instance with missing fields populated from the provided [config]. + * Creates a copy of the request with the merchantId and sandBox values + * replaced by the ones from the provided [Config] if they are null. * - * @param config Configuration supplying default values. - * @return Updated [PaymentUnVerifiedRequest] instance. + * @param config The [Config] object that provides default values for merchantId and sandBox. + * @return A new instance of [PaymentUnVerifiedRequest] with updated values. */ - fun copyWithConfig(config: Config): PaymentUnVerifiedRequest = copy( - merchantId = merchantId ?: config.merchantId, - sandBox = sandBox ?: config.sandBox - ) + fun copyWithConfig(config: Config): PaymentUnVerifiedRequest { + return this.copy( + merchantId = this.merchantId ?: config.merchantId, + sandBox = this.sandBox ?: config.sandBox + ) + } }