Skip to content

Commit

Permalink
ECWID-155668 Add "updateShippingOption" method to ecwid-java-api-clie…
Browse files Browse the repository at this point in the history
…nt - (feat) replace FetchedStoreProfile.ShippingOption with new FetchedShippingOption
  • Loading branch information
RomanTimchenkoLightspeed committed Jan 22, 2025
1 parent 1109053 commit ce1efe1
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 170 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ data class FetchedStoreProfile(
data class Shipping(
val handlingFee: HandlingFee? = null,
val shippingOrigin: ShippingOrigin? = null,
val shippingOptions: List<ShippingOption>? = null
val shippingOptions: List<FetchedShippingOption>? = null
)

data class HandlingFee(
Expand All @@ -262,43 +262,6 @@ data class FetchedStoreProfile(
val phone: String? = null
)

data class ShippingOption(
val id: String? = null,
val title: String? = null,
val enabled: Boolean? = null,
val orderBy: Int? = null,
val fulfilmentType: FulfilmentType? = null,
val destinationZone: Zone? = null,
val deliveryTimeDays: String? = null,
val description: String? = null,
val carrier: String? = null,
val carrierMethods: List<CarrierMethod>? = null,
val carrierSettings: CarrierSettings? = null,
val ratesCalculationType: RatesCalculationType? = null,
val shippingCostMarkup: Double? = null,
val flatRate: FlatRate? = null,
val ratesTable: TableRatesDetails? = null,
val appClientId: String? = null,
val locationId: String? = null,
val pickupInstruction: String? = null,
val scheduledPickup: Boolean? = null,
val pickupPreparationTimeHours: Int? = null,
val pickupBusinessHours: String? = null,
val scheduled: Boolean? = null,
val scheduledTimePrecisionType: ScheduledTimePrecisionType? = null,
)

@Suppress("unused")
enum class ScheduledTimePrecisionType {
DATE,
DATE_AND_TIME_SLOT
}

@Suppress("unused")
enum class FulfilmentType {
pickup, shipping, delivery
}

data class Zone(
val id: String? = null,
val name: String? = null,
Expand All @@ -307,87 +270,6 @@ data class FetchedStoreProfile(
val postCodes: List<String>? = null
)

data class CarrierMethod(
val id: String? = null,
val name: String? = null,
val enabled: Boolean? = null,
val orderBy: Int? = null
)

data class CarrierSettings(
val defaultCarrierAccountEnabled: Boolean? = null,
val defaultPostageDimensions: DefaultPostageDimensions? = null
)

data class DefaultPostageDimensions(
val length: Double? = null,
val width: Double? = null,
val height: Double? = null
)

@Suppress("unused")
enum class RatesCalculationType {

carrier_calculated,
table,
flat,
app;

override fun toString(): String {
return asApiString()
}

fun asApiString(): String {
return super.toString().replace("_", "-")
}
}

data class FlatRate(
val rateType: RateType? = null,
val rate: Double? = null
) {

@Suppress("unused")
enum class RateType {
ABSOLUTE,
PERCENT
}
}

data class TableRatesDetails(
val tableBasedOn: RateBase? = null,
val rates: List<TableRate>? = null
) {

@Suppress("unused")
enum class RateBase {
subtotal,
discountedSubtotal,
weight
}
}

data class TableRate(
val tableRateConditions: TableRateConditions? = null,
val rate: TableRateDetails? = null
)

data class TableRateConditions(
val weightFrom: Double? = null,
val weightTo: Double? = null,
val subtotalFrom: Double? = null,
val subtotalTo: Double? = null,
val discountedSubtotalFrom: Double? = null,
val discountedSubtotalTo: Double? = null
)

data class TableRateDetails(
val perOrderAbs: Double? = null,
val perOrderPercent: Double? = null,
val perItem: Double? = null,
val perWeightUnitRate: Double? = null
)

data class TaxSettings(
val automaticTaxEnabled: Boolean? = null,
val taxes: List<Taxes>? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.ecwid.apiclient.v3.dto.profile.result

import java.util.*

class ShippingOptionsResult : ArrayList<FetchedStoreProfile.ShippingOption>()
class ShippingOptionsResult : ArrayList<FetchedShippingOption>()
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ecwid.apiclient.v3.jsontransformer.gson

import com.ecwid.apiclient.v3.dto.product.result.GetProductFiltersResult.ProductFilters
import com.ecwid.apiclient.v3.dto.profile.result.FetchedStoreProfile.RatesCalculationType
import com.ecwid.apiclient.v3.dto.profile.enums.RatesCalculationType
import com.ecwid.apiclient.v3.exception.JsonDeserializationException
import com.ecwid.apiclient.v3.impl.ParsedResponseWithExt
import com.ecwid.apiclient.v3.jsontransformer.JsonTransformer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ecwid.apiclient.v3.jsontransformer.gson.typeadapters

import com.ecwid.apiclient.v3.dto.profile.result.FetchedStoreProfile.RatesCalculationType
import com.ecwid.apiclient.v3.dto.profile.enums.RatesCalculationType
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ val fetchedStoreProfileNullablePropertyRules: List<NullablePropertyRule<*, *>> =
IgnoreNullable(FetchedStoreProfile.ApplePay::verificationFileUrl),
IgnoreNullable(FetchedStoreProfile.BusinessRegistrationID::name),
IgnoreNullable(FetchedStoreProfile.BusinessRegistrationID::value),
IgnoreNullable(FetchedStoreProfile.CarrierMethod::enabled),
IgnoreNullable(FetchedStoreProfile.CarrierMethod::id),
IgnoreNullable(FetchedStoreProfile.CarrierMethod::name),
IgnoreNullable(FetchedStoreProfile.CarrierMethod::orderBy),
IgnoreNullable(FetchedStoreProfile.CarrierSettings::defaultCarrierAccountEnabled),
IgnoreNullable(FetchedStoreProfile.CarrierSettings::defaultPostageDimensions),
IgnoreNullable(FetchedStoreProfile.Company::city),
IgnoreNullable(FetchedStoreProfile.Company::companyName),
IgnoreNullable(FetchedStoreProfile.Company::countryCode),
Expand All @@ -51,9 +45,6 @@ val fetchedStoreProfileNullablePropertyRules: List<NullablePropertyRule<*, *>> =
IgnoreNullable(FetchedStoreProfile.Company::postalCode),
IgnoreNullable(FetchedStoreProfile.Company::stateOrProvinceCode),
IgnoreNullable(FetchedStoreProfile.Company::street),
IgnoreNullable(FetchedStoreProfile.DefaultPostageDimensions::height),
IgnoreNullable(FetchedStoreProfile.DefaultPostageDimensions::length),
IgnoreNullable(FetchedStoreProfile.DefaultPostageDimensions::width),
AllowNullable(FetchedStoreProfile.DesignSettings::breadcrumbsHaveHomeItem),
AllowNullable(FetchedStoreProfile.DesignSettings::breadcrumbsHomeUrl),
AllowNullable(FetchedStoreProfile.DesignSettings::breadcrumbsSeparator),
Expand Down Expand Up @@ -186,8 +177,6 @@ val fetchedStoreProfileNullablePropertyRules: List<NullablePropertyRule<*, *>> =
IgnoreNullable(FetchedStoreProfile.FeatureTogglesInfo::enabled),
IgnoreNullable(FetchedStoreProfile.FeatureTogglesInfo::name),
IgnoreNullable(FetchedStoreProfile.FeatureTogglesInfo::visible),
IgnoreNullable(FetchedStoreProfile.FlatRate::rate),
IgnoreNullable(FetchedStoreProfile.FlatRate::rateType),
IgnoreNullable(FetchedStoreProfile.FormatsAndUnits::currency),
IgnoreNullable(FetchedStoreProfile.FormatsAndUnits::currencyDecimalSeparator),
IgnoreNullable(FetchedStoreProfile.FormatsAndUnits::currencyGroupSeparator),
Expand Down Expand Up @@ -310,29 +299,6 @@ val fetchedStoreProfileNullablePropertyRules: List<NullablePropertyRule<*, *>> =
IgnoreNullable(FetchedStoreProfile.Shipping::handlingFee),
IgnoreNullable(FetchedStoreProfile.Shipping::shippingOptions),
IgnoreNullable(FetchedStoreProfile.Shipping::shippingOrigin),
IgnoreNullable(FetchedStoreProfile.ShippingOption::appClientId),
IgnoreNullable(FetchedStoreProfile.ShippingOption::carrier),
IgnoreNullable(FetchedStoreProfile.ShippingOption::carrierMethods),
IgnoreNullable(FetchedStoreProfile.ShippingOption::carrierSettings),
IgnoreNullable(FetchedStoreProfile.ShippingOption::deliveryTimeDays),
IgnoreNullable(FetchedStoreProfile.ShippingOption::description),
IgnoreNullable(FetchedStoreProfile.ShippingOption::destinationZone),
IgnoreNullable(FetchedStoreProfile.ShippingOption::enabled),
IgnoreNullable(FetchedStoreProfile.ShippingOption::flatRate),
IgnoreNullable(FetchedStoreProfile.ShippingOption::fulfilmentType),
IgnoreNullable(FetchedStoreProfile.ShippingOption::id),
AllowNullable(FetchedStoreProfile.ShippingOption::locationId),
IgnoreNullable(FetchedStoreProfile.ShippingOption::orderBy),
IgnoreNullable(FetchedStoreProfile.ShippingOption::pickupBusinessHours),
IgnoreNullable(FetchedStoreProfile.ShippingOption::pickupInstruction),
IgnoreNullable(FetchedStoreProfile.ShippingOption::pickupPreparationTimeHours),
IgnoreNullable(FetchedStoreProfile.ShippingOption::ratesCalculationType),
IgnoreNullable(FetchedStoreProfile.ShippingOption::ratesTable),
IgnoreNullable(FetchedStoreProfile.ShippingOption::scheduledPickup),
IgnoreNullable(FetchedStoreProfile.ShippingOption::shippingCostMarkup),
IgnoreNullable(FetchedStoreProfile.ShippingOption::title),
AllowNullable(FetchedStoreProfile.ShippingOption::scheduled),
AllowNullable(FetchedStoreProfile.ShippingOption::scheduledTimePrecisionType),
IgnoreNullable(FetchedStoreProfile.ShippingOrigin::city),
IgnoreNullable(FetchedStoreProfile.ShippingOrigin::companyName),
IgnoreNullable(FetchedStoreProfile.ShippingOrigin::countryCode),
Expand All @@ -342,20 +308,6 @@ val fetchedStoreProfileNullablePropertyRules: List<NullablePropertyRule<*, *>> =
IgnoreNullable(FetchedStoreProfile.ShippingOrigin::stateOrProvinceCode),
IgnoreNullable(FetchedStoreProfile.ShippingOrigin::street),
AllowNullable(FetchedStoreProfile.ShippingSettings::enabledShippingMethods),
IgnoreNullable(FetchedStoreProfile.TableRate::rate),
IgnoreNullable(FetchedStoreProfile.TableRate::tableRateConditions),
IgnoreNullable(FetchedStoreProfile.TableRateConditions::discountedSubtotalFrom),
IgnoreNullable(FetchedStoreProfile.TableRateConditions::discountedSubtotalTo),
IgnoreNullable(FetchedStoreProfile.TableRateConditions::subtotalFrom),
IgnoreNullable(FetchedStoreProfile.TableRateConditions::subtotalTo),
IgnoreNullable(FetchedStoreProfile.TableRateConditions::weightFrom),
IgnoreNullable(FetchedStoreProfile.TableRateConditions::weightTo),
IgnoreNullable(FetchedStoreProfile.TableRateDetails::perItem),
IgnoreNullable(FetchedStoreProfile.TableRateDetails::perOrderAbs),
IgnoreNullable(FetchedStoreProfile.TableRateDetails::perOrderPercent),
IgnoreNullable(FetchedStoreProfile.TableRateDetails::perWeightUnitRate),
IgnoreNullable(FetchedStoreProfile.TableRatesDetails::rates),
IgnoreNullable(FetchedStoreProfile.TableRatesDetails::tableBasedOn),
IgnoreNullable(FetchedStoreProfile.TaxSettings::automaticTaxEnabled),
IgnoreNullable(FetchedStoreProfile.TaxSettings::pricesIncludeTax),
IgnoreNullable(FetchedStoreProfile.TaxSettings::taxes),
Expand Down

0 comments on commit ce1efe1

Please sign in to comment.