Skip to content

Commit 1c03713

Browse files
ECWID-155668 Add "updateShippingOption" method to ecwid-java-api-client - (feat) make updateShippingOption available in the API client
1 parent 24fb42d commit 1c03713

File tree

5 files changed

+104
-1
lines changed

5 files changed

+104
-1
lines changed

src/main/kotlin/com/ecwid/apiclient/v3/StoreProfileApiClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface StoreProfileApiClient {
1717
fun getShippingOptions(request: ShippingOptionsRequest): ShippingOptionsResult
1818

1919
// fun addShippingOption()
20-
// fun updateShippingOption()
20+
fun updateShippingOption(request: ShippingOptionUpdateRequest): ShippingOptionUpdateResult
2121
fun getPaymentOptions(request: PaymentOptionsRequest): PaymentOptionsResult
2222
fun createPaymentOption(request: PaymentOptionCreateRequest): PaymentOptionCreateResult
2323
fun deletePaymentOption(request: PaymentOptionDeleteRequest): PaymentOptionDeleteResult
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.ecwid.apiclient.v3.dto.profile.request
2+
3+
import com.ecwid.apiclient.v3.dto.ApiRequest
4+
import com.ecwid.apiclient.v3.httptransport.HttpBody
5+
import com.ecwid.apiclient.v3.impl.RequestInfo
6+
7+
data class ShippingOptionUpdateRequest(
8+
val optionId: String = "",
9+
val updatedShippingOption: UpdatedShippingOption = UpdatedShippingOption()
10+
): ApiRequest {
11+
override fun toRequestInfo() = RequestInfo.createPutRequest(
12+
pathSegments = listOf(
13+
"profile",
14+
"shippingOptions",
15+
optionId,
16+
),
17+
httpBody = HttpBody.JsonBody(
18+
obj = updatedShippingOption
19+
)
20+
)
21+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package com.ecwid.apiclient.v3.dto.profile.request
2+
3+
import java.util.*
4+
5+
data class UpdatedShippingOption(
6+
val title: String? = null,
7+
val enabled: Boolean? = null,
8+
val orderBy: Int? = null,
9+
val destinationZone: Zone? = null,
10+
val businessHours: String? = null,
11+
val businessHoursLimitationType: String? = null,
12+
val blackoutDates: List<BlackoutDates>? = null,
13+
val scheduled: Boolean? = null,
14+
val scheduledPickup: Boolean? = null,
15+
val fulfillmentTimeInMinutes: Int? = null,
16+
val scheduledTimePrecisionType: String? = null,
17+
val deliveryTimeDays: String? = null,
18+
val timeSlotLengthInMinutes: Int? = null,
19+
val allowSameDayDelivery: Boolean? = null,
20+
val cutoffTimeForSameDayDelivery: String? = null,
21+
val availabilityPeriod: String? = null,
22+
val pickupInstruction: String? = null,
23+
val description: String? = null,
24+
val pickupPreparationTimeHours: Int? = null,
25+
val pickupBusinessHours:String? = null,
26+
val minimumOrderSubtotal: Int? = null,
27+
val flatRate: FlatRate? = null,
28+
val ratesTable: TableRatesDetails? = null,
29+
val estimatedShippingTimeAtCheckoutSettings: EstimatedShippingTimeAtCheckoutSettings? = null,
30+
val details: Details? = null,
31+
)
32+
33+
data class Zone(
34+
val name: String? = null,
35+
val countryCodes: List<String>? = null,
36+
val stateOrProvinceCodes: List<String>? = null,
37+
val postCodes: List<String>? = null,
38+
val geoPolygons: List<GeoPolygons>? = null,
39+
)
40+
41+
data class GeoPolygons(
42+
val coordinates: List<List<Double>>? = null,
43+
)
44+
45+
data class BlackoutDates(
46+
var fromDate: Date? = null,
47+
var toDate: Date? = null,
48+
var repeatedAnnually: Boolean? = null,
49+
)
50+
51+
data class FlatRate(
52+
val rateType: String? = null,
53+
val rate: Double? = null,
54+
)
55+
56+
data class TableRatesDetails(
57+
val tableBasedOn: String? = null,
58+
val rates: String? = null,
59+
)
60+
61+
data class EstimatedShippingTimeAtCheckoutSettings(
62+
val estimatedDeliveryDateAtCheckoutEnabled: Boolean? = null,
63+
val estimatedTransitTimeInDays: List<Int>? = null,
64+
val fulfillmentTimeInDays: Int? = null,
65+
val cutoffTimeForSameDayPacking: String? = null,
66+
val shippingBusinessDays: List<String>? = null,
67+
val deliveryDays: List<String>? = null,
68+
)
69+
70+
data class Details(
71+
val useDefaultAccount: Boolean? = null,
72+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.ecwid.apiclient.v3.dto.profile.result
2+
3+
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO
4+
5+
data class ShippingOptionUpdateResult(
6+
val success: Boolean = true
7+
) : ApiResultDTO

src/main/kotlin/com/ecwid/apiclient/v3/impl/StoreProfileApiClientImpl.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ internal class StoreProfileApiClientImpl(
5555
override fun getShippingOptions(request: ShippingOptionsRequest): ShippingOptionsResult =
5656
apiClientHelper.makeObjectResultRequest(request)
5757

58+
override fun updateShippingOption(request: ShippingOptionUpdateRequest): ShippingOptionUpdateResult =
59+
apiClientHelper.makeObjectResultRequest(request)
60+
5861
override fun getPaymentOptions(request: PaymentOptionsRequest): PaymentOptionsResult =
5962
apiClientHelper.makeObjectResultRequest(request)
6063

0 commit comments

Comments
 (0)