File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
Networking/Networking/Model
WooCommerce/Classes/Model Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ extension OrderStatus: RawRepresentable {
6464extension OrderStatus : CustomStringConvertible {
6565
6666 /// Returns a string describing the current OrderStatus Instance
67+ /// Custom doesn't return a localized string because the payload arrives at runtime, not buildtime.
6768 ///
6869 public var description : String {
6970 switch self {
@@ -74,9 +75,23 @@ extension OrderStatus: CustomStringConvertible {
7475 case . cancelled: return NSLocalizedString ( " Canceled " , comment: " Cancelled Order Status " )
7576 case . completed: return NSLocalizedString ( " Completed " , comment: " Completed Order Status " )
7677 case . refunded: return NSLocalizedString ( " Refunded " , comment: " Refunded Order Status " )
77- case . custom( let payload) : return NSLocalizedString ( " \( payload ) " , comment : " Custom Order Status " )
78+ case . custom( let payload) : return formattedCustomStatus ( from : payload )
7879 }
7980 }
81+
82+ /// Returns a reading-friendly payment label for custom payment statuses
83+ ///
84+ public func formattedCustomStatus( from payload: String ) -> String {
85+ let wordList = payload. components ( separatedBy: " - " )
86+
87+ var formatWordList = [ String] ( )
88+ for word in wordList {
89+ formatWordList. append ( word. capitalized)
90+ }
91+ let formattedStatus = formatWordList. joined ( separator: " " )
92+
93+ return formattedStatus
94+ }
8095}
8196
8297
Original file line number Diff line number Diff line change @@ -15,12 +15,6 @@ extension Order {
1515 return NSLocale ( localeIdentifier: identifier) . currencySymbol
1616 }
1717
18- /// Determines if a shipping address exists.
19- ///
20- var hasSeparateShippingDetail : Bool {
21- return shippingAddress != nil
22- }
23-
2418 /// FIXME: Creates an empty-string value Billing details, until i6 fix
2519 ///
2620 func generateEmptyBillingAddress( ) -> Address {
You can’t perform that action at this time.
0 commit comments