Skip to content

Commit

Permalink
ECWID-123548 - make priceModifier and priceModifierType nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
mplain committed Jul 12, 2023
1 parent 04f853a commit 47e804a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ data class UpdatedProduct(
data class ProductOptionChoice(
val text: String = "",
val textTranslated: LocalizedValueMap? = null,
val priceModifier: Double = 0.0,
val priceModifierType: PriceModifierType = PriceModifierType.ABSOLUTE
val priceModifier: Double? = null,
val priceModifierType: PriceModifierType? = null,
)

data class ShippingSettings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.ecwid.apiclient.v3.dto.category.request.CategoriesSearchRequest.Paren
import com.ecwid.apiclient.v3.dto.category.request.CategoryCreateRequest
import com.ecwid.apiclient.v3.dto.category.request.UpdatedCategory
import com.ecwid.apiclient.v3.dto.common.*
import com.ecwid.apiclient.v3.dto.product.enums.PriceModifierType
import com.ecwid.apiclient.v3.dto.product.enums.ShippingSettingsType
import com.ecwid.apiclient.v3.dto.product.request.*
import com.ecwid.apiclient.v3.dto.product.request.GetProductFiltersRequest.*
Expand Down Expand Up @@ -1571,7 +1572,7 @@ private fun generateProductOptionChoice(): ProductOptionChoice {
"en" to enText
),
priceModifier = randomModifier(),
priceModifierType = randomEnumValue()
priceModifierType = randomEnumValue<PriceModifierType>()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.ecwid.apiclient.v3.entity
import com.ecwid.apiclient.v3.converter.toUpdated
import com.ecwid.apiclient.v3.dto.common.AsyncPictureData
import com.ecwid.apiclient.v3.dto.common.UploadFileData
import com.ecwid.apiclient.v3.dto.product.enums.PriceModifierType
import com.ecwid.apiclient.v3.dto.product.request.ProductCreateRequest
import com.ecwid.apiclient.v3.dto.product.request.ProductDetailsRequest
import com.ecwid.apiclient.v3.dto.product.request.UpdatedProduct
Expand Down Expand Up @@ -340,7 +341,7 @@ private fun generateProductSelectOption(name: String, values: List<String>): Upd
private fun generateProductOptionChoice(value: String) = UpdatedProduct.ProductOptionChoice(
text = value,
priceModifier = randomModifier(),
priceModifierType = randomEnumValue()
priceModifierType = randomEnumValue<PriceModifierType>()
)

private fun generateProductRadioOption(name: String, values: List<String>): UpdatedProduct.ProductOption.RadioOption {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ import kotlin.reflect.KProperty1
val nonnullPropertyRules: List<NonnullPropertyRule<*, *>> = listOf(
AllowNonnull(ApiUpdatedDTO.ModifyKind.ReadWrite::fetchedDTOClass),

AllowNonnull(UpdatedProduct.ProductOption.CheckboxOption::required),
AllowNonnull(UpdatedProduct.ProductOption.DateOption::required),
AllowNonnull(UpdatedProduct.ProductOption.FilesOption::required),
AllowNonnull(UpdatedProduct.ProductOption.RadioOption::required),
AllowNonnull(UpdatedProduct.ProductOption.SelectOption::required),
AllowNonnull(UpdatedProduct.ProductOption.SizeOption::required),
AllowNonnull(UpdatedProduct.ProductOption.TextAreaOption::required),
AllowNonnull(UpdatedProduct.ProductOption.TextFieldOption::required),
AllowNonnull(UpdatedProduct.CustomPriceTier::value),

AllowNonnull(UpdatedStorageData::key),
Expand All @@ -39,18 +31,13 @@ val nonnullPropertyRules: List<NonnullPropertyRule<*, *>> = listOf(
IgnoreNonnull(UpdatedProduct.ProductOption.DateOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.FilesOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.RadioOption::choices),
IgnoreNonnull(UpdatedProduct.ProductOption.RadioOption::defaultChoice),
IgnoreNonnull(UpdatedProduct.ProductOption.RadioOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.SelectOption::choices),
IgnoreNonnull(UpdatedProduct.ProductOption.SelectOption::defaultChoice),
IgnoreNonnull(UpdatedProduct.ProductOption.SelectOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.SizeOption::choices),
IgnoreNonnull(UpdatedProduct.ProductOption.SizeOption::defaultChoice),
IgnoreNonnull(UpdatedProduct.ProductOption.SizeOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.TextAreaOption::name),
IgnoreNonnull(UpdatedProduct.ProductOption.TextFieldOption::name),
IgnoreNonnull(UpdatedProduct.ProductOptionChoice::priceModifier),
IgnoreNonnull(UpdatedProduct.ProductOptionChoice::priceModifierType),
IgnoreNonnull(UpdatedProduct.ProductOptionChoice::text),
IgnoreNonnull(UpdatedProduct.RecurringChargeSettings::recurringInterval),
IgnoreNonnull(UpdatedProduct.RecurringChargeSettings::recurringIntervalCount),
Expand Down

0 comments on commit 47e804a

Please sign in to comment.