// File generated from our OpenAPI spec by Stainless.

package com.increase.api.models.cardpushtransfers

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

internal class CardPushTransferCreateParamsTest {

    @Test
    fun create() {
        CardPushTransferCreateParams.builder()
            .businessApplicationIdentifier(
                CardPushTransferCreateParams.BusinessApplicationIdentifier.FUNDS_DISBURSEMENT
            )
            .cardTokenId("outbound_card_token_zlt0ml6youq3q7vcdlg0")
            .merchantCategoryCode("5734")
            .merchantCityName("New York")
            .merchantName("Acme Corp")
            .merchantNamePrefix("Acme")
            .merchantPostalCode("10045")
            .merchantState("NY")
            .presentmentAmount(
                CardPushTransferCreateParams.PresentmentAmount.builder()
                    .currency(CardPushTransferCreateParams.PresentmentAmount.Currency.USD)
                    .value("1234.56")
                    .build()
            )
            .recipientName("Ian Crease")
            .senderAddressCity("New York")
            .senderAddressLine1("33 Liberty Street")
            .senderAddressPostalCode("10045")
            .senderAddressState("NY")
            .senderName("Ian Crease")
            .sourceAccountNumberId("account_number_v18nkfqm6afpsrvy82b2")
            .merchantLegalBusinessName("x6")
            .merchantStreetAddress("merchant_street_address")
            .recipientAddressCity("recipient_address_city")
            .recipientAddressLine1("recipient_address_line1")
            .recipientAddressPostalCode("x6")
            .recipientAddressState("x6")
            .requireApproval(true)
            .build()
    }

    @Test
    fun body() {
        val params =
            CardPushTransferCreateParams.builder()
                .businessApplicationIdentifier(
                    CardPushTransferCreateParams.BusinessApplicationIdentifier.FUNDS_DISBURSEMENT
                )
                .cardTokenId("outbound_card_token_zlt0ml6youq3q7vcdlg0")
                .merchantCategoryCode("5734")
                .merchantCityName("New York")
                .merchantName("Acme Corp")
                .merchantNamePrefix("Acme")
                .merchantPostalCode("10045")
                .merchantState("NY")
                .presentmentAmount(
                    CardPushTransferCreateParams.PresentmentAmount.builder()
                        .currency(CardPushTransferCreateParams.PresentmentAmount.Currency.USD)
                        .value("1234.56")
                        .build()
                )
                .recipientName("Ian Crease")
                .senderAddressCity("New York")
                .senderAddressLine1("33 Liberty Street")
                .senderAddressPostalCode("10045")
                .senderAddressState("NY")
                .senderName("Ian Crease")
                .sourceAccountNumberId("account_number_v18nkfqm6afpsrvy82b2")
                .merchantLegalBusinessName("x6")
                .merchantStreetAddress("merchant_street_address")
                .recipientAddressCity("recipient_address_city")
                .recipientAddressLine1("recipient_address_line1")
                .recipientAddressPostalCode("x6")
                .recipientAddressState("x6")
                .requireApproval(true)
                .build()

        val body = params._body()

        assertThat(body.businessApplicationIdentifier())
            .isEqualTo(
                CardPushTransferCreateParams.BusinessApplicationIdentifier.FUNDS_DISBURSEMENT
            )
        assertThat(body.cardTokenId()).isEqualTo("outbound_card_token_zlt0ml6youq3q7vcdlg0")
        assertThat(body.merchantCategoryCode()).isEqualTo("5734")
        assertThat(body.merchantCityName()).isEqualTo("New York")
        assertThat(body.merchantName()).isEqualTo("Acme Corp")
        assertThat(body.merchantNamePrefix()).isEqualTo("Acme")
        assertThat(body.merchantPostalCode()).isEqualTo("10045")
        assertThat(body.merchantState()).isEqualTo("NY")
        assertThat(body.presentmentAmount())
            .isEqualTo(
                CardPushTransferCreateParams.PresentmentAmount.builder()
                    .currency(CardPushTransferCreateParams.PresentmentAmount.Currency.USD)
                    .value("1234.56")
                    .build()
            )
        assertThat(body.recipientName()).isEqualTo("Ian Crease")
        assertThat(body.senderAddressCity()).isEqualTo("New York")
        assertThat(body.senderAddressLine1()).isEqualTo("33 Liberty Street")
        assertThat(body.senderAddressPostalCode()).isEqualTo("10045")
        assertThat(body.senderAddressState()).isEqualTo("NY")
        assertThat(body.senderName()).isEqualTo("Ian Crease")
        assertThat(body.sourceAccountNumberId()).isEqualTo("account_number_v18nkfqm6afpsrvy82b2")
        assertThat(body.merchantLegalBusinessName()).contains("x6")
        assertThat(body.merchantStreetAddress()).contains("merchant_street_address")
        assertThat(body.recipientAddressCity()).contains("recipient_address_city")
        assertThat(body.recipientAddressLine1()).contains("recipient_address_line1")
        assertThat(body.recipientAddressPostalCode()).contains("x6")
        assertThat(body.recipientAddressState()).contains("x6")
        assertThat(body.requireApproval()).contains(true)
    }

