Skip to content

Commit cf42b03

Browse files
Merge pull request #395 from Ecwid/ECWID-137817
ECWID-137817 New customers: add favorites to the internal API - added 'favorites' field to FetchedCustomer
2 parents cecdc51 + ec1b87d commit cf42b03

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/result/FetchedCustomer.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import com.ecwid.apiclient.v3.dto.customer.enums.CommercialRelationshipScheme
66
import com.ecwid.apiclient.v3.dto.customer.request.UpdatedCustomer
77
import com.ecwid.apiclient.v3.jsontransformer.JsonFieldName
88
import java.util.*
9+
import kotlin.collections.ArrayList
910

1011
data class FetchedCustomer(
1112
val id: Int = 0,
@@ -24,6 +25,7 @@ data class FetchedCustomer(
2425
val lang: String? = null,
2526
val stats: CustomerStats? = null,
2627
val privateAdminNotes: String? = null,
28+
val favorites: List<CustomerFavorite> = ArrayList(),
2729

2830
@JsonFieldName("b2b_b2c")
2931
val commercialRelationshipScheme: CommercialRelationshipScheme = CommercialRelationshipScheme.b2c,
@@ -82,5 +84,10 @@ data class FetchedCustomer(
8284
val timestamp: Date? = null,
8385
)
8486

87+
data class CustomerFavorite(
88+
val productId: Long = 0,
89+
val addedTimestamp: Date? = null,
90+
)
91+
8592
override fun getModifyKind() = ModifyKind.ReadWrite(UpdatedCustomer::class)
8693
}

src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ val nonUpdatablePropertyRules: List<NonUpdatablePropertyRule<*, *>> = listOf(
157157
ReadOnly(FetchedCustomer.ShippingAddress::addressFormatted),
158158
ReadOnly(FetchedCustomer::stats),
159159
ReadOnly(FetchedCustomer.CustomerContact::timestamp),
160+
ReadOnly(FetchedCustomer::favorites),
161+
ReadOnly(FetchedCustomer.CustomerFavorite::productId),
162+
ReadOnly(FetchedCustomer.CustomerFavorite::addedTimestamp),
160163

161164
ReadOnly(FetchedCustomerGroup::id),
162165

src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCustomerRules.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ val fetchedCustomerNullablePropertyRules: List<NullablePropertyRule<*, *>> = lis
5454
AllowNullable(FetchedCustomer.CustomerContact::handle),
5555
AllowNullable(FetchedCustomer.CustomerContact::note),
5656
AllowNullable(FetchedCustomer.CustomerContact::timestamp),
57+
AllowNullable(FetchedCustomer.CustomerFavorite::addedTimestamp),
5758

5859
AllowNullable(CustomerFilterShippingAddress::street),
5960
AllowNullable(CustomerFilterShippingAddress::city),

0 commit comments

Comments
 (0)