Skip to content
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 @@ -56,6 +56,7 @@ data class Product(
val isStockManaged: Boolean,
val stockQuantity: Double,
val sku: String,
val globalUniqueId: String,
val shippingClass: String,
val shippingClassId: Long,
val isDownloadable: Boolean,
Expand Down Expand Up @@ -116,6 +117,7 @@ data class Product(
isSoldIndividually == product.isSoldIndividually &&
reviewsAllowed == product.reviewsAllowed &&
sku == product.sku &&
globalUniqueId == product.globalUniqueId &&
slug == product.slug &&
type == product.type &&
name.fastStripHtml() == product.name.fastStripHtml() &&
Expand Down Expand Up @@ -292,6 +294,7 @@ data class Product(
shortDescription = updatedProduct.shortDescription,
name = updatedProduct.name,
sku = updatedProduct.sku,
globalUniqueId = updatedProduct.globalUniqueId,
slug = updatedProduct.slug,
status = updatedProduct.status,
catalogVisibility = updatedProduct.catalogVisibility,
Expand Down Expand Up @@ -415,6 +418,7 @@ fun Product.toDataModel(storedProductModel: WCProductModel? = null): WCProductMo
it.shortDescription = shortDescription
it.name = name
it.sku = sku
it.globalUniqueId = globalUniqueId
it.slug = slug
it.status = status.toString()
it.catalogVisibility = catalogVisibility.toString()
Expand Down Expand Up @@ -513,6 +517,7 @@ fun WCProductModel.toAppModel(): Product {
isStockManaged = this.manageStock,
stockQuantity = this.stockQuantity,
sku = this.sku,
globalUniqueId = this.globalUniqueId,
slug = this.slug,
length = this.length.toFloatOrNull() ?: 0f,
width = this.width.toFloatOrNull() ?: 0f,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ open class ProductVariation(
open val remoteProductId: Long,
open val remoteVariationId: Long,
open val sku: String,
open val globalUniqueId: String,
open val image: Image?,
open val price: BigDecimal?,
open val regularPrice: BigDecimal?,
Expand Down Expand Up @@ -76,6 +77,7 @@ open class ProductVariation(
remoteVariationId == variation.remoteVariationId &&
remoteProductId == variation.remoteProductId &&
sku == variation.sku &&
globalUniqueId == variation.globalUniqueId &&
image?.id == variation.image?.id &&
regularPrice isEquivalentTo variation.regularPrice &&
salePrice isEquivalentTo variation.salePrice &&
Expand Down Expand Up @@ -136,6 +138,7 @@ open class ProductVariation(
it.remoteProductId = remoteProductId
it.remoteVariationId = remoteVariationId
it.sku = sku
it.globalUniqueId = globalUniqueId
it.image = imageToJson()
it.regularPrice = if (regularPrice.isNotSet()) "" else regularPrice.toString()
it.salePrice = if (salePrice.isNotSet()) "" else salePrice.toString()
Expand Down Expand Up @@ -189,6 +192,7 @@ open class ProductVariation(
remoteProductId: Long = this.remoteProductId,
remoteVariationId: Long = this.remoteVariationId,
sku: String = this.sku,
globalUniqueId: String = this.globalUniqueId,
image: Image? = this.image,
price: BigDecimal? = this.price,
regularPrice: BigDecimal? = this.regularPrice,
Expand Down Expand Up @@ -223,6 +227,7 @@ open class ProductVariation(
remoteProductId = remoteProductId,
remoteVariationId = remoteVariationId,
sku = sku,
globalUniqueId = globalUniqueId,
image = image,
price = price,
regularPrice = regularPrice,
Expand Down Expand Up @@ -281,6 +286,7 @@ fun WCProductVariationModel.toAppModel(): ProductVariation {
remoteProductId = this.remoteProductId,
remoteVariationId = this.remoteVariationId,
sku = this.sku,
globalUniqueId = this.globalUniqueId,
image = this.getImageModel()?.let {
Product.Image(
it.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class SubscriptionProductVariation(
override val remoteProductId: Long,
override val remoteVariationId: Long,
override val sku: String,
override val globalUniqueId: String,
override val image: Product.Image?,
override val price: BigDecimal?,
override val regularPrice: BigDecimal?,
Expand Down Expand Up @@ -53,6 +54,7 @@ class SubscriptionProductVariation(
remoteProductId = remoteProductId,
remoteVariationId = remoteVariationId,
sku = sku,
globalUniqueId = globalUniqueId,
image = image,
price = price,
regularPrice = regularPrice,
Expand Down Expand Up @@ -89,6 +91,7 @@ class SubscriptionProductVariation(
remoteProductId = model.remoteProductId,
remoteVariationId = model.remoteVariationId,
sku = model.sku,
globalUniqueId = model.globalUniqueId,
image = model.getImageModel()?.let {
Product.Image(
it.id,
Expand Down Expand Up @@ -137,6 +140,7 @@ class SubscriptionProductVariation(
remoteVariationId == variation.remoteVariationId &&
remoteProductId == variation.remoteProductId &&
sku == variation.sku &&
globalUniqueId == variation.globalUniqueId &&
image?.id == variation.image?.id &&
regularPrice isEquivalentTo variation.regularPrice &&
salePrice isEquivalentTo variation.salePrice &&
Expand Down Expand Up @@ -172,6 +176,7 @@ class SubscriptionProductVariation(
result = 31 * result + remoteProductId.hashCode()
result = 31 * result + remoteVariationId.hashCode()
result = 31 * result + sku.hashCode()
result = 31 * result + globalUniqueId.hashCode()
result = 31 * result + (image?.hashCode() ?: 0)
result = 31 * result + (price?.hashCode() ?: 0)
result = 31 * result + (regularPrice?.hashCode() ?: 0)
Expand Down Expand Up @@ -208,6 +213,7 @@ class SubscriptionProductVariation(
remoteProductId: Long,
remoteVariationId: Long,
sku: String,
globalUniqueId: String,
image: Product.Image?,
price: BigDecimal?,
regularPrice: BigDecimal?,
Expand Down Expand Up @@ -242,6 +248,7 @@ class SubscriptionProductVariation(
remoteProductId = remoteProductId,
remoteVariationId = remoteVariationId,
sku = sku,
globalUniqueId = globalUniqueId,
image = image,
price = price,
regularPrice = regularPrice,
Expand Down Expand Up @@ -280,6 +287,7 @@ class SubscriptionProductVariation(
remoteProductId: Long = this.remoteProductId,
remoteVariationId: Long = this.remoteVariationId,
sku: String = this.sku,
globalUniqueId: String = this.globalUniqueId,
image: Image? = this.image,
price: BigDecimal? = this.price,
regularPrice: BigDecimal? = this.regularPrice,
Expand Down Expand Up @@ -315,6 +323,7 @@ class SubscriptionProductVariation(
remoteProductId = remoteProductId,
remoteVariationId = remoteVariationId,
sku = sku,
globalUniqueId = globalUniqueId,
image = image,
price = price,
regularPrice = regularPrice,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ object ProductHelper {
isStockManaged = false,
stockQuantity = 0.0,
sku = "",
globalUniqueId = "",
slug = "",
length = 0f,
width = 0f,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ class ProductInventoryFragment :
binding.productSku.text = it
}
}

new.inventoryData.globalUniqueId?.takeIfNotEqualTo(old?.inventoryData?.globalUniqueId) {
if (binding.productGlobalUniqueId.text != it) {
binding.productGlobalUniqueId.text = it
}
}

new.inventoryData.stockQuantity?.takeIfNotEqualTo(old?.inventoryData?.stockQuantity) {
val quantity = StringUtils.formatCountDecimal(it, forInput = true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class ProductInventoryViewModel @Inject constructor(
@Parcelize
data class InventoryData(
val sku: String? = null,
val globalUniqueId: String? = null,
val isStockManaged: Boolean? = null,
val isSoldIndividually: Boolean? = null,
val stockStatus: ProductStockStatus? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ class ProductDetailCardBuilder(
ViewProductInventory(
InventoryData(
sku = this.sku,
globalUniqueId = this.globalUniqueId,
isStockManaged = this.isStockManaged,
stockStatus = this.stockStatus,
stockQuantity = this.stockQuantity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ class VariationDetailCardBuilder(
ViewInventory(
InventoryData(
sku = this.sku,
globalUniqueId = this.globalUniqueId,
isStockManaged = this.isStockManaged,
stockStatus = this.stockStatus,
stockQuantity = this.stockQuantity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fun generateVariation(): ProductVariation {
remoteProductId = 1,
remoteVariationId = 2,
sku = "sku",
globalUniqueId = "globalUniqueId",
image = null,
price = null,
regularPrice = null,
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ stripe-terminal = '3.7.1'
tinder-statemachine = '0.2.0'
wiremock = '2.26.3'
wordpress-aztec = 'v2.1.4'
wordpress-fluxc = '2.100.0'
wordpress-fluxc = 'trunk-3d095f6f0a41e50faab2038a9f195f536b6e4520'
wordpress-login = '1.19.0'
wordpress-libaddressinput = '0.0.2'
wordpress-mediapicker = '0.3.1'
Expand Down