Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api)!: reorganize check_transfer and network fields; add request_details; add unknown` #39

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
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
Expand Up @@ -14450,7 +14450,6 @@ private constructor(
private val merchantCity: JsonField<String>,
private val merchantCountry: JsonField<String>,
private val physicalCardId: JsonField<String>,
private val network: JsonField<Network>,
private val networkDetails: JsonField<NetworkDetails>,
private val amount: JsonField<Long>,
private val currency: JsonField<Currency>,
Expand Down Expand Up @@ -14495,9 +14494,6 @@ private constructor(
*/
fun physicalCardId(): String? = physicalCardId.getNullable("physical_card_id")

/** The payment network used to process this card authorization */
fun network(): Network = network.getRequired("network")

/** Fields specific to the `network` */
fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details")

Expand Down Expand Up @@ -14570,9 +14566,6 @@ private constructor(
@ExcludeMissing
fun _physicalCardId() = physicalCardId

/** The payment network used to process this card authorization */
@JsonProperty("network") @ExcludeMissing fun _network() = network

/** Fields specific to the `network` */
@JsonProperty("network_details")
@ExcludeMissing
Expand Down Expand Up @@ -14624,7 +14617,6 @@ private constructor(
merchantCity()
merchantCountry()
physicalCardId()
network()
networkDetails().validate()
amount()
currency()
Expand All @@ -14650,7 +14642,6 @@ private constructor(
this.merchantCity == other.merchantCity &&
this.merchantCountry == other.merchantCountry &&
this.physicalCardId == other.physicalCardId &&
this.network == other.network &&
this.networkDetails == other.networkDetails &&
this.amount == other.amount &&
this.currency == other.currency &&
Expand All @@ -14671,7 +14662,6 @@ private constructor(
merchantCity,
merchantCountry,
physicalCardId,
network,
networkDetails,
amount,
currency,
Expand All @@ -14686,7 +14676,7 @@ private constructor(
}

override fun toString() =
"CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, network=$network, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}"
"CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -14701,7 +14691,6 @@ private constructor(
private var merchantCity: JsonField<String> = JsonMissing.of()
private var merchantCountry: JsonField<String> = JsonMissing.of()
private var physicalCardId: JsonField<String> = JsonMissing.of()
private var network: JsonField<Network> = JsonMissing.of()
private var networkDetails: JsonField<NetworkDetails> = JsonMissing.of()
private var amount: JsonField<Long> = JsonMissing.of()
private var currency: JsonField<Currency> = JsonMissing.of()
Expand All @@ -14718,7 +14707,6 @@ private constructor(
this.merchantCity = cardDecline.merchantCity
this.merchantCountry = cardDecline.merchantCountry
this.physicalCardId = cardDecline.physicalCardId
this.network = cardDecline.network
this.networkDetails = cardDecline.networkDetails
this.amount = cardDecline.amount
this.currency = cardDecline.currency
Expand Down Expand Up @@ -14813,14 +14801,6 @@ private constructor(
this.physicalCardId = physicalCardId
}

/** The payment network used to process this card authorization */
fun network(network: Network) = network(JsonField.of(network))

/** The payment network used to process this card authorization */
@JsonProperty("network")
@ExcludeMissing
fun network(network: JsonField<Network>) = apply { this.network = network }

/** Fields specific to the `network` */
fun networkDetails(networkDetails: NetworkDetails) =
networkDetails(JsonField.of(networkDetails))
Expand Down Expand Up @@ -14936,7 +14916,6 @@ private constructor(
merchantCity,
merchantCountry,
physicalCardId,
network,
networkDetails,
amount,
currency,
Expand All @@ -14948,63 +14927,12 @@ private constructor(
)
}

class Network
@JsonCreator
private constructor(
private val value: JsonField<String>,
) {

@com.fasterxml.jackson.annotation.JsonValue
fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is Network && this.value == other.value
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

val VISA = Network(JsonField.of("visa"))

fun of(value: String) = Network(JsonField.of(value))
}

enum class Known {
VISA,
}

enum class Value {
VISA,
_UNKNOWN,
}

fun value(): Value =
when (this) {
VISA -> Value.VISA
else -> Value._UNKNOWN
}

fun known(): Known =
when (this) {
VISA -> Known.VISA
else -> throw IncreaseInvalidDataException("Unknown Network: $value")
}

fun asString(): String = _value().asStringOrThrow()
}

/** Fields specific to the `network` */
@JsonDeserialize(builder = NetworkDetails.Builder::class)
@NoAutoDetect
class NetworkDetails
private constructor(
private val category: JsonField<Category>,
private val visa: JsonField<Visa>,
private val additionalProperties: Map<String, JsonValue>,
) {
Expand All @@ -15013,8 +14941,14 @@ private constructor(

private var hashCode: Int = 0

/** The payment network used to process this card authorization */
fun category(): Category = category.getRequired("category")

/** Fields specific to the `visa` network */
fun visa(): Visa = visa.getRequired("visa")
fun visa(): Visa? = visa.getNullable("visa")

/** The payment network used to process this card authorization */
@JsonProperty("category") @ExcludeMissing fun _category() = category

/** Fields specific to the `visa` network */
@JsonProperty("visa") @ExcludeMissing fun _visa() = visa
Expand All @@ -15025,7 +14959,8 @@ private constructor(

fun validate(): NetworkDetails = apply {
if (!validated) {
visa().validate()
category()
visa()?.validate()
validated = true
}
}
Expand All @@ -15038,19 +14973,25 @@ private constructor(
}

return other is NetworkDetails &&
this.category == other.category &&
this.visa == other.visa &&
this.additionalProperties == other.additionalProperties
}

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = Objects.hash(visa, additionalProperties)
hashCode =
Objects.hash(
category,
visa,
additionalProperties,
)
}
return hashCode
}

override fun toString() =
"NetworkDetails{visa=$visa, additionalProperties=$additionalProperties}"
"NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -15059,15 +15000,27 @@ private constructor(

class Builder {

private var category: JsonField<Category> = JsonMissing.of()
private var visa: JsonField<Visa> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> =
mutableMapOf()

internal fun from(networkDetails: NetworkDetails) = apply {
this.category = networkDetails.category
this.visa = networkDetails.visa
additionalProperties(networkDetails.additionalProperties)
}

/** The payment network used to process this card authorization */
fun category(category: Category) = category(JsonField.of(category))

/** The payment network used to process this card authorization */
@JsonProperty("category")
@ExcludeMissing
fun category(category: JsonField<Category>) = apply {
this.category = category
}

/** Fields specific to the `visa` network */
fun visa(visa: Visa) = visa(JsonField.of(visa))

Expand All @@ -15092,7 +15045,64 @@ private constructor(
) = apply { this.additionalProperties.putAll(additionalProperties) }

fun build(): NetworkDetails =
NetworkDetails(visa, additionalProperties.toUnmodifiable())
NetworkDetails(
category,
visa,
additionalProperties.toUnmodifiable(),
)
}

class Category
@JsonCreator
private constructor(
private val value: JsonField<String>,
) {

@com.fasterxml.jackson.annotation.JsonValue
fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is Category && this.value == other.value
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

val VISA = Category(JsonField.of("visa"))

fun of(value: String) = Category(JsonField.of(value))
}

enum class Known {
VISA,
}

enum class Value {
VISA,
_UNKNOWN,
}

fun value(): Value =
when (this) {
VISA -> Value.VISA
else -> Value._UNKNOWN
}

fun known(): Known =
when (this) {
VISA -> Known.VISA
else ->
throw IncreaseInvalidDataException("Unknown Category: $value")
}

fun asString(): String = _value().asStringOrThrow()
}

/** Fields specific to the `visa` network */
Expand Down
Loading