// File generated from our OpenAPI spec by Stainless.

package com.increase.api.models.declinedtransactions

import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
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 DeclinedTransactionListPageResponseTest {

    @Test
    fun create() {
        val declinedTransactionListPageResponse =
            DeclinedTransactionListPageResponse.builder()
                .addData(
                    DeclinedTransaction.builder()
                        .id("declined_transaction_17jbn0yyhvkt4v4ooym8")
                        .accountId("account_in71c4amph0vgo2qllky")
                        .amount(1750L)
                        .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                        .currency(DeclinedTransaction.Currency.USD)
                        .description("INVOICE 2468")
                        .routeId("account_number_v18nkfqm6afpsrvy82b2")
                        .routeType(DeclinedTransaction.RouteType.ACCOUNT_NUMBER)
                        .source(
                            DeclinedTransaction.Source.builder()
                                .category(DeclinedTransaction.Source.Category.ACH_DECLINE)
                                .achDecline(
                                    DeclinedTransaction.Source.AchDecline.builder()
                                        .id("ach_decline_72v1mcwxudctq56efipa")
                                        .amount(1750L)
                                        .inboundAchTransferId(
                                            "inbound_ach_transfer_tdrwqr3fq9gnnq49odev"
                                        )
                                        .originatorCompanyDescriptiveDate(null)
                                        .originatorCompanyDiscretionaryData(null)
                                        .originatorCompanyId("0987654321")
                                        .originatorCompanyName("BIG BANK")
                                        .reason(
                                            DeclinedTransaction.Source.AchDecline.Reason
                                                .INSUFFICIENT_FUNDS
                                        )
                                        .receiverIdNumber("12345678900")
                                        .receiverName("IAN CREASE")
                                        .traceNumber("021000038461022")
                                        .type(
                                            DeclinedTransaction.Source.AchDecline.Type.ACH_DECLINE
                                        )
                                        .build()
                                )
                                .cardDecline(
                                    DeclinedTransaction.Source.CardDecline.builder()
                                        .id("card_decline_bx3o8zd7glq8yvtwg25v")
                                        .actioner(
                                            DeclinedTransaction.Source.CardDecline.Actioner.INCREASE
                                        )
                                        .additionalAmounts(
                                            DeclinedTransaction.Source.CardDecline.AdditionalAmounts
                                                .builder()
                                                .clinic(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Clinic
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .dental(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Dental
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .original(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Original
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .prescription(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Prescription
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .surcharge(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Surcharge
                                                        .builder()
                                                        .amount(10L)
                                                        .currency("USD")
                                                        .build()
                                                )
                                                .totalCumulative(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .TotalCumulative
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .totalHealthcare(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .TotalHealthcare
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .transit(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Transit
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .unknown(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Unknown
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .vision(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Vision
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .build()
                                        )
                                        .amount(-1000L)
                                        .cardPaymentId("card_payment_nd3k2kacrqjli8482ave")
                                        .currency(
                                            DeclinedTransaction.Source.CardDecline.Currency.USD
                                        )
                                        .declinedTransactionId(
                                            "declined_transaction_17jbn0yyhvkt4v4ooym8"
                                        )
                                        .digitalWalletTokenId(null)
                                        .direction(
                                            DeclinedTransaction.Source.CardDecline.Direction
                                                .SETTLEMENT
                                        )
                                        .incrementedCardAuthorizationId(null)
                                        .merchantAcceptorId("5665270011000168")
                                        .merchantCategoryCode("5734")
                                        .merchantCity("New York")
                                        .merchantCountry("US")
                                        .merchantDescriptor("AMAZON.COM")
                                        .merchantPostalCode("10045")
                                        .merchantState(null)
                                        .networkDetails(
                                            DeclinedTransaction.Source.CardDecline.NetworkDetails
                                                .builder()
                                                .category(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .NetworkDetails
                                                        .Category
                                                        .VISA
                                                )
                                                .pulse(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .NetworkDetails
                                                        .Pulse
                                                        .builder()
                                                        .build()
                                                )
                                                .visa(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .NetworkDetails
                                                        .Visa
                                                        .builder()
                                                        .electronicCommerceIndicator(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .NetworkDetails
                                                                .Visa
                                                                .ElectronicCommerceIndicator
                                                                .SECURE_ELECTRONIC_COMMERCE
                                                        )
                                                        .pointOfServiceEntryMode(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .NetworkDetails
                                                                .Visa
                                                                .PointOfServiceEntryMode
                                                                .MANUAL
                                                        )
                                                        .standInProcessingReason(null)
                                                        .terminalEntryCapability(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .NetworkDetails
                                                                .Visa
                                                                .TerminalEntryCapability
                                                                .MAGNETIC_STRIPE
                                                        )
                                                        .build()
                                                )
                                                .build()
                                        )
                                        .networkIdentifiers(
                                            DeclinedTransaction.Source.CardDecline
                                                .NetworkIdentifiers
                                                .builder()
                                                .authorizationIdentificationResponse(null)
                                                .retrievalReferenceNumber("785867080153")
                                                .traceNumber("487941")
                                                .transactionId("627199945183184")
                                                .build()
                                        )
                                        .networkRiskScore(10L)
                                        .physicalCardId(null)
                                        .presentmentAmount(-1000L)
                                        .presentmentCurrency("USD")
                                        .processingCategory(
                                            DeclinedTransaction.Source.CardDecline
                                                .ProcessingCategory
                                                .PURCHASE
                                        )
                                        .realTimeDecisionId(null)
                                        .realTimeDecisionReason(null)
                                        .reason(
                                            DeclinedTransaction.Source.CardDecline.Reason
                                                .INSUFFICIENT_FUNDS
                                        )
                                        .addSchemeFee(
                                            DeclinedTransaction.Source.CardDecline.SchemeFee
                                                .builder()
                                                .amount("0.137465")
                                                .createdAt(
                                                    OffsetDateTime.parse("2020-01-31T23:59:59Z")
                                                )
                                                .currency(
                                                    DeclinedTransaction.Source.CardDecline.SchemeFee
                                                        .Currency
                                                        .USD
                                                )
                                                .feeType(
                                                    DeclinedTransaction.Source.CardDecline.SchemeFee
                                                        .FeeType
                                                        .VISA_CORPORATE_ACCEPTANCE_FEE
                                                )
                                                .fixedComponent(null)
                                                .variableRate("0.0002")
                                                .build()
                                        )
                                        .terminalId("RCN5VNXS")
                                        .verification(
                                            DeclinedTransaction.Source.CardDecline.Verification
                                                .builder()
                                                .cardVerificationCode(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .Verification
                                                        .CardVerificationCode
                                                        .builder()
                                                        .result(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .Verification
                                                                .CardVerificationCode
                                                                .Result
                                                                .MATCH
                                                        )
                                                        .build()
                                                )
                                                .cardholderAddress(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .Verification
                                                        .CardholderAddress
                                                        .builder()
                                                        .actualLine1("33 Liberty Street")
                                                        .actualPostalCode("94131")
                                                        .providedLine1("33 Liberty Street")
                                                        .providedPostalCode("94132")
                                                        .result(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .Verification
                                                                .CardholderAddress
                                                                .Result
                                                                .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                                        )
                                                        .build()
                                                )
                                                .cardholderName(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .Verification
                                                        .CardholderName
                                                        .builder()
                                                        .providedFirstName("provided_first_name")
                                                        .providedLastName("provided_last_name")
                                                        .providedMiddleName("provided_middle_name")
                                                        .build()
                                                )
                                                .build()
                                        )
                                        .build()
                                )
                                .checkDecline(
                                    DeclinedTransaction.Source.CheckDecline.builder()
                                        .amount(-1000L)
                                        .auxiliaryOnUs("99999")
                                        .backImageFileId(null)
                                        .checkTransferId("check_transfer_30b43acfu9vw8fyc4f5")
                                        .frontImageFileId(null)
                                        .inboundCheckDepositId(
                                            "inbound_check_deposit_zoshvqybq0cjjm31mra"
                                        )
                                        .reason(
                                            DeclinedTransaction.Source.CheckDecline.Reason
                                                .INSUFFICIENT_FUNDS
                                        )
                                        .build()
                                )
                                .checkDepositRejection(
                                    DeclinedTransaction.Source.CheckDepositRejection.builder()
                                        .amount(1750L)
                                        .checkDepositId("check_deposit_f06n9gpg7sxn8t19lfc1")
                                        .currency(
                                            DeclinedTransaction.Source.CheckDepositRejection
                                                .Currency
                                                .USD
                                        )
                                        .declinedTransactionId(
                                            "declined_transaction_17jbn0yyhvkt4v4ooym8"
                                        )
                                        .reason(
                                            DeclinedTransaction.Source.CheckDepositRejection.Reason
                                                .INCOMPLETE_IMAGE
                                        )
                                        .rejectedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                        .build()
                                )
                                .inboundFednowTransferDecline(
                                    DeclinedTransaction.Source.InboundFednowTransferDecline
                                        .builder()
                                        .reason(
                                            DeclinedTransaction.Source.InboundFednowTransferDecline
                                                .Reason
                                                .ACCOUNT_NUMBER_DISABLED
                                        )
                                        .transferId("inbound_fednow_transfer_ctxxbc07oh5ke5w1hk20")
                                        .build()
                                )
                                .inboundRealTimePaymentsTransferDecline(
                                    DeclinedTransaction.Source
                                        .InboundRealTimePaymentsTransferDecline
                                        .builder()
                                        .amount(100L)
                                        .creditorName("Ian Crease")
                                        .currency(
                                            DeclinedTransaction.Source
                                                .InboundRealTimePaymentsTransferDecline
                                                .Currency
                                                .USD
                                        )
                                        .debtorAccountNumber("987654321")
                                        .debtorName("National Phonograph Company")
                                        .debtorRoutingNumber("101050001")
                                        .reason(
                                            DeclinedTransaction.Source
                                                .InboundRealTimePaymentsTransferDecline
                                                .Reason
                                                .ACCOUNT_NUMBER_DISABLED
                                        )
                                        .transactionIdentification(
                                            "20220501234567891T1BSLZO01745013025"
                                        )
                                        .transferId(
                                            "inbound_real_time_payments_transfer_63hlz498vcxg644hcrzr"
                                        )
                                        .unstructuredRemittanceInformation("Invoice 29582")
                                        .build()
                                )
                                .other(DeclinedTransaction.Source.Other.builder().build())
                                .wireDecline(
                                    DeclinedTransaction.Source.WireDecline.builder()
                                        .inboundWireTransferId(
                                            "inbound_wire_transfer_f228m6bmhtcxjco9pwp0"
                                        )
                                        .reason(
                                            DeclinedTransaction.Source.WireDecline.Reason
                                                .ACCOUNT_NUMBER_DISABLED
                                        )
                                        .build()
                                )
                                .build()
                        )
                        .type(DeclinedTransaction.Type.DECLINED_TRANSACTION)
                        .build()
                )
                .nextCursor("v57w5d")
                .build()

        assertThat(declinedTransactionListPageResponse.data())
            .containsExactly(
                DeclinedTransaction.builder()
                    .id("declined_transaction_17jbn0yyhvkt4v4ooym8")
                    .accountId("account_in71c4amph0vgo2qllky")
                    .amount(1750L)
                    .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                    .currency(DeclinedTransaction.Currency.USD)
                    .description("INVOICE 2468")
                    .routeId("account_number_v18nkfqm6afpsrvy82b2")
                    .routeType(DeclinedTransaction.RouteType.ACCOUNT_NUMBER)
                    .source(
                        DeclinedTransaction.Source.builder()
                            .category(DeclinedTransaction.Source.Category.ACH_DECLINE)
                            .achDecline(
                                DeclinedTransaction.Source.AchDecline.builder()
                                    .id("ach_decline_72v1mcwxudctq56efipa")
                                    .amount(1750L)
                                    .inboundAchTransferId(
                                        "inbound_ach_transfer_tdrwqr3fq9gnnq49odev"
                                    )
                                    .originatorCompanyDescriptiveDate(null)
                                    .originatorCompanyDiscretionaryData(null)
                                    .originatorCompanyId("0987654321")
                                    .originatorCompanyName("BIG BANK")
                                    .reason(
                                        DeclinedTransaction.Source.AchDecline.Reason
                                            .INSUFFICIENT_FUNDS
                                    )
                                    .receiverIdNumber("12345678900")
                                    .receiverName("IAN CREASE")
                                    .traceNumber("021000038461022")
                                    .type(DeclinedTransaction.Source.AchDecline.Type.ACH_DECLINE)
                                    .build()
                            )
                            .cardDecline(
                                DeclinedTransaction.Source.CardDecline.builder()
                                    .id("card_decline_bx3o8zd7glq8yvtwg25v")
                                    .actioner(
                                        DeclinedTransaction.Source.CardDecline.Actioner.INCREASE
                                    )
                                    .additionalAmounts(
                                        DeclinedTransaction.Source.CardDecline.AdditionalAmounts
                                            .builder()
                                            .clinic(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .Clinic
                                                    .builder()
                                                    .amount(0L)
                                                    .currency("currency")
                                                    .build()
                                            )
                                            .dental(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .Dental
                                                    .builder()
                                                    .amount(0L)
                                                    .currency("currency")
                                                    .build()
                                            )
                                            .original(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .Original
                                                    .builder()
                                                    .amount(0L)
                                                    .currency("currency")
                                                    .build()
                                            )
                                            .prescription(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .Prescription
                                                    .builder()
                                                    .amount(0L)
                                                    .currency("currency")
                                                    .build()
                                            )
                                            .surcharge(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .Surcharge
                                                    .builder()
                                                    .amount(10L)
                                                    .currency("USD")
                                                    .build()
                                            )
                                            .totalCumulative(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .TotalCumulative
                                                    .builder()
                                                    .amount(0L)
                                                    .currency("currency")
                                                    .build()
                                            )
                                            .totalHealthcare(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .TotalHealthcare
                                                    .builder()
                                                    .amount(0L)
                                                    .currency("currency")
                                                    .build()
                                            )
                                            .transit(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .Transit
                                                    .builder()
                                                    .amount(0L)
                                                    .currency("currency")
                                                    .build()
                                            )
                                            .unknown(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .Unknown
                                                    .builder()
                                                    .amount(0L)
                                                    .currency("currency")
                                                    .build()
                                            )
                                            .vision(
                                                DeclinedTransaction.Source.CardDecline
                                                    .AdditionalAmounts
                                                    .Vision
                                                    .builder()
                                                    .amount(0L)
                                                    .currency("currency")
                                                    .build()
                                            )
                                            .build()
                                    )
                                    .amount(-1000L)
                                    .cardPaymentId("card_payment_nd3k2kacrqjli8482ave")
                                    .currency(DeclinedTransaction.Source.CardDecline.Currency.USD)
                                    .declinedTransactionId(
                                        "declined_transaction_17jbn0yyhvkt4v4ooym8"
                                    )
                                    .digitalWalletTokenId(null)
                                    .direction(
                                        DeclinedTransaction.Source.CardDecline.Direction.SETTLEMENT
                                    )
                                    .incrementedCardAuthorizationId(null)
                                    .merchantAcceptorId("5665270011000168")
                                    .merchantCategoryCode("5734")
                                    .merchantCity("New York")
                                    .merchantCountry("US")
                                    .merchantDescriptor("AMAZON.COM")
                                    .merchantPostalCode("10045")
                                    .merchantState(null)
                                    .networkDetails(
                                        DeclinedTransaction.Source.CardDecline.NetworkDetails
                                            .builder()
                                            .category(
                                                DeclinedTransaction.Source.CardDecline
                                                    .NetworkDetails
                                                    .Category
                                                    .VISA
                                            )
                                            .pulse(
                                                DeclinedTransaction.Source.CardDecline
                                                    .NetworkDetails
                                                    .Pulse
                                                    .builder()
                                                    .build()
                                            )
                                            .visa(
                                                DeclinedTransaction.Source.CardDecline
                                                    .NetworkDetails
                                                    .Visa
                                                    .builder()
                                                    .electronicCommerceIndicator(
                                                        DeclinedTransaction.Source.CardDecline
                                                            .NetworkDetails
                                                            .Visa
                                                            .ElectronicCommerceIndicator
                                                            .SECURE_ELECTRONIC_COMMERCE
                                                    )
                                                    .pointOfServiceEntryMode(
                                                        DeclinedTransaction.Source.CardDecline
                                                            .NetworkDetails
                                                            .Visa
                                                            .PointOfServiceEntryMode
                                                            .MANUAL
                                                    )
                                                    .standInProcessingReason(null)
                                                    .terminalEntryCapability(
                                                        DeclinedTransaction.Source.CardDecline
                                                            .NetworkDetails
                                                            .Visa
                                                            .TerminalEntryCapability
                                                            .MAGNETIC_STRIPE
                                                    )
                                                    .build()
                                            )
                                            .build()
                                    )
                                    .networkIdentifiers(
                                        DeclinedTransaction.Source.CardDecline.NetworkIdentifiers
                                            .builder()
                                            .authorizationIdentificationResponse(null)
                                            .retrievalReferenceNumber("785867080153")
                                            .traceNumber("487941")
                                            .transactionId("627199945183184")
                                            .build()
                                    )
                                    .networkRiskScore(10L)
                                    .physicalCardId(null)
                                    .presentmentAmount(-1000L)
                                    .presentmentCurrency("USD")
                                    .processingCategory(
                                        DeclinedTransaction.Source.CardDecline.ProcessingCategory
                                            .PURCHASE
                                    )
                                    .realTimeDecisionId(null)
                                    .realTimeDecisionReason(null)
                                    .reason(
                                        DeclinedTransaction.Source.CardDecline.Reason
                                            .INSUFFICIENT_FUNDS
                                    )
                                    .addSchemeFee(
                                        DeclinedTransaction.Source.CardDecline.SchemeFee.builder()
                                            .amount("0.137465")
                                            .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                            .currency(
                                                DeclinedTransaction.Source.CardDecline.SchemeFee
                                                    .Currency
                                                    .USD
                                            )
                                            .feeType(
                                                DeclinedTransaction.Source.CardDecline.SchemeFee
                                                    .FeeType
                                                    .VISA_CORPORATE_ACCEPTANCE_FEE
                                            )
                                            .fixedComponent(null)
                                            .variableRate("0.0002")
                                            .build()
                                    )
                                    .terminalId("RCN5VNXS")
                                    .verification(
                                        DeclinedTransaction.Source.CardDecline.Verification
                                            .builder()
                                            .cardVerificationCode(
                                                DeclinedTransaction.Source.CardDecline.Verification
                                                    .CardVerificationCode
                                                    .builder()
                                                    .result(
                                                        DeclinedTransaction.Source.CardDecline
                                                            .Verification
                                                            .CardVerificationCode
                                                            .Result
                                                            .MATCH
                                                    )
                                                    .build()
                                            )
                                            .cardholderAddress(
                                                DeclinedTransaction.Source.CardDecline.Verification
                                                    .CardholderAddress
                                                    .builder()
                                                    .actualLine1("33 Liberty Street")
                                                    .actualPostalCode("94131")
                                                    .providedLine1("33 Liberty Street")
                                                    .providedPostalCode("94132")
                                                    .result(
                                                        DeclinedTransaction.Source.CardDecline
                                                            .Verification
                                                            .CardholderAddress
                                                            .Result
                                                            .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                                    )
                                                    .build()
                                            )
                                            .cardholderName(
                                                DeclinedTransaction.Source.CardDecline.Verification
                                                    .CardholderName
                                                    .builder()
                                                    .providedFirstName("provided_first_name")
                                                    .providedLastName("provided_last_name")
                                                    .providedMiddleName("provided_middle_name")
                                                    .build()
                                            )
                                            .build()
                                    )
                                    .build()
                            )
                            .checkDecline(
                                DeclinedTransaction.Source.CheckDecline.builder()
                                    .amount(-1000L)
                                    .auxiliaryOnUs("99999")
                                    .backImageFileId(null)
                                    .checkTransferId("check_transfer_30b43acfu9vw8fyc4f5")
                                    .frontImageFileId(null)
                                    .inboundCheckDepositId(
                                        "inbound_check_deposit_zoshvqybq0cjjm31mra"
                                    )
                                    .reason(
                                        DeclinedTransaction.Source.CheckDecline.Reason
                                            .INSUFFICIENT_FUNDS
                                    )
                                    .build()
                            )
                            .checkDepositRejection(
                                DeclinedTransaction.Source.CheckDepositRejection.builder()
                                    .amount(1750L)
                                    .checkDepositId("check_deposit_f06n9gpg7sxn8t19lfc1")
                                    .currency(
                                        DeclinedTransaction.Source.CheckDepositRejection.Currency
                                            .USD
                                    )
                                    .declinedTransactionId(
                                        "declined_transaction_17jbn0yyhvkt4v4ooym8"
                                    )
                                    .reason(
                                        DeclinedTransaction.Source.CheckDepositRejection.Reason
                                            .INCOMPLETE_IMAGE
                                    )
                                    .rejectedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                    .build()
                            )
                            .inboundFednowTransferDecline(
                                DeclinedTransaction.Source.InboundFednowTransferDecline.builder()
                                    .reason(
                                        DeclinedTransaction.Source.InboundFednowTransferDecline
                                            .Reason
                                            .ACCOUNT_NUMBER_DISABLED
                                    )
                                    .transferId("inbound_fednow_transfer_ctxxbc07oh5ke5w1hk20")
                                    .build()
                            )
                            .inboundRealTimePaymentsTransferDecline(
                                DeclinedTransaction.Source.InboundRealTimePaymentsTransferDecline
                                    .builder()
                                    .amount(100L)
                                    .creditorName("Ian Crease")
                                    .currency(
                                        DeclinedTransaction.Source
                                            .InboundRealTimePaymentsTransferDecline
                                            .Currency
                                            .USD
                                    )
                                    .debtorAccountNumber("987654321")
                                    .debtorName("National Phonograph Company")
                                    .debtorRoutingNumber("101050001")
                                    .reason(
                                        DeclinedTransaction.Source
                                            .InboundRealTimePaymentsTransferDecline
                                            .Reason
                                            .ACCOUNT_NUMBER_DISABLED
                                    )
                                    .transactionIdentification(
                                        "20220501234567891T1BSLZO01745013025"
                                    )
                                    .transferId(
                                        "inbound_real_time_payments_transfer_63hlz498vcxg644hcrzr"
                                    )
                                    .unstructuredRemittanceInformation("Invoice 29582")
                                    .build()
                            )
                            .other(DeclinedTransaction.Source.Other.builder().build())
                            .wireDecline(
                                DeclinedTransaction.Source.WireDecline.builder()
                                    .inboundWireTransferId(
                                        "inbound_wire_transfer_f228m6bmhtcxjco9pwp0"
                                    )
                                    .reason(
                                        DeclinedTransaction.Source.WireDecline.Reason
                                            .ACCOUNT_NUMBER_DISABLED
                                    )
                                    .build()
                            )
                            .build()
                    )
                    .type(DeclinedTransaction.Type.DECLINED_TRANSACTION)
                    .build()
            )
        assertThat(declinedTransactionListPageResponse.nextCursor()).contains("v57w5d")
    }

    @Test
    fun roundtrip() {
        val jsonMapper = jsonMapper()
        val declinedTransactionListPageResponse =
            DeclinedTransactionListPageResponse.builder()
                .addData(
                    DeclinedTransaction.builder()
                        .id("declined_transaction_17jbn0yyhvkt4v4ooym8")
                        .accountId("account_in71c4amph0vgo2qllky")
                        .amount(1750L)
                        .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                        .currency(DeclinedTransaction.Currency.USD)
                        .description("INVOICE 2468")
                        .routeId("account_number_v18nkfqm6afpsrvy82b2")
                        .routeType(DeclinedTransaction.RouteType.ACCOUNT_NUMBER)
                        .source(
                            DeclinedTransaction.Source.builder()
                                .category(DeclinedTransaction.Source.Category.ACH_DECLINE)
                                .achDecline(
                                    DeclinedTransaction.Source.AchDecline.builder()
                                        .id("ach_decline_72v1mcwxudctq56efipa")
                                        .amount(1750L)
                                        .inboundAchTransferId(
                                            "inbound_ach_transfer_tdrwqr3fq9gnnq49odev"
                                        )
                                        .originatorCompanyDescriptiveDate(null)
                                        .originatorCompanyDiscretionaryData(null)
                                        .originatorCompanyId("0987654321")
                                        .originatorCompanyName("BIG BANK")
                                        .reason(
                                            DeclinedTransaction.Source.AchDecline.Reason
                                                .INSUFFICIENT_FUNDS
                                        )
                                        .receiverIdNumber("12345678900")
                                        .receiverName("IAN CREASE")
                                        .traceNumber("021000038461022")
                                        .type(
                                            DeclinedTransaction.Source.AchDecline.Type.ACH_DECLINE
                                        )
                                        .build()
                                )
                                .cardDecline(
                                    DeclinedTransaction.Source.CardDecline.builder()
                                        .id("card_decline_bx3o8zd7glq8yvtwg25v")
                                        .actioner(
                                            DeclinedTransaction.Source.CardDecline.Actioner.INCREASE
                                        )
                                        .additionalAmounts(
                                            DeclinedTransaction.Source.CardDecline.AdditionalAmounts
                                                .builder()
                                                .clinic(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Clinic
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .dental(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Dental
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .original(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Original
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .prescription(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Prescription
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .surcharge(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Surcharge
                                                        .builder()
                                                        .amount(10L)
                                                        .currency("USD")
                                                        .build()
                                                )
                                                .totalCumulative(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .TotalCumulative
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .totalHealthcare(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .TotalHealthcare
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .transit(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Transit
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .unknown(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Unknown
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .vision(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .AdditionalAmounts
                                                        .Vision
                                                        .builder()
                                                        .amount(0L)
                                                        .currency("currency")
                                                        .build()
                                                )
                                                .build()
                                        )
                                        .amount(-1000L)
                                        .cardPaymentId("card_payment_nd3k2kacrqjli8482ave")
                                        .currency(
                                            DeclinedTransaction.Source.CardDecline.Currency.USD
                                        )
                                        .declinedTransactionId(
                                            "declined_transaction_17jbn0yyhvkt4v4ooym8"
                                        )
                                        .digitalWalletTokenId(null)
                                        .direction(
                                            DeclinedTransaction.Source.CardDecline.Direction
                                                .SETTLEMENT
                                        )
                                        .incrementedCardAuthorizationId(null)
                                        .merchantAcceptorId("5665270011000168")
                                        .merchantCategoryCode("5734")
                                        .merchantCity("New York")
                                        .merchantCountry("US")
                                        .merchantDescriptor("AMAZON.COM")
                                        .merchantPostalCode("10045")
                                        .merchantState(null)
                                        .networkDetails(
                                            DeclinedTransaction.Source.CardDecline.NetworkDetails
                                                .builder()
                                                .category(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .NetworkDetails
                                                        .Category
                                                        .VISA
                                                )
                                                .pulse(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .NetworkDetails
                                                        .Pulse
                                                        .builder()
                                                        .build()
                                                )
                                                .visa(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .NetworkDetails
                                                        .Visa
                                                        .builder()
                                                        .electronicCommerceIndicator(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .NetworkDetails
                                                                .Visa
                                                                .ElectronicCommerceIndicator
                                                                .SECURE_ELECTRONIC_COMMERCE
                                                        )
                                                        .pointOfServiceEntryMode(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .NetworkDetails
                                                                .Visa
                                                                .PointOfServiceEntryMode
                                                                .MANUAL
                                                        )
                                                        .standInProcessingReason(null)
                                                        .terminalEntryCapability(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .NetworkDetails
                                                                .Visa
                                                                .TerminalEntryCapability
                                                                .MAGNETIC_STRIPE
                                                        )
                                                        .build()
                                                )
                                                .build()
                                        )
                                        .networkIdentifiers(
                                            DeclinedTransaction.Source.CardDecline
                                                .NetworkIdentifiers
                                                .builder()
                                                .authorizationIdentificationResponse(null)
                                                .retrievalReferenceNumber("785867080153")
                                                .traceNumber("487941")
                                                .transactionId("627199945183184")
                                                .build()
                                        )
                                        .networkRiskScore(10L)
                                        .physicalCardId(null)
                                        .presentmentAmount(-1000L)
                                        .presentmentCurrency("USD")
                                        .processingCategory(
                                            DeclinedTransaction.Source.CardDecline
                                                .ProcessingCategory
                                                .PURCHASE
                                        )
                                        .realTimeDecisionId(null)
                                        .realTimeDecisionReason(null)
                                        .reason(
                                            DeclinedTransaction.Source.CardDecline.Reason
                                                .INSUFFICIENT_FUNDS
                                        )
                                        .addSchemeFee(
                                            DeclinedTransaction.Source.CardDecline.SchemeFee
                                                .builder()
                                                .amount("0.137465")
                                                .createdAt(
                                                    OffsetDateTime.parse("2020-01-31T23:59:59Z")
                                                )
                                                .currency(
                                                    DeclinedTransaction.Source.CardDecline.SchemeFee
                                                        .Currency
                                                        .USD
                                                )
                                                .feeType(
                                                    DeclinedTransaction.Source.CardDecline.SchemeFee
                                                        .FeeType
                                                        .VISA_CORPORATE_ACCEPTANCE_FEE
                                                )
                                                .fixedComponent(null)
                                                .variableRate("0.0002")
                                                .build()
                                        )
                                        .terminalId("RCN5VNXS")
                                        .verification(
                                            DeclinedTransaction.Source.CardDecline.Verification
                                                .builder()
                                                .cardVerificationCode(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .Verification
                                                        .CardVerificationCode
                                                        .builder()
                                                        .result(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .Verification
                                                                .CardVerificationCode
                                                                .Result
                                                                .MATCH
                                                        )
                                                        .build()
                                                )
                                                .cardholderAddress(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .Verification
                                                        .CardholderAddress
                                                        .builder()
                                                        .actualLine1("33 Liberty Street")
                                                        .actualPostalCode("94131")
                                                        .providedLine1("33 Liberty Street")
                                                        .providedPostalCode("94132")
                                                        .result(
                                                            DeclinedTransaction.Source.CardDecline
                                                                .Verification
                                                                .CardholderAddress
                                                                .Result
                                                                .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                                        )
                                                        .build()
                                                )
                                                .cardholderName(
                                                    DeclinedTransaction.Source.CardDecline
                                                        .Verification
                                                        .CardholderName
                                                        .builder()
                                                        .providedFirstName("provided_first_name")
                                                        .providedLastName("provided_last_name")
                                                        .providedMiddleName("provided_middle_name")
                                                        .build()
                                                )
                                                .build()
                                        )
                                        .build()
                                )
                                .checkDecline(
                                    DeclinedTransaction.Source.CheckDecline.builder()
                                        .amount(-1000L)
                                        .auxiliaryOnUs("99999")
                                        .backImageFileId(null)
                                        .checkTransferId("check_transfer_30b43acfu9vw8fyc4f5")
                                        .frontImageFileId(null)
                                        .inboundCheckDepositId(
                                            "inbound_check_deposit_zoshvqybq0cjjm31mra"
                                        )
                                        .reason(
                                            DeclinedTransaction.Source.CheckDecline.Reason
                                                .INSUFFICIENT_FUNDS
                                        )
                                        .build()
                                )
                                .checkDepositRejection(
                                    DeclinedTransaction.Source.CheckDepositRejection.builder()
                                        .amount(1750L)
                                        .checkDepositId("check_deposit_f06n9gpg7sxn8t19lfc1")
                                        .currency(
                                            DeclinedTransaction.Source.CheckDepositRejection
                                                .Currency
                                                .USD
                                        )
                                        .declinedTransactionId(
                                            "declined_transaction_17jbn0yyhvkt4v4ooym8"
                                        )
                                        .reason(
                                            DeclinedTransaction.Source.CheckDepositRejection.Reason
                                                .INCOMPLETE_IMAGE
                                        )
                                        .rejectedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
                                        .build()
                                )
                                .inboundFednowTransferDecline(
                                    DeclinedTransaction.Source.InboundFednowTransferDecline
                                        .builder()
                                        .reason(
                                            DeclinedTransaction.Source.InboundFednowTransferDecline
                                                .Reason
                                                .ACCOUNT_NUMBER_DISABLED
                                        )
                                        .transferId("inbound_fednow_transfer_ctxxbc07oh5ke5w1hk20")
                                        .build()
                                )
                                .inboundRealTimePaymentsTransferDecline(
                                    DeclinedTransaction.Source
                                        .InboundRealTimePaymentsTransferDecline
                                        .builder()
                                        .amount(100L)
                                        .creditorName("Ian Crease")
                                        .currency(
                                            DeclinedTransaction.Source
                                                .InboundRealTimePaymentsTransferDecline
                                                .Currency
                                                .USD
                                        )
                                        .debtorAccountNumber("987654321")
                                        .debtorName("National Phonograph Company")
                                        .debtorRoutingNumber("101050001")
                                        .reason(
                                            DeclinedTransaction.Source
                                                .InboundRealTimePaymentsTransferDecline
                                                .Reason
                                                .ACCOUNT_NUMBER_DISABLED
                                        )
                                        .transactionIdentification(
                                            "20220501234567891T1BSLZO01745013025"
                                        )
                                        .transferId(
                                            "inbound_real_time_payments_transfer_63hlz498vcxg644hcrzr"
                                        )
                                        .unstructuredRemittanceInformation("Invoice 29582")
                                        .build()
                                )
                                .other(DeclinedTransaction.Source.Other.builder().build())
                                .wireDecline(
                                    DeclinedTransaction.Source.WireDecline.builder()
                                        .inboundWireTransferId(
                                            "inbound_wire_transfer_f228m6bmhtcxjco9pwp0"
                                        )
                                        .reason(
                                            DeclinedTransaction.Source.WireDecline.Reason
                                                .ACCOUNT_NUMBER_DISABLED
                                        )
                                        .build()
                                )
                                .build()
                        )
                        .type(DeclinedTransaction.Type.DECLINED_TRANSACTION)
                        .build()
                )
                .nextCursor("v57w5d")
                .build()

        val roundtrippedDeclinedTransactionListPageResponse =
            jsonMapper.readValue(
                jsonMapper.writeValueAsString(declinedTransactionListPageResponse),
                jacksonTypeRef<DeclinedTransactionListPageResponse>(),
            )

        assertThat(roundtrippedDeclinedTransactionListPageResponse)
            .isEqualTo(declinedTransactionListPageResponse)
    }
}
