Skip to content

Commit

Permalink
Merge pull request #445 from Ecwid/ECWID-153267
Browse files Browse the repository at this point in the history
ECWID-153267 REST API: the 'lang' parameter in GET responses to /orders endpoint is not returned
  • Loading branch information
zenon-ecwid authored Nov 27, 2024
2 parents de4559d + 95db5b0 commit c01e7e2
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ fun FetchedOrder.toUpdated(): UpdatedOrder {
paymentReference = paymentReference,
loyalty = loyalty?.toUpdated(),
customerFiscalCode = customerFiscalCode,
lang = lang,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ data class UpdatedOrder(
val paymentReference: String? = null,
val loyalty: Loyalty? = null,
val customerFiscalCode: String? = null,
val lang: String? = null,

) : ApiUpdatedDTO {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ data class FetchedOrder(
val shippingLabelAvailableForShipment: Boolean = false,
val loyalty: Loyalty? = null,
val customerFiscalCode: String? = null,
val lang: String? = null,

) : ApiFetchedDTO, ApiResultDTO {

Expand Down
6 changes: 4 additions & 2 deletions src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.ecwid.apiclient.v3.entity
import com.ecwid.apiclient.v3.converter.toUpdated
import com.ecwid.apiclient.v3.dto.cart.request.*
import com.ecwid.apiclient.v3.dto.cart.result.CalculateOrderDetailsResult
import com.ecwid.apiclient.v3.dto.cart.result.CalculateOrderDetailsResult.DiscountInfo
import com.ecwid.apiclient.v3.dto.order.enums.*
import com.ecwid.apiclient.v3.dto.order.request.OrderCreateRequest
import com.ecwid.apiclient.v3.dto.order.request.OrderDetailsRequest
Expand Down Expand Up @@ -352,7 +353,7 @@ class CartsTest : BaseEntityTest() {
checkPersonsEquals(orderForCalculate.billingPerson, calculatedOrder.billingPerson)
checkPersonsEquals(orderForCalculate.shippingPerson, calculatedOrder.shippingPerson)
assertEquals(
null,
emptyList<DiscountInfo>(),
calculatedOrder.discountInfo
) // TODO Discover why after each calculation this field resets to null
}
Expand Down Expand Up @@ -709,6 +710,7 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder
it.copy(
appliesToItems = null
)
}
},
lang = order.lang
)
}
3 changes: 2 additions & 1 deletion src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder
it.copy(
appliesToItems = null
)
}
},
lang = order.lang
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,5 @@ val fetchedOrderNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf
AllowNullable(FetchedOrder.LoyaltyRedemption::amount),
AllowNullable(FetchedOrder.LoyaltyRedemption::cancelled),
AllowNullable(FetchedOrder::customerFiscalCode),
AllowNullable(FetchedOrder::lang),
)
1 change: 1 addition & 0 deletions src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ fun generateTestOrder(): UpdatedOrder {
),
refererChannel = "Referer channel " + randomAlphanumeric(8),
),
lang = "en",
orderExtraFields = listOf(
UpdatedOrder.OrderExtraFields(
customerInputType = "TEXT",
Expand Down

0 comments on commit c01e7e2

Please sign in to comment.