Skip to content

Commit

Permalink
Merge pull request #395 from Ecwid/ECWID-137817
Browse files Browse the repository at this point in the history
ECWID-137817 New customers: add favorites to the internal API - added 'favorites' field to FetchedCustomer
  • Loading branch information
renat-ayzyatullen authored Apr 10, 2024
2 parents cecdc51 + ec1b87d commit cf42b03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -24,6 +25,7 @@ data class FetchedCustomer(
val lang: String? = null,
val stats: CustomerStats? = null,
val privateAdminNotes: String? = null,
val favorites: List<CustomerFavorite> = ArrayList(),

@JsonFieldName("b2b_b2c")
val commercialRelationshipScheme: CommercialRelationshipScheme = CommercialRelationshipScheme.b2c,
Expand Down Expand Up @@ -82,5 +84,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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ val nonUpdatablePropertyRules: List<NonUpdatablePropertyRule<*, *>> = 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),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ val fetchedCustomerNullablePropertyRules: List<NullablePropertyRule<*, *>> = lis
AllowNullable(FetchedCustomer.CustomerContact::handle),
AllowNullable(FetchedCustomer.CustomerContact::note),
AllowNullable(FetchedCustomer.CustomerContact::timestamp),
AllowNullable(FetchedCustomer.CustomerFavorite::addedTimestamp),

AllowNullable(CustomerFilterShippingAddress::street),
AllowNullable(CustomerFilterShippingAddress::city),
Expand Down

0 comments on commit cf42b03

Please sign in to comment.