From fb740f7f7f3732961c1a183bf70d6b7a0c04107f Mon Sep 17 00:00:00 2001 From: Renat Ayzyatullen Date: Mon, 8 Apr 2024 14:20:11 +0400 Subject: [PATCH 1/3] ECWID-137817 New customers: add favorites to the internal API - added 'favorites' field to FetchedCustomer --- .../apiclient/v3/dto/customer/result/FetchedCustomer.kt | 6 ++++++ .../ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt | 3 +++ .../v3/rule/nullablepropertyrules/FetchedCustomerRules.kt | 1 + 3 files changed, 10 insertions(+) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt index 390eb2cf7..a8465e7c3 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt @@ -24,6 +24,7 @@ data class FetchedCustomer( val lang: String? = null, val stats: CustomerStats? = null, val privateAdminNotes: String? = null, + var favorites: List, @JsonFieldName("b2b_b2c") val commercialRelationshipScheme: CommercialRelationshipScheme = CommercialRelationshipScheme.b2c, @@ -82,5 +83,10 @@ data class FetchedCustomer( val timestamp: Date? = null, ) + data class CustomerFavorite( + val productId: Long = 0, + val addedTimestamp: Date? = null, + ) + override fun getModifyKind() = ModifyKind.ReadWrite(UpdatedCustomer::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 3f4c3755c..5af0d161c 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt @@ -157,6 +157,9 @@ val nonUpdatablePropertyRules: List> = listOf( ReadOnly(FetchedCustomer.ShippingAddress::addressFormatted), ReadOnly(FetchedCustomer::stats), ReadOnly(FetchedCustomer.CustomerContact::timestamp), + ReadOnly(FetchedCustomer::favorites), + ReadOnly(FetchedCustomer.CustomerFavorite::productId), + ReadOnly(FetchedCustomer.CustomerFavorite::addedTimestamp), ReadOnly(FetchedCustomerGroup::id), diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCustomerRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCustomerRules.kt index 0dca3eca2..76258fbd5 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCustomerRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCustomerRules.kt @@ -54,6 +54,7 @@ val fetchedCustomerNullablePropertyRules: List> = lis AllowNullable(FetchedCustomer.CustomerContact::handle), AllowNullable(FetchedCustomer.CustomerContact::note), AllowNullable(FetchedCustomer.CustomerContact::timestamp), + AllowNullable(FetchedCustomer.CustomerFavorite::addedTimestamp), AllowNullable(CustomerFilterShippingAddress::street), AllowNullable(CustomerFilterShippingAddress::city), From 5c092ef95fbdf6ec4ab6911f314b7987e0299b18 Mon Sep 17 00:00:00 2001 From: Renat Ayzyatullen Date: Mon, 8 Apr 2024 14:35:48 +0400 Subject: [PATCH 2/3] ECWID-137817 New customers: add favorites to the internal API - added default value to 'favorites' field in FetchedCustomer --- .../ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt index a8465e7c3..cfb433108 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt @@ -6,6 +6,7 @@ import com.ecwid.apiclient.v3.dto.customer.enums.CommercialRelationshipScheme import com.ecwid.apiclient.v3.dto.customer.request.UpdatedCustomer import com.ecwid.apiclient.v3.jsontransformer.JsonFieldName import java.util.* +import kotlin.collections.ArrayList data class FetchedCustomer( val id: Int = 0, @@ -24,7 +25,7 @@ data class FetchedCustomer( val lang: String? = null, val stats: CustomerStats? = null, val privateAdminNotes: String? = null, - var favorites: List, + var favorites: List = ArrayList(), @JsonFieldName("b2b_b2c") val commercialRelationshipScheme: CommercialRelationshipScheme = CommercialRelationshipScheme.b2c, From ec1b87d951ab87e06fca9751d35d8cbb1f12492f Mon Sep 17 00:00:00 2001 From: Renat Ayzyatullen Date: Mon, 8 Apr 2024 14:48:11 +0400 Subject: [PATCH 3/3] ECWID-137817 New customers: add favorites to the internal API - changed 'favorites' field to val --- .../ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt index cfb433108..bee396dad 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt @@ -25,7 +25,7 @@ data class FetchedCustomer( val lang: String? = null, val stats: CustomerStats? = null, val privateAdminNotes: String? = null, - var favorites: List = ArrayList(), + val favorites: List = ArrayList(), @JsonFieldName("b2b_b2c") val commercialRelationshipScheme: CommercialRelationshipScheme = CommercialRelationshipScheme.b2c,