Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c15dedd
Update OrderListMapper to parse content without the data envelope
itsmeichigo Jan 5, 2023
4f490d3
Update OrderMapper to parse content without the data envelope
itsmeichigo Jan 5, 2023
2aa6b0c
Add mock response for order list without data envelope
itsmeichigo Jan 5, 2023
4af6e2f
Update mapper test for order list
itsmeichigo Jan 5, 2023
092a967
Add mock data for order response without data envelope
itsmeichigo Jan 5, 2023
a19069b
Update unit test for OrderMapper
itsmeichigo Jan 5, 2023
0a4829a
Add mock data for order notes without data envelope
itsmeichigo Jan 5, 2023
12a47a6
Update mapper for order note
itsmeichigo Jan 5, 2023
697130c
Update tests for OrderNotesMapper
itsmeichigo Jan 5, 2023
de1a5b8
Enable REST API for all order endpoints
itsmeichigo Jan 5, 2023
84751cc
Silence hound
itsmeichigo Jan 5, 2023
3cb0d8b
Merge branch 'trunk' into feat/8550-orders-migrate
itsmeichigo Jan 5, 2023
8b074c0
Fix incorrect expectation for OrderNotesMapperTests
itsmeichigo Jan 6, 2023
99cffd5
Update ReportOrderTotalsMapper to parse contents without data envelope
itsmeichigo Jan 6, 2023
24b150f
Enable REST request for loadOrdersTotals
itsmeichigo Jan 6, 2023
7011826
Add tests for report orders mapper
itsmeichigo Jan 6, 2023
bff7805
Merge branch 'trunk' into feat/8550-orders-migrate
itsmeichigo Jan 6, 2023
7848519
Fix typos on OrderListMapperTests
itsmeichigo Jan 6, 2023
4d36b6c
Fix typos on OrderMapperTests
itsmeichigo Jan 6, 2023
f0f2944
Fix typos on OrderNotesMapperTests
itsmeichigo Jan 6, 2023
6dad597
ReportOrderTotalsMapperTests throwMake tests in
itsmeichigo Jan 6, 2023
2f9d67d
Remove redundant extension for ReportOrderTotalsMapperTests
itsmeichigo Jan 6, 2023
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
24 changes: 24 additions & 0 deletions Networking/Networking.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,10 @@
DE34051B28BDF12C00CF0D97 /* jetpack-connection-url.json in Resources */ = {isa = PBXBuildFile; fileRef = DE34051A28BDF12C00CF0D97 /* jetpack-connection-url.json */; };
DE34051D28BDF1C900CF0D97 /* JetpackConnectionURLMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE34051C28BDF1C900CF0D97 /* JetpackConnectionURLMapperTests.swift */; };
DE34051F28BDFB0B00CF0D97 /* JetpackConnectionRemoteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE34051E28BDFB0B00CF0D97 /* JetpackConnectionRemoteTests.swift */; };
DE42F95D2966CB6A00D514C2 /* order-notes-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = DE42F95C2966CB6A00D514C2 /* order-notes-without-data.json */; };
DE42F9602967C88400D514C2 /* report-orders-total-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = DE42F95E2967C88400D514C2 /* report-orders-total-without-data.json */; };
DE42F9612967C88400D514C2 /* report-orders-total.json in Resources */ = {isa = PBXBuildFile; fileRef = DE42F95F2967C88400D514C2 /* report-orders-total.json */; };
DE42F9632967C8B900D514C2 /* ReportOrderTotalsMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE42F9622967C8B900D514C2 /* ReportOrderTotalsMapperTests.swift */; };
DE50295928C5BD0200551736 /* JetpackUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE50295828C5BD0200551736 /* JetpackUser.swift */; };
DE50295B28C5F99700551736 /* DotcomUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE50295A28C5F99700551736 /* DotcomUser.swift */; };
DE50295D28C6068B00551736 /* JetpackUserMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE50295C28C6068B00551736 /* JetpackUserMapper.swift */; };
Expand Down Expand Up @@ -725,6 +729,8 @@
DEF13C562965689F0024A02B /* LeaderboardListMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF13C552965689F0024A02B /* LeaderboardListMapperTests.swift */; };
DEF13C5A296571150024A02B /* leaderboards-year-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = DEF13C59296571150024A02B /* leaderboards-year-without-data.json */; };
DEF13C5C2965812D0024A02B /* order-stats-v4-year-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = DEF13C5B2965812D0024A02B /* order-stats-v4-year-without-data.json */; };
DEF13C5E296686AB0024A02B /* orders-load-all-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = DEF13C5D296686AB0024A02B /* orders-load-all-without-data.json */; };
DEF13C6029668C420024A02B /* order-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = DEF13C5F29668C420024A02B /* order-without-data.json */; };
DEFBA74E29485A7600C35BA9 /* RESTRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEFBA74D29485A7600C35BA9 /* RESTRequest.swift */; };
DEFBA7542949CE6600C35BA9 /* RequestProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEFBA7532949CE6600C35BA9 /* RequestProcessor.swift */; };
DEFBA7562949D17400C35BA9 /* DefaultRequestAuthenticatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEFBA7552949D17300C35BA9 /* DefaultRequestAuthenticatorTests.swift */; };
Expand Down Expand Up @@ -1493,6 +1499,10 @@
DE34051A28BDF12C00CF0D97 /* jetpack-connection-url.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "jetpack-connection-url.json"; sourceTree = "<group>"; };
DE34051C28BDF1C900CF0D97 /* JetpackConnectionURLMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackConnectionURLMapperTests.swift; sourceTree = "<group>"; };
DE34051E28BDFB0B00CF0D97 /* JetpackConnectionRemoteTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackConnectionRemoteTests.swift; sourceTree = "<group>"; };
DE42F95C2966CB6A00D514C2 /* order-notes-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "order-notes-without-data.json"; sourceTree = "<group>"; };
DE42F95E2967C88400D514C2 /* report-orders-total-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "report-orders-total-without-data.json"; path = "NetworkingTests/Responses/report-orders-total-without-data.json"; sourceTree = SOURCE_ROOT; };
DE42F95F2967C88400D514C2 /* report-orders-total.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "report-orders-total.json"; path = "NetworkingTests/Responses/report-orders-total.json"; sourceTree = SOURCE_ROOT; };
DE42F9622967C8B900D514C2 /* ReportOrderTotalsMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportOrderTotalsMapperTests.swift; sourceTree = "<group>"; };
DE50295828C5BD0200551736 /* JetpackUser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackUser.swift; sourceTree = "<group>"; };
DE50295A28C5F99700551736 /* DotcomUser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DotcomUser.swift; sourceTree = "<group>"; };
DE50295C28C6068B00551736 /* JetpackUserMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackUserMapper.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1528,6 +1538,8 @@
DEF13C552965689F0024A02B /* LeaderboardListMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeaderboardListMapperTests.swift; sourceTree = "<group>"; };
DEF13C59296571150024A02B /* leaderboards-year-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "leaderboards-year-without-data.json"; sourceTree = "<group>"; };
DEF13C5B2965812D0024A02B /* order-stats-v4-year-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "order-stats-v4-year-without-data.json"; sourceTree = "<group>"; };
DEF13C5D296686AB0024A02B /* orders-load-all-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "orders-load-all-without-data.json"; sourceTree = "<group>"; };
DEF13C5F29668C420024A02B /* order-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "order-without-data.json"; sourceTree = "<group>"; };
DEFBA74D29485A7600C35BA9 /* RESTRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RESTRequest.swift; sourceTree = "<group>"; };
DEFBA7532949CE6600C35BA9 /* RequestProcessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestProcessor.swift; sourceTree = "<group>"; };
DEFBA7552949D17300C35BA9 /* DefaultRequestAuthenticatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultRequestAuthenticatorTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2114,6 +2126,8 @@
EE80A24B29556F1D003591E4 /* Coupon */,
EE338A0A294AF92A00183934 /* AppliicationPassword */,
DE9DEEF4291CF1B40070AD7C /* site-plugin-without-envelope.json */,
DE42F95E2967C88400D514C2 /* report-orders-total-without-data.json */,
DE42F95F2967C88400D514C2 /* report-orders-total.json */,
DE2E8EA8295416C9002E4B14 /* wordpress-site-info.json */,
028CB714290223CB00331C09 /* account-username-suggestions.json */,
028CB71C2902589E00331C09 /* create-account-error-email-exists.json */,
Expand Down Expand Up @@ -2200,10 +2214,13 @@
B554FA8C2180B59700C54DFF /* notifications-load-hashes.json */,
AE2D6624272A941C004A2C3A /* null-data.json */,
B5C6FCD520A3768900A4F8E4 /* order.json */,
DEF13C5F29668C420024A02B /* order-without-data.json */,
034480C227A42F9100DFACD2 /* order-with-charge.json */,
02C254D62563999200A04423 /* order-shipping-labels.json */,
B559EBA920A0B5CD00836CD4 /* orders-load-all.json */,
DEF13C5D296686AB0024A02B /* orders-load-all-without-data.json */,
74C8F06520EEB76400B6EDC9 /* order-notes.json */,
DE42F95C2966CB6A00D514C2 /* order-notes-without-data.json */,
CEF88DAA233E911A00BED485 /* order-fully-refunded.json */,
CEF88DAE233E9F7D00BED485 /* order-details-partially-refunded.json */,
D8FBFF2322D52815006E3336 /* order-stats-v4-daily.json */,
Expand Down Expand Up @@ -2615,6 +2632,7 @@
68CB801328D8A05200E169F8 /* CustomerMapperTests.swift */,
68F48B1028E3BBC60045C15B /* WCAnalyticsCustomerMapperTests.swift */,
EE338A0D294AF9BD00183934 /* ApplicationPasswordMapperTests.swift */,
DE42F9622967C8B900D514C2 /* ReportOrderTotalsMapperTests.swift */,
EEA658412966C41A00112DF0 /* ProductIDMapperTests.swift */,
EEA658472966CBAD00112DF0 /* EntityIDMapperTests.swift */,
);
Expand Down Expand Up @@ -2881,6 +2899,7 @@
D865CE5F278CA183002C8520 /* stripe-payment-intent-requires-action.json in Resources */,
CCF48B2C2628AE160034EA83 /* shipping-label-account-settings.json in Resources */,
31A451D927863A2E00FE81AA /* stripe-account-live-test.json in Resources */,
DE42F9602967C88400D514C2 /* report-orders-total-without-data.json in Resources */,
DE9DEEF5291CF1B40070AD7C /* site-plugin-without-envelope.json in Resources */,
0261F5A928D4641500B7AC72 /* products-sku-search.json in Resources */,
EE80A24829547F8B003591E4 /* coupon-without-data.json in Resources */,
Expand Down Expand Up @@ -2938,6 +2957,7 @@
3158FE6C26129D2E00E566B9 /* wcpay-account-rejected-terms-of-service.json in Resources */,
E16C59B928F927CA007D55BB /* iap-order-create.json in Resources */,
31054728262E2FEE00C5C02B /* wcpay-payment-intent-canceled.json in Resources */,
DE42F9612967C88400D514C2 /* report-orders-total.json in Resources */,
31A451CC27863A2E00FE81AA /* stripe-account-rejected-fraud.json in Resources */,
31A451D827863A2E00FE81AA /* stripe-account-restricted-overdue.json in Resources */,
D865CE69278CA245002C8520 /* stripe-payment-intent-unknown-status.json in Resources */,
Expand Down Expand Up @@ -3007,6 +3027,7 @@
EE80A24729547F8B003591E4 /* coupons-all-without-data.json in Resources */,
7412A8F021B6E416005D182A /* report-orders.json in Resources */,
CCF4346A2906C9C300B4475A /* products-ids-only-empty.json in Resources */,
DEF13C5E296686AB0024A02B /* orders-load-all-without-data.json in Resources */,
4515282B257A8C010076B03C /* product-attribute-delete.json in Resources */,
020C907B24C6E108001E2BEB /* product-variation-update.json in Resources */,
D8FBFF1822D4DDB9006E3336 /* order-stats-v4-hour.json in Resources */,
Expand All @@ -3018,6 +3039,7 @@
261CF2CB255C50010090D8D3 /* payment-gateway-list-half.json in Resources */,
02C254D72563999300A04423 /* order-shipping-labels.json in Resources */,
45B204BC24890B1200FE6526 /* category.json in Resources */,
DEF13C6029668C420024A02B /* order-without-data.json in Resources */,
022902D422E2436400059692 /* stats_module_disabled_error.json in Resources */,
4513382827A96DE700AE5E78 /* inbox-note.json in Resources */,
31A451D227863A2E00FE81AA /* stripe-account-restricted-pending.json in Resources */,
Expand Down Expand Up @@ -3062,6 +3084,7 @@
D8FBFF1522D3BE09006E3336 /* order-stats-v4-defaults.json in Resources */,
7495AACF225D366D00801A89 /* variation-as-product.json in Resources */,
0272E3FB254AABB800436277 /* order-with-line-item-attributes-before-API-support.json in Resources */,
DE42F95D2966CB6A00D514C2 /* order-notes-without-data.json in Resources */,
31723C892787A299007F1405 /* stripe-connection-token.json in Resources */,
74A1D266211898F000931DFA /* site-visits-year.json in Resources */,
743BF8BE21191B63008A9D87 /* site-visits.json in Resources */,
Expand Down Expand Up @@ -3642,6 +3665,7 @@
74CF0A8C22414D7800DB993F /* ProductMapperTests.swift in Sources */,
45152815257A83DD0076B03C /* ProductAttributesRemoteTests.swift in Sources */,
B505F6D720BEE58800BB1B69 /* AccountRemoteTests.swift in Sources */,
DE42F9632967C8B900D514C2 /* ReportOrderTotalsMapperTests.swift in Sources */,
453305EB2459E01A00264E50 /* PostMapperTests.swift in Sources */,
CE0A0F1D22398D520075ED8D /* ProductListMapperTests.swift in Sources */,
2670C3FC270F4E06002FE931 /* SiteListMapperTests.swift in Sources */,
Expand Down
6 changes: 5 additions & 1 deletion Networking/Networking/Mapper/OrderListMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ struct OrderListMapper: Mapper {
.siteID: siteID
]

