Skip to content

Commit ad84397

Browse files
committed
Delete coupon-specific logic from itemservice
1 parent a10bdf1 commit ad84397

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

Yosemite/Yosemite/PointOfSale/PointOfSaleItemService.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,30 +100,6 @@ public final class PointOfSaleItemService: PointOfSaleItemServiceProtocol {
100100
}
101101
}
102102

103-
public func providePointOfSaleCoupons() throws -> PagedItems<POSItem> {
104-
guard let storage = storage else {
105-
throw PointOfSaleItemServiceError.storageFailure
106-
}
107-
let predicate = NSPredicate(format: "siteID == %lld", siteID)
108-
let descriptor = NSSortDescriptor(keyPath: \StorageCoupon.dateCreated,
109-
ascending: false)
110-
111-
let resultsController = ResultsController<StorageCoupon>(storageManager: storage,
112-
matching: predicate,
113-
sortedBy: [descriptor])
114-
115-
try resultsController.performFetch()
116-
let storeCoupons = resultsController.fetchedObjects
117-
let posCoupons = mapCouponsToPOSItems(coupons: storeCoupons)
118-
return .init(items: posCoupons, hasMorePages: false)
119-
}
120-
121-
private func mapCouponsToPOSItems(coupons: [Coupon]) -> [POSItem] {
122-
coupons.compactMap { coupon in
123-
.coupon(POSCoupon(id: UUID(), couponID: coupon.couponID))
124-
}
125-
}
126-
127103
// Maps result to POSItem, and populate the output with:
128104
// - Formatted price based on store's currency settings.
129105
// - Product thumbnail, if any.

Yosemite/Yosemite/PointOfSale/PointOfSaleItemServiceProtocol.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public extension Sequence where Element == POSOrderableItem {
5858
public protocol PointOfSaleItemServiceProtocol {
5959
func providePointOfSaleItems(pageNumber: Int) async throws -> PagedItems<POSItem>
6060
func providePointOfSaleVariationItems(for parentProduct: POSVariableParentProduct, pageNumber: Int) async throws -> PagedItems<POSItem>
61-
func providePointOfSaleCoupons() throws -> PagedItems<POSItem>
6261
}
6362

6463
// Default implementation for convenience, so we do not need to pass the first page explicitly

0 commit comments

Comments
 (0)