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-153267 REST API: the 'lang' parameter in GET responses to /orders endpoint is not returned #445

Merged
merged 6 commits into from
Nov 27, 2024
Merged
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,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
Loading