All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.carpentum.sdk.payment.internal.generated.model.AuthTokenByActionRequestJsonJsonAdapter.kt Maven / Gradle / Ivy

The newest version!
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
    "RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
    "PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")

package tech.carpentum.sdk.payment.`internal`.generated.model

import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import java.lang.NullPointerException
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.emptySet
import kotlin.text.buildString
import tech.carpentum.sdk.payment.model.AuthTokenAction
import tech.carpentum.sdk.payment.model.CurrencyCode
import tech.carpentum.sdk.payment.model.Money
import tech.carpentum.sdk.payment.model.SettlementMethod

public class AuthTokenByActionRequestJsonJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("merchantCode", "secret",
      "validitySecs", "action", "idPayment", "money", "moneyProvided", "currencyCodeRequired",
      "moneyRequired", "currencyCodeProvided", "settlementMethod")

  private val nullableStringAdapter: JsonAdapter = moshi.adapter(String::class.java,
      emptySet(), "merchantCode")

  private val nullableIntAdapter: JsonAdapter = moshi.adapter(Int::class.javaObjectType,
      emptySet(), "validitySecs")

  private val nullableAuthTokenActionAdapter: JsonAdapter =
      moshi.adapter(AuthTokenAction::class.java, emptySet(), "action")

  private val nullableMoneyAdapter: JsonAdapter = moshi.adapter(Money::class.java,
      emptySet(), "money")

  private val nullableCurrencyCodeAdapter: JsonAdapter =
      moshi.adapter(CurrencyCode::class.java, emptySet(), "currencyCodeRequired")

  private val nullableSettlementMethodAdapter: JsonAdapter =
      moshi.adapter(SettlementMethod::class.java, emptySet(), "settlementMethod")

  public override fun toString(): String = buildString(50) {
      append("GeneratedJsonAdapter(").append("AuthTokenByActionRequestJson").append(')') }

  public override fun fromJson(reader: JsonReader): AuthTokenByActionRequestJson {
    var merchantCode: String? = null
    var merchantCodeSet: Boolean = false
    var secret: String? = null
    var secretSet: Boolean = false
    var validitySecs: Int? = null
    var validitySecsSet: Boolean = false
    var action: AuthTokenAction? = null
    var actionSet: Boolean = false
    var idPayment: String? = null
    var idPaymentSet: Boolean = false
    var money: Money? = null
    var moneySet: Boolean = false
    var moneyProvided: Money? = null
    var moneyProvidedSet: Boolean = false
    var currencyCodeRequired: CurrencyCode? = null
    var currencyCodeRequiredSet: Boolean = false
    var moneyRequired: Money? = null
    var moneyRequiredSet: Boolean = false
    var currencyCodeProvided: CurrencyCode? = null
    var currencyCodeProvidedSet: Boolean = false
    var settlementMethod: SettlementMethod? = null
    var settlementMethodSet: Boolean = false
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          merchantCode = nullableStringAdapter.fromJson(reader)
          merchantCodeSet = true
        }
        1 -> {
          secret = nullableStringAdapter.fromJson(reader)
          secretSet = true
        }
        2 -> {
          validitySecs = nullableIntAdapter.fromJson(reader)
          validitySecsSet = true
        }
        3 -> {
          action = nullableAuthTokenActionAdapter.fromJson(reader)
          actionSet = true
        }
        4 -> {
          idPayment = nullableStringAdapter.fromJson(reader)
          idPaymentSet = true
        }
        5 -> {
          money = nullableMoneyAdapter.fromJson(reader)
          moneySet = true
        }
        6 -> {
          moneyProvided = nullableMoneyAdapter.fromJson(reader)
          moneyProvidedSet = true
        }
        7 -> {
          currencyCodeRequired = nullableCurrencyCodeAdapter.fromJson(reader)
          currencyCodeRequiredSet = true
        }
        8 -> {
          moneyRequired = nullableMoneyAdapter.fromJson(reader)
          moneyRequiredSet = true
        }
        9 -> {
          currencyCodeProvided = nullableCurrencyCodeAdapter.fromJson(reader)
          currencyCodeProvidedSet = true
        }
        10 -> {
          settlementMethod = nullableSettlementMethodAdapter.fromJson(reader)
          settlementMethodSet = true
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    val result: AuthTokenByActionRequestJson
    result = AuthTokenByActionRequestJson(
    )
    if (merchantCodeSet) {
      result.merchantCode = merchantCode
    }
    if (secretSet) {
      result.secret = secret
    }
    if (validitySecsSet) {
      result.validitySecs = validitySecs
    }
    if (actionSet) {
      result.action = action
    }
    if (idPaymentSet) {
      result.idPayment = idPayment
    }
    if (moneySet) {
      result.money = money
    }
    if (moneyProvidedSet) {
      result.moneyProvided = moneyProvided
    }
    if (currencyCodeRequiredSet) {
      result.currencyCodeRequired = currencyCodeRequired
    }
    if (moneyRequiredSet) {
      result.moneyRequired = moneyRequired
    }
    if (currencyCodeProvidedSet) {
      result.currencyCodeProvided = currencyCodeProvided
    }
    if (settlementMethodSet) {
      result.settlementMethod = settlementMethod
    }
    return result
  }

  public override fun toJson(writer: JsonWriter, value_: AuthTokenByActionRequestJson?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("merchantCode")
    nullableStringAdapter.toJson(writer, value_.merchantCode)
    writer.name("secret")
    nullableStringAdapter.toJson(writer, value_.secret)
    writer.name("validitySecs")
    nullableIntAdapter.toJson(writer, value_.validitySecs)
    writer.name("action")
    nullableAuthTokenActionAdapter.toJson(writer, value_.action)
    writer.name("idPayment")
    nullableStringAdapter.toJson(writer, value_.idPayment)
    writer.name("money")
    nullableMoneyAdapter.toJson(writer, value_.money)
    writer.name("moneyProvided")
    nullableMoneyAdapter.toJson(writer, value_.moneyProvided)
    writer.name("currencyCodeRequired")
    nullableCurrencyCodeAdapter.toJson(writer, value_.currencyCodeRequired)
    writer.name("moneyRequired")
    nullableMoneyAdapter.toJson(writer, value_.moneyRequired)
    writer.name("currencyCodeProvided")
    nullableCurrencyCodeAdapter.toJson(writer, value_.currencyCodeProvided)
    writer.name("settlementMethod")
    nullableSettlementMethodAdapter.toJson(writer, value_.settlementMethod)
    writer.endObject()
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy