Skip to content

Commit 2c3b460

Browse files
committed
Merge remote-tracking branch 'origin/master' into ECWID-107598
2 parents 81c5ff6 + c5b999c commit 2c3b460

8 files changed

Lines changed: 115 additions & 42 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.ecwid.apiclient.v3.dto.common
2+
3+
import com.ecwid.apiclient.v3.dto.custom.CustomAppRequest
4+
import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueLocation
5+
import com.ecwid.apiclient.v3.dto.product.result.FetchedProduct
6+
import com.ecwid.apiclient.v3.dto.producttype.enums.AttributeType
7+
import com.ecwid.apiclient.v3.dto.variation.result.FetchedVariation
8+
9+
interface FetchedAttributeValue {
10+
val id: Int?
11+
val name: String?
12+
val type: AttributeType?
13+
val value: String?
14+
val show: AttributeValueLocation?
15+
16+
fun toProductAttribute() = FetchedProduct.AttributeValue(
17+
id = id,
18+
name = name,
19+
type = type,
20+
value = value,
21+
show = show,
22+
)
23+
24+
fun toVariationAttribute() = FetchedVariation.AttributeValue(
25+
id = id,
26+
name = name,
27+
type = type,
28+
value = value,
29+
show = show,
30+
)
31+
32+
fun toOrderAttribute() = CustomAppRequest.AttributeValue(
33+
id = id,
34+
name = name,
35+
type = type,
36+
value = value,
37+
show = show,
38+
)
39+
40+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.ecwid.apiclient.v3.dto.common
2+
3+
import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueAlias
4+
import com.ecwid.apiclient.v3.dto.product.request.UpdatedProduct
5+
import com.ecwid.apiclient.v3.dto.variation.request.UpdatedVariation
6+
7+
interface UpdatedAttributeValue {
8+
val id: Int?
9+
val alias: AttributeValueAlias?
10+
val name: String?
11+
val value: String?
12+
13+
fun toProductAttribute() = UpdatedProduct.AttributeValue(
14+
id = id,
15+
alias = alias,
16+
name = name,
17+
value = value,
18+
)
19+
20+
fun toVariationAttribute() = UpdatedVariation.AttributeValue(
21+
id = id,
22+
alias = alias,
23+
name = name,
24+
value = value,
25+
)
26+
27+
}

src/main/kotlin/com/ecwid/apiclient/v3/dto/custom/CustomAppRequest.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package com.ecwid.apiclient.v3.dto.custom
22

33
import com.ecwid.apiclient.v3.dto.cart.result.FetchedCart
4-
import com.ecwid.apiclient.v3.dto.common.ApiRequestDTO
5-
import com.ecwid.apiclient.v3.dto.common.OrderedStringToListStringMap
6-
import com.ecwid.apiclient.v3.dto.common.OrderedStringToStringMap
7-
import com.ecwid.apiclient.v3.dto.common.PictureInfo
4+
import com.ecwid.apiclient.v3.dto.common.*
85
import com.ecwid.apiclient.v3.dto.order.enums.*
96
import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueLocation
107
import com.ecwid.apiclient.v3.dto.producttype.enums.AttributeType
@@ -226,7 +223,10 @@ data class CustomAppRequest(
226223
val applicationLimit: DiscountCouponApplicationLimit? = null,
227224
val creationDate: Date? = null,
228225
val orderCount: Int? = null,
229-
@Deprecated("This field is added for backward compatibility only. Don't use it.", replaceWith = ReplaceWith("catalogLimit"))
226+
@Deprecated(
227+
"This field is added for backward compatibility only. Don't use it.",
228+
replaceWith = ReplaceWith("catalogLimit")
229+
)
230230
val legacyCatalogLimit: DiscountCouponCatalogLimit? = null,
231231
val catalogLimit: DiscountCouponCatalogLimit? = null,
232232
val repeatCustomerOnly: Boolean? = null,
@@ -277,12 +277,12 @@ data class CustomAppRequest(
277277
)
278278

279279
data class AttributeValue(
280-
val id: Int? = null,
281-
val name: String? = null,
282-
val type: AttributeType? = null,
283-
val value: String? = null,
284-
val show: AttributeValueLocation? = null
285-
)
280+
override val id: Int? = null,
281+
override val name: String? = null,
282+
override val type: AttributeType? = null,
283+
override val value: String? = null,
284+
override val show: AttributeValueLocation? = null
285+
) : FetchedAttributeValue
286286

287287
data class ProductDimensions(
288288
val length: Double? = null,

src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package com.ecwid.apiclient.v3.dto.product.request
22

3-
import com.ecwid.apiclient.v3.dto.common.NullableUpdatedValue
4-
import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO
3+
import com.ecwid.apiclient.v3.dto.common.*
54
import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind
6-
import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap
7-
import com.ecwid.apiclient.v3.dto.common.ProductCondition
85
import com.ecwid.apiclient.v3.dto.product.enums.*
96
import com.ecwid.apiclient.v3.dto.product.result.FetchedProduct
107

@@ -276,11 +273,11 @@ data class UpdatedProduct(
276273
)
277274

278275
data class AttributeValue internal constructor(
279-
val id: Int? = null,
280-
val alias: AttributeValueAlias? = null,
281-
val name: String? = null,
282-
val value: String? = null
283-
) {
276+
override val id: Int? = null,
277+
override val alias: AttributeValueAlias? = null,
278+
override val name: String? = null,
279+
override val value: String? = null
280+
) : UpdatedAttributeValue {
284281

285282
companion object {
286283

src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package com.ecwid.apiclient.v3.dto.product.result
22

3-
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO
3+
import com.ecwid.apiclient.v3.dto.common.*
44
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind
5-
import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap
6-
import com.ecwid.apiclient.v3.dto.common.PictureInfo
7-
import com.ecwid.apiclient.v3.dto.common.ProductCondition
85
import com.ecwid.apiclient.v3.dto.product.enums.*
96
import com.ecwid.apiclient.v3.dto.product.request.UpdatedProduct
107
import com.ecwid.apiclient.v3.dto.producttype.enums.AttributeType
@@ -238,12 +235,12 @@ data class FetchedProduct(
238235
)
239236

240237
data class AttributeValue(
241-
val id: Int? = null,
242-
val name: String? = null,
243-
val type: AttributeType? = null,
244-
val value: String? = null,
245-
val show: AttributeValueLocation? = null
246-
)
238+
override val id: Int? = null,
239+
override val name: String? = null,
240+
override val type: AttributeType? = null,
241+
override val value: String? = null,
242+
override val show: AttributeValueLocation? = null
243+
) : FetchedAttributeValue
247244

248245
data class RelatedProducts(
249246
val productIds: List<Int>? = null,

src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/request/UpdatedVariation.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.ecwid.apiclient.v3.dto.variation.request
22

33
import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO
44
import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind
5+
import com.ecwid.apiclient.v3.dto.common.UpdatedAttributeValue
56
import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueAlias
67
import com.ecwid.apiclient.v3.dto.product.enums.OutOfStockVisibilityBehaviour
78
import com.ecwid.apiclient.v3.dto.variation.result.FetchedVariation
@@ -34,11 +35,11 @@ data class UpdatedVariation(
3435
) : ApiUpdatedDTO {
3536

3637
data class AttributeValue(
37-
val id: Int? = null,
38-
val alias: AttributeValueAlias? = null,
39-
val name: String? = null,
40-
val value: String? = null
41-
)
38+
override val id: Int? = null,
39+
override val alias: AttributeValueAlias? = null,
40+
override val name: String? = null,
41+
override val value: String? = null
42+
) : UpdatedAttributeValue
4243

4344
data class WholesalePrice(
4445
val quantity: Int = 0,

src/main/kotlin/com/ecwid/apiclient/v3/dto/variation/result/FetchedVariation.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.ecwid.apiclient.v3.dto.variation.result
22

33
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO
44
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind
5+
import com.ecwid.apiclient.v3.dto.common.FetchedAttributeValue
56
import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap
67
import com.ecwid.apiclient.v3.dto.product.enums.AttributeValueLocation
78
import com.ecwid.apiclient.v3.dto.product.enums.OutOfStockVisibilityBehaviour
@@ -49,12 +50,12 @@ data class FetchedVariation(
4950
) : ApiFetchedDTO {
5051

5152
data class AttributeValue(
52-
val id: Int? = null,
53-
val name: String? = null,
54-
val type: AttributeType? = null,
55-
val value: String? = null,
56-
val show: AttributeValueLocation? = null
57-
)
53+
override val id: Int? = null,
54+
override val name: String? = null,
55+
override val type: AttributeType? = null,
56+
override val value: String? = null,
57+
override val show: AttributeValueLocation? = null
58+
) : FetchedAttributeValue
5859

5960
data class WholesalePrice(
6061
val quantity: Int = 0,

src/test/kotlin/com/ecwid/apiclient/v3/entity/CategoriesTest.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,17 @@ private fun generateTestCategory(
537537
),
538538
enabled = enabled,
539539
productIds = productIds,
540-
isSampleCategory = false
540+
isSampleCategory = false,
541+
seoTitle = "",
542+
seoTitleTranslated = LocalizedValueMap(
543+
"ru" to "",
544+
"en" to ""
545+
),
546+
seoDescription = "",
547+
seoDescriptionTranslated = LocalizedValueMap(
548+
"ru" to "",
549+
"en" to ""
550+
)
541551
)
542552
}
543553

0 commit comments

Comments
 (0)