return try decoder.decode(OrderListEnvelope.self, from: response).orders
do {
return try decoder.decode(OrderListEnvelope.self, from: response).orders
} catch {
return try decoder.decode([Order].self, from: response)
}
}
}

Expand Down
7 changes: 5 additions & 2 deletions Networking/Networking/Mapper/OrderMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ struct OrderMapper: Mapper {
decoder.userInfo = [
.siteID: siteID
]

return try decoder.decode(OrderEnvelope.self, from: response).order
do {
return try decoder.decode(OrderEnvelope.self, from: response).order
} catch {
return try decoder.decode(Order.self, from: response)
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion Networking/Networking/Mapper/OrderNoteMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ class OrderNoteMapper: Mapper {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .formatted(DateFormatter.Defaults.dateTimeFormatter)

return try decoder.decode(OrderNoteEnvelope.self, from: response).orderNote
do {
return try decoder.decode(OrderNoteEnvelope.self, from: response).orderNote
} catch {
return try decoder.decode(OrderNote.self, from: response)
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion Networking/Networking/Mapper/OrderNotesMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ class OrderNotesMapper: Mapper {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .formatted(DateFormatter.Defaults.dateTimeFormatter)

return try decoder.decode(OrderNotesEnvelope.self, from: response).orderNotes
do {
return try decoder.decode(OrderNotesEnvelope.self, from: response).orderNotes
} catch {
return try decoder.decode([OrderNote].self, from: response)
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion Networking/Networking/Mapper/ReportOrderTotalsMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ struct ReportOrderTotalsMapper: Mapper {
decoder.userInfo = [
.siteID: siteID
]
return try decoder.decode(ReportOrderTotalsEnvelope.self, from: response).data
do {
return try decoder.decode(ReportOrderTotalsEnvelope.self, from: response).data
} catch {
return try decoder.decode([OrderStatus].self, from: response)
}
}
}

Expand Down
Loading