From 9865de753b53d98f559bef94c3f6a51d74f467a6 Mon Sep 17 00:00:00 2001 From: Alexander Blake Date: Wed, 13 Nov 2024 16:38:35 +0400 Subject: [PATCH] =?UTF-8?q?ECWID-152638=20OE2:=20add=20tax=20fields=20to?= =?UTF-8?q?=20ecwid-java-api-client=20=E2=80=94=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt | 3 +++ .../ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt | 6 ++++++ .../com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt | 6 ++++++ src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt | 3 +++ src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt | 3 +++ .../v3/rule/nullablepropertyrules/FetchedOrderRules.kt | 3 +++ 6 files changed, 24 insertions(+) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt index 76af5e35..f1287dd6 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt @@ -93,6 +93,9 @@ fun FetchedOrder.toUpdated(): UpdatedOrder { paymentReference = paymentReference, loyalty = loyalty?.toUpdated(), customerFiscalCode = customerFiscalCode, + electronicInvoicePecEmail = electronicInvoicePecEmail, + electronicInvoiceSdiCode = electronicInvoiceSdiCode, + commercialRelationshipScheme = commercialRelationshipScheme, ) } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt index cdca867a..ee15e67f 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt @@ -5,8 +5,10 @@ import com.ecwid.apiclient.v3.dto.common.ApiUpdatedDTO.ModifyKind import com.ecwid.apiclient.v3.dto.common.BaseOrderTax import com.ecwid.apiclient.v3.dto.common.OrderedStringToListStringMap import com.ecwid.apiclient.v3.dto.common.OrderedStringToStringMap +import com.ecwid.apiclient.v3.dto.customer.enums.CommercialRelationshipScheme import com.ecwid.apiclient.v3.dto.order.enums.* import com.ecwid.apiclient.v3.dto.order.result.FetchedOrder +import com.ecwid.apiclient.v3.jsontransformer.JsonFieldName import java.text.DateFormat import java.text.SimpleDateFormat import java.util.* @@ -97,6 +99,10 @@ data class UpdatedOrder( val paymentReference: String? = null, val loyalty: Loyalty? = null, val customerFiscalCode: String? = null, + val electronicInvoicePecEmail: String? = null, + val electronicInvoiceSdiCode: String? = null, + @JsonFieldName("b2b_b2c") + val commercialRelationshipScheme: CommercialRelationshipScheme? = null, ) : ApiUpdatedDTO { 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 db85e017..ff865dfb 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 @@ -6,8 +6,10 @@ 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 +import com.ecwid.apiclient.v3.dto.customer.enums.CommercialRelationshipScheme import com.ecwid.apiclient.v3.dto.order.enums.* import com.ecwid.apiclient.v3.dto.order.request.UpdatedOrder +import com.ecwid.apiclient.v3.jsontransformer.JsonFieldName import java.util.* data class FetchedOrder( @@ -119,6 +121,10 @@ data class FetchedOrder( val shippingLabelAvailableForShipment: Boolean = false, val loyalty: Loyalty? = null, val customerFiscalCode: String? = null, + val electronicInvoicePecEmail: String? = "", + val electronicInvoiceSdiCode: String? = "", + @JsonFieldName("b2b_b2c") + val commercialRelationshipScheme: CommercialRelationshipScheme? = CommercialRelationshipScheme.b2c, ) : ApiFetchedDTO, ApiResultDTO { diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt b/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt index 71f89015..faf61505 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt @@ -705,6 +705,9 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder ) }, customerFiscalCode = null, // ApiOrder has empty string instead of null + electronicInvoicePecEmail = null, + electronicInvoiceSdiCode = null, + commercialRelationshipScheme = null, discountInfo = order.discountInfo?.map { it.copy( appliesToItems = null diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt b/src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt index 34a52968..08f22255 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt @@ -433,6 +433,9 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder item.cleanupForComparison(requestItem) }, customerFiscalCode = null, // ApiOrder has empty string instead of null + electronicInvoicePecEmail = null, + electronicInvoiceSdiCode = null, + commercialRelationshipScheme = null, discountInfo = order.discountInfo?.map { it.copy( appliesToItems = null diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt index b50d999c..6eec05ba 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt @@ -321,4 +321,7 @@ val fetchedOrderNullablePropertyRules: List> = listOf AllowNullable(FetchedOrder.LoyaltyRedemption::amount), AllowNullable(FetchedOrder.LoyaltyRedemption::cancelled), AllowNullable(FetchedOrder::customerFiscalCode), + AllowNullable(FetchedOrder::electronicInvoicePecEmail), + AllowNullable(FetchedOrder::electronicInvoiceSdiCode), + AllowNullable(FetchedOrder::commercialRelationshipScheme), )