Skip to content

Commit 2ad06b2

Browse files
committed
Remove unused properties from POS models
1 parent ee4814f commit 2ad06b2

File tree

9 files changed

+0
-103
lines changed

9 files changed

+0
-103
lines changed

Modules/Sources/Fakes/Networking.generated.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,9 +756,6 @@ extension Networking.POSProduct {
756756
sku: .fake(),
757757
globalUniqueID: .fake(),
758758
price: .fake(),
759-
regularPrice: .fake(),
760-
salePrice: .fake(),
761-
onSale: .fake(),
762759
downloadable: .fake(),
763760
parentID: .fake(),
764761
images: .fake(),
@@ -782,9 +779,6 @@ extension Networking.POSProductVariation {
782779
sku: .fake(),
783780
globalUniqueID: .fake(),
784781
price: .fake(),
785-
regularPrice: .fake(),
786-
salePrice: .fake(),
787-
onSale: .fake(),
788782
downloadable: .fake(),
789783
manageStock: .fake(),
790784
stockQuantity: .fake(),

Modules/Sources/Networking/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,9 +1249,6 @@ extension Networking.POSProduct {
12491249
sku: NullableCopiableProp<String> = .copy,
12501250
globalUniqueID: NullableCopiableProp<String> = .copy,
12511251
price: CopiableProp<String> = .copy,
1252-
regularPrice: NullableCopiableProp<String> = .copy,
1253-
salePrice: NullableCopiableProp<String> = .copy,
1254-
onSale: CopiableProp<Bool> = .copy,
12551252
downloadable: CopiableProp<Bool> = .copy,
12561253
parentID: CopiableProp<Int64> = .copy,
12571254
images: CopiableProp<[ProductImage]> = .copy,
@@ -1267,9 +1264,6 @@ extension Networking.POSProduct {
12671264
let sku = sku ?? self.sku
12681265
let globalUniqueID = globalUniqueID ?? self.globalUniqueID
12691266
let price = price ?? self.price
1270-
let regularPrice = regularPrice ?? self.regularPrice
1271-
let salePrice = salePrice ?? self.salePrice
1272-
let onSale = onSale ?? self.onSale
12731267
let downloadable = downloadable ?? self.downloadable
12741268
let parentID = parentID ?? self.parentID
12751269
let images = images ?? self.images
@@ -1286,9 +1280,6 @@ extension Networking.POSProduct {
12861280
sku: sku,
12871281
globalUniqueID: globalUniqueID,
12881282
price: price,
1289-
regularPrice: regularPrice,
1290-
salePrice: salePrice,
1291-
onSale: onSale,
12921283
downloadable: downloadable,
12931284
parentID: parentID,
12941285
images: images,
@@ -1310,9 +1301,6 @@ extension Networking.POSProductVariation {
13101301
sku: NullableCopiableProp<String> = .copy,
13111302
globalUniqueID: NullableCopiableProp<String> = .copy,
13121303
price: CopiableProp<String> = .copy,
1313-
regularPrice: NullableCopiableProp<String> = .copy,
1314-
salePrice: NullableCopiableProp<String> = .copy,
1315-
onSale: CopiableProp<Bool> = .copy,
13161304
downloadable: CopiableProp<Bool> = .copy,
13171305
manageStock: CopiableProp<Bool> = .copy,
13181306
stockQuantity: NullableCopiableProp<Decimal> = .copy,
@@ -1326,9 +1314,6 @@ extension Networking.POSProductVariation {
13261314
let sku = sku ?? self.sku
13271315
let globalUniqueID = globalUniqueID ?? self.globalUniqueID
13281316
let price = price ?? self.price
1329-
let regularPrice = regularPrice ?? self.regularPrice
1330-
let salePrice = salePrice ?? self.salePrice
1331-
let onSale = onSale ?? self.onSale
13321317
let downloadable = downloadable ?? self.downloadable
13331318
let manageStock = manageStock ?? self.manageStock
13341319
let stockQuantity = stockQuantity ?? self.stockQuantity
@@ -1343,9 +1328,6 @@ extension Networking.POSProductVariation {
13431328
sku: sku,
13441329
globalUniqueID: globalUniqueID,
13451330
price: price,
1346-
regularPrice: regularPrice,
1347-
salePrice: salePrice,
1348-
onSale: onSale,
13491331
downloadable: downloadable,
13501332
manageStock: manageStock,
13511333
stockQuantity: stockQuantity,

Modules/Sources/Networking/Model/POSProduct.swift

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
1616
public let globalUniqueID: String?
1717

1818
public let price: String
19-
public let regularPrice: String?
20-
public let salePrice: String?
21-
public let onSale: Bool
2219

2320
public let downloadable: Bool
2421

@@ -50,9 +47,6 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
5047
sku: String?,
5148
globalUniqueID: String?,
5249
price: String,
53-
regularPrice: String?,
54-
salePrice: String?,
55-
onSale: Bool,
5650
downloadable: Bool,
5751
parentID: Int64,
5852
images: [ProductImage],
@@ -68,9 +62,6 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
6862
self.globalUniqueID = globalUniqueID
6963

7064
self.price = price
71-
self.regularPrice = regularPrice
72-
self.salePrice = salePrice
73-
self.onSale = onSale
7465

7566
self.downloadable = downloadable
7667

@@ -111,24 +102,6 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
111102
targetType: String.self,
112103
forKey: .price,
113104
alternativeTypes: [decimalString]) ?? ""
114-
let regularPrice = container.failsafeDecodeIfPresent(
115-
targetType: String.self,
116-
forKey: .regularPrice,
117-
alternativeTypes: [decimalString])
118-
let onSale = container.failsafeDecodeIfPresent(
119-
targetType: Bool.self,
120-
forKey: .onSale,
121-
alternativeTypes: [ .string(transform: { NSString(string: $0).boolValue })]) ?? false
122-
123-
// Even though a plain install of WooCommerce Core provides string values,
124-
// some plugins alter the field value from String to Int or Decimal.
125-
let salePrice = container.failsafeDecodeIfPresent(
126-
targetType: String.self,
127-
forKey: .salePrice,
128-
shouldDecodeTargetTypeFirst: false,
129-
alternativeTypes: [
130-
.string(transform: { (onSale && $0.isEmpty) ? "0" : $0 }),
131-
decimalString])
132105

133106
let downloadable = try container.decode(Bool.self, forKey: .downloadable)
134107

@@ -149,9 +122,6 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
149122
sku: sku,
150123
globalUniqueID: globalUniqueID,
151124
price: price,
152-
regularPrice: regularPrice,
153-
salePrice: salePrice,
154-
onSale: onSale,
155125
downloadable: downloadable,
156126
parentID: parentID,
157127
images: images,
@@ -182,9 +152,6 @@ private extension POSProduct {
182152
case sku
183153
case globalUniqueID = "global_unique_id"
184154
case price
185-
case regularPrice = "regular_price"
186-
case salePrice = "sale_price"
187-
case onSale = "on_sale"
188155
case downloadable
189156
case parentID = "parent_id"
190157
case images

Modules/Sources/Networking/Model/POSProductVariation.swift

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
2121
public let globalUniqueID: String?
2222

2323
public let price: String
24-
public let regularPrice: String?
25-
public let salePrice: String?
26-
public let onSale: Bool
27-
2824
public let downloadable: Bool
2925

3026
public let manageStock: Bool
@@ -43,9 +39,6 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
4339
sku: String?,
4440
globalUniqueID: String?,
4541
price: String,
46-
regularPrice: String?,
47-
salePrice: String?,
48-
onSale: Bool,
4942
downloadable: Bool,
5043
manageStock: Bool,
5144
stockQuantity: Decimal?,
@@ -58,9 +51,6 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
5851
self.sku = sku
5952
self.globalUniqueID = globalUniqueID
6053
self.price = price
61-
self.regularPrice = regularPrice
62-
self.salePrice = salePrice
63-
self.onSale = onSale
6454
self.downloadable = downloadable
6555
self.manageStock = manageStock
6656
self.stockQuantity = stockQuantity
@@ -90,18 +80,6 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
9080
targetType: String.self,
9181
forKey: .price,
9282
alternativeTypes: [decimalString]) ?? ""
93-
let regularPrice = container.failsafeDecodeIfPresent(
94-
targetType: String.self,
95-
forKey: .regularPrice,
96-
alternativeTypes: [decimalString])
97-
let salePrice = container.failsafeDecodeIfPresent(
98-
targetType: String.self,
99-
forKey: .salePrice,
100-
alternativeTypes: [decimalString])
101-
let onSale = container.failsafeDecodeIfPresent(
102-
targetType: Bool.self,
103-
forKey: .onSale,
104-
alternativeTypes: [.string(transform: { NSString(string: $0).boolValue })]) ?? false
10583
let downloadable = try container.decode(Bool.self, forKey: .downloadable)
10684
let manageStock = container.failsafeDecodeIfPresent(
10785
targetType: Bool.self,
@@ -128,9 +106,6 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
128106
sku: sku,
129107
globalUniqueID: globalUniqueID,
130108
price: price,
131-
regularPrice: regularPrice,
132-
salePrice: salePrice,
133-
onSale: onSale,
134109
downloadable: downloadable,
135110
manageStock: manageStock,
136111
stockQuantity: stockQuantity,
@@ -158,9 +133,6 @@ private extension POSProductVariation {
158133
case attributes
159134
case image
160135
case price
161-
case regularPrice = "regular_price"
162-
case salePrice = "sale_price"
163-
case onSale = "on_sale"
164136
case sku
165137
case globalUniqueID = "global_unique_id"
166138
case downloadable

Modules/Sources/Networking/Remote/POSCatalogSyncRemote.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@ private extension POSProduct {
192192
sku: sku,
193193
globalUniqueID: globalUniqueID,
194194
price: price,
195-
regularPrice: regularPrice,
196-
salePrice: salePrice,
197-
onSale: onSale,
198195
downloadable: downloadable,
199196
manageStock: manageStock,
200197
stockQuantity: stockQuantity,

Modules/Sources/Yosemite/PointOfSale/Items/POSProductOrVariationResolver.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ private extension POSProduct {
8686
sku: sku,
8787
globalUniqueID: globalUniqueID,
8888
price: price,
89-
regularPrice: regularPrice,
90-
salePrice: salePrice,
91-
onSale: onSale,
9289
downloadable: downloadable,
9390
manageStock: manageStock,
9491
stockQuantity: stockQuantity,

Modules/Tests/NetworkingTests/Remote/POSCatalogSyncRemoteTests.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,6 @@ struct POSCatalogSyncRemoteTests {
396396
#expect(simpleProduct.globalUniqueID == "61732018")
397397
#expect(simpleProduct.name == "Synergistic Copper Clock")
398398
#expect(simpleProduct.price == "220")
399-
#expect(simpleProduct.regularPrice == "230.04")
400-
#expect(simpleProduct.onSale == true)
401399
#expect(simpleProduct.images.count == 1)
402400
#expect(simpleProduct.images.first?.src == "https://example.com/wp-content/uploads/2025/08/img-ad.png")
403401

@@ -408,8 +406,6 @@ struct POSCatalogSyncRemoteTests {
408406
#expect(variableProduct.globalUniqueID == "")
409407
#expect(variableProduct.name == "Incredible Silk Chair")
410408
#expect(variableProduct.price == "134.58")
411-
#expect(variableProduct.regularPrice == "")
412-
#expect(variableProduct.onSale == false)
413409
#expect(variableProduct.images.count == 1)
414410
#expect(variableProduct.images.first?.src == "https://example.com/wp-content/uploads/2025/08/img-harum.png")
415411
#expect(variableProduct.attributes == [
@@ -431,8 +427,6 @@ struct POSCatalogSyncRemoteTests {
431427
#expect(variation.sku == "")
432428
#expect(variation.globalUniqueID == "")
433429
#expect(variation.price == "330.34")
434-
#expect(variation.regularPrice == "330.34")
435-
#expect(variation.onSale == false)
436430
#expect(variation.attributes.count == 3)
437431
#expect(variation.image?.src == "https://example.com/wp-content/uploads/2025/08/img-quae.png")
438432
#expect(variation.attributes == [

Modules/Tests/NetworkingTests/Remote/POSProductsNetworkingTests.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ struct POSProductsNetworkingTests {
186186
#expect(fieldNames.contains("sku"))
187187
#expect(fieldNames.contains("global_unique_id"))
188188
#expect(fieldNames.contains("price"))
189-
#expect(fieldNames.contains("regular_price"))
190-
#expect(fieldNames.contains("sale_price"))
191-
#expect(fieldNames.contains("on_sale"))
192189
#expect(fieldNames.contains("downloadable"))
193190
#expect(fieldNames.contains("parent_id"))
194191
#expect(fieldNames.contains("images"))

Modules/Tests/NetworkingTests/Remote/ProductVariationsRemoteTests.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,6 @@ final class ProductVariationsRemoteTests: XCTestCase {
177177

178178
let expectedPrice = 12
179179
XCTAssertEqual(firstVariation.price, "\(expectedPrice)")
180-
XCTAssertEqual(firstVariation.regularPrice, "\(expectedPrice)")
181-
XCTAssertEqual(firstVariation.salePrice, "8")
182-
XCTAssertFalse(firstVariation.onSale)
183180

184181
let expectedAttributes: [ProductVariationAttribute] = [
185182
ProductVariationAttribute(id: 0, name: "Darkness", option: "99%"),

0 commit comments

Comments
 (0)