diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..ac96bd15c Binary files /dev/null and b/.DS_Store differ diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 000000000..4ba955174 Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt b/src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt index 41689b9e8..ab3964113 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt @@ -73,6 +73,7 @@ open class ApiClient private constructor( instantSiteRedirectsApiClient: InstantSiteRedirectsApiClientImpl, slugInfoApiClient: SlugInfoApiClientImpl, productReviewsApiClient: ProductReviewsApiClientImpl, + storeExtrafieldsApiClient: StoreExtrafieldsApiClientImpl, ) : StoreProfileApiClient by storeProfileApiClient, ProductsApiClient by productsApiClient, @@ -92,7 +93,8 @@ open class ApiClient private constructor( SubscriptionsApiClient by subscriptionsApiClient, InstantSiteRedirectsApiClient by instantSiteRedirectsApiClient, SlugInfoApiClient by slugInfoApiClient, - ProductReviewsApiClient by productReviewsApiClient { + ProductReviewsApiClient by productReviewsApiClient, + StoreExtrafieldsApiClient by storeExtrafieldsApiClient { constructor(apiClientHelper: ApiClientHelper) : this( apiClientHelper = apiClientHelper, @@ -115,6 +117,7 @@ open class ApiClient private constructor( instantSiteRedirectsApiClient = InstantSiteRedirectsApiClientImpl(apiClientHelper), slugInfoApiClient = SlugInfoApiClientImpl(apiClientHelper), productReviewsApiClient = ProductReviewsApiClientImpl(apiClientHelper), + storeExtrafieldsApiClient = StoreExtrafieldsApiClientImpl(apiClientHelper), ) companion object { diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/StoreExtrafieldsApiClient.kt b/src/main/kotlin/com/ecwid/apiclient/v3/StoreExtrafieldsApiClient.kt new file mode 100644 index 000000000..cbc25de30 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/StoreExtrafieldsApiClient.kt @@ -0,0 +1,13 @@ +package com.ecwid.apiclient.v3 + +import com.ecwid.apiclient.v3.dto.extrafield.request.* +import com.ecwid.apiclient.v3.dto.extrafield.result.* + + +interface StoreExtrafieldsApiClient { + fun searchCustomersConfigs(request: CustomersConfigsSearchRequest): CustomersConfigsSearchResult + fun getCustomersConfig(request: CustomersConfigDetailsRequest): FetchedCustomersConfig + fun createCustomersConfig(request: CustomersConfigCreateRequest): CustomersConfigCreateResult + fun updateCustomersConfig(request: CustomersConfigUpdateRequest): CustomersConfigUpdateResult + fun deleteCustomersConfig(request: CustomersConfigDeleteRequest): CustomersConfigDeleteResult +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCustomer.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCustomer.kt index 89a481641..c6cd07684 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCustomer.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCustomer.kt @@ -17,6 +17,7 @@ fun FetchedCustomer.toUpdated(): UpdatedCustomer { lang = lang, privateAdminNotes = privateAdminNotes, commercialRelationshipScheme = commercialRelationshipScheme, + extrafields = extrafields?.map(FetchedCustomer.CustomerExtrafield::toUpdated) ) } @@ -61,3 +62,12 @@ fun FetchedCustomer.CustomerContact.toUpdated(): UpdatedCustomer.CustomerContact orderBy = orderBy, ) } + +fun FetchedCustomer.CustomerExtrafield.toUpdated(): UpdatedCustomer.CustomerExtrafield { + return UpdatedCustomer.CustomerExtrafield( + key = key, + title = title, + value = value, + type = type, + ) +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCustomersConfig.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCustomersConfig.kt new file mode 100644 index 000000000..7fd20665e --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedCustomersConfig.kt @@ -0,0 +1,14 @@ +package com.ecwid.apiclient.v3.converter + +import com.ecwid.apiclient.v3.dto.extrafield.request.UpdatedCustomersConfig +import com.ecwid.apiclient.v3.dto.extrafield.result.FetchedCustomersConfig + + +fun FetchedCustomersConfig.toUpdated(): UpdatedCustomersConfig { + return UpdatedCustomersConfig( + key = key, + title = title, + type = type, + shownOnOrderDetails = shownOnOrderDetails, + ) +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/request/UpdatedCustomer.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/request/UpdatedCustomer.kt index 71ef56184..b074b1f9b 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/request/UpdatedCustomer.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/request/UpdatedCustomer.kt @@ -4,6 +4,7 @@ import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind import com.ecwid.apiclient.v3.dto.customer.enums.CommercialRelationshipScheme import com.ecwid.apiclient.v3.dto.customer.result.FetchedCustomer +import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldType import com.ecwid.apiclient.v3.jsontransformer.JsonFieldName data class UpdatedCustomer( @@ -19,6 +20,7 @@ data class UpdatedCustomer( val acceptMarketing: Boolean? = null, val lang: String? = null, val privateAdminNotes: String? = null, + val extrafields: List? = null, @JsonFieldName("b2b_b2c") val commercialRelationshipScheme: CommercialRelationshipScheme? = null, @@ -60,5 +62,12 @@ data class UpdatedCustomer( val orderBy: Int? = null, ) + data class CustomerExtrafield( + val key: String? = null, + val title: String? = null, + val value: String? = null, + val type: ExtrafieldType? = null, + ) + override fun getModifyKind() = ModifyKind.ReadWrite(FetchedCustomer::class) } 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 bee396dad..0eb8e146f 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 @@ -4,9 +4,10 @@ import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind import com.ecwid.apiclient.v3.dto.customer.enums.CommercialRelationshipScheme import com.ecwid.apiclient.v3.dto.customer.request.UpdatedCustomer +import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldEntityType +import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldType import com.ecwid.apiclient.v3.jsontransformer.JsonFieldName import java.util.* -import kotlin.collections.ArrayList data class FetchedCustomer( val id: Int = 0, @@ -26,6 +27,7 @@ data class FetchedCustomer( val stats: CustomerStats? = null, val privateAdminNotes: String? = null, val favorites: List = ArrayList(), + val extrafields: List? = null, @JsonFieldName("b2b_b2c") val commercialRelationshipScheme: CommercialRelationshipScheme = CommercialRelationshipScheme.b2c, @@ -89,5 +91,14 @@ data class FetchedCustomer( val addedTimestamp: Date? = null, ) + data class CustomerExtrafield( + val key: String? = null, + val title: String? = null, + val value: String? = null, + val orderBy: Int = 0, + val type: ExtrafieldType? = null, + val entityTypes: List = emptyList(), + ) + override fun getModifyKind() = ModifyKind.ReadWrite(UpdatedCustomer::class) } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/enums/ExtrafieldEntityType.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/enums/ExtrafieldEntityType.kt new file mode 100644 index 000000000..aeab6936c --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/enums/ExtrafieldEntityType.kt @@ -0,0 +1,6 @@ +package com.ecwid.apiclient.v3.dto.extrafield.enums + +enum class ExtrafieldEntityType { + CHECKOUT, + CUSTOMERS, +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/enums/ExtrafieldType.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/enums/ExtrafieldType.kt similarity index 69% rename from src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/enums/ExtrafieldType.kt rename to src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/enums/ExtrafieldType.kt index 06de06240..b33010764 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/enums/ExtrafieldType.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/enums/ExtrafieldType.kt @@ -1,4 +1,4 @@ -package com.ecwid.apiclient.v3.dto.profile.enums +package com.ecwid.apiclient.v3.dto.extrafield.enums enum class ExtrafieldType { TEXT, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigCreateRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigCreateRequest.kt new file mode 100644 index 000000000..afb90e4e7 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigCreateRequest.kt @@ -0,0 +1,19 @@ +package com.ecwid.apiclient.v3.dto.extrafield.request + +import com.ecwid.apiclient.v3.dto.ApiRequest +import com.ecwid.apiclient.v3.httptransport.HttpBody +import com.ecwid.apiclient.v3.impl.RequestInfo + +data class CustomersConfigCreateRequest( + val newConfig: UpdatedCustomersConfig = UpdatedCustomersConfig() +) : ApiRequest { + override fun toRequestInfo() = RequestInfo.createPostRequest( + pathSegments = listOf( + "store_extrafields", + "customers" + ), + httpBody = HttpBody.JsonBody( + obj = newConfig + ) + ) +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigDeleteRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigDeleteRequest.kt new file mode 100644 index 000000000..720d72984 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigDeleteRequest.kt @@ -0,0 +1,17 @@ +package com.ecwid.apiclient.v3.dto.extrafield.request + +import com.ecwid.apiclient.v3.dto.ApiRequest +import com.ecwid.apiclient.v3.impl.RequestInfo + +data class CustomersConfigDeleteRequest( + val extrafieldKey: String = "" +) : ApiRequest { + override fun toRequestInfo() = RequestInfo.createDeleteRequest( + pathSegments = listOf( + "store_extrafields", + "customers", + extrafieldKey + ), + params = mapOf() + ) +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigDetailsRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigDetailsRequest.kt new file mode 100644 index 000000000..b25344fb7 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigDetailsRequest.kt @@ -0,0 +1,20 @@ +package com.ecwid.apiclient.v3.dto.extrafield.request + +import com.ecwid.apiclient.v3.dto.ApiRequest +import com.ecwid.apiclient.v3.impl.RequestInfo +import com.ecwid.apiclient.v3.responsefields.ResponseFields + +data class CustomersConfigDetailsRequest( + val extrafieldKey: String = "", + val responseFields: ResponseFields = ResponseFields.All, +) : ApiRequest { + override fun toRequestInfo() = RequestInfo.createGetRequest( + pathSegments = listOf( + "store_extrafields", + "customers", + extrafieldKey + ), + params = mapOf(), + responseFields = responseFields, + ) +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigUpdateRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigUpdateRequest.kt new file mode 100644 index 000000000..2d684caeb --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigUpdateRequest.kt @@ -0,0 +1,21 @@ +package com.ecwid.apiclient.v3.dto.extrafield.request + +import com.ecwid.apiclient.v3.dto.ApiRequest +import com.ecwid.apiclient.v3.httptransport.HttpBody +import com.ecwid.apiclient.v3.impl.RequestInfo + +data class CustomersConfigUpdateRequest( + val extrafieldKey: String = "", + val updatedConfig: UpdatedCustomersConfig = UpdatedCustomersConfig() +) : ApiRequest { + override fun toRequestInfo() = RequestInfo.createPutRequest( + pathSegments = listOf( + "store_extrafields", + "customers", + extrafieldKey + ), + httpBody = HttpBody.JsonBody( + obj = updatedConfig + ) + ) +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigsSearchRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigsSearchRequest.kt new file mode 100644 index 000000000..15bd3d0a9 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/CustomersConfigsSearchRequest.kt @@ -0,0 +1,19 @@ +package com.ecwid.apiclient.v3.dto.extrafield.request + +import com.ecwid.apiclient.v3.dto.ApiRequest +import com.ecwid.apiclient.v3.impl.RequestInfo +import com.ecwid.apiclient.v3.responsefields.ResponseFields + + +data class CustomersConfigsSearchRequest( + val responseFields: ResponseFields = ResponseFields.All, +) : ApiRequest { + override fun toRequestInfo() = RequestInfo.createGetRequest( + pathSegments = listOf( + "store_extrafields", + "customers" + ), + params = mapOf(), + responseFields = responseFields, + ) +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/UpdatedCustomersConfig.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/UpdatedCustomersConfig.kt new file mode 100644 index 000000000..e56c4b68f --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/request/UpdatedCustomersConfig.kt @@ -0,0 +1,16 @@ +package com.ecwid.apiclient.v3.dto.extrafield.request + +import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO +import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind +import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldType +import com.ecwid.apiclient.v3.dto.extrafield.result.FetchedCustomersConfig + +data class UpdatedCustomersConfig( + val key: String? = null, + val title: String? = null, + val type: ExtrafieldType? = null, + val shownOnOrderDetails: Boolean? = null, +) : ApiUpdatedDTO { + + override fun getModifyKind() = ModifyKind.ReadWrite(FetchedCustomersConfig::class) +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigCreateResult.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigCreateResult.kt new file mode 100644 index 000000000..f1ade57c7 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigCreateResult.kt @@ -0,0 +1,8 @@ +package com.ecwid.apiclient.v3.dto.extrafield.result + +import com.ecwid.apiclient.v3.dto.common.ApiResultDTO + +data class CustomersConfigCreateResult( + val createCount: Int = 0, + val key: String = "" +) : ApiResultDTO diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigDeleteResult.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigDeleteResult.kt new file mode 100644 index 000000000..505e782b0 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigDeleteResult.kt @@ -0,0 +1,7 @@ +package com.ecwid.apiclient.v3.dto.extrafield.result + +import com.ecwid.apiclient.v3.dto.common.ApiResultDTO + +data class CustomersConfigDeleteResult( + val deleteCount: Int = 0 +) : ApiResultDTO diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigUpdateResult.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigUpdateResult.kt new file mode 100644 index 000000000..284195248 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigUpdateResult.kt @@ -0,0 +1,7 @@ +package com.ecwid.apiclient.v3.dto.extrafield.result + +import com.ecwid.apiclient.v3.dto.common.ApiResultDTO + +data class CustomersConfigUpdateResult( + val updateCount: Int = 0 +) : ApiResultDTO diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigsSearchResult.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigsSearchResult.kt new file mode 100644 index 000000000..58bfa93af --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/CustomersConfigsSearchResult.kt @@ -0,0 +1,7 @@ +package com.ecwid.apiclient.v3.dto.extrafield.result + +import com.ecwid.apiclient.v3.dto.common.ApiResultDTO + +data class CustomersConfigsSearchResult( + val items: List = listOf(), +) : ApiResultDTO diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/FetchedCustomersConfig.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/FetchedCustomersConfig.kt new file mode 100644 index 000000000..1bd77f459 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/extrafield/result/FetchedCustomersConfig.kt @@ -0,0 +1,20 @@ +package com.ecwid.apiclient.v3.dto.extrafield.result + +import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO +import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldEntityType +import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldType +import com.ecwid.apiclient.v3.dto.extrafield.request.UpdatedCustomersConfig +import java.util.* + +data class FetchedCustomersConfig( + val key: String? = null, + val title: String? = null, + val entityTypes: ExtrafieldEntityType? = null, + val type: ExtrafieldType? = null, + val shownOnOrderDetails: Boolean? = null, + val createdDate: Date? = null, + val lastModifiedDate: Date? = null, +) : ApiFetchedDTO { + + override fun getModifyKind() = ApiFetchedDTO.ModifyKind.ReadWrite(UpdatedCustomersConfig::class) +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/ExtrafieldConfigUpdateRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/ExtrafieldConfigUpdateRequest.kt index c5048d004..8589b925e 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/ExtrafieldConfigUpdateRequest.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/ExtrafieldConfigUpdateRequest.kt @@ -12,7 +12,7 @@ data class ExtrafieldConfigUpdateRequest( pathSegments = listOf( "profile", "extrafields", - "$extrafieldKey" + extrafieldKey ), httpBody = HttpBody.JsonBody( obj = updatedConfig diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/UpdatedExtrafieldConfig.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/UpdatedExtrafieldConfig.kt index 16d43cc46..a1ccf2613 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/UpdatedExtrafieldConfig.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/UpdatedExtrafieldConfig.kt @@ -3,38 +3,38 @@ package com.ecwid.apiclient.v3.dto.profile.request import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap +import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldType import com.ecwid.apiclient.v3.dto.profile.enums.CheckoutDisplaySection -import com.ecwid.apiclient.v3.dto.profile.enums.ExtrafieldType import com.ecwid.apiclient.v3.dto.profile.enums.OrderDetailsDisplaySection import com.ecwid.apiclient.v3.dto.profile.enums.SurchargeType import com.ecwid.apiclient.v3.dto.profile.result.FetchedExtrafieldConfig data class UpdatedExtrafieldConfig( - val key: String? = null, - val title: String? = null, - val type: ExtrafieldType? = null, - val textPlaceholder: String? = null, - val tip: String? = null, - val options: List? = null, - val value: String? = null, - val available: Boolean? = null, - val required: Boolean? = null, - val checkoutDisplaySection: CheckoutDisplaySection? = null, - val orderDetailsDisplaySection: OrderDetailsDisplaySection? = null, - val showForCountry: List? = null, - val showForPaymentMethodIds: List? = null, - val showForShippingMethodIds: List? = null, - val showInInvoice: Boolean? = null, - val showInNotifications: Boolean? = null, - val orderBy: Int? = null, - val surchargeType: SurchargeType? = null, - val surchargeTaxable: Boolean? = null, - val showZeroSurchargeInTotal: Boolean? = null, - val surchargeShortName: UpdatedExtrafieldSurchargeConfig? = null, - val titleTranslated: LocalizedValueMap? = null, - val textPlaceholderTranslated: LocalizedValueMap? = null, - val tipTranslated: LocalizedValueMap? = null, - val valueTranslated: LocalizedValueMap? = null + val key: String? = null, + val title: String? = null, + val type: ExtrafieldType? = null, + val textPlaceholder: String? = null, + val tip: String? = null, + val options: List? = null, + val value: String? = null, + val available: Boolean? = null, + val required: Boolean? = null, + val checkoutDisplaySection: CheckoutDisplaySection? = null, + val orderDetailsDisplaySection: OrderDetailsDisplaySection? = null, + val showForCountry: List? = null, + val showForPaymentMethodIds: List? = null, + val showForShippingMethodIds: List? = null, + val showInInvoice: Boolean? = null, + val showInNotifications: Boolean? = null, + val orderBy: Int? = null, + val surchargeType: SurchargeType? = null, + val surchargeTaxable: Boolean? = null, + val showZeroSurchargeInTotal: Boolean? = null, + val surchargeShortName: UpdatedExtrafieldSurchargeConfig? = null, + val titleTranslated: LocalizedValueMap? = null, + val textPlaceholderTranslated: LocalizedValueMap? = null, + val tipTranslated: LocalizedValueMap? = null, + val valueTranslated: LocalizedValueMap? = null ) : ApiUpdatedDTO { data class UpdatedExtrafieldOptionConfig( diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedExtrafieldConfig.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedExtrafieldConfig.kt index d80480e5c..d5b3f77cb 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedExtrafieldConfig.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedExtrafieldConfig.kt @@ -3,8 +3,8 @@ package com.ecwid.apiclient.v3.dto.profile.result import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap +import com.ecwid.apiclient.v3.dto.extrafield.enums.ExtrafieldType import com.ecwid.apiclient.v3.dto.profile.enums.CheckoutDisplaySection -import com.ecwid.apiclient.v3.dto.profile.enums.ExtrafieldType import com.ecwid.apiclient.v3.dto.profile.enums.OrderDetailsDisplaySection import com.ecwid.apiclient.v3.dto.profile.enums.SurchargeType import com.ecwid.apiclient.v3.dto.profile.request.UpdatedExtrafieldConfig diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/impl/StoreExtrafieldsApiClientImpl.kt b/src/main/kotlin/com/ecwid/apiclient/v3/impl/StoreExtrafieldsApiClientImpl.kt new file mode 100644 index 000000000..4c11fc7a2 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/impl/StoreExtrafieldsApiClientImpl.kt @@ -0,0 +1,26 @@ +package com.ecwid.apiclient.v3.impl + +import com.ecwid.apiclient.v3.ApiClientHelper +import com.ecwid.apiclient.v3.StoreExtrafieldsApiClient +import com.ecwid.apiclient.v3.dto.extrafield.request.* +import com.ecwid.apiclient.v3.dto.extrafield.result.* + +internal class StoreExtrafieldsApiClientImpl( + private val apiClientHelper: ApiClientHelper +) : StoreExtrafieldsApiClient { + + override fun searchCustomersConfigs(request: CustomersConfigsSearchRequest): CustomersConfigsSearchResult = + apiClientHelper.makeObjectResultRequest(request) + + override fun getCustomersConfig(request: CustomersConfigDetailsRequest): FetchedCustomersConfig = + apiClientHelper.makeObjectResultRequest(request) + + override fun createCustomersConfig(request: CustomersConfigCreateRequest): CustomersConfigCreateResult = + apiClientHelper.makeObjectResultRequest(request) + + override fun updateCustomersConfig(request: CustomersConfigUpdateRequest): CustomersConfigUpdateResult = + apiClientHelper.makeObjectResultRequest(request) + + override fun deleteCustomersConfig(request: CustomersConfigDeleteRequest): CustomersConfigDeleteResult = + apiClientHelper.makeObjectResultRequest(request) +} 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 e7bcb59e8..7484c0172 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/NonUpdatablePropertyRules.kt @@ -5,6 +5,7 @@ import com.ecwid.apiclient.v3.dto.category.result.FetchedCategory import com.ecwid.apiclient.v3.dto.coupon.result.FetchedCoupon import com.ecwid.apiclient.v3.dto.customer.result.FetchedCustomer import com.ecwid.apiclient.v3.dto.customergroup.result.FetchedCustomerGroup +import com.ecwid.apiclient.v3.dto.extrafield.result.FetchedCustomersConfig import com.ecwid.apiclient.v3.dto.instantsite.redirects.result.FetchedInstantSiteRedirect import com.ecwid.apiclient.v3.dto.order.result.FetchedOrder import com.ecwid.apiclient.v3.dto.product.result.FetchedProduct @@ -161,6 +162,8 @@ val nonUpdatablePropertyRules: List> = listOf( ReadOnly(FetchedCustomer::favorites), ReadOnly(FetchedCustomer.CustomerFavorite::productId), ReadOnly(FetchedCustomer.CustomerFavorite::addedTimestamp), + ReadOnly(FetchedCustomer.CustomerExtrafield::entityTypes), + ReadOnly(FetchedCustomer.CustomerExtrafield::orderBy), ReadOnly(FetchedCustomerGroup::id), @@ -321,6 +324,10 @@ val nonUpdatablePropertyRules: List> = listOf( ReadOnly(FetchedOrderStatusSettings::lastNameChangeDate), ReadOnly(FetchedInstantSiteRedirect::id), + + ReadOnly(FetchedCustomersConfig::entityTypes), + ReadOnly(FetchedCustomersConfig::createdDate), + ReadOnly(FetchedCustomersConfig::lastModifiedDate), ) sealed class NonUpdatablePropertyRule( diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/NullablePropertyRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/NullablePropertyRules.kt index b8fd414bd..5054d9647 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/NullablePropertyRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/NullablePropertyRules.kt @@ -186,6 +186,7 @@ val nullablePropertyRules: List> = listOf( fetchedProductReviewNullablePropertyRules, productReviewMassUpdateRequestNullablePropertyRules, productReviewSearchRequestNullablePropertyRules, + fetchedCustomersConfigNullablePropertyRules, ).flatten() sealed class NullablePropertyRule( 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 76258fbd5..45bec35e6 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 @@ -55,6 +55,11 @@ val fetchedCustomerNullablePropertyRules: List> = lis AllowNullable(FetchedCustomer.CustomerContact::note), AllowNullable(FetchedCustomer.CustomerContact::timestamp), AllowNullable(FetchedCustomer.CustomerFavorite::addedTimestamp), + AllowNullable(FetchedCustomer::extrafields), + AllowNullable(FetchedCustomer.CustomerExtrafield::key), + AllowNullable(FetchedCustomer.CustomerExtrafield::title), + AllowNullable(FetchedCustomer.CustomerExtrafield::value), + AllowNullable(FetchedCustomer.CustomerExtrafield::type), AllowNullable(CustomerFilterShippingAddress::street), AllowNullable(CustomerFilterShippingAddress::city), diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCustomersConfigRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCustomersConfigRules.kt new file mode 100644 index 000000000..5f4f7d4da --- /dev/null +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCustomersConfigRules.kt @@ -0,0 +1,15 @@ +package com.ecwid.apiclient.v3.rule.nullablepropertyrules + +import com.ecwid.apiclient.v3.dto.extrafield.result.FetchedCustomersConfig +import com.ecwid.apiclient.v3.rule.NullablePropertyRule +import com.ecwid.apiclient.v3.rule.NullablePropertyRule.AllowNullable + +val fetchedCustomersConfigNullablePropertyRules: List> = listOf( + AllowNullable(FetchedCustomersConfig::key), + AllowNullable(FetchedCustomersConfig::title), + AllowNullable(FetchedCustomersConfig::entityTypes), + AllowNullable(FetchedCustomersConfig::type), + AllowNullable(FetchedCustomersConfig::shownOnOrderDetails), + AllowNullable(FetchedCustomersConfig::createdDate), + AllowNullable(FetchedCustomersConfig::lastModifiedDate), +)