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 12b47a230..ab3964113 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt @@ -32,7 +32,9 @@ import com.ecwid.apiclient.v3.dto.productreview.request.* import com.ecwid.apiclient.v3.dto.productreview.result.* import com.ecwid.apiclient.v3.dto.producttype.request.* import com.ecwid.apiclient.v3.dto.producttype.result.* +import com.ecwid.apiclient.v3.dto.report.request.ReportAdviceRequest import com.ecwid.apiclient.v3.dto.report.request.ReportRequest +import com.ecwid.apiclient.v3.dto.report.result.FetchedReportAdviceResponse import com.ecwid.apiclient.v3.dto.report.result.FetchedReportResponse import com.ecwid.apiclient.v3.dto.saleschannels.request.* import com.ecwid.apiclient.v3.dto.saleschannels.response.* @@ -71,6 +73,7 @@ open class ApiClient private constructor( instantSiteRedirectsApiClient: InstantSiteRedirectsApiClientImpl, slugInfoApiClient: SlugInfoApiClientImpl, productReviewsApiClient: ProductReviewsApiClientImpl, + storeExtrafieldsApiClient: StoreExtrafieldsApiClientImpl, ) : StoreProfileApiClient by storeProfileApiClient, ProductsApiClient by productsApiClient, @@ -90,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, @@ -113,6 +117,7 @@ open class ApiClient private constructor( instantSiteRedirectsApiClient = InstantSiteRedirectsApiClientImpl(apiClientHelper), slugInfoApiClient = SlugInfoApiClientImpl(apiClientHelper), productReviewsApiClient = ProductReviewsApiClientImpl(apiClientHelper), + storeExtrafieldsApiClient = StoreExtrafieldsApiClientImpl(apiClientHelper), ) companion object { @@ -136,23 +141,6 @@ open class ApiClient private constructor( } } -// Orders -// https://developers.ecwid.com/api-documentation/orders -interface OrdersApiClient { - fun searchOrders(request: OrdersSearchRequest): OrdersSearchResult - fun searchOrdersAsSequence(request: OrdersSearchRequest): Sequence - fun getOrderDetails(request: OrderDetailsRequest): FetchedOrder - fun getOrderInvoice(request: OrderInvoiceRequest): String - fun createOrder(request: OrderCreateRequest): OrderCreateResult - fun updateOrder(request: OrderUpdateRequest): OrderUpdateResult - fun deleteOrder(request: OrderDeleteRequest): OrderDeleteResult - fun uploadOrderItemOptionFile(request: OrderItemOptionFileUploadRequest): OrderItemOptionFileUploadResult - fun deleteOrderItemOptionFile(request: OrderItemOptionFileDeleteRequest): OrderItemOptionFileDeleteResult - fun deleteOrderItemOptionFiles(request: OrderItemOptionFilesDeleteRequest): OrderItemOptionFileDeleteResult - fun searchDeletedOrders(request: DeletedOrdersSearchRequest): DeletedOrdersSearchResult - fun searchDeletedOrdersAsSequence(request: DeletedOrdersSearchRequest): Sequence -} - // Product types // https://developers.ecwid.com/api-documentation/product-types interface ProductTypesApiClient { @@ -294,6 +282,7 @@ interface ApplicationStorageApiClient { // Report API interface ReportsApiClient { fun fetchReport(request: ReportRequest): FetchedReportResponse + fun getReportAdvice(request: ReportAdviceRequest): FetchedReportAdviceResponse } // Recurring subscriptions diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/OrdersApiClient.kt b/src/main/kotlin/com/ecwid/apiclient/v3/OrdersApiClient.kt new file mode 100644 index 000000000..4214456d1 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/OrdersApiClient.kt @@ -0,0 +1,30 @@ +package com.ecwid.apiclient.v3 + +import com.ecwid.apiclient.v3.dto.common.PartialResult +import com.ecwid.apiclient.v3.dto.order.request.* +import com.ecwid.apiclient.v3.dto.order.result.* +import kotlin.reflect.KClass + +// Orders +// https://developers.ecwid.com/api-documentation/orders +interface OrdersApiClient { + fun searchOrders(request: OrdersSearchRequest): OrdersSearchResult + fun searchOrders(request: OrdersSearchRequest, resultClass: KClass): Result + where Result : PartialResult + fun searchOrdersAsSequence(request: OrdersSearchRequest): Sequence + fun getOrderDetails(request: OrderDetailsRequest): FetchedOrder + fun getOrderInvoice(request: OrderInvoiceRequest): String + fun createOrder(request: OrderCreateRequest): OrderCreateResult + fun updateOrder(request: OrderUpdateRequest): OrderUpdateResult + fun deleteOrder(request: OrderDeleteRequest): OrderDeleteResult + fun uploadOrderItemOptionFile(request: OrderItemOptionFileUploadRequest): OrderItemOptionFileUploadResult + fun deleteOrderItemOptionFile(request: OrderItemOptionFileDeleteRequest): OrderItemOptionFileDeleteResult + fun deleteOrderItemOptionFiles(request: OrderItemOptionFilesDeleteRequest): OrderItemOptionFileDeleteResult + fun searchDeletedOrders(request: DeletedOrdersSearchRequest): DeletedOrdersSearchResult + fun searchDeletedOrdersAsSequence(request: DeletedOrdersSearchRequest): Sequence +} + +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") +inline fun > OrdersApiClient.searchOrders(request: OrdersSearchRequest): Result { + return searchOrders(request, Result::class) +} 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/StoreProfileApiClient.kt b/src/main/kotlin/com/ecwid/apiclient/v3/StoreProfileApiClient.kt index d54e1cd38..94f640bda 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/StoreProfileApiClient.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/StoreProfileApiClient.kt @@ -35,6 +35,8 @@ interface StoreProfileApiClient { fun updateExtrafieldConfig(request: ExtrafieldConfigUpdateRequest): ExtrafieldConfigUpdateResult fun deleteExtrafieldConfig(request: ExtrafieldConfigDeleteRequest): ExtrafieldConfigDeleteResult fun searchOrderStatusesSettings(request: OrderStatusSettingsSearchRequest): OrderStatusSettingsSearchResult + fun searchOrderStatusesSettings(request: OrderStatusSettingsSearchRequest, resultClass: KClass): Result + where Result : PartialResult fun getOrderStatusSettingsDetails(request: OrderStatusSettingsDetailsRequest): FetchedOrderStatusSettings fun updateOrderStatusSettings(request: OrderStatusSettingsUpdateRequest): OrderStatusSettingsUpdateResult } @@ -43,3 +45,8 @@ interface StoreProfileApiClient { inline fun > StoreProfileApiClient.getStoreProfile(request: StoreProfileRequest): Result { return getStoreProfile(request, Result::class) } + +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") +inline fun > StoreProfileApiClient.searchOrderStatusesSettings(request: OrderStatusSettingsSearchRequest): Result { + return searchOrderStatusesSettings(request, Result::class) +} 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/converter/FetchedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt index b822356ee..a08acb081 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedProduct.kt @@ -12,6 +12,7 @@ fun FetchedProduct.toUpdated(): UpdatedProduct { description = description, descriptionTranslated = descriptionTranslated, sku = sku, + customSlug = customSlug, enabled = enabled, quantity = quantity, @@ -55,6 +56,7 @@ fun FetchedProduct.toUpdated(): UpdatedProduct { media = media?.toUpdated(), + discountsAllowed = discountsAllowed, subtitle = subtitle, ribbon = ribbon?.toUpdated(), ribbonTranslated = ribbonTranslated, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/request/CustomersSearchRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/request/CustomersSearchRequest.kt index e392f023c..38d27c64d 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/request/CustomersSearchRequest.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/customer/request/CustomersSearchRequest.kt @@ -11,6 +11,7 @@ data class CustomersSearchRequest( val name: String? = null, val email: String? = null, val customerGroupId: Int? = null, + val usePrecalculatedOrderCount: Boolean? = null, val minOrderCount: Int? = null, val maxOrderCount: Int? = null, val minSalesValue: Int? = null, @@ -70,6 +71,7 @@ data class CustomersSearchRequest( request.name?.let { put("name", it) } request.email?.let { put("email", it) } request.customerGroupId?.let { put("customerGroup", it.toString()) } + request.usePrecalculatedOrderCount?.let { put("usePrecalculatedOrderCount", it.toString()) } request.minOrderCount?.let { put("minOrderCount", it.toString()) } request.maxOrderCount?.let { put("maxOrderCount", it.toString()) } request.minSalesValue?.let { put("minSalesValue", it.toString()) } 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..57a873b6b --- /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: List? = 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/order/result/FetchedOrder.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt index 906f73979..db85e017c 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt @@ -2,6 +2,7 @@ package com.ecwid.apiclient.v3.dto.order.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.ApiResultDTO import com.ecwid.apiclient.v3.dto.common.ExtendedOrderTax import com.ecwid.apiclient.v3.dto.common.OrderedStringToListStringMap import com.ecwid.apiclient.v3.dto.common.OrderedStringToStringMap @@ -119,7 +120,7 @@ data class FetchedOrder( val loyalty: Loyalty? = null, val customerFiscalCode: String? = null, - ) : ApiFetchedDTO { + ) : ApiFetchedDTO, ApiResultDTO { data class CreditCardStatus( val avsMessage: String? = null, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt index 7ba8359bb..af9c01e87 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/request/UpdatedProduct.kt @@ -11,6 +11,7 @@ data class UpdatedProduct( val description: String? = null, val descriptionTranslated: LocalizedValueMap? = null, val sku: String? = null, + val customSlug: String? = null, val isSampleProduct: Boolean? = null, val enabled: Boolean? = null, @@ -55,6 +56,7 @@ data class UpdatedProduct( val media: ProductMedia? = null, + val discountsAllowed: Boolean? = null, val subtitle: String? = null, val ribbon: Ribbon? = null, val ribbonTranslated: LocalizedValueMap? = null, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt index 1e3ffc041..fd03d5507 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/product/result/FetchedProduct.kt @@ -17,6 +17,7 @@ data class FetchedProduct( val sku: String = "", val isSampleProduct: Boolean? = null, val url: String? = null, + val customSlug: String? = null, val created: Date = Date(), val createTimestamp: Int = 0, @@ -121,6 +122,7 @@ data class FetchedProduct( val defaultCombinationId: Int? = null, // TODO implement combinations support val combinations: List? = null, // TODO implement combinations support val isGiftCard: Boolean? = null, // TODO from ECWID-67826: this flag is read-only. API for creating gift cards in the plans (BACKLOG-4157) + val discountsAllowed: Boolean? = null, val subtitle: String? = null, val ribbon: Ribbon? = null, val ribbonTranslated: LocalizedValueMap? = null, 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/dto/profile/result/FetchedOrderStatusSettings.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedOrderStatusSettings.kt index 86d09bf01..4205c61ca 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedOrderStatusSettings.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedOrderStatusSettings.kt @@ -1,6 +1,7 @@ package com.ecwid.apiclient.v3.dto.profile.result import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO +import com.ecwid.apiclient.v3.dto.common.ApiResultDTO import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap import com.ecwid.apiclient.v3.dto.profile.request.UpdatedOrderStatusSettings @@ -13,6 +14,6 @@ data class FetchedOrderStatusSettings( val nameTranslations: LocalizedValueMap? = null, val sendNotificationWhenStatusIsAssigned: Boolean = true, val lastNameChangeDate: String? = null, -) : ApiFetchedDTO { +) : ApiFetchedDTO, ApiResultDTO { override fun getModifyKind() = ApiFetchedDTO.ModifyKind.ReadWrite(UpdatedOrderStatusSettings::class) } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/OrderStatusSettingsSearchResult.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/OrderStatusSettingsSearchResult.kt index 46a6f9e6e..1dd7e154f 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/OrderStatusSettingsSearchResult.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/OrderStatusSettingsSearchResult.kt @@ -4,4 +4,5 @@ import com.ecwid.apiclient.v3.dto.common.ApiResultDTO data class OrderStatusSettingsSearchResult( val items: List = listOf(), + val limit: Int = 0, ) : ApiResultDTO diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/report/request/ReportAdviceRequest.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/report/request/ReportAdviceRequest.kt new file mode 100644 index 000000000..b757c135c --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/report/request/ReportAdviceRequest.kt @@ -0,0 +1,22 @@ +package com.ecwid.apiclient.v3.dto.report.request + +import com.ecwid.apiclient.v3.dto.ApiRequest +import com.ecwid.apiclient.v3.dto.report.enums.ReportType +import com.ecwid.apiclient.v3.impl.RequestInfo +import com.ecwid.apiclient.v3.responsefields.ResponseFields + +data class ReportAdviceRequest( + val reportType: ReportType = ReportType.allTraffic, +) : ApiRequest { + + override fun toRequestInfo() = RequestInfo.createGetRequest( + pathSegments = listOf( + "reports", + reportType.toString(), + "tip" + ), + params = emptyMap(), + responseFields = ResponseFields.All + ) + +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/report/result/FetchedReportAdviceResponse.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/report/result/FetchedReportAdviceResponse.kt new file mode 100644 index 000000000..1eb74d585 --- /dev/null +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/report/result/FetchedReportAdviceResponse.kt @@ -0,0 +1,11 @@ +package com.ecwid.apiclient.v3.dto.report.result + +import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO + +data class FetchedReportAdviceResponse( + val tip: String? = null +) : ApiFetchedDTO { + + override fun getModifyKind() = ApiFetchedDTO.ModifyKind.ReadOnly + +} diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/webhook/Webhook.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/webhook/Webhook.kt index dce42be43..414099e8f 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/webhook/Webhook.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/webhook/Webhook.kt @@ -44,6 +44,15 @@ data class Webhook( @SerializedName("customer.updated") CUSTOMER_UPDATED, + @SerializedName("customer_group.created") + CUSTOMER_GROUP_CREATED, + + @SerializedName("customer_group.updated") + CUSTOMER_GROUP_UPDATED, + + @SerializedName("customer_group.deleted") + CUSTOMER_GROUP_DELETED, + @SerializedName("customer.personal_data_removal_request") CUSTOMER_PERSONAL_DATA_REMOVAL_REQUEST, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/impl/OrdersApiClientImpl.kt b/src/main/kotlin/com/ecwid/apiclient/v3/impl/OrdersApiClientImpl.kt index 0dca5909c..2f97cb9a4 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/impl/OrdersApiClientImpl.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/impl/OrdersApiClientImpl.kt @@ -2,9 +2,11 @@ package com.ecwid.apiclient.v3.impl import com.ecwid.apiclient.v3.ApiClientHelper import com.ecwid.apiclient.v3.OrdersApiClient +import com.ecwid.apiclient.v3.dto.common.PartialResult import com.ecwid.apiclient.v3.dto.order.request.* import com.ecwid.apiclient.v3.dto.order.result.* import com.ecwid.apiclient.v3.responsefields.AS_SEQUENCE_SEARCH_RESULT_REQUIRED_FIELDS +import kotlin.reflect.KClass internal class OrdersApiClientImpl( private val apiClientHelper: ApiClientHelper @@ -13,6 +15,16 @@ internal class OrdersApiClientImpl( override fun searchOrders(request: OrdersSearchRequest) = apiClientHelper.makeObjectResultRequest(request) + override fun > searchOrders( + request: OrdersSearchRequest, + resultClass: KClass + ): Result { + return apiClientHelper.makeObjectPartialResultRequest( + request = request, + resultClass = resultClass, + ) + } + override fun searchOrdersAsSequence(request: OrdersSearchRequest) = sequence { var offsetRequest = request.copy( responseFields = request.responseFields + AS_SEQUENCE_SEARCH_RESULT_REQUIRED_FIELDS diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/impl/ReportsApiClientImpl.kt b/src/main/kotlin/com/ecwid/apiclient/v3/impl/ReportsApiClientImpl.kt index 224eb6cb4..d289b1947 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/impl/ReportsApiClientImpl.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/impl/ReportsApiClientImpl.kt @@ -2,7 +2,9 @@ package com.ecwid.apiclient.v3.impl import com.ecwid.apiclient.v3.ApiClientHelper import com.ecwid.apiclient.v3.ReportsApiClient +import com.ecwid.apiclient.v3.dto.report.request.ReportAdviceRequest import com.ecwid.apiclient.v3.dto.report.request.ReportRequest +import com.ecwid.apiclient.v3.dto.report.result.FetchedReportAdviceResponse import com.ecwid.apiclient.v3.dto.report.result.FetchedReportResponse class ReportsApiClientImpl( @@ -12,4 +14,7 @@ class ReportsApiClientImpl( override fun fetchReport(request: ReportRequest) = apiClientHelper.makeObjectResultRequest(request) + override fun getReportAdvice(request: ReportAdviceRequest) = + apiClientHelper.makeObjectResultRequest(request) + } 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/main/kotlin/com/ecwid/apiclient/v3/impl/StoreProfileApiClientImpl.kt b/src/main/kotlin/com/ecwid/apiclient/v3/impl/StoreProfileApiClientImpl.kt index 19e8a4d74..a57f4c91c 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/impl/StoreProfileApiClientImpl.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/impl/StoreProfileApiClientImpl.kt @@ -79,4 +79,11 @@ internal class StoreProfileApiClientImpl( override fun > getStoreProfile(request: StoreProfileRequest, resultClass: KClass): Result { return apiClientHelper.makeObjectPartialResultRequest(request, resultClass) } + + override fun > searchOrderStatusesSettings( + request: OrderStatusSettingsSearchRequest, + resultClass: KClass + ): Result { + return apiClientHelper.makeObjectPartialResultRequest(request, resultClass) + } } diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/DtoContractUnitTest.kt b/src/test/kotlin/com/ecwid/apiclient/v3/DtoContractUnitTest.kt index 81f11545d..0505a327b 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/DtoContractUnitTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/DtoContractUnitTest.kt @@ -151,7 +151,7 @@ class DtoContractUnitTest { .filterNot { dtoClass -> dtoClass.isClassifiedDTOOrEnclosingClass(*dtoMarkerInterfaces) } assertTrue(problemDtoClasses.isEmpty()) { val interfacesStr = dtoMarkerInterfaces.joinToString(separator = ", ") { int -> int.simpleName } - "Some of top level DTO data classes does implement one of marker interfaces [$interfacesStr]:\n" + + "Some of top level DTO data classes do not implement any marker interfaces [$interfacesStr]:\n" + classesToLoggableString(problemDtoClasses) } } diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/entity/ProductsTest.kt b/src/test/kotlin/com/ecwid/apiclient/v3/entity/ProductsTest.kt index 527c01e75..fdb1ed5a8 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/entity/ProductsTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/entity/ProductsTest.kt @@ -429,7 +429,7 @@ class ProductsTest : BaseEntityTest() { // Creating new product val productCreateRequest = ProductCreateRequest( - newProduct = generateTestProduct(categoryIds = categoryIds) + newProduct = generateTestProduct(categoryIds = categoryIds, discountsAllowed = true) ) val productCreateResult = apiClient.createProduct(productCreateRequest) assertTrue(productCreateResult.id > 0) @@ -445,9 +445,8 @@ class ProductsTest : BaseEntityTest() { // Completely updating newly created product val productUpdateRequest = ProductUpdateRequest( productId = productDetails1.id, - updatedProduct = generateTestProduct(categoryIds = categoryIds).withUnchangedShowOnFrontend( - productCreateRequest - ) + updatedProduct = generateTestProduct(categoryIds = categoryIds, discountsAllowed = false) + .withUnchangedShowOnFrontend(productCreateRequest) ) val productUpdateResult1 = apiClient.updateProduct(productUpdateRequest) assertEquals(1, productUpdateResult1.updateCount) @@ -1344,7 +1343,7 @@ private fun generateTestCategory(parentId: Int? = null): UpdatedCategory { ) } -private fun generateTestProduct(categoryIds: List = listOf()): UpdatedProduct { +private fun generateTestProduct(categoryIds: List = listOf(), discountsAllowed: Boolean = true): UpdatedProduct { val basePrice = randomPrice() val enName = "Product " + randomAlphanumeric(8) val enDescription = "Description " + randomAlphanumeric(16) @@ -1420,6 +1419,7 @@ private fun generateTestProduct(categoryIds: List = listOf()): UpdatedProdu tax = TaxInfo(), + discountsAllowed = discountsAllowed, subtitle = "Subtitle sample", ribbon = Ribbon( "Ribbon", 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 85f2e0c2d..6d7c92874 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/NullablePropertyRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/NullablePropertyRules.kt @@ -19,6 +19,7 @@ import com.ecwid.apiclient.v3.dto.productreview.request.UpdatedProductReviewStat import com.ecwid.apiclient.v3.dto.profile.request.StoreProfileRequest import com.ecwid.apiclient.v3.dto.profile.result.FetchedLatestStats import com.ecwid.apiclient.v3.dto.report.request.ReportRequest +import com.ecwid.apiclient.v3.dto.report.result.FetchedReportAdviceResponse import com.ecwid.apiclient.v3.dto.report.result.FetchedReportResponse import com.ecwid.apiclient.v3.dto.storage.result.FetchedStorageData import com.ecwid.apiclient.v3.dto.variation.request.ProductVariationsRequest @@ -96,6 +97,8 @@ val otherNullablePropertyRules: List> = listOf( AllowNullable(FetchedReportResponse::comparePeriodDataset), AllowNullable(FetchedReportResponse::additionalData), + AllowNullable(FetchedReportAdviceResponse::tip), + AllowNullable(FetchedReportResponse.FetchedDataset::startTimeStamp), AllowNullable(FetchedReportResponse.FetchedDataset::endTimeStamp), AllowNullable(FetchedReportResponse.FetchedDataset::percentage), @@ -184,6 +187,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/CustomersSearchRequestRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CustomersSearchRequestRules.kt index a0d81eace..532e6fe8d 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CustomersSearchRequestRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CustomersSearchRequestRules.kt @@ -10,6 +10,7 @@ val customersSearchRequestNullablePropertyRules: List AllowNullable(CustomersSearchRequest::customerGroupId), AllowNullable(CustomersSearchRequest::email), AllowNullable(CustomersSearchRequest::keyword), + AllowNullable(CustomersSearchRequest::usePrecalculatedOrderCount), AllowNullable(CustomersSearchRequest::maxOrderCount), AllowNullable(CustomersSearchRequest::minOrderCount), AllowNullable(CustomersSearchRequest::maxSalesValue), 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), +) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt index fbb043c2e..1113d8f84 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedProductRules.kt @@ -42,6 +42,7 @@ val fetchedProductNullablePropertyRules: List> = list IgnoreNullable(FetchedProduct::description), IgnoreNullable(FetchedProduct::descriptionTranslated), IgnoreNullable(FetchedProduct::dimensions), + AllowNullable(FetchedProduct::discountsAllowed), IgnoreNullable(FetchedProduct::enabled), IgnoreNullable(FetchedProduct::favorites), IgnoreNullable(FetchedProduct::files), @@ -88,6 +89,7 @@ val fetchedProductNullablePropertyRules: List> = list IgnoreNullable(FetchedProduct::tax), IgnoreNullable(FetchedProduct::unlimited), IgnoreNullable(FetchedProduct::url), + AllowNullable(FetchedProduct::customSlug), IgnoreNullable(FetchedProduct::warningLimit), IgnoreNullable(FetchedProduct::weight), IgnoreNullable(FetchedProduct::wholesalePrices),