-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
398e0d2
commit a7b63ef
Showing
34 changed files
with
3,880 additions
and
81 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
Sources/code/application/Models/Cart/ProductPricePerUnitCartAppModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
|
||
|
||
import Foundation | ||
public extension ApplicationClient.Cart { | ||
/* | ||
Model: ProductPricePerUnit | ||
Used By: Cart | ||
*/ | ||
class ProductPricePerUnit: Codable { | ||
|
||
public var currencySymbol: String? | ||
|
||
public var sellingPrice: Double? | ||
|
||
public var currencyCode: String? | ||
|
||
public var addOn: Double? | ||
|
||
public var effective: Double? | ||
|
||
public var marked: Double? | ||
|
||
|
||
public enum CodingKeys: String, CodingKey { | ||
|
||
case currencySymbol = "currency_symbol" | ||
|
||
case sellingPrice = "selling_price" | ||
|
||
case currencyCode = "currency_code" | ||
|
||
case addOn = "add_on" | ||
|
||
case effective = "effective" | ||
|
||
case marked = "marked" | ||
|
||
} | ||
|
||
public init(addOn: Double? = nil, currencyCode: String? = nil, currencySymbol: String? = nil, effective: Double? = nil, marked: Double? = nil, sellingPrice: Double? = nil) { | ||
|
||
self.currencySymbol = currencySymbol | ||
|
||
self.sellingPrice = sellingPrice | ||
|
||
self.currencyCode = currencyCode | ||
|
||
self.addOn = addOn | ||
|
||
self.effective = effective | ||
|
||
self.marked = marked | ||
|
||
} | ||
|
||
required public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
|
||
|
||
do { | ||
currencySymbol = try container.decode(String.self, forKey: .currencySymbol) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
sellingPrice = try container.decode(Double.self, forKey: .sellingPrice) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
currencyCode = try container.decode(String.self, forKey: .currencyCode) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
addOn = try container.decode(Double.self, forKey: .addOn) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
effective = try container.decode(Double.self, forKey: .effective) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
marked = try container.decode(Double.self, forKey: .marked) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
|
||
|
||
|
||
try? container.encodeIfPresent(currencySymbol, forKey: .currencySymbol) | ||
|
||
|
||
|
||
|
||
try? container.encodeIfPresent(sellingPrice, forKey: .sellingPrice) | ||
|
||
|
||
|
||
|
||
try? container.encodeIfPresent(currencyCode, forKey: .currencyCode) | ||
|
||
|
||
|
||
|
||
try? container.encodeIfPresent(addOn, forKey: .addOn) | ||
|
||
|
||
|
||
|
||
try? container.encodeIfPresent(effective, forKey: .effective) | ||
|
||
|
||
|
||
|
||
try? container.encodeIfPresent(marked, forKey: .marked) | ||
|
||
|
||
} | ||
|
||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
Sources/code/application/Models/Cart/ProductPricePerUnitInfoCartAppModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
|
||
import Foundation | ||
public extension ApplicationClient.Cart { | ||
/* | ||
Model: ProductPricePerUnitInfo | ||
Used By: Cart | ||
*/ | ||
class ProductPricePerUnitInfo: Codable { | ||
|
||
public var base: ProductPricePerUnit? | ||
|
||
public var converted: ProductPricePerUnit? | ||
|
||
|
||
public enum CodingKeys: String, CodingKey { | ||
|
||
case base = "base" | ||
|
||
case converted = "converted" | ||
|
||
} | ||
|
||
public init(base: ProductPricePerUnit? = nil, converted: ProductPricePerUnit? = nil) { | ||
|
||
self.base = base | ||
|
||
self.converted = converted | ||
|
||
} | ||
|
||
required public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
|
||
|
||
do { | ||
base = try container.decode(ProductPricePerUnit.self, forKey: .base) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
converted = try container.decode(ProductPricePerUnit.self, forKey: .converted) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
|
||
|
||
|
||
try? container.encodeIfPresent(base, forKey: .base) | ||
|
||
|
||
|
||
|
||
try? container.encodeIfPresent(converted, forKey: .converted) | ||
|
||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,13 @@ extension PlatformClient { | |
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.