Skip to content

Commit ae75fce

Browse files
authored
Merge pull request #385 from Ecwid/ECWID-135534
ECWID-135534 api v3: calculate order details — use shipping rate if i…
2 parents bbb2a12 + d9c8dd0 commit ae75fce

8 files changed

Lines changed: 8 additions & 0 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
@@ -232,6 +232,7 @@ fun FetchedOrder.PersonInfo.toUpdated(): UpdatedOrder.PersonInfo {
232232

233233
fun FetchedOrder.ShippingOption.toUpdated(): UpdatedOrder.ShippingOption {
234234
return UpdatedOrder.ShippingOption(
235+
shippingMethodId = shippingMethodId,
235236
shippingCarrierName = shippingCarrierName,
236237
shippingMethodName = shippingMethodName,
237238
shippingRate = shippingRate,

src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ data class FetchedCart(
230230
)
231231

232232
data class ShippingOptionInfo(
233+
val shippingMethodId: String? = null,
233234
val shippingCarrierName: String? = null,
234235
val shippingMethodName: String? = null,
235236
val shippingRate: Double? = null,

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
@@ -294,6 +294,7 @@ data class UpdatedOrder(
294294
)
295295

296296
data class ShippingOption(
297+
val shippingMethodId: String? = null,
297298
val shippingCarrierName: String? = null,
298299
val shippingMethodName: String? = null,
299300
val shippingRate: Double? = null,

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
@@ -318,6 +318,7 @@ data class FetchedOrder(
318318
)
319319

320320
data class ShippingOption(
321+
val shippingMethodId: String? = null,
321322
val shippingCarrierName: String? = null,
322323
val shippingMethodName: String? = null,
323324
val shippingRate: Double? = null,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ class CartsTest : BaseEntityTest() {
164164
testOrder.shippingOption?.shippingCarrierName,
165165
cartDetailsResult.shippingOption?.shippingCarrierName
166166
)
167+
assertEquals(testOrder.shippingOption?.shippingMethodId, cartDetailsResult.shippingOption?.shippingMethodId)
167168
assertEquals(testOrder.shippingOption?.shippingMethodName, cartDetailsResult.shippingOption?.shippingMethodName)
168169
assertEquals(testOrder.shippingOption?.shippingRate, cartDetailsResult.shippingOption?.shippingRate)
169170
assertEquals(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ val fetchedCartNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
163163
IgnoreNullable(FetchedCart.SelectionInfo::selectionModifier),
164164
IgnoreNullable(FetchedCart.SelectionInfo::selectionModifierType),
165165
IgnoreNullable(FetchedCart.SelectionInfo::selectionTitle),
166+
AllowNullable(FetchedCart.ShippingOptionInfo::shippingMethodId),
166167
IgnoreNullable(FetchedCart.ShippingOptionInfo::estimatedTransitTime),
167168
IgnoreNullable(FetchedCart.ShippingOptionInfo::isPickup),
168169
IgnoreNullable(FetchedCart.ShippingOptionInfo::pickupInstruction),

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
@@ -172,6 +172,7 @@ val fetchedOrderNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf
172172
AllowNullable(FetchedOrder.ShippingLabelInfo::commercialInvoiceUrl),
173173
AllowNullable(FetchedOrder.ShippingLabelInfo::labelFileType),
174174
AllowNullable(FetchedOrder.ShippingLabelInfo::labelUrl),
175+
AllowNullable(FetchedOrder.ShippingOption::shippingMethodId),
175176
IgnoreNullable(FetchedOrder.ShippingOption::estimatedTransitTime),
176177
IgnoreNullable(FetchedOrder.ShippingOption::fulfillmentType),
177178
IgnoreNullable(FetchedOrder.ShippingOption::isPickup),

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ fun generateTestOrder(): UpdatedOrder {
100100
shippingPerson = generatePersonInfo(),
101101

102102
shippingOption = UpdatedOrder.ShippingOption(
103+
shippingMethodId = "MethodId " + randomAlphanumeric(8),
103104
shippingCarrierName = "Carrier " + randomAlphanumeric(8),
104105
shippingMethodName = "Method " + randomAlphanumeric(8),
105106
shippingRate = randomPrice(),

0 commit comments

Comments
 (0)