// File generated from our OpenAPI spec by Stainless.

package com.increase.api.models.pendingtransactions

import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import com.increase.api.core.JsonValue
import com.increase.api.core.jsonMapper
import java.time.OffsetDateTime
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

internal class PendingTransactionTest {

    @Test
    fun create() {
        val pendingTransaction =
            PendingTransaction.builder()
                .id("pending_transaction_k1sfetcau2qbvjbzgju4")
                .accountId("account_in71c4amph0vgo2qllky")
                .amount(100L)
                .completedAt(null)
                .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                .currency(PendingTransaction.Currency.USD)
                .description("INVOICE 2468")
                .heldAmount(100L)
                .routeId("card_oubs0hwk5rn6knuecxg2")
                .routeType(PendingTransaction.RouteType.CARD)
                .source(
                    PendingTransaction.Source.builder()
                        .category(PendingTransaction.Source.Category.ACH_TRANSFER_INSTRUCTION)
                        .accountTransferInstruction(
                            PendingTransaction.Source.AccountTransferInstruction.builder()
                                .amount(100L)
                                .currency(
                                    PendingTransaction.Source.AccountTransferInstruction.Currency
                                        .USD
                                )
                                .transferId("account_transfer_7k9qe1ysdgqztnt63l7n")
                                .build()
                        )
                        .achTransferInstruction(
                            PendingTransaction.Source.AchTransferInstruction.builder()
                                .amount(100L)
                                .transferId("ach_transfer_uoxatyh3lt5evrsdvo7q")
                                .build()
                        )
                        .blockchainOfframpTransfer(
                            PendingTransaction.Source.BlockchainOfframpTransfer.builder()
                                .id("blockchain_offramp_transfer_sqd2x3ti6u2sy91v696m")
                                .token(
                                    PendingTransaction.Source.BlockchainOfframpTransfer.Token.USDC
                                )
                                .amount(10000L)
                                .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                .destinationAccountId("account_in71c4amph0vgo2qllky")
                                .initiatingTransactionHash(
                                    "0xcd7c2ab9e2075a3be3740c3a1f6e6e2c112e37d6b3f4a15e9e3e5a93b82c2c0a"
                                )
                                .sourceBlockchainAddressId(
                                    "blockchain_address_tijjpqp9t5d358ehydqi"
                                )
                                .status(
                                    PendingTransaction.Source.BlockchainOfframpTransfer.Status
                                        .SETTLED
                                )
                                .transactionId("transaction_uyrp7fld2ium70oa7oi")
                                .type(
                                    PendingTransaction.Source.BlockchainOfframpTransfer.Type
                                        .BLOCKCHAIN_OFFRAMP_TRANSFER
                                )
                                .build()
                        )
                        .blockchainOnrampTransferInstruction(
                            PendingTransaction.Source.BlockchainOnrampTransferInstruction.builder()
                                .amount(10000L)
                                .destinationBlockchainAddress(
                                    "0x304a554a310C7e546dfe434669C62820b7D83490"
                                )
                                .transferId("blockchain_onramp_transfer_sg8nzy569rk0dnfk28bv")
                                .build()
                        )
                        .cardAuthorization(
                            PendingTransaction.Source.CardAuthorization.builder()
                                .id("card_authorization_6iqxap6ivd0fo5eu3i8x")
                                .actioner(
                                    PendingTransaction.Source.CardAuthorization.Actioner.INCREASE
                                )
                                .additionalAmounts(
                                    PendingTransaction.Source.CardAuthorization.AdditionalAmounts
                                        .builder()
                                        .clinic(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Clinic
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .dental(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Dental
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .original(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Original
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .prescription(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Prescription
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .surcharge(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Surcharge
                                                .builder()
                                                .amount(10L)
                                                .currency("USD")
                                                .build()
                                        )
                                        .totalCumulative(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .TotalCumulative
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .totalHealthcare(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .TotalHealthcare
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .transit(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Transit
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .unknown(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Unknown
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .vision(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Vision
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .build()
                                )
                                .amount(100L)
                                .cardPaymentId("card_payment_nd3k2kacrqjli8482ave")
                                .currency(PendingTransaction.Source.CardAuthorization.Currency.USD)
                                .digitalWalletTokenId(null)
                                .direction(
                                    PendingTransaction.Source.CardAuthorization.Direction.SETTLEMENT
                                )
                                .expiresAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                .healthcare(
                                    PendingTransaction.Source.CardAuthorization.Healthcare.builder()
                                        .merchantNinetyPercentEligibility(
                                            PendingTransaction.Source.CardAuthorization.Healthcare
                                                .MerchantNinetyPercentEligibility
                                                .ELIGIBLE
                                        )
                                        .build()
                                )
                                .merchantAcceptorId("5665270011000168")
                                .merchantCategoryCode("5734")
                                .merchantCity("New York")
                                .merchantCountry("US")
                                .merchantDescriptor("AMAZON.COM")
                                .merchantPostalCode("10045")
                                .merchantState("NY")
                                .networkDetails(
                                    PendingTransaction.Source.CardAuthorization.NetworkDetails
                                        .builder()
                                        .category(
                                            PendingTransaction.Source.CardAuthorization
                                                .NetworkDetails
                                                .Category
                                                .VISA
                                        )
                                        .pulse(
                                            PendingTransaction.Source.CardAuthorization
                                                .NetworkDetails
                                                .Pulse
                                                .builder()
                                                .build()
                                        )
                                        .visa(
                                            PendingTransaction.Source.CardAuthorization
                                                .NetworkDetails
                                                .Visa
                                                .builder()
                                                .electronicCommerceIndicator(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .NetworkDetails
                                                        .Visa
                                                        .ElectronicCommerceIndicator
                                                        .SECURE_ELECTRONIC_COMMERCE
                                                )
                                                .pointOfServiceEntryMode(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .NetworkDetails
                                                        .Visa
                                                        .PointOfServiceEntryMode
                                                        .MANUAL
                                                )
                                                .standInProcessingReason(null)
                                                .terminalEntryCapability(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .NetworkDetails
                                                        .Visa
                                                        .TerminalEntryCapability
                                                        .MAGNETIC_STRIPE
                                                )
                                                .build()
                                        )
                                        .build()
                                )
                                .networkIdentifiers(
                                    PendingTransaction.Source.CardAuthorization.NetworkIdentifiers
                                        .builder()
                                        .authorizationIdentificationResponse(null)
                                        .retrievalReferenceNumber("785867080153")
                                        .traceNumber("487941")
                                        .transactionId("627199945183184")
                                        .build()
                                )
                                .networkRiskScore(10L)
                                .pendingTransactionId(null)
                                .physicalCardId(null)
                                .presentmentAmount(100L)
                                .presentmentCurrency("USD")
                                .processingCategory(
                                    PendingTransaction.Source.CardAuthorization.ProcessingCategory
                                        .PURCHASE
                                )
                                .realTimeDecisionId(null)
                                .addSchemeFee(
                                    PendingTransaction.Source.CardAuthorization.SchemeFee.builder()
                                        .amount("0.137465")
                                        .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                        .currency(
                                            PendingTransaction.Source.CardAuthorization.SchemeFee
                                                .Currency
                                                .USD
                                        )
                                        .feeType(
                                            PendingTransaction.Source.CardAuthorization.SchemeFee
                                                .FeeType
                                                .VISA_CORPORATE_ACCEPTANCE_FEE
                                        )
                                        .fixedComponent(null)
                                        .variableRate("0.0002")
                                        .build()
                                )
                                .terminalId("RCN5VNXS")
                                .type(
                                    PendingTransaction.Source.CardAuthorization.Type
                                        .CARD_AUTHORIZATION
                                )
                                .verification(
                                    PendingTransaction.Source.CardAuthorization.Verification
                                        .builder()
                                        .cardVerificationCode(
                                            PendingTransaction.Source.CardAuthorization.Verification
                                                .CardVerificationCode
                                                .builder()
                                                .result(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .Verification
                                                        .CardVerificationCode
                                                        .Result
                                                        .MATCH
                                                )
                                                .build()
                                        )
                                        .cardholderAddress(
                                            PendingTransaction.Source.CardAuthorization.Verification
                                                .CardholderAddress
                                                .builder()
                                                .actualLine1("33 Liberty Street")
                                                .actualPostalCode("94131")
                                                .providedLine1("33 Liberty Street")
                                                .providedPostalCode("94132")
                                                .result(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .Verification
                                                        .CardholderAddress
                                                        .Result
                                                        .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                                )
                                                .build()
                                        )
                                        .cardholderName(
                                            PendingTransaction.Source.CardAuthorization.Verification
                                                .CardholderName
                                                .builder()
                                                .providedFirstName("provided_first_name")
                                                .providedLastName("provided_last_name")
                                                .providedMiddleName("provided_middle_name")
                                                .build()
                                        )
                                        .build()
                                )
                                .build()
                        )
                        .cardPushTransferInstruction(
                            PendingTransaction.Source.CardPushTransferInstruction.builder()
                                .amount(100L)
                                .transferId("outbound_card_push_transfer_e0z9rdpamraczh4tvwye")
                                .build()
                        )
                        .checkDepositInstruction(
                            PendingTransaction.Source.CheckDepositInstruction.builder()
                                .amount(100L)
                                .backImageFileId("file_26khfk98mzfz90a11oqx")
                                .checkDepositId("check_deposit_f06n9gpg7sxn8t19lfc1")
                                .currency(
                                    PendingTransaction.Source.CheckDepositInstruction.Currency.USD
                                )
                                .frontImageFileId("file_makxrc67oh9l6sg7w9yc")
                                .build()
                        )
                        .checkTransferInstruction(
                            PendingTransaction.Source.CheckTransferInstruction.builder()
                                .amount(100L)
                                .currency(
                                    PendingTransaction.Source.CheckTransferInstruction.Currency.USD
                                )
                                .transferId("check_transfer_30b43acfu9vw8fyc4f5")
                                .build()
                        )
                        .fednowTransferInstruction(
                            PendingTransaction.Source.FednowTransferInstruction.builder()
                                .transferId("fednow_transfer_4i0mptrdu1mueg1196bg")
                                .build()
                        )
                        .inboundFundsHold(
                            PendingTransaction.Source.InboundFundsHold.builder()
                                .amount(100L)
                                .automaticallyReleasesAt(
                                    OffsetDateTime.parse("2020-01-31T23:59:59Z")
                                )
                                .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                .currency(PendingTransaction.Source.InboundFundsHold.Currency.USD)
                                .heldTransactionId("transaction_uyrp7fld2ium70oa7oi")
                                .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4")
                                .releasedAt(null)
                                .status(PendingTransaction.Source.InboundFundsHold.Status.HELD)
                                .type(
                                    PendingTransaction.Source.InboundFundsHold.Type
                                        .INBOUND_FUNDS_HOLD
                                )
                                .build()
                        )
                        .inboundWireTransferReversal(
                            PendingTransaction.Source.InboundWireTransferReversal.builder()
                                .inboundWireTransferId("inbound_wire_transfer_f228m6bmhtcxjco9pwp0")
                                .build()
                        )
                        .other(PendingTransaction.Source.Other.builder().build())
                        .realTimePaymentsTransferInstruction(
                            PendingTransaction.Source.RealTimePaymentsTransferInstruction.builder()
                                .amount(100L)
                                .transferId("real_time_payments_transfer_iyuhl5kdn7ssmup83mvq")
                                .build()
                        )
                        .swiftTransferInstruction(
                            PendingTransaction.Source.SwiftTransferInstruction.builder()
                                .transferId("swift_transfer_29h21xkng03788zwd3fh")
                                .build()
                        )
                        .userInitiatedHold(
                            PendingTransaction.Source.UserInitiatedHold.builder()
                                .putAdditionalProperty("foo", JsonValue.from("bar"))
                                .build()
                        )
                        .wireTransferInstruction(
                            PendingTransaction.Source.WireTransferInstruction.builder()
                                .accountNumber("987654321")
                                .amount(100L)
                                .messageToRecipient("HELLO")
                                .routingNumber("101050001")
                                .transferId("wire_transfer_5akynk7dqsq25qwk9q2u")
                                .build()
                        )
                        .build()
                )
                .status(PendingTransaction.Status.PENDING)
                .type(PendingTransaction.Type.PENDING_TRANSACTION)
                .build()

        assertThat(pendingTransaction.id()).isEqualTo("pending_transaction_k1sfetcau2qbvjbzgju4")
        assertThat(pendingTransaction.accountId()).isEqualTo("account_in71c4amph0vgo2qllky")
        assertThat(pendingTransaction.amount()).isEqualTo(100L)
        assertThat(pendingTransaction.completedAt()).isEmpty
        assertThat(pendingTransaction.createdAt())
            .isEqualTo(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
        assertThat(pendingTransaction.currency()).isEqualTo(PendingTransaction.Currency.USD)
        assertThat(pendingTransaction.description()).isEqualTo("INVOICE 2468")
        assertThat(pendingTransaction.heldAmount()).isEqualTo(100L)
        assertThat(pendingTransaction.routeId()).contains("card_oubs0hwk5rn6knuecxg2")
        assertThat(pendingTransaction.routeType()).contains(PendingTransaction.RouteType.CARD)
        assertThat(pendingTransaction.source())
            .isEqualTo(
                PendingTransaction.Source.builder()
                    .category(PendingTransaction.Source.Category.ACH_TRANSFER_INSTRUCTION)
                    .accountTransferInstruction(
                        PendingTransaction.Source.AccountTransferInstruction.builder()
                            .amount(100L)
                            .currency(
                                PendingTransaction.Source.AccountTransferInstruction.Currency.USD
                            )
                            .transferId("account_transfer_7k9qe1ysdgqztnt63l7n")
                            .build()
                    )
                    .achTransferInstruction(
                        PendingTransaction.Source.AchTransferInstruction.builder()
                            .amount(100L)
                            .transferId("ach_transfer_uoxatyh3lt5evrsdvo7q")
                            .build()
                    )
                    .blockchainOfframpTransfer(
                        PendingTransaction.Source.BlockchainOfframpTransfer.builder()
                            .id("blockchain_offramp_transfer_sqd2x3ti6u2sy91v696m")
                            .token(PendingTransaction.Source.BlockchainOfframpTransfer.Token.USDC)
                            .amount(10000L)
                            .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                            .destinationAccountId("account_in71c4amph0vgo2qllky")
                            .initiatingTransactionHash(
                                "0xcd7c2ab9e2075a3be3740c3a1f6e6e2c112e37d6b3f4a15e9e3e5a93b82c2c0a"
                            )
                            .sourceBlockchainAddressId("blockchain_address_tijjpqp9t5d358ehydqi")
                            .status(
                                PendingTransaction.Source.BlockchainOfframpTransfer.Status.SETTLED
                            )
                            .transactionId("transaction_uyrp7fld2ium70oa7oi")
                            .type(
                                PendingTransaction.Source.BlockchainOfframpTransfer.Type
                                    .BLOCKCHAIN_OFFRAMP_TRANSFER
                            )
                            .build()
                    )
                    .blockchainOnrampTransferInstruction(
                        PendingTransaction.Source.BlockchainOnrampTransferInstruction.builder()
                            .amount(10000L)
                            .destinationBlockchainAddress(
                                "0x304a554a310C7e546dfe434669C62820b7D83490"
                            )
                            .transferId("blockchain_onramp_transfer_sg8nzy569rk0dnfk28bv")
                            .build()
                    )
                    .cardAuthorization(
                        PendingTransaction.Source.CardAuthorization.builder()
                            .id("card_authorization_6iqxap6ivd0fo5eu3i8x")
                            .actioner(PendingTransaction.Source.CardAuthorization.Actioner.INCREASE)
                            .additionalAmounts(
                                PendingTransaction.Source.CardAuthorization.AdditionalAmounts
                                    .builder()
                                    .clinic(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .Clinic
                                            .builder()
                                            .amount(0L)
                                            .currency("currency")
                                            .build()
                                    )
                                    .dental(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .Dental
                                            .builder()
                                            .amount(0L)
                                            .currency("currency")
                                            .build()
                                    )
                                    .original(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .Original
                                            .builder()
                                            .amount(0L)
                                            .currency("currency")
                                            .build()
                                    )
                                    .prescription(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .Prescription
                                            .builder()
                                            .amount(0L)
                                            .currency("currency")
                                            .build()
                                    )
                                    .surcharge(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .Surcharge
                                            .builder()
                                            .amount(10L)
                                            .currency("USD")
                                            .build()
                                    )
                                    .totalCumulative(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .TotalCumulative
                                            .builder()
                                            .amount(0L)
                                            .currency("currency")
                                            .build()
                                    )
                                    .totalHealthcare(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .TotalHealthcare
                                            .builder()
                                            .amount(0L)
                                            .currency("currency")
                                            .build()
                                    )
                                    .transit(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .Transit
                                            .builder()
                                            .amount(0L)
                                            .currency("currency")
                                            .build()
                                    )
                                    .unknown(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .Unknown
                                            .builder()
                                            .amount(0L)
                                            .currency("currency")
                                            .build()
                                    )
                                    .vision(
                                        PendingTransaction.Source.CardAuthorization
                                            .AdditionalAmounts
                                            .Vision
                                            .builder()
                                            .amount(0L)
                                            .currency("currency")
                                            .build()
                                    )
                                    .build()
                            )
                            .amount(100L)
                            .cardPaymentId("card_payment_nd3k2kacrqjli8482ave")
                            .currency(PendingTransaction.Source.CardAuthorization.Currency.USD)
                            .digitalWalletTokenId(null)
                            .direction(
                                PendingTransaction.Source.CardAuthorization.Direction.SETTLEMENT
                            )
                            .expiresAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                            .healthcare(
                                PendingTransaction.Source.CardAuthorization.Healthcare.builder()
                                    .merchantNinetyPercentEligibility(
                                        PendingTransaction.Source.CardAuthorization.Healthcare
                                            .MerchantNinetyPercentEligibility
                                            .ELIGIBLE
                                    )
                                    .build()
                            )
                            .merchantAcceptorId("5665270011000168")
                            .merchantCategoryCode("5734")
                            .merchantCity("New York")
                            .merchantCountry("US")
                            .merchantDescriptor("AMAZON.COM")
                            .merchantPostalCode("10045")
                            .merchantState("NY")
                            .networkDetails(
                                PendingTransaction.Source.CardAuthorization.NetworkDetails.builder()
                                    .category(
                                        PendingTransaction.Source.CardAuthorization.NetworkDetails
                                            .Category
                                            .VISA
                                    )
                                    .pulse(
                                        PendingTransaction.Source.CardAuthorization.NetworkDetails
                                            .Pulse
                                            .builder()
                                            .build()
                                    )
                                    .visa(
                                        PendingTransaction.Source.CardAuthorization.NetworkDetails
                                            .Visa
                                            .builder()
                                            .electronicCommerceIndicator(
                                                PendingTransaction.Source.CardAuthorization
                                                    .NetworkDetails
                                                    .Visa
                                                    .ElectronicCommerceIndicator
                                                    .SECURE_ELECTRONIC_COMMERCE
                                            )
                                            .pointOfServiceEntryMode(
                                                PendingTransaction.Source.CardAuthorization
                                                    .NetworkDetails
                                                    .Visa
                                                    .PointOfServiceEntryMode
                                                    .MANUAL
                                            )
                                            .standInProcessingReason(null)
                                            .terminalEntryCapability(
                                                PendingTransaction.Source.CardAuthorization
                                                    .NetworkDetails
                                                    .Visa
                                                    .TerminalEntryCapability
                                                    .MAGNETIC_STRIPE
                                            )
                                            .build()
                                    )
                                    .build()
                            )
                            .networkIdentifiers(
                                PendingTransaction.Source.CardAuthorization.NetworkIdentifiers
                                    .builder()
                                    .authorizationIdentificationResponse(null)
                                    .retrievalReferenceNumber("785867080153")
                                    .traceNumber("487941")
                                    .transactionId("627199945183184")
                                    .build()
                            )
                            .networkRiskScore(10L)
                            .pendingTransactionId(null)
                            .physicalCardId(null)
                            .presentmentAmount(100L)
                            .presentmentCurrency("USD")
                            .processingCategory(
                                PendingTransaction.Source.CardAuthorization.ProcessingCategory
                                    .PURCHASE
                            )
                            .realTimeDecisionId(null)
                            .addSchemeFee(
                                PendingTransaction.Source.CardAuthorization.SchemeFee.builder()
                                    .amount("0.137465")
                                    .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                    .currency(
                                        PendingTransaction.Source.CardAuthorization.SchemeFee
                                            .Currency
                                            .USD
                                    )
                                    .feeType(
                                        PendingTransaction.Source.CardAuthorization.SchemeFee
                                            .FeeType
                                            .VISA_CORPORATE_ACCEPTANCE_FEE
                                    )
                                    .fixedComponent(null)
                                    .variableRate("0.0002")
                                    .build()
                            )
                            .terminalId("RCN5VNXS")
                            .type(
                                PendingTransaction.Source.CardAuthorization.Type.CARD_AUTHORIZATION
                            )
                            .verification(
                                PendingTransaction.Source.CardAuthorization.Verification.builder()
                                    .cardVerificationCode(
                                        PendingTransaction.Source.CardAuthorization.Verification
                                            .CardVerificationCode
                                            .builder()
                                            .result(
                                                PendingTransaction.Source.CardAuthorization
                                                    .Verification
                                                    .CardVerificationCode
                                                    .Result
                                                    .MATCH
                                            )
                                            .build()
                                    )
                                    .cardholderAddress(
                                        PendingTransaction.Source.CardAuthorization.Verification
                                            .CardholderAddress
                                            .builder()
                                            .actualLine1("33 Liberty Street")
                                            .actualPostalCode("94131")
                                            .providedLine1("33 Liberty Street")
                                            .providedPostalCode("94132")
                                            .result(
                                                PendingTransaction.Source.CardAuthorization
                                                    .Verification
                                                    .CardholderAddress
                                                    .Result
                                                    .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                            )
                                            .build()
                                    )
                                    .cardholderName(
                                        PendingTransaction.Source.CardAuthorization.Verification
                                            .CardholderName
                                            .builder()
                                            .providedFirstName("provided_first_name")
                                            .providedLastName("provided_last_name")
                                            .providedMiddleName("provided_middle_name")
                                            .build()
                                    )
                                    .build()
                            )
                            .build()
                    )
                    .cardPushTransferInstruction(
                        PendingTransaction.Source.CardPushTransferInstruction.builder()
                            .amount(100L)
                            .transferId("outbound_card_push_transfer_e0z9rdpamraczh4tvwye")
                            .build()
                    )
                    .checkDepositInstruction(
                        PendingTransaction.Source.CheckDepositInstruction.builder()
                            .amount(100L)
                            .backImageFileId("file_26khfk98mzfz90a11oqx")
                            .checkDepositId("check_deposit_f06n9gpg7sxn8t19lfc1")
                            .currency(
                                PendingTransaction.Source.CheckDepositInstruction.Currency.USD
                            )
                            .frontImageFileId("file_makxrc67oh9l6sg7w9yc")
                            .build()
                    )
                    .checkTransferInstruction(
                        PendingTransaction.Source.CheckTransferInstruction.builder()
                            .amount(100L)
                            .currency(
                                PendingTransaction.Source.CheckTransferInstruction.Currency.USD
                            )
                            .transferId("check_transfer_30b43acfu9vw8fyc4f5")
                            .build()
                    )
                    .fednowTransferInstruction(
                        PendingTransaction.Source.FednowTransferInstruction.builder()
                            .transferId("fednow_transfer_4i0mptrdu1mueg1196bg")
                            .build()
                    )
                    .inboundFundsHold(
                        PendingTransaction.Source.InboundFundsHold.builder()
                            .amount(100L)
                            .automaticallyReleasesAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                            .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                            .currency(PendingTransaction.Source.InboundFundsHold.Currency.USD)
                            .heldTransactionId("transaction_uyrp7fld2ium70oa7oi")
                            .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4")
                            .releasedAt(null)
                            .status(PendingTransaction.Source.InboundFundsHold.Status.HELD)
                            .type(
                                PendingTransaction.Source.InboundFundsHold.Type.INBOUND_FUNDS_HOLD
                            )
                            .build()
                    )
                    .inboundWireTransferReversal(
                        PendingTransaction.Source.InboundWireTransferReversal.builder()
                            .inboundWireTransferId("inbound_wire_transfer_f228m6bmhtcxjco9pwp0")
                            .build()
                    )
                    .other(PendingTransaction.Source.Other.builder().build())
                    .realTimePaymentsTransferInstruction(
                        PendingTransaction.Source.RealTimePaymentsTransferInstruction.builder()
                            .amount(100L)
                            .transferId("real_time_payments_transfer_iyuhl5kdn7ssmup83mvq")
                            .build()
                    )
                    .swiftTransferInstruction(
                        PendingTransaction.Source.SwiftTransferInstruction.builder()
                            .transferId("swift_transfer_29h21xkng03788zwd3fh")
                            .build()
                    )
                    .userInitiatedHold(
                        PendingTransaction.Source.UserInitiatedHold.builder()
                            .putAdditionalProperty("foo", JsonValue.from("bar"))
                            .build()
                    )
                    .wireTransferInstruction(
                        PendingTransaction.Source.WireTransferInstruction.builder()
                            .accountNumber("987654321")
                            .amount(100L)
                            .messageToRecipient("HELLO")
                            .routingNumber("101050001")
                            .transferId("wire_transfer_5akynk7dqsq25qwk9q2u")
                            .build()
                    )
                    .build()
            )
        assertThat(pendingTransaction.status()).isEqualTo(PendingTransaction.Status.PENDING)
        assertThat(pendingTransaction.type()).isEqualTo(PendingTransaction.Type.PENDING_TRANSACTION)
    }

    @Test
    fun roundtrip() {
        val jsonMapper = jsonMapper()
        val pendingTransaction =
            PendingTransaction.builder()
                .id("pending_transaction_k1sfetcau2qbvjbzgju4")
                .accountId("account_in71c4amph0vgo2qllky")
                .amount(100L)
                .completedAt(null)
                .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                .currency(PendingTransaction.Currency.USD)
                .description("INVOICE 2468")
                .heldAmount(100L)
                .routeId("card_oubs0hwk5rn6knuecxg2")
                .routeType(PendingTransaction.RouteType.CARD)
                .source(
                    PendingTransaction.Source.builder()
                        .category(PendingTransaction.Source.Category.ACH_TRANSFER_INSTRUCTION)
                        .accountTransferInstruction(
                            PendingTransaction.Source.AccountTransferInstruction.builder()
                                .amount(100L)
                                .currency(
                                    PendingTransaction.Source.AccountTransferInstruction.Currency
                                        .USD
                                )
                                .transferId("account_transfer_7k9qe1ysdgqztnt63l7n")
                                .build()
                        )
                        .achTransferInstruction(
                            PendingTransaction.Source.AchTransferInstruction.builder()
                                .amount(100L)
                                .transferId("ach_transfer_uoxatyh3lt5evrsdvo7q")
                                .build()
                        )
                        .blockchainOfframpTransfer(
                            PendingTransaction.Source.BlockchainOfframpTransfer.builder()
                                .id("blockchain_offramp_transfer_sqd2x3ti6u2sy91v696m")
                                .token(
                                    PendingTransaction.Source.BlockchainOfframpTransfer.Token.USDC
                                )
                                .amount(10000L)
                                .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                .destinationAccountId("account_in71c4amph0vgo2qllky")
                                .initiatingTransactionHash(
                                    "0xcd7c2ab9e2075a3be3740c3a1f6e6e2c112e37d6b3f4a15e9e3e5a93b82c2c0a"
                                )
                                .sourceBlockchainAddressId(
                                    "blockchain_address_tijjpqp9t5d358ehydqi"
                                )
                                .status(
                                    PendingTransaction.Source.BlockchainOfframpTransfer.Status
                                        .SETTLED
                                )
                                .transactionId("transaction_uyrp7fld2ium70oa7oi")
                                .type(
                                    PendingTransaction.Source.BlockchainOfframpTransfer.Type
                                        .BLOCKCHAIN_OFFRAMP_TRANSFER
                                )
                                .build()
                        )
                        .blockchainOnrampTransferInstruction(
                            PendingTransaction.Source.BlockchainOnrampTransferInstruction.builder()
                                .amount(10000L)
                                .destinationBlockchainAddress(
                                    "0x304a554a310C7e546dfe434669C62820b7D83490"
                                )
                                .transferId("blockchain_onramp_transfer_sg8nzy569rk0dnfk28bv")
                                .build()
                        )
                        .cardAuthorization(
                            PendingTransaction.Source.CardAuthorization.builder()
                                .id("card_authorization_6iqxap6ivd0fo5eu3i8x")
                                .actioner(
                                    PendingTransaction.Source.CardAuthorization.Actioner.INCREASE
                                )
                                .additionalAmounts(
                                    PendingTransaction.Source.CardAuthorization.AdditionalAmounts
                                        .builder()
                                        .clinic(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Clinic
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .dental(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Dental
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .original(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Original
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .prescription(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Prescription
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .surcharge(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Surcharge
                                                .builder()
                                                .amount(10L)
                                                .currency("USD")
                                                .build()
                                        )
                                        .totalCumulative(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .TotalCumulative
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .totalHealthcare(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .TotalHealthcare
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .transit(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Transit
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .unknown(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Unknown
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .vision(
                                            PendingTransaction.Source.CardAuthorization
                                                .AdditionalAmounts
                                                .Vision
                                                .builder()
                                                .amount(0L)
                                                .currency("currency")
                                                .build()
                                        )
                                        .build()
                                )
                                .amount(100L)
                                .cardPaymentId("card_payment_nd3k2kacrqjli8482ave")
                                .currency(PendingTransaction.Source.CardAuthorization.Currency.USD)
                                .digitalWalletTokenId(null)
                                .direction(
                                    PendingTransaction.Source.CardAuthorization.Direction.SETTLEMENT
                                )
                                .expiresAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                .healthcare(
                                    PendingTransaction.Source.CardAuthorization.Healthcare.builder()
                                        .merchantNinetyPercentEligibility(
                                            PendingTransaction.Source.CardAuthorization.Healthcare
                                                .MerchantNinetyPercentEligibility
                                                .ELIGIBLE
                                        )
                                        .build()
                                )
                                .merchantAcceptorId("5665270011000168")
                                .merchantCategoryCode("5734")
                                .merchantCity("New York")
                                .merchantCountry("US")
                                .merchantDescriptor("AMAZON.COM")
                                .merchantPostalCode("10045")
                                .merchantState("NY")
                                .networkDetails(
                                    PendingTransaction.Source.CardAuthorization.NetworkDetails
                                        .builder()
                                        .category(
                                            PendingTransaction.Source.CardAuthorization
                                                .NetworkDetails
                                                .Category
                                                .VISA
                                        )
                                        .pulse(
                                            PendingTransaction.Source.CardAuthorization
                                                .NetworkDetails
                                                .Pulse
                                                .builder()
                                                .build()
                                        )
                                        .visa(
                                            PendingTransaction.Source.CardAuthorization
                                                .NetworkDetails
                                                .Visa
                                                .builder()
                                                .electronicCommerceIndicator(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .NetworkDetails
                                                        .Visa
                                                        .ElectronicCommerceIndicator
                                                        .SECURE_ELECTRONIC_COMMERCE
                                                )
                                                .pointOfServiceEntryMode(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .NetworkDetails
                                                        .Visa
                                                        .PointOfServiceEntryMode
                                                        .MANUAL
                                                )
                                                .standInProcessingReason(null)
                                                .terminalEntryCapability(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .NetworkDetails
                                                        .Visa
                                                        .TerminalEntryCapability
                                                        .MAGNETIC_STRIPE
                                                )
                                                .build()
                                        )
                                        .build()
                                )
                                .networkIdentifiers(
                                    PendingTransaction.Source.CardAuthorization.NetworkIdentifiers
                                        .builder()
                                        .authorizationIdentificationResponse(null)
                                        .retrievalReferenceNumber("785867080153")
                                        .traceNumber("487941")
                                        .transactionId("627199945183184")
                                        .build()
                                )
                                .networkRiskScore(10L)
                                .pendingTransactionId(null)
                                .physicalCardId(null)
                                .presentmentAmount(100L)
                                .presentmentCurrency("USD")
                                .processingCategory(
                                    PendingTransaction.Source.CardAuthorization.ProcessingCategory
                                        .PURCHASE
                                )
                                .realTimeDecisionId(null)
                                .addSchemeFee(
                                    PendingTransaction.Source.CardAuthorization.SchemeFee.builder()
                                        .amount("0.137465")
                                        .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                        .currency(
                                            PendingTransaction.Source.CardAuthorization.SchemeFee
                                                .Currency
                                                .USD
                                        )
                                        .feeType(
                                            PendingTransaction.Source.CardAuthorization.SchemeFee
                                                .FeeType
                                                .VISA_CORPORATE_ACCEPTANCE_FEE
                                        )
                                        .fixedComponent(null)
                                        .variableRate("0.0002")
                                        .build()
                                )
                                .terminalId("RCN5VNXS")
                                .type(
                                    PendingTransaction.Source.CardAuthorization.Type
                                        .CARD_AUTHORIZATION
                                )
                                .verification(
                                    PendingTransaction.Source.CardAuthorization.Verification
                                        .builder()
                                        .cardVerificationCode(
                                            PendingTransaction.Source.CardAuthorization.Verification
                                                .CardVerificationCode
                                                .builder()
                                                .result(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .Verification
                                                        .CardVerificationCode
                                                        .Result
                                                        .MATCH
                                                )
                                                .build()
                                        )
                                        .cardholderAddress(
                                            PendingTransaction.Source.CardAuthorization.Verification
                                                .CardholderAddress
                                                .builder()
                                                .actualLine1("33 Liberty Street")
                                                .actualPostalCode("94131")
                                                .providedLine1("33 Liberty Street")
                                                .providedPostalCode("94132")
                                                .result(
                                                    PendingTransaction.Source.CardAuthorization
                                                        .Verification
                                                        .CardholderAddress
                                                        .Result
                                                        .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                                )
                                                .build()
                                        )
                                        .cardholderName(
                                            PendingTransaction.Source.CardAuthorization.Verification
                                                .CardholderName
                                                .builder()
                                                .providedFirstName("provided_first_name")
                                                .providedLastName("provided_last_name")
                                                .providedMiddleName("provided_middle_name")
                                                .build()
                                        )
                                        .build()
                                )
                                .build()
                        )
                        .cardPushTransferInstruction(
                            PendingTransaction.Source.CardPushTransferInstruction.builder()
                                .amount(100L)
                                .transferId("outbound_card_push_transfer_e0z9rdpamraczh4tvwye")
                                .build()
                        )
                        .checkDepositInstruction(
                            PendingTransaction.Source.CheckDepositInstruction.builder()
                                .amount(100L)
                                .backImageFileId("file_26khfk98mzfz90a11oqx")
                                .checkDepositId("check_deposit_f06n9gpg7sxn8t19lfc1")
                                .currency(
                                    PendingTransaction.Source.CheckDepositInstruction.Currency.USD
                                )
                                .frontImageFileId("file_makxrc67oh9l6sg7w9yc")
                                .build()
                        )
                        .checkTransferInstruction(
                            PendingTransaction.Source.CheckTransferInstruction.builder()
                                .amount(100L)
                                .currency(
                                    PendingTransaction.Source.CheckTransferInstruction.Currency.USD
                                )
                                .transferId("check_transfer_30b43acfu9vw8fyc4f5")
                                .build()
                        )
                        .fednowTransferInstruction(
                            PendingTransaction.Source.FednowTransferInstruction.builder()
                                .transferId("fednow_transfer_4i0mptrdu1mueg1196bg")
                                .build()
                        )
                        .inboundFundsHold(
                            PendingTransaction.Source.InboundFundsHold.builder()
                                .amount(100L)
                                .automaticallyReleasesAt(
                                    OffsetDateTime.parse("2020-01-31T23:59:59Z")
                                )
                                .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                .currency(PendingTransaction.Source.InboundFundsHold.Currency.USD)
                                .heldTransactionId("transaction_uyrp7fld2ium70oa7oi")
                                .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4")
                                .releasedAt(null)
                                .status(PendingTransaction.Source.InboundFundsHold.Status.HELD)
                                .type(
                                    PendingTransaction.Source.InboundFundsHold.Type
                                        .INBOUND_FUNDS_HOLD
                                )
                                .build()
                        )
                        .inboundWireTransferReversal(
                            PendingTransaction.Source.InboundWireTransferReversal.builder()
                                .inboundWireTransferId("inbound_wire_transfer_f228m6bmhtcxjco9pwp0")
                                .build()
                        )
                        .other(PendingTransaction.Source.Other.builder().build())
                        .realTimePaymentsTransferInstruction(
                            PendingTransaction.Source.RealTimePaymentsTransferInstruction.builder()
                                .amount(100L)
                                .transferId("real_time_payments_transfer_iyuhl5kdn7ssmup83mvq")
                                .build()
                        )
                        .swiftTransferInstruction(
                            PendingTransaction.Source.SwiftTransferInstruction.builder()
                                .transferId("swift_transfer_29h21xkng03788zwd3fh")
                                .build()
                        )
                        .userInitiatedHold(
                            PendingTransaction.Source.UserInitiatedHold.builder()
                                .putAdditionalProperty("foo", JsonValue.from("bar"))
                                .build()
                        )
                        .wireTransferInstruction(
                            PendingTransaction.Source.WireTransferInstruction.builder()
                                .accountNumber("987654321")
                                .amount(100L)
                                .messageToRecipient("HELLO")
                                .routingNumber("101050001")
                                .transferId("wire_transfer_5akynk7dqsq25qwk9q2u")
                                .build()
                        )
                        .build()
                )
                .status(PendingTransaction.Status.PENDING)
                .type(PendingTransaction.Type.PENDING_TRANSACTION)
                .build()

        val roundtrippedPendingTransaction =
            jsonMapper.readValue(
                jsonMapper.writeValueAsString(pendingTransaction),
                jacksonTypeRef<PendingTransaction>(),
            )

        assertThat(roundtrippedPendingTransaction).isEqualTo(pendingTransaction)
    }
}
