diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt index a9786d6a..fa22dedb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,11 +16,27 @@ class AlertTest { .id("XuxCbt7x9L82yyeF") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("currency") - .customer(Alert.Customer.builder().build()) + .customer( + Alert.Customer.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .enabled(true) - .metric(Alert.Metric.builder().build()) - .plan(Alert.Plan.builder().build()) - .subscription(Alert.Subscription.builder().build()) + .metric( + Alert.Metric.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .plan( + Alert.Plan.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .subscription( + Alert.Subscription.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .thresholds(listOf(Alert.Threshold.builder().value(0.0).build())) .type(Alert.Type.USAGE_EXCEEDED) .build() @@ -27,11 +44,29 @@ class AlertTest { assertThat(alert.id()).isEqualTo("XuxCbt7x9L82yyeF") assertThat(alert.createdAt()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(alert.currency()).contains("currency") - assertThat(alert.customer()).contains(Alert.Customer.builder().build()) + assertThat(alert.customer()) + .contains( + Alert.Customer.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(alert.enabled()).isEqualTo(true) - assertThat(alert.metric()).contains(Alert.Metric.builder().build()) - assertThat(alert.plan()).contains(Alert.Plan.builder().build()) - assertThat(alert.subscription()).contains(Alert.Subscription.builder().build()) + assertThat(alert.metric()) + .contains( + Alert.Metric.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + assertThat(alert.plan()) + .contains( + Alert.Plan.builder().putAdditionalProperty("foo", JsonValue.from("string")).build() + ) + assertThat(alert.subscription()) + .contains( + Alert.Subscription.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(alert.thresholds().get()) .containsExactly(Alert.Threshold.builder().value(0.0).build()) assertThat(alert.type()).isEqualTo(Alert.Type.USAGE_EXCEEDED) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AmountDiscountTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AmountDiscountTest.kt index 12102a3c..9a0a9031 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AmountDiscountTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AmountDiscountTest.kt @@ -12,13 +12,14 @@ class AmountDiscountTest { val amountDiscount = AmountDiscount.builder() .amountDiscount("amount_discount") - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(AmountDiscount.DiscountType.AMOUNT) .reason("reason") .build() assertThat(amountDiscount).isNotNull assertThat(amountDiscount.amountDiscount()).isEqualTo("amount_discount") - assertThat(amountDiscount.appliesToPriceIds()).containsExactly("string") + assertThat(amountDiscount.appliesToPriceIds()) + .containsExactly("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") assertThat(amountDiscount.discountType()).isEqualTo(AmountDiscount.DiscountType.AMOUNT) assertThat(amountDiscount.reason()).contains("reason") } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/BillableMetricTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/BillableMetricTest.kt index 99254d21..b126f54e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/BillableMetricTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/BillableMetricTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -31,7 +32,11 @@ class BillableMetricTest { .name("name") .build() ) - .metadata(BillableMetric.Metadata.builder().build()) + .metadata( + BillableMetric.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .status(BillableMetric.Status.ACTIVE) .build() @@ -56,7 +61,12 @@ class BillableMetricTest { .name("name") .build() ) - assertThat(billableMetric.metadata()).isEqualTo(BillableMetric.Metadata.builder().build()) + assertThat(billableMetric.metadata()) + .isEqualTo( + BillableMetric.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(billableMetric.name()).isEqualTo("name") assertThat(billableMetric.status()).isEqualTo(BillableMetric.Status.ACTIVE) } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponTest.kt index 47ff455c..493c4188 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CouponTest.kt @@ -17,7 +17,7 @@ class CouponTest { .discount( Coupon.Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -36,7 +36,7 @@ class CouponTest { .isEqualTo( Coupon.Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt index cba3cf3b..11f978fa 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -56,7 +57,12 @@ class CustomerCostListByExternalIdResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -94,7 +100,12 @@ class CustomerCostListByExternalIdResponseTest { ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder().build() + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() ) .minimum( Price.UnitPrice.Minimum.builder() @@ -172,7 +183,12 @@ class CustomerCostListByExternalIdResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -208,7 +224,14 @@ class CustomerCostListByExternalIdResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt index 6a5fc463..d494f0fa 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -56,7 +57,12 @@ class CustomerCostListResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -94,7 +100,12 @@ class CustomerCostListResponseTest { ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder().build() + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() ) .minimum( Price.UnitPrice.Minimum.builder() @@ -172,7 +183,12 @@ class CustomerCostListResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -208,7 +224,14 @@ class CustomerCostListResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt index 9333a246..b243a569 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -42,7 +43,11 @@ class CustomerCreateParamsTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -117,7 +122,11 @@ class CustomerCreateParamsTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -190,7 +199,12 @@ class CustomerCreateParamsTest { assertThat(body.currency()).isEqualTo("currency") assertThat(body.emailDelivery()).isEqualTo(true) assertThat(body.externalCustomerId()).isEqualTo("external_customer_id") - assertThat(body.metadata()).isEqualTo(CustomerCreateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(body.paymentProvider()) .isEqualTo(CustomerCreateParams.PaymentProvider.QUICKBOOKS) assertThat(body.paymentProviderId()).isEqualTo("payment_provider_id") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt index f21ee9c3..63db58b6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat @@ -44,6 +45,7 @@ class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .AddIncrementCreditLedgerEntryRequestParams .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .perUnitCostBasis("per_unit_cost_basis") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt index 43f21cbc..6eea5a34 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat @@ -43,6 +44,7 @@ class CustomerCreditLedgerCreateEntryParamsTest { .AddIncrementCreditLedgerEntryRequestParams .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .perUnitCostBasis("per_unit_cost_basis") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerTest.kt index 81122dec..36f5be97 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -32,7 +33,11 @@ class CustomerTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -98,7 +103,12 @@ class CustomerTest { assertThat(customer.emailDelivery()).isEqualTo(true) assertThat(customer.exemptFromAutomatedTax()).contains(true) assertThat(customer.externalCustomerId()).contains("external_customer_id") - assertThat(customer.metadata()).isEqualTo(Customer.Metadata.builder().build()) + assertThat(customer.metadata()) + .isEqualTo( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(customer.name()).isEqualTo("name") assertThat(customer.paymentProvider()).contains(Customer.PaymentProvider.QUICKBOOKS) assertThat(customer.paymentProviderId()).contains("payment_provider_id") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt index 4ccccfde..1f54c345 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -43,7 +44,11 @@ class CustomerUpdateByExternalIdParamsTest { .email("dev@stainlessapi.com") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerUpdateByExternalIdParams.Metadata.builder().build()) + .metadata( + CustomerUpdateByExternalIdParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(CustomerUpdateByExternalIdParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -123,7 +128,11 @@ class CustomerUpdateByExternalIdParamsTest { .email("dev@stainlessapi.com") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerUpdateByExternalIdParams.Metadata.builder().build()) + .metadata( + CustomerUpdateByExternalIdParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(CustomerUpdateByExternalIdParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -201,7 +210,11 @@ class CustomerUpdateByExternalIdParamsTest { assertThat(body.emailDelivery()).isEqualTo(true) assertThat(body.externalCustomerId()).isEqualTo("external_customer_id") assertThat(body.metadata()) - .isEqualTo(CustomerUpdateByExternalIdParams.Metadata.builder().build()) + .isEqualTo( + CustomerUpdateByExternalIdParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(body.name()).isEqualTo("name") assertThat(body.paymentProvider()) .isEqualTo(CustomerUpdateByExternalIdParams.PaymentProvider.QUICKBOOKS) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt index f8a806e2..058613ea 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -42,7 +43,11 @@ class CustomerUpdateParamsTest { .email("dev@stainlessapi.com") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerUpdateParams.Metadata.builder().build()) + .metadata( + CustomerUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(CustomerUpdateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -117,7 +122,11 @@ class CustomerUpdateParamsTest { .email("dev@stainlessapi.com") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerUpdateParams.Metadata.builder().build()) + .metadata( + CustomerUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(CustomerUpdateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -189,7 +198,12 @@ class CustomerUpdateParamsTest { assertThat(body.email()).isEqualTo("dev@stainlessapi.com") assertThat(body.emailDelivery()).isEqualTo(true) assertThat(body.externalCustomerId()).isEqualTo("external_customer_id") - assertThat(body.metadata()).isEqualTo(CustomerUpdateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + CustomerUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(body.name()).isEqualTo("name") assertThat(body.paymentProvider()) .isEqualTo(CustomerUpdateParams.PaymentProvider.QUICKBOOKS) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceCreateParamsTest.kt index 6610f74c..b421f6ca 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import java.time.LocalDate import java.time.OffsetDateTime @@ -37,7 +38,7 @@ class InvoiceCreateParamsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -46,7 +47,11 @@ class InvoiceCreateParamsTest { ) .externalCustomerId("external-customer-id") .memo("An optional memo for my invoice.") - .metadata(InvoiceCreateParams.Metadata.builder().build()) + .metadata( + InvoiceCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .willAutoIssue(false) .build() } @@ -79,7 +84,7 @@ class InvoiceCreateParamsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -88,7 +93,11 @@ class InvoiceCreateParamsTest { ) .externalCustomerId("external-customer-id") .memo("An optional memo for my invoice.") - .metadata(InvoiceCreateParams.Metadata.builder().build()) + .metadata( + InvoiceCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .willAutoIssue(false) .build() val body = params.getBody() @@ -119,7 +128,7 @@ class InvoiceCreateParamsTest { .isEqualTo( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -128,7 +137,12 @@ class InvoiceCreateParamsTest { ) assertThat(body.externalCustomerId()).isEqualTo("external-customer-id") assertThat(body.memo()).isEqualTo("An optional memo for my invoice.") - assertThat(body.metadata()).isEqualTo(InvoiceCreateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + InvoiceCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(body.willAutoIssue()).isEqualTo(false) } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt index e9b4e748..c07c0a7b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt @@ -2,7 +2,7 @@ package com.withorb.api.models -import com.withorb.api.core.JsonNull +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -93,12 +93,12 @@ class InvoiceFetchUpcomingResponseTest { .value("value") .build() ) - .discount(JsonNull.of()) + .discount(JsonValue.from(mapOf())) .discounts( listOf( InvoiceLevelDiscount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -122,7 +122,9 @@ class InvoiceFetchUpcomingResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -178,7 +180,12 @@ class InvoiceFetchUpcomingResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -212,7 +219,14 @@ class InvoiceFetchUpcomingResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -295,7 +309,11 @@ class InvoiceFetchUpcomingResponseTest { ) .maximumAmount("maximum_amount") .memo("memo") - .metadata(InvoiceFetchUpcomingResponse.Metadata.builder().build()) + .metadata( + InvoiceFetchUpcomingResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( InvoiceFetchUpcomingResponse.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -423,12 +441,13 @@ class InvoiceFetchUpcomingResponseTest { .value("value") .build() ) - assertThat(invoiceFetchUpcomingResponse._discount()).isEqualTo(JsonNull.of()) + assertThat(invoiceFetchUpcomingResponse._discount()) + .isEqualTo(JsonValue.from(mapOf())) assertThat(invoiceFetchUpcomingResponse.discounts()) .containsExactly( InvoiceLevelDiscount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -457,7 +476,7 @@ class InvoiceFetchUpcomingResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -510,7 +529,9 @@ class InvoiceFetchUpcomingResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -538,7 +559,11 @@ class InvoiceFetchUpcomingResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -617,7 +642,11 @@ class InvoiceFetchUpcomingResponseTest { assertThat(invoiceFetchUpcomingResponse.maximumAmount()).contains("maximum_amount") assertThat(invoiceFetchUpcomingResponse.memo()).contains("memo") assertThat(invoiceFetchUpcomingResponse.metadata()) - .isEqualTo(InvoiceFetchUpcomingResponse.Metadata.builder().build()) + .isEqualTo( + InvoiceFetchUpcomingResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(invoiceFetchUpcomingResponse.minimum()) .contains( InvoiceFetchUpcomingResponse.Minimum.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt index b1c99f76..33d830b1 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -17,7 +18,7 @@ class InvoiceLineItemCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -69,7 +70,9 @@ class InvoiceLineItemCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -94,7 +97,11 @@ class InvoiceLineItemCreateResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -164,7 +171,7 @@ class InvoiceLineItemCreateResponseTest { .contains( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -218,7 +225,9 @@ class InvoiceLineItemCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -243,7 +252,11 @@ class InvoiceLineItemCreateResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt index 9ceb3896..978faec7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt @@ -2,7 +2,7 @@ package com.withorb.api.models -import com.withorb.api.core.JsonNull +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -85,12 +85,12 @@ class InvoiceTest { .value("value") .build() ) - .discount(JsonNull.of()) + .discount(JsonValue.from(mapOf())) .discounts( listOf( InvoiceLevelDiscount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -115,7 +115,9 @@ class InvoiceTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -171,7 +173,12 @@ class InvoiceTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -205,7 +212,14 @@ class InvoiceTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -278,7 +292,11 @@ class InvoiceTest { ) .maximumAmount("maximum_amount") .memo("memo") - .metadata(Invoice.Metadata.builder().build()) + .metadata( + Invoice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Invoice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -393,12 +411,12 @@ class InvoiceTest { .value("value") .build() ) - assertThat(invoice._discount()).isEqualTo(JsonNull.of()) + assertThat(invoice._discount()).isEqualTo(JsonValue.from(mapOf())) assertThat(invoice.discounts()) .containsExactly( InvoiceLevelDiscount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -426,7 +444,7 @@ class InvoiceTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -479,7 +497,9 @@ class InvoiceTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -507,7 +527,11 @@ class InvoiceTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -577,7 +601,12 @@ class InvoiceTest { ) assertThat(invoice.maximumAmount()).contains("maximum_amount") assertThat(invoice.memo()).contains("memo") - assertThat(invoice.metadata()).isEqualTo(Invoice.Metadata.builder().build()) + assertThat(invoice.metadata()) + .isEqualTo( + Invoice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(invoice.minimum()) .contains( Invoice.Minimum.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceUpdateParamsTest.kt index 48a07009..08a4c043 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -12,7 +13,11 @@ class InvoiceUpdateParamsTest { fun createInvoiceUpdateParams() { InvoiceUpdateParams.builder() .invoiceId("invoice_id") - .metadata(InvoiceUpdateParams.Metadata.builder().build()) + .metadata( + InvoiceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() } @@ -21,11 +26,20 @@ class InvoiceUpdateParamsTest { val params = InvoiceUpdateParams.builder() .invoiceId("invoice_id") - .metadata(InvoiceUpdateParams.Metadata.builder().build()) + .metadata( + InvoiceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.metadata()).isEqualTo(InvoiceUpdateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + InvoiceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricCreateParamsTest.kt index 267d3fda..a0490e83 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,7 +16,11 @@ class MetricCreateParamsTest { .itemId("item_id") .name("Bytes downloaded") .sql("SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'") - .metadata(MetricCreateParams.Metadata.builder().build()) + .metadata( + MetricCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() } @@ -27,7 +32,11 @@ class MetricCreateParamsTest { .itemId("item_id") .name("Bytes downloaded") .sql("SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'") - .metadata(MetricCreateParams.Metadata.builder().build()) + .metadata( + MetricCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() val body = params.getBody() assertThat(body).isNotNull @@ -36,7 +45,12 @@ class MetricCreateParamsTest { assertThat(body.name()).isEqualTo("Bytes downloaded") assertThat(body.sql()) .isEqualTo("SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'") - assertThat(body.metadata()).isEqualTo(MetricCreateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + MetricCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricUpdateParamsTest.kt index d73df26e..0051155c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -12,7 +13,11 @@ class MetricUpdateParamsTest { fun createMetricUpdateParams() { MetricUpdateParams.builder() .metricId("metric_id") - .metadata(MetricUpdateParams.Metadata.builder().build()) + .metadata( + MetricUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() } @@ -21,11 +26,20 @@ class MetricUpdateParamsTest { val params = MetricUpdateParams.builder() .metricId("metric_id") - .metadata(MetricUpdateParams.Metadata.builder().build()) + .metadata( + MetricUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.metadata()).isEqualTo(MetricUpdateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + MetricUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PercentageDiscountTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PercentageDiscountTest.kt index fe691fd0..9a1807be 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PercentageDiscountTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PercentageDiscountTest.kt @@ -11,13 +11,14 @@ class PercentageDiscountTest { fun createPercentageDiscount() { val percentageDiscount = PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") .build() assertThat(percentageDiscount).isNotNull - assertThat(percentageDiscount.appliesToPriceIds()).containsExactly("string") + assertThat(percentageDiscount.appliesToPriceIds()) + .containsExactly("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") assertThat(percentageDiscount.discountType()) .isEqualTo(PercentageDiscount.DiscountType.PERCENTAGE) assertThat(percentageDiscount.percentageDiscount()).isEqualTo(0.15) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt index 5fd6fb97..2d68ad4d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -58,7 +59,9 @@ class PlanCreateParamsTest { .build() ) .metadata( - PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder().build() + PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() ) .build() ) @@ -66,7 +69,11 @@ class PlanCreateParamsTest { ) .defaultInvoiceMemo("default_invoice_memo") .externalPlanId("external_plan_id") - .metadata(PlanCreateParams.Metadata.builder().build()) + .metadata( + PlanCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .netTerms(0L) .status(PlanCreateParams.Status.ACTIVE) .build() @@ -126,6 +133,7 @@ class PlanCreateParamsTest { ) .metadata( PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .build() @@ -134,7 +142,11 @@ class PlanCreateParamsTest { ) .defaultInvoiceMemo("default_invoice_memo") .externalPlanId("external_plan_id") - .metadata(PlanCreateParams.Metadata.builder().build()) + .metadata( + PlanCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .netTerms(0L) .status(PlanCreateParams.Status.ACTIVE) .build() @@ -188,7 +200,9 @@ class PlanCreateParamsTest { .build() ) .metadata( - PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder().build() + PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() ) .build() ) @@ -196,7 +210,12 @@ class PlanCreateParamsTest { ) assertThat(body.defaultInvoiceMemo()).isEqualTo("default_invoice_memo") assertThat(body.externalPlanId()).isEqualTo("external_plan_id") - assertThat(body.metadata()).isEqualTo(PlanCreateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + PlanCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(body.netTerms()).isEqualTo(0L) assertThat(body.status()).isEqualTo(PlanCreateParams.Status.ACTIVE) } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParamsTest.kt index 42e68eba..4b898760 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -13,7 +14,11 @@ class PlanExternalPlanIdUpdateParamsTest { PlanExternalPlanIdUpdateParams.builder() .otherExternalPlanId("external_plan_id") .externalPlanId("external_plan_id") - .metadata(PlanExternalPlanIdUpdateParams.Metadata.builder().build()) + .metadata( + PlanExternalPlanIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() } @@ -23,13 +28,21 @@ class PlanExternalPlanIdUpdateParamsTest { PlanExternalPlanIdUpdateParams.builder() .otherExternalPlanId("external_plan_id") .externalPlanId("external_plan_id") - .metadata(PlanExternalPlanIdUpdateParams.Metadata.builder().build()) + .metadata( + PlanExternalPlanIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.externalPlanId()).isEqualTo("external_plan_id") assertThat(body.metadata()) - .isEqualTo(PlanExternalPlanIdUpdateParams.Metadata.builder().build()) + .isEqualTo( + PlanExternalPlanIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt index a00991a0..385120e8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -46,7 +47,7 @@ class PlanTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -62,7 +63,11 @@ class PlanTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -80,7 +85,9 @@ class PlanTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -138,7 +145,9 @@ class PlanTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -166,7 +175,11 @@ class PlanTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -238,7 +251,7 @@ class PlanTest { .contains( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -255,7 +268,12 @@ class PlanTest { .build() ) assertThat(plan.maximumAmount()).contains("maximum_amount") - assertThat(plan.metadata()).isEqualTo(Plan.Metadata.builder().build()) + assertThat(plan.metadata()) + .isEqualTo( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(plan.minimum()) .contains( Plan.Minimum.builder() @@ -274,7 +292,7 @@ class PlanTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -328,7 +346,9 @@ class PlanTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -353,7 +373,11 @@ class PlanTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanUpdateParamsTest.kt index 2efa85a1..13b1fe38 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -13,7 +14,11 @@ class PlanUpdateParamsTest { PlanUpdateParams.builder() .planId("plan_id") .externalPlanId("external_plan_id") - .metadata(PlanUpdateParams.Metadata.builder().build()) + .metadata( + PlanUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() } @@ -23,12 +28,21 @@ class PlanUpdateParamsTest { PlanUpdateParams.builder() .planId("plan_id") .externalPlanId("external_plan_id") - .metadata(PlanUpdateParams.Metadata.builder().build()) + .metadata( + PlanUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.externalPlanId()).isEqualTo("external_plan_id") - assertThat(body.metadata()).isEqualTo(PlanUpdateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + PlanUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt index 022caaed..dd7d13a2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.junit.jupiter.api.Test @@ -48,7 +49,11 @@ class PriceCreateParamsTest { ) .build() ) - .metadata(PriceCreateParams.NewFloatingUnitPrice.Metadata.builder().build()) + .metadata( + PriceCreateParams.NewFloatingUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() ) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateParamsTest.kt index b7121ef4..e4315b08 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateParamsTest.kt @@ -18,7 +18,7 @@ class PriceEvaluateParamsTest { .customerId("customer_id") .externalCustomerId("external_customer_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") - .groupingKeys(listOf("string")) + .groupingKeys(listOf("case when my_event_type = 'foo' then true else false end")) .build() } @@ -32,7 +32,7 @@ class PriceEvaluateParamsTest { .customerId("customer_id") .externalCustomerId("external_customer_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") - .groupingKeys(listOf("string")) + .groupingKeys(listOf("case when my_event_type = 'foo' then true else false end")) .build() val body = params.getBody() assertThat(body).isNotNull @@ -43,7 +43,8 @@ class PriceEvaluateParamsTest { assertThat(body.externalCustomerId()).isEqualTo("external_customer_id") assertThat(body.filter()) .isEqualTo("my_numeric_property > 100 AND my_other_property = 'bar'") - assertThat(body.groupingKeys()).isEqualTo(listOf("string")) + assertThat(body.groupingKeys()) + .isEqualTo(listOf("case when my_event_type = 'foo' then true else false end")) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParamsTest.kt index fa0b12ac..2ae444a9 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -12,7 +13,11 @@ class PriceExternalPriceIdUpdateParamsTest { fun createPriceExternalPriceIdUpdateParams() { PriceExternalPriceIdUpdateParams.builder() .externalPriceId("external_price_id") - .metadata(PriceExternalPriceIdUpdateParams.Metadata.builder().build()) + .metadata( + PriceExternalPriceIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() } @@ -21,12 +26,20 @@ class PriceExternalPriceIdUpdateParamsTest { val params = PriceExternalPriceIdUpdateParams.builder() .externalPriceId("external_price_id") - .metadata(PriceExternalPriceIdUpdateParams.Metadata.builder().build()) + .metadata( + PriceExternalPriceIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.metadata()) - .isEqualTo(PriceExternalPriceIdUpdateParams.Metadata.builder().build()) + .isEqualTo( + PriceExternalPriceIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceUpdateParamsTest.kt index 0328b744..1691ea81 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -12,7 +13,11 @@ class PriceUpdateParamsTest { fun createPriceUpdateParams() { PriceUpdateParams.builder() .priceId("price_id") - .metadata(PriceUpdateParams.Metadata.builder().build()) + .metadata( + PriceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() } @@ -21,11 +26,20 @@ class PriceUpdateParamsTest { val params = PriceUpdateParams.builder() .priceId("price_id") - .metadata(PriceUpdateParams.Metadata.builder().build()) + .metadata( + PriceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.metadata()).isEqualTo(PriceUpdateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + PriceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt index afb2e4a5..d3a7883c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -80,7 +81,11 @@ class SubscriptionCancelResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -171,7 +176,11 @@ class SubscriptionCancelResponseTest { .build() ) ) - .metadata(SubscriptionCancelResponse.Metadata.builder().build()) + .metadata( + SubscriptionCancelResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( SubscriptionCancelResponse.MinimumInterval.builder() @@ -220,7 +229,9 @@ class SubscriptionCancelResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -236,7 +247,11 @@ class SubscriptionCancelResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -254,7 +269,9 @@ class SubscriptionCancelResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -317,7 +334,12 @@ class SubscriptionCancelResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -351,7 +373,14 @@ class SubscriptionCancelResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -446,7 +475,12 @@ class SubscriptionCancelResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -480,7 +514,14 @@ class SubscriptionCancelResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -591,7 +632,11 @@ class SubscriptionCancelResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -678,7 +723,11 @@ class SubscriptionCancelResponseTest { .build() ) assertThat(subscriptionCancelResponse.metadata()) - .isEqualTo(SubscriptionCancelResponse.Metadata.builder().build()) + .isEqualTo( + SubscriptionCancelResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscriptionCancelResponse.minimumIntervals()) .containsExactly( SubscriptionCancelResponse.MinimumInterval.builder() @@ -727,7 +776,7 @@ class SubscriptionCancelResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -743,7 +792,11 @@ class SubscriptionCancelResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -761,7 +814,9 @@ class SubscriptionCancelResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -822,7 +877,9 @@ class SubscriptionCancelResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -853,7 +910,11 @@ class SubscriptionCancelResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -938,7 +999,9 @@ class SubscriptionCancelResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -966,7 +1029,11 @@ class SubscriptionCancelResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt index 0dd11732..be33e738 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateParamsTest.kt @@ -28,7 +28,7 @@ class SubscriptionCreateParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -129,6 +129,7 @@ class SubscriptionCreateParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .referenceId("reference_id") @@ -162,7 +163,11 @@ class SubscriptionCreateParamsTest { .filter("my_property > 100 AND my_other_property = 'bar'") .initialPhaseOrder(2L) .invoicingThreshold("10.00") - .metadata(SubscriptionCreateParams.Metadata.builder().build()) + .metadata( + SubscriptionCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .netTerms(0L) .perCreditOverageAmount(0.0) .planId("ZMwNQefe7J3ecf7W") @@ -198,7 +203,7 @@ class SubscriptionCreateParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -297,6 +302,7 @@ class SubscriptionCreateParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .referenceId("reference_id") @@ -331,7 +337,7 @@ class SubscriptionCreateParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -432,6 +438,10 @@ class SubscriptionCreateParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -465,7 +475,11 @@ class SubscriptionCreateParamsTest { .filter("my_property > 100 AND my_other_property = 'bar'") .initialPhaseOrder(2L) .invoicingThreshold("10.00") - .metadata(SubscriptionCreateParams.Metadata.builder().build()) + .metadata( + SubscriptionCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .netTerms(0L) .perCreditOverageAmount(0.0) .planId("ZMwNQefe7J3ecf7W") @@ -502,7 +516,7 @@ class SubscriptionCreateParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -604,6 +618,10 @@ class SubscriptionCreateParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -635,7 +653,7 @@ class SubscriptionCreateParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -737,6 +755,7 @@ class SubscriptionCreateParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .referenceId("reference_id") @@ -773,7 +792,12 @@ class SubscriptionCreateParamsTest { assertThat(body.filter()).isEqualTo("my_property > 100 AND my_other_property = 'bar'") assertThat(body.initialPhaseOrder()).isEqualTo(2L) assertThat(body.invoicingThreshold()).isEqualTo("10.00") - assertThat(body.metadata()).isEqualTo(SubscriptionCreateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + SubscriptionCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(body.netTerms()).isEqualTo(0L) assertThat(body.perCreditOverageAmount()).isEqualTo(0.0) assertThat(body.planId()).isEqualTo("ZMwNQefe7J3ecf7W") @@ -812,7 +836,7 @@ class SubscriptionCreateParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -912,6 +936,7 @@ class SubscriptionCreateParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .referenceId("reference_id") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt index 59ac3928..1f86c0d3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -80,7 +81,11 @@ class SubscriptionCreateResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -171,7 +176,11 @@ class SubscriptionCreateResponseTest { .build() ) ) - .metadata(SubscriptionCreateResponse.Metadata.builder().build()) + .metadata( + SubscriptionCreateResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( SubscriptionCreateResponse.MinimumInterval.builder() @@ -220,7 +229,9 @@ class SubscriptionCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -236,7 +247,11 @@ class SubscriptionCreateResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -254,7 +269,9 @@ class SubscriptionCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -317,7 +334,12 @@ class SubscriptionCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -351,7 +373,14 @@ class SubscriptionCreateResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -446,7 +475,12 @@ class SubscriptionCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -480,7 +514,14 @@ class SubscriptionCreateResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -591,7 +632,11 @@ class SubscriptionCreateResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -678,7 +723,11 @@ class SubscriptionCreateResponseTest { .build() ) assertThat(subscriptionCreateResponse.metadata()) - .isEqualTo(SubscriptionCreateResponse.Metadata.builder().build()) + .isEqualTo( + SubscriptionCreateResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscriptionCreateResponse.minimumIntervals()) .containsExactly( SubscriptionCreateResponse.MinimumInterval.builder() @@ -727,7 +776,7 @@ class SubscriptionCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -743,7 +792,11 @@ class SubscriptionCreateResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -761,7 +814,9 @@ class SubscriptionCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -822,7 +877,9 @@ class SubscriptionCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -853,7 +910,11 @@ class SubscriptionCreateResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -938,7 +999,9 @@ class SubscriptionCreateResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -966,7 +1029,11 @@ class SubscriptionCreateResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt index 985b2f92..8448b074 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -56,7 +57,12 @@ class SubscriptionFetchCostsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -94,7 +100,12 @@ class SubscriptionFetchCostsResponseTest { ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder().build() + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() ) .minimum( Price.UnitPrice.Minimum.builder() @@ -172,7 +183,12 @@ class SubscriptionFetchCostsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -208,7 +224,14 @@ class SubscriptionFetchCostsResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt index 42e3b819..9a1b223e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat @@ -135,6 +136,7 @@ class SubscriptionPriceIntervalsParamsTest { .NewFloatingUnitPrice .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .build() @@ -160,7 +162,7 @@ class SubscriptionPriceIntervalsParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -355,6 +357,10 @@ class SubscriptionPriceIntervalsParamsTest { .NewFloatingUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .build() @@ -380,7 +386,7 @@ class SubscriptionPriceIntervalsParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -570,6 +576,7 @@ class SubscriptionPriceIntervalsParamsTest { .NewFloatingUnitPrice .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .build() @@ -596,7 +603,7 @@ class SubscriptionPriceIntervalsParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt index cd0ee26c..da4f1e7c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -82,7 +83,11 @@ class SubscriptionPriceIntervalsResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -175,7 +180,11 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) ) - .metadata(SubscriptionPriceIntervalsResponse.Metadata.builder().build()) + .metadata( + SubscriptionPriceIntervalsResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( SubscriptionPriceIntervalsResponse.MinimumInterval.builder() @@ -224,7 +233,9 @@ class SubscriptionPriceIntervalsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -240,7 +251,11 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -258,7 +273,9 @@ class SubscriptionPriceIntervalsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -321,7 +338,12 @@ class SubscriptionPriceIntervalsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -355,7 +377,14 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -450,7 +479,12 @@ class SubscriptionPriceIntervalsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -484,7 +518,14 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -596,7 +637,11 @@ class SubscriptionPriceIntervalsResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -687,7 +732,11 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) assertThat(subscriptionPriceIntervalsResponse.metadata()) - .isEqualTo(SubscriptionPriceIntervalsResponse.Metadata.builder().build()) + .isEqualTo( + SubscriptionPriceIntervalsResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscriptionPriceIntervalsResponse.minimumIntervals()) .containsExactly( SubscriptionPriceIntervalsResponse.MinimumInterval.builder() @@ -736,7 +785,7 @@ class SubscriptionPriceIntervalsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -752,7 +801,11 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -770,7 +823,9 @@ class SubscriptionPriceIntervalsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -831,7 +886,9 @@ class SubscriptionPriceIntervalsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -862,7 +919,11 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -948,7 +1009,9 @@ class SubscriptionPriceIntervalsResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -976,7 +1039,11 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt index 24087f7a..da19c186 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParamsTest.kt @@ -31,7 +31,7 @@ class SubscriptionSchedulePlanChangeParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -137,6 +137,10 @@ class SubscriptionSchedulePlanChangeParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -205,7 +209,7 @@ class SubscriptionSchedulePlanChangeParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -311,6 +315,10 @@ class SubscriptionSchedulePlanChangeParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -348,7 +356,7 @@ class SubscriptionSchedulePlanChangeParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -456,6 +464,10 @@ class SubscriptionSchedulePlanChangeParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -525,7 +537,7 @@ class SubscriptionSchedulePlanChangeParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -639,6 +651,10 @@ class SubscriptionSchedulePlanChangeParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -672,7 +688,7 @@ class SubscriptionSchedulePlanChangeParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -779,6 +795,10 @@ class SubscriptionSchedulePlanChangeParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -850,7 +870,7 @@ class SubscriptionSchedulePlanChangeParamsTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -957,6 +977,10 @@ class SubscriptionSchedulePlanChangeParamsTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt index 7440256e..84aa4f7c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -82,7 +83,11 @@ class SubscriptionSchedulePlanChangeResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -175,7 +180,11 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) ) - .metadata(SubscriptionSchedulePlanChangeResponse.Metadata.builder().build()) + .metadata( + SubscriptionSchedulePlanChangeResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( SubscriptionSchedulePlanChangeResponse.MinimumInterval.builder() @@ -224,7 +233,9 @@ class SubscriptionSchedulePlanChangeResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -240,7 +251,11 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -258,7 +273,9 @@ class SubscriptionSchedulePlanChangeResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -321,7 +338,12 @@ class SubscriptionSchedulePlanChangeResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -355,7 +377,14 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -450,7 +479,12 @@ class SubscriptionSchedulePlanChangeResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -484,7 +518,14 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -596,7 +637,11 @@ class SubscriptionSchedulePlanChangeResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -687,7 +732,11 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) assertThat(subscriptionSchedulePlanChangeResponse.metadata()) - .isEqualTo(SubscriptionSchedulePlanChangeResponse.Metadata.builder().build()) + .isEqualTo( + SubscriptionSchedulePlanChangeResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscriptionSchedulePlanChangeResponse.minimumIntervals()) .containsExactly( SubscriptionSchedulePlanChangeResponse.MinimumInterval.builder() @@ -736,7 +785,7 @@ class SubscriptionSchedulePlanChangeResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -752,7 +801,11 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -770,7 +823,9 @@ class SubscriptionSchedulePlanChangeResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -831,7 +886,9 @@ class SubscriptionSchedulePlanChangeResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -862,7 +919,11 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -948,7 +1009,9 @@ class SubscriptionSchedulePlanChangeResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -976,7 +1039,11 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt index 433a9d1d..ece0c804 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -79,7 +80,11 @@ class SubscriptionTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -168,7 +173,11 @@ class SubscriptionTest { .build() ) ) - .metadata(Subscription.Metadata.builder().build()) + .metadata( + Subscription.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( Subscription.MinimumInterval.builder() @@ -217,7 +226,9 @@ class SubscriptionTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -233,7 +244,11 @@ class SubscriptionTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -251,7 +266,9 @@ class SubscriptionTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -314,7 +331,12 @@ class SubscriptionTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -348,7 +370,14 @@ class SubscriptionTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -441,7 +470,12 @@ class SubscriptionTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -475,7 +509,14 @@ class SubscriptionTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -584,7 +625,11 @@ class SubscriptionTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -668,7 +713,12 @@ class SubscriptionTest { .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - assertThat(subscription.metadata()).isEqualTo(Subscription.Metadata.builder().build()) + assertThat(subscription.metadata()) + .isEqualTo( + Subscription.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscription.minimumIntervals()) .containsExactly( Subscription.MinimumInterval.builder() @@ -717,7 +767,7 @@ class SubscriptionTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -733,7 +783,11 @@ class SubscriptionTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -751,7 +805,9 @@ class SubscriptionTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -812,7 +868,9 @@ class SubscriptionTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -843,7 +901,11 @@ class SubscriptionTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -927,7 +989,9 @@ class SubscriptionTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -955,7 +1019,11 @@ class SubscriptionTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt index 78f98908..72914b02 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -81,7 +82,11 @@ class SubscriptionTriggerPhaseResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -172,7 +177,11 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) ) - .metadata(SubscriptionTriggerPhaseResponse.Metadata.builder().build()) + .metadata( + SubscriptionTriggerPhaseResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( SubscriptionTriggerPhaseResponse.MinimumInterval.builder() @@ -221,7 +230,9 @@ class SubscriptionTriggerPhaseResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -237,7 +248,11 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -255,7 +270,9 @@ class SubscriptionTriggerPhaseResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -318,7 +335,12 @@ class SubscriptionTriggerPhaseResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -352,7 +374,14 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -447,7 +476,12 @@ class SubscriptionTriggerPhaseResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -481,7 +515,14 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -593,7 +634,11 @@ class SubscriptionTriggerPhaseResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -683,7 +728,11 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) assertThat(subscriptionTriggerPhaseResponse.metadata()) - .isEqualTo(SubscriptionTriggerPhaseResponse.Metadata.builder().build()) + .isEqualTo( + SubscriptionTriggerPhaseResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscriptionTriggerPhaseResponse.minimumIntervals()) .containsExactly( SubscriptionTriggerPhaseResponse.MinimumInterval.builder() @@ -732,7 +781,7 @@ class SubscriptionTriggerPhaseResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -748,7 +797,11 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -766,7 +819,9 @@ class SubscriptionTriggerPhaseResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -827,7 +882,9 @@ class SubscriptionTriggerPhaseResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -858,7 +915,11 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -944,7 +1005,9 @@ class SubscriptionTriggerPhaseResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -972,7 +1035,11 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt index e5fe2d8a..eb694531 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -85,7 +86,11 @@ class SubscriptionUnscheduleCancellationResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -179,7 +184,11 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) ) - .metadata(SubscriptionUnscheduleCancellationResponse.Metadata.builder().build()) + .metadata( + SubscriptionUnscheduleCancellationResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( SubscriptionUnscheduleCancellationResponse.MinimumInterval.builder() @@ -228,7 +237,9 @@ class SubscriptionUnscheduleCancellationResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -244,7 +255,11 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -262,7 +277,9 @@ class SubscriptionUnscheduleCancellationResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -325,7 +342,12 @@ class SubscriptionUnscheduleCancellationResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -359,7 +381,14 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -454,7 +483,12 @@ class SubscriptionUnscheduleCancellationResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -488,7 +522,14 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -602,7 +643,11 @@ class SubscriptionUnscheduleCancellationResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -695,7 +740,11 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) assertThat(subscriptionUnscheduleCancellationResponse.metadata()) - .isEqualTo(SubscriptionUnscheduleCancellationResponse.Metadata.builder().build()) + .isEqualTo( + SubscriptionUnscheduleCancellationResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscriptionUnscheduleCancellationResponse.minimumIntervals()) .containsExactly( SubscriptionUnscheduleCancellationResponse.MinimumInterval.builder() @@ -744,7 +793,7 @@ class SubscriptionUnscheduleCancellationResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -760,7 +809,11 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -778,7 +831,9 @@ class SubscriptionUnscheduleCancellationResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -839,7 +894,9 @@ class SubscriptionUnscheduleCancellationResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -870,7 +927,11 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -956,7 +1017,9 @@ class SubscriptionUnscheduleCancellationResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -984,7 +1047,11 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt index b6d6d145..aaf17905 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -88,7 +89,11 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -187,7 +192,9 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) ) .metadata( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.Metadata.builder().build() + SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() ) .minimumIntervals( listOf( @@ -238,7 +245,9 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -254,7 +263,11 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -272,7 +285,9 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -335,7 +350,12 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -369,7 +389,14 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -466,7 +493,12 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -500,7 +532,14 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -629,7 +668,11 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -725,7 +768,9 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { ) assertThat(subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.metadata()) .isEqualTo( - SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.Metadata.builder().build() + SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() ) assertThat(subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.minimumIntervals()) .containsExactly( @@ -775,7 +820,7 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -791,7 +836,11 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -809,7 +858,9 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -870,7 +921,9 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -901,7 +954,11 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -987,7 +1044,9 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -1015,7 +1074,11 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt index 86d4700a..00f35131 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -86,7 +87,11 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -182,7 +187,9 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { ) ) .metadata( - SubscriptionUnschedulePendingPlanChangesResponse.Metadata.builder().build() + SubscriptionUnschedulePendingPlanChangesResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() ) .minimumIntervals( listOf( @@ -232,7 +239,9 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -248,7 +257,11 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -266,7 +279,9 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -329,7 +344,12 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -363,7 +383,14 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -458,7 +485,12 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -492,7 +524,14 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -611,7 +650,11 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -704,7 +747,11 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) assertThat(subscriptionUnschedulePendingPlanChangesResponse.metadata()) - .isEqualTo(SubscriptionUnschedulePendingPlanChangesResponse.Metadata.builder().build()) + .isEqualTo( + SubscriptionUnschedulePendingPlanChangesResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscriptionUnschedulePendingPlanChangesResponse.minimumIntervals()) .containsExactly( SubscriptionUnschedulePendingPlanChangesResponse.MinimumInterval.builder() @@ -753,7 +800,7 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -769,7 +816,11 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -787,7 +838,9 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -848,7 +901,9 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -879,7 +934,11 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -965,7 +1024,9 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -993,7 +1054,11 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt index 1abfe382..236b1175 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -85,7 +86,11 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -179,7 +184,11 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) ) - .metadata(SubscriptionUpdateFixedFeeQuantityResponse.Metadata.builder().build()) + .metadata( + SubscriptionUpdateFixedFeeQuantityResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( SubscriptionUpdateFixedFeeQuantityResponse.MinimumInterval.builder() @@ -228,7 +237,9 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -244,7 +255,11 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -262,7 +277,9 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -325,7 +342,12 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -359,7 +381,14 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -454,7 +483,12 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -488,7 +522,14 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -602,7 +643,11 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -695,7 +740,11 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) assertThat(subscriptionUpdateFixedFeeQuantityResponse.metadata()) - .isEqualTo(SubscriptionUpdateFixedFeeQuantityResponse.Metadata.builder().build()) + .isEqualTo( + SubscriptionUpdateFixedFeeQuantityResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscriptionUpdateFixedFeeQuantityResponse.minimumIntervals()) .containsExactly( SubscriptionUpdateFixedFeeQuantityResponse.MinimumInterval.builder() @@ -744,7 +793,7 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -760,7 +809,11 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -778,7 +831,9 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -839,7 +894,9 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -870,7 +927,11 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -956,7 +1017,9 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -984,7 +1047,11 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateParamsTest.kt index 2fd3c0f5..daf03517 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,7 +16,11 @@ class SubscriptionUpdateParamsTest { .autoCollection(true) .defaultInvoiceMemo("default_invoice_memo") .invoicingThreshold("10.00") - .metadata(SubscriptionUpdateParams.Metadata.builder().build()) + .metadata( + SubscriptionUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .netTerms(0L) .build() } @@ -28,7 +33,11 @@ class SubscriptionUpdateParamsTest { .autoCollection(true) .defaultInvoiceMemo("default_invoice_memo") .invoicingThreshold("10.00") - .metadata(SubscriptionUpdateParams.Metadata.builder().build()) + .metadata( + SubscriptionUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .netTerms(0L) .build() val body = params.getBody() @@ -36,7 +45,12 @@ class SubscriptionUpdateParamsTest { assertThat(body.autoCollection()).isEqualTo(true) assertThat(body.defaultInvoiceMemo()).isEqualTo("default_invoice_memo") assertThat(body.invoicingThreshold()).isEqualTo("10.00") - assertThat(body.metadata()).isEqualTo(SubscriptionUpdateParams.Metadata.builder().build()) + assertThat(body.metadata()) + .isEqualTo( + SubscriptionUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(body.netTerms()).isEqualTo(0L) } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParamsTest.kt index f73faeec..388b6438 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParamsTest.kt @@ -15,7 +15,7 @@ class SubscriptionUpdateTrialParamsTest { .subscriptionId("subscription_id") .trialEndDate( SubscriptionUpdateTrialParams.TrialEndDate.ofOffsetDateTime( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + OffsetDateTime.parse("2017-07-21T17:32:28Z") ) ) .shift(true) @@ -29,7 +29,7 @@ class SubscriptionUpdateTrialParamsTest { .subscriptionId("subscription_id") .trialEndDate( SubscriptionUpdateTrialParams.TrialEndDate.ofOffsetDateTime( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + OffsetDateTime.parse("2017-07-21T17:32:28Z") ) ) .shift(true) @@ -39,7 +39,7 @@ class SubscriptionUpdateTrialParamsTest { assertThat(body.trialEndDate()) .isEqualTo( SubscriptionUpdateTrialParams.TrialEndDate.ofOffsetDateTime( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + OffsetDateTime.parse("2017-07-21T17:32:28Z") ) ) assertThat(body.shift()).isEqualTo(true) @@ -52,7 +52,7 @@ class SubscriptionUpdateTrialParamsTest { .subscriptionId("subscription_id") .trialEndDate( SubscriptionUpdateTrialParams.TrialEndDate.ofOffsetDateTime( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + OffsetDateTime.parse("2017-07-21T17:32:28Z") ) ) .build() @@ -61,7 +61,7 @@ class SubscriptionUpdateTrialParamsTest { assertThat(body.trialEndDate()) .isEqualTo( SubscriptionUpdateTrialParams.TrialEndDate.ofOffsetDateTime( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + OffsetDateTime.parse("2017-07-21T17:32:28Z") ) ) } @@ -73,7 +73,7 @@ class SubscriptionUpdateTrialParamsTest { .subscriptionId("subscription_id") .trialEndDate( SubscriptionUpdateTrialParams.TrialEndDate.ofOffsetDateTime( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + OffsetDateTime.parse("2017-07-21T17:32:28Z") ) ) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt index 31a8b262..70dc0439 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -81,7 +82,11 @@ class SubscriptionUpdateTrialResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -172,7 +177,11 @@ class SubscriptionUpdateTrialResponseTest { .build() ) ) - .metadata(SubscriptionUpdateTrialResponse.Metadata.builder().build()) + .metadata( + SubscriptionUpdateTrialResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( SubscriptionUpdateTrialResponse.MinimumInterval.builder() @@ -221,7 +230,9 @@ class SubscriptionUpdateTrialResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -237,7 +248,11 @@ class SubscriptionUpdateTrialResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -255,7 +270,9 @@ class SubscriptionUpdateTrialResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -318,7 +335,12 @@ class SubscriptionUpdateTrialResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -352,7 +374,14 @@ class SubscriptionUpdateTrialResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -447,7 +476,12 @@ class SubscriptionUpdateTrialResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -481,7 +515,14 @@ class SubscriptionUpdateTrialResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -593,7 +634,11 @@ class SubscriptionUpdateTrialResponseTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -683,7 +728,11 @@ class SubscriptionUpdateTrialResponseTest { .build() ) assertThat(subscriptionUpdateTrialResponse.metadata()) - .isEqualTo(SubscriptionUpdateTrialResponse.Metadata.builder().build()) + .isEqualTo( + SubscriptionUpdateTrialResponse.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) assertThat(subscriptionUpdateTrialResponse.minimumIntervals()) .containsExactly( SubscriptionUpdateTrialResponse.MinimumInterval.builder() @@ -732,7 +781,7 @@ class SubscriptionUpdateTrialResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -748,7 +797,11 @@ class SubscriptionUpdateTrialResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -766,7 +819,9 @@ class SubscriptionUpdateTrialResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -827,7 +882,9 @@ class SubscriptionUpdateTrialResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -858,7 +915,11 @@ class SubscriptionUpdateTrialResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -943,7 +1004,9 @@ class SubscriptionUpdateTrialResponseTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -971,7 +1034,11 @@ class SubscriptionUpdateTrialResponseTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt index acaf1b88..1ad00972 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import com.withorb.api.core.JsonValue import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -87,7 +88,11 @@ class SubscriptionsTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -184,7 +189,11 @@ class SubscriptionsTest { .build() ) ) - .metadata(Subscription.Metadata.builder().build()) + .metadata( + Subscription.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( Subscription.MinimumInterval.builder() @@ -234,7 +243,9 @@ class SubscriptionsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -252,7 +263,11 @@ class SubscriptionsTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -270,7 +285,12 @@ class SubscriptionsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -340,7 +360,12 @@ class SubscriptionsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -378,7 +403,12 @@ class SubscriptionsTest { ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder().build() + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() ) .minimum( Price.UnitPrice.Minimum.builder() @@ -486,7 +516,12 @@ class SubscriptionsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -524,7 +559,12 @@ class SubscriptionsTest { ) .maximumAmount("maximum_amount") .metadata( - Price.UnitPrice.Metadata.builder().build() + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() ) .minimum( Price.UnitPrice.Minimum.builder() @@ -643,7 +683,11 @@ class SubscriptionsTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -732,7 +776,11 @@ class SubscriptionsTest { .build() ) ) - .metadata(Subscription.Metadata.builder().build()) + .metadata( + Subscription.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimumIntervals( listOf( Subscription.MinimumInterval.builder() @@ -782,7 +830,9 @@ class SubscriptionsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") + ) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -798,7 +848,11 @@ class SubscriptionsTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Plan.Metadata.builder().build()) + .metadata( + Plan.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .minimum( Plan.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -816,7 +870,12 @@ class SubscriptionsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType.PERCENTAGE ) @@ -881,7 +940,12 @@ class SubscriptionsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -917,7 +981,14 @@ class SubscriptionsTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) @@ -1013,7 +1084,12 @@ class SubscriptionsTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds( + listOf( + "h74gfhdjvn7ujokd", + "7hfgtgjnbvc3ujkl" + ) + ) .discountType( PercentageDiscount.DiscountType .PERCENTAGE @@ -1049,7 +1125,14 @@ class SubscriptionsTest { .build() ) .maximumAmount("maximum_amount") - .metadata(Price.UnitPrice.Metadata.builder().build()) + .metadata( + Price.UnitPrice.Metadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) + .build() + ) .minimum( Price.UnitPrice.Minimum.builder() .appliesToPriceIds(listOf("string")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/TrialDiscountTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/TrialDiscountTest.kt index f0fd127c..8a13706d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/TrialDiscountTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/TrialDiscountTest.kt @@ -11,14 +11,15 @@ class TrialDiscountTest { fun createTrialDiscount() { val trialDiscount = TrialDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(TrialDiscount.DiscountType.TRIAL) .reason("reason") .trialAmountDiscount("trial_amount_discount") .trialPercentageDiscount(0.0) .build() assertThat(trialDiscount).isNotNull - assertThat(trialDiscount.appliesToPriceIds()).containsExactly("string") + assertThat(trialDiscount.appliesToPriceIds()) + .containsExactly("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl") assertThat(trialDiscount.discountType()).isEqualTo(TrialDiscount.DiscountType.TRIAL) assertThat(trialDiscount.reason()).contains("reason") assertThat(trialDiscount.trialAmountDiscount()).contains("trial_amount_discount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt index 99585aa3..58ac30c8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/ErrorHandlingTest.kt @@ -15,6 +15,7 @@ import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.withorb.api.client.OrbClient import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonString +import com.withorb.api.core.JsonValue import com.withorb.api.core.http.Headers import com.withorb.api.core.jsonMapper import com.withorb.api.errors.BadRequestException @@ -90,7 +91,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -151,7 +156,11 @@ class ErrorHandlingTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -236,7 +245,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -321,7 +334,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -406,7 +423,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -491,7 +512,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -576,7 +601,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -661,7 +690,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -746,7 +779,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -831,7 +868,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -921,7 +962,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -1005,7 +1050,11 @@ class ErrorHandlingTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt index 2853de6b..de1e62e4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt @@ -89,7 +89,11 @@ class ServiceParamsTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -153,7 +157,11 @@ class ServiceParamsTest { .emailDelivery(true) .exemptFromAutomatedTax(true) .externalCustomerId("external_customer_id") - .metadata(Customer.Metadata.builder().build()) + .metadata( + Customer.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt index 08e4e43a..e8e87ffa 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt @@ -4,6 +4,7 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import com.withorb.api.models.CustomerListParams import org.junit.jupiter.api.Test @@ -55,7 +56,11 @@ class CustomerServiceTest { .currency("currency") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerCreateParams.Metadata.builder().build()) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") .reportingConfiguration( @@ -142,7 +147,11 @@ class CustomerServiceTest { .email("dev@stainlessapi.com") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerUpdateParams.Metadata.builder().build()) + .metadata( + CustomerUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(CustomerUpdateParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") @@ -285,7 +294,11 @@ class CustomerServiceTest { .email("dev@stainlessapi.com") .emailDelivery(true) .externalCustomerId("external_customer_id") - .metadata(CustomerUpdateByExternalIdParams.Metadata.builder().build()) + .metadata( + CustomerUpdateByExternalIdParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .name("name") .paymentProvider(CustomerUpdateByExternalIdParams.PaymentProvider.QUICKBOOKS) .paymentProviderId("payment_provider_id") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt index 8067d25a..5fe598d2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt @@ -4,6 +4,7 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import com.withorb.api.models.InvoiceListParams import java.time.LocalDate @@ -49,7 +50,7 @@ class InvoiceServiceTest { .discount( Discount.ofPercentageDiscount( PercentageDiscount.builder() - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl")) .discountType(PercentageDiscount.DiscountType.PERCENTAGE) .percentageDiscount(0.15) .reason("reason") @@ -58,7 +59,11 @@ class InvoiceServiceTest { ) .externalCustomerId("external-customer-id") .memo("An optional memo for my invoice.") - .metadata(InvoiceCreateParams.Metadata.builder().build()) + .metadata( + InvoiceCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .willAutoIssue(false) .build() ) @@ -78,7 +83,11 @@ class InvoiceServiceTest { invoiceService.update( InvoiceUpdateParams.builder() .invoiceId("invoice_id") - .metadata(InvoiceUpdateParams.Metadata.builder().build()) + .metadata( + InvoiceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() ) println(invoice) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt index 211235f0..514503d9 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt @@ -4,6 +4,7 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import com.withorb.api.models.MetricListParams import org.junit.jupiter.api.Test @@ -27,7 +28,11 @@ class MetricServiceTest { .itemId("item_id") .name("Bytes downloaded") .sql("SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'") - .metadata(MetricCreateParams.Metadata.builder().build()) + .metadata( + MetricCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() ) println(billableMetric) @@ -46,7 +51,11 @@ class MetricServiceTest { metricService.update( MetricUpdateParams.builder() .metricId("metric_id") - .metadata(MetricUpdateParams.Metadata.builder().build()) + .metadata( + MetricUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() ) println(billableMetric) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt index 163a1386..8b329414 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt @@ -4,6 +4,7 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import com.withorb.api.models.PlanListParams import org.junit.jupiter.api.Test @@ -75,6 +76,7 @@ class PlanServiceTest { ) .metadata( PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .build() @@ -83,7 +85,11 @@ class PlanServiceTest { ) .defaultInvoiceMemo("default_invoice_memo") .externalPlanId("external_plan_id") - .metadata(PlanCreateParams.Metadata.builder().build()) + .metadata( + PlanCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .netTerms(0L) .status(PlanCreateParams.Status.ACTIVE) .build() @@ -105,7 +111,11 @@ class PlanServiceTest { PlanUpdateParams.builder() .planId("plan_id") .externalPlanId("external_plan_id") - .metadata(PlanUpdateParams.Metadata.builder().build()) + .metadata( + PlanUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() ) println(plan) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt index 8762a3d7..f6275247 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt @@ -4,6 +4,7 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import com.withorb.api.models.PriceListParams import java.time.OffsetDateTime @@ -67,7 +68,9 @@ class PriceServiceTest { .build() ) .metadata( - PriceCreateParams.NewFloatingUnitPrice.Metadata.builder().build() + PriceCreateParams.NewFloatingUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() ) .build() ) @@ -88,7 +91,11 @@ class PriceServiceTest { priceService.update( PriceUpdateParams.builder() .priceId("price_id") - .metadata(PriceUpdateParams.Metadata.builder().build()) + .metadata( + PriceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() ) println(price) @@ -124,7 +131,9 @@ class PriceServiceTest { .customerId("customer_id") .externalCustomerId("external_customer_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") - .groupingKeys(listOf("string")) + .groupingKeys( + listOf("case when my_event_type = 'foo' then true else false end") + ) .build() ) println(priceEvaluateResponse) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt index f9d73b46..59530562 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt @@ -44,7 +44,7 @@ class SubscriptionServiceTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -148,6 +148,10 @@ class SubscriptionServiceTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -181,7 +185,11 @@ class SubscriptionServiceTest { .filter("my_property > 100 AND my_other_property = 'bar'") .initialPhaseOrder(2L) .invoicingThreshold("10.00") - .metadata(SubscriptionCreateParams.Metadata.builder().build()) + .metadata( + SubscriptionCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .netTerms(0L) .perCreditOverageAmount(0.0) .planId("ZMwNQefe7J3ecf7W") @@ -218,7 +226,7 @@ class SubscriptionServiceTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -322,6 +330,10 @@ class SubscriptionServiceTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -355,7 +367,11 @@ class SubscriptionServiceTest { .autoCollection(true) .defaultInvoiceMemo("default_invoice_memo") .invoicingThreshold("10.00") - .metadata(SubscriptionUpdateParams.Metadata.builder().build()) + .metadata( + SubscriptionUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .netTerms(0L) .build() ) @@ -622,6 +638,10 @@ class SubscriptionServiceTest { .NewFloatingUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .build() @@ -648,7 +668,7 @@ class SubscriptionServiceTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -755,7 +775,7 @@ class SubscriptionServiceTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -871,6 +891,10 @@ class SubscriptionServiceTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -942,7 +966,7 @@ class SubscriptionServiceTest { .AdjustmentType .PERCENTAGE_DISCOUNT ) - .appliesToPriceIds(listOf("string")) + .appliesToPriceIds(listOf("price_1", "price_2")) .percentageDiscount(0.0) .isInvoiceLevel(true) .build() @@ -1062,6 +1086,10 @@ class SubscriptionServiceTest { .NewSubscriptionUnitPrice .Metadata .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string") + ) .build() ) .referenceId("reference_id") @@ -1189,7 +1217,7 @@ class SubscriptionServiceTest { .subscriptionId("subscription_id") .trialEndDate( SubscriptionUpdateTrialParams.TrialEndDate.ofOffsetDateTime( - OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + OffsetDateTime.parse("2017-07-21T17:32:28Z") ) ) .shift(true) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt index f64b7383..77af8f08 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt @@ -4,6 +4,7 @@ package com.withorb.api.services.blocking.customers.credits import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import com.withorb.api.models.CustomerCreditLedgerListByExternalIdParams import com.withorb.api.models.CustomerCreditLedgerListParams @@ -73,6 +74,7 @@ class LedgerServiceTest { .AddIncrementCreditLedgerEntryRequestParams .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .perUnitCostBasis("per_unit_cost_basis") @@ -126,6 +128,7 @@ class LedgerServiceTest { .AddIncrementCreditLedgerEntryRequestParams .Metadata .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) .perUnitCostBasis("per_unit_cost_basis") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt index e96e00c2..5899568e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt @@ -4,6 +4,7 @@ package com.withorb.api.services.blocking.plans import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -24,7 +25,11 @@ class ExternalPlanIdServiceTest { PlanExternalPlanIdUpdateParams.builder() .otherExternalPlanId("external_plan_id") .externalPlanId("external_plan_id") - .metadata(PlanExternalPlanIdUpdateParams.Metadata.builder().build()) + .metadata( + PlanExternalPlanIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() ) println(plan) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt index 426235b3..83f9f166 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt @@ -4,6 +4,7 @@ package com.withorb.api.services.blocking.prices import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient +import com.withorb.api.core.JsonValue import com.withorb.api.models.* import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -23,7 +24,11 @@ class ExternalPriceIdServiceTest { externalPriceIdService.update( PriceExternalPriceIdUpdateParams.builder() .externalPriceId("external_price_id") - .metadata(PriceExternalPriceIdUpdateParams.Metadata.builder().build()) + .metadata( + PriceExternalPriceIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) .build() ) println(price)