Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECWID-152638 OE2: add tax fields #444

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ fun FetchedOrder.toUpdated(): UpdatedOrder {
paymentReference = paymentReference,
loyalty = loyalty?.toUpdated(),
customerFiscalCode = customerFiscalCode,
electronicInvoicePecEmail = electronicInvoicePecEmail,
electronicInvoiceSdiCode = electronicInvoiceSdiCode,
commercialRelationshipScheme = commercialRelationshipScheme,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 {

Expand Down
3 changes: 3 additions & 0 deletions src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,7 @@ val fetchedOrderNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf
AllowNullable(FetchedOrder.LoyaltyRedemption::amount),
AllowNullable(FetchedOrder.LoyaltyRedemption::cancelled),
AllowNullable(FetchedOrder::customerFiscalCode),
AllowNullable(FetchedOrder::electronicInvoicePecEmail),
AllowNullable(FetchedOrder::electronicInvoiceSdiCode),
AllowNullable(FetchedOrder::commercialRelationshipScheme),
)
Loading