    @Test
    fun bodyWithoutOptionalFields() {
        val params =
            CardPushTransferCreateParams.builder()
                .businessApplicationIdentifier(
                    CardPushTransferCreateParams.BusinessApplicationIdentifier.FUNDS_DISBURSEMENT
                )
                .cardTokenId("outbound_card_token_zlt0ml6youq3q7vcdlg0")
                .merchantCategoryCode("5734")
                .merchantCityName("New York")
                .merchantName("Acme Corp")
                .merchantNamePrefix("Acme")
                .merchantPostalCode("10045")
                .merchantState("NY")
                .presentmentAmount(
                    CardPushTransferCreateParams.PresentmentAmount.builder()
                        .currency(CardPushTransferCreateParams.PresentmentAmount.Currency.USD)
                        .value("1234.56")
                        .build()
                )
                .recipientName("Ian Crease")
                .senderAddressCity("New York")
                .senderAddressLine1("33 Liberty Street")
                .senderAddressPostalCode("10045")
                .senderAddressState("NY")
                .senderName("Ian Crease")
                .sourceAccountNumberId("account_number_v18nkfqm6afpsrvy82b2")
                .build()

        val body = params._body()

        assertThat(body.businessApplicationIdentifier())
            .isEqualTo(
                CardPushTransferCreateParams.BusinessApplicationIdentifier.FUNDS_DISBURSEMENT
            )
        assertThat(body.cardTokenId()).isEqualTo("outbound_card_token_zlt0ml6youq3q7vcdlg0")
        assertThat(body.merchantCategoryCode()).isEqualTo("5734")
        assertThat(body.merchantCityName()).isEqualTo("New York")
        assertThat(body.merchantName()).isEqualTo("Acme Corp")
        assertThat(body.merchantNamePrefix()).isEqualTo("Acme")
        assertThat(body.merchantPostalCode()).isEqualTo("10045")
        assertThat(body.merchantState()).isEqualTo("NY")
        assertThat(body.presentmentAmount())
            .isEqualTo(
                CardPushTransferCreateParams.PresentmentAmount.builder()
                    .currency(CardPushTransferCreateParams.PresentmentAmount.Currency.USD)
                    .value("1234.56")
                    .build()
            )
        assertThat(body.recipientName()).isEqualTo("Ian Crease")
        assertThat(body.senderAddressCity()).isEqualTo("New York")
        assertThat(body.senderAddressLine1()).isEqualTo("33 Liberty Street")
        assertThat(body.senderAddressPostalCode()).isEqualTo("10045")
        assertThat(body.senderAddressState()).isEqualTo("NY")
        assertThat(body.senderName()).isEqualTo("Ian Crease")
        assertThat(body.sourceAccountNumberId()).isEqualTo("account_number_v18nkfqm6afpsrvy82b2")
    }
}
