Skip to content
Closed
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@

package com.example.zarinpal.data.remote.dto.inquiry

import com.example.zarinpal.data.remote.dto.Config
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Request data for inquiring about a payment.
* Represents the request data required to inquire about a payment.
*
* @property merchantId Optional merchant identifier.
* @property sandBox Indicates whether to use sandbox (test) mode.
* @property authority Required payment authority code.
* @property merchantId The unique identifier for the merchant (nullable).
* @property sandBox Indicates if the payment inquiry should be processed in sandbox mode (test mode).
* @property authority The authorization code for the payment inquiry (required).
*/
@Serializable
data class PaymentInquiryRequest(
@SerialName("merchant_id")
val merchantId: String? = null,
val sandBox: Boolean? = null,
val authority: String
) {

val merchantId: String?=null,
val sandBox :Boolean?=null,
val authority :String,
){
/**
* Returns a copy of this request using fallback values from [config]
* if [merchantId] or [sandBox] are null.
* 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 The [Config] object that provides default values for merchantId and sandBox.
* @return A new instance of [PaymentInquiryRequest] with updated values.
*/
fun copyWithConfig(config: Config): PaymentInquiryRequest = copy(
merchantId = merchantId ?: config.merchantId,
sandBox = sandBox ?: config.sandBox
)
fun copyWithConfig(config: Config): PaymentInquiryRequest {
return this.copy(
merchantId = this.merchantId ?: config.merchantId,
sandBox = this.sandBox ?: config.sandBox
)
}
}