diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCombination.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCombination.kt index 263a34ed7..d142eed24 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCombination.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCombination.kt @@ -20,6 +20,7 @@ fun FetchedVariation.toUpdated(): UpdatedVariation { wholesalePrices = wholesalePrices?.map(FetchedVariation.WholesalePrice::toUpdated), compareToPrice = compareToPrice, lowestPrice = lowestPrice, + lowestPriceSettings = lowestPriceSettings.toUpdated(), weight = weight, dimensions = dimensions?.toUpdated(), @@ -76,3 +77,8 @@ private fun List.toUpdated() = map { subscriptionPriceWithSignUpFee = it.subscriptionPriceWithSignUpFee ) } + +private fun FetchedVariation.LowestPriceSettings.toUpdated() = UpdatedVariation.LowestPriceSettings( + lowestPriceEnabled = lowestPriceEnabled, + manualLowestPrice = manualLowestPrice, +) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt index f4108b95c..c50d7174b 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt @@ -28,6 +28,7 @@ fun FetchedProduct.toUpdated(): UpdatedProduct { wholesalePrices = wholesalePrices?.map(FetchedProduct.WholesalePrice::toUpdated), compareToPrice = compareToPrice, lowestPrice = lowestPrice, + lowestPriceSettings = lowestPriceSettings.toUpdated(), weight = weight, dimensions = dimensions?.toUpdated(), @@ -233,3 +234,8 @@ fun FetchedProduct.TaxInfo.toUpdated() = UpdatedProduct.TaxInfo( enabledManualTaxes = enabledManualTaxes, taxClassCode = taxClassCode, ) + +fun FetchedProduct.LowestPriceSettings.toUpdated() = UpdatedProduct.LowestPriceSettings( + lowestPriceEnabled = lowestPriceEnabled, + manualLowestPrice = manualLowestPrice +) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt index f14384154..0dc0e5d43 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt @@ -28,6 +28,7 @@ data class UpdatedProduct( val wholesalePrices: List? = null, val compareToPrice: Double? = null, val lowestPrice: Double? = null, + val lowestPriceSettings: LowestPriceSettings? = null, val weight: Double? = null, val dimensions: ProductDimensions? = null, @@ -380,5 +381,10 @@ data class UpdatedProduct( ) } + data class LowestPriceSettings( + val lowestPriceEnabled: Boolean? = null, + val manualLowestPrice: Double? = null, + ) + override fun getModifyKind() = ModifyKind.ReadWrite(FetchedProduct::class) } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt index 36a142b15..086757442 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt @@ -85,6 +85,8 @@ data class FetchedProduct( val defaultDisplayedLowestPrice: Double? = null, val defaultDisplayedLowestPriceFormatted: String? = null, + val lowestPriceSettings: LowestPriceSettings = LowestPriceSettings(), + val weight: Double? = null, val dimensions: ProductDimensions? = null, val volume: Double = 0.0, @@ -380,4 +382,14 @@ data class FetchedProduct( ) override fun getModifyKind() = ModifyKind.ReadWrite(UpdatedProduct::class) + + data class LowestPriceSettings( + val lowestPriceEnabled: Boolean = false, + val manualLowestPrice: Double? = null, + val defaultDisplayedLowestPrice: Double? = null, + val defaultDisplayedLowestPriceFormatted: String? = null, + val automaticLowestPrice: Double? = null, + val defaultDisplayedAutomaticLowestPrice: Double? = null, + val defaultDisplayedAutomaticLowestPriceFormatted: String? = null, + ) } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt index 2cd9505d9..f07b85b23 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt @@ -20,6 +20,7 @@ data class UpdatedVariation( val compareToPrice: Double? = null, val lowestPrice: Double? = null, val wholesalePrices: List? = null, + val lowestPriceSettings: LowestPriceSettings? = null, val quantity: Int? = null, val outOfStockVisibilityBehaviour: OutOfStockVisibilityBehaviour? = null, @@ -79,5 +80,10 @@ data class UpdatedVariation( val subscriptionPriceWithSignUpFee: Double? = null, ) + data class LowestPriceSettings( + val lowestPriceEnabled: Boolean? = null, + val manualLowestPrice: Double? = null, + ) + override fun getModifyKind() = ModifyKind.ReadWrite(FetchedVariation::class) } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt index c3e3f3e63..e8dd1c233 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt @@ -33,6 +33,7 @@ data class FetchedVariation( val defaultDisplayedLowestPrice: Double? = null, val defaultDisplayedLowestPriceFormatted: String? = null, val wholesalePrices: List? = null, + val lowestPriceSettings: LowestPriceSettings = LowestPriceSettings(), val quantity: Int? = null, val outOfStockVisibilityBehaviour: OutOfStockVisibilityBehaviour? = null, @@ -118,5 +119,15 @@ data class FetchedVariation( val signUpFeeFormatted: String? = null ) + data class LowestPriceSettings( + val lowestPriceEnabled: Boolean = false, + val manualLowestPrice: Double? = null, + val defaultDisplayedLowestPrice: Double? = null, + val defaultDisplayedLowestPriceFormatted: String? = null, + val automaticLowestPrice: Double? = null, + val defaultDisplayedAutomaticLowestPrice: Double? = null, + val defaultDisplayedAutomaticLowestPriceFormatted: String? = null, + ) + override fun getModifyKind() = ModifyKind.ReadWrite(UpdatedVariation::class) } diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt index ef9dc09ed..7574d2dd8 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt @@ -43,6 +43,11 @@ val nonUpdatablePropertyRules: List> = listOf( Ignored(FetchedProduct::lowestPrice), ReadOnly(FetchedProduct::defaultDisplayedLowestPrice), ReadOnly(FetchedProduct::defaultDisplayedLowestPriceFormatted), + ReadOnly(FetchedProduct.LowestPriceSettings::defaultDisplayedLowestPrice), + ReadOnly(FetchedProduct.LowestPriceSettings::defaultDisplayedLowestPriceFormatted), + ReadOnly(FetchedProduct.LowestPriceSettings::automaticLowestPrice), + ReadOnly(FetchedProduct.LowestPriceSettings::defaultDisplayedAutomaticLowestPrice), + ReadOnly(FetchedProduct.LowestPriceSettings::defaultDisplayedAutomaticLowestPriceFormatted), Ignored(FetchedProduct.AttributeValue::name), Ignored(FetchedProduct.AttributeValue::type), Ignored(FetchedProduct.AttributeValue::show), @@ -262,6 +267,11 @@ val nonUpdatablePropertyRules: List> = listOf( Ignored(FetchedVariation::lowestPrice), ReadOnly(FetchedVariation::defaultDisplayedLowestPrice), ReadOnly(FetchedVariation::defaultDisplayedLowestPriceFormatted), + ReadOnly(FetchedVariation.LowestPriceSettings::defaultDisplayedLowestPrice), + ReadOnly(FetchedVariation.LowestPriceSettings::defaultDisplayedLowestPriceFormatted), + ReadOnly(FetchedVariation.LowestPriceSettings::automaticLowestPrice), + ReadOnly(FetchedVariation.LowestPriceSettings::defaultDisplayedAutomaticLowestPrice), + ReadOnly(FetchedVariation.LowestPriceSettings::defaultDisplayedAutomaticLowestPriceFormatted), Ignored(FetchedVariation.AttributeValue::name), Ignored(FetchedVariation.AttributeValue::type), Ignored(FetchedVariation.AttributeValue::show), diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt index 7a5c6a669..fa27ed139 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt @@ -26,6 +26,13 @@ val fetchedProductNullablePropertyRules: List> = list AllowNullable(FetchedProduct::lowestPrice), AllowNullable(FetchedProduct::defaultDisplayedLowestPrice), AllowNullable(FetchedProduct::defaultDisplayedLowestPriceFormatted), + AllowNullable(FetchedProduct.LowestPriceSettings::manualLowestPrice), + AllowNullable(FetchedProduct.LowestPriceSettings::defaultDisplayedLowestPrice), + AllowNullable(FetchedProduct.LowestPriceSettings::defaultDisplayedLowestPriceFormatted), + AllowNullable(FetchedProduct.LowestPriceSettings::automaticLowestPrice), + AllowNullable(FetchedProduct.LowestPriceSettings::defaultDisplayedAutomaticLowestPrice), + AllowNullable(FetchedProduct.LowestPriceSettings::defaultDisplayedAutomaticLowestPriceFormatted), + AllowNullable(FetchedProduct::customsHsTariffCode), IgnoreNullable(FetchedProduct::defaultCategoryId), IgnoreNullable(FetchedProduct::defaultCombinationId), diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedVariationRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedVariationRules.kt index c1ba0ed9d..259dca079 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedVariationRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedVariationRules.kt @@ -12,6 +12,12 @@ val fetchedVariationTypeNullablePropertyRules: List> IgnoreNullable(FetchedVariation::lowestPrice), IgnoreNullable(FetchedVariation::defaultDisplayedLowestPrice), IgnoreNullable(FetchedVariation::defaultDisplayedLowestPriceFormatted), + AllowNullable(FetchedVariation.LowestPriceSettings::manualLowestPrice), + AllowNullable(FetchedVariation.LowestPriceSettings::defaultDisplayedLowestPrice), + AllowNullable(FetchedVariation.LowestPriceSettings::defaultDisplayedLowestPriceFormatted), + AllowNullable(FetchedVariation.LowestPriceSettings::automaticLowestPrice), + AllowNullable(FetchedVariation.LowestPriceSettings::defaultDisplayedAutomaticLowestPrice), + AllowNullable(FetchedVariation.LowestPriceSettings::defaultDisplayedAutomaticLowestPriceFormatted), AllowNullable(FetchedVariation::costPrice), AllowNullable(FetchedVariation::customsHsTariffCode), IgnoreNullable(FetchedVariation::defaultDisplayedPrice),