Skip to content

Commit c01e7e2

Browse files
authored
Merge pull request #445 from Ecwid/ECWID-153267
ECWID-153267 REST API: the 'lang' parameter in GET responses to /orders endpoint is not returned
2 parents de4559d + 95db5b0 commit c01e7e2

7 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ fun FetchedOrder.toUpdated(): UpdatedOrder {
9393
paymentReference = paymentReference,
9494
loyalty = loyalty?.toUpdated(),
9595
customerFiscalCode = customerFiscalCode,
96+
lang = lang,
9697
)
9798
}
9899

src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ data class UpdatedOrder(
9797
val paymentReference: String? = null,
9898
val loyalty: Loyalty? = null,
9999
val customerFiscalCode: String? = null,
100+
val lang: String? = null,
100101

101102
) : ApiUpdatedDTO {
102103

src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ data class FetchedOrder(
119119
val shippingLabelAvailableForShipment: Boolean = false,
120120
val loyalty: Loyalty? = null,
121121
val customerFiscalCode: String? = null,
122+
val lang: String? = null,
122123

123124
) : ApiFetchedDTO, ApiResultDTO {
124125

src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.ecwid.apiclient.v3.entity
33
import com.ecwid.apiclient.v3.converter.toUpdated
44
import com.ecwid.apiclient.v3.dto.cart.request.*
55
import com.ecwid.apiclient.v3.dto.cart.result.CalculateOrderDetailsResult
6+
import com.ecwid.apiclient.v3.dto.cart.result.CalculateOrderDetailsResult.DiscountInfo
67
import com.ecwid.apiclient.v3.dto.order.enums.*
78
import com.ecwid.apiclient.v3.dto.order.request.OrderCreateRequest
89
import com.ecwid.apiclient.v3.dto.order.request.OrderDetailsRequest
@@ -352,7 +353,7 @@ class CartsTest : BaseEntityTest() {
352353
checkPersonsEquals(orderForCalculate.billingPerson, calculatedOrder.billingPerson)
353354
checkPersonsEquals(orderForCalculate.shippingPerson, calculatedOrder.shippingPerson)
354355
assertEquals(
355-
null,
356+
emptyList<DiscountInfo>(),
356357
calculatedOrder.discountInfo
357358
) // TODO Discover why after each calculation this field resets to null
358359
}
@@ -709,6 +710,7 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder
709710
it.copy(
710711
appliesToItems = null
711712
)
712-
}
713+
},
714+
lang = order.lang
713715
)
714716
}

src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder
437437
it.copy(
438438
appliesToItems = null
439439
)
440-
}
440+
},
441+
lang = order.lang
441442
)
442443
}
443444

src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,5 @@ val fetchedOrderNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf
321321
AllowNullable(FetchedOrder.LoyaltyRedemption::amount),
322322
AllowNullable(FetchedOrder.LoyaltyRedemption::cancelled),
323323
AllowNullable(FetchedOrder::customerFiscalCode),
324+
AllowNullable(FetchedOrder::lang),
324325
)

src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fun generateTestOrder(): UpdatedOrder {
137137
),
138138
refererChannel = "Referer channel " + randomAlphanumeric(8),
139139
),
140+
lang = "en",
140141
orderExtraFields = listOf(
141142
UpdatedOrder.OrderExtraFields(
142143
customerInputType = "TEXT",

0 commit comments

Comments
 (0)