Skip to content

Commit 3c1f5ee

Browse files
author
Sharma Elanthiriayan
committed
Introduce OrderTaxLine struct to handle tax_lines in Order.
1 parent 4686863 commit 3c1f5ee

File tree

2 files changed

+65
-11
lines changed

2 files changed

+65
-11
lines changed

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@
467467
B5C6FCD420A373BB00A4F8E4 /* OrderMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C6FCD320A373BA00A4F8E4 /* OrderMapper.swift */; };
468468
B5C6FCD620A3768900A4F8E4 /* order.json in Resources */ = {isa = PBXBuildFile; fileRef = B5C6FCD520A3768900A4F8E4 /* order.json */; };
469469
B5DAEFF02180DD5A0002356A /* NotificationsRemote.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DAEFEF2180DD5A0002356A /* NotificationsRemote.swift */; };
470+
BAB373722795A1FB00837B4A /* OrderTaxLine.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB373712795A1FB00837B4A /* OrderTaxLine.swift */; };
470471
CC07865F267799EE00BA9AC1 /* ShippingLabelPurchase.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC07865E267799EE00BA9AC1 /* ShippingLabelPurchase.swift */; };
471472
CC0786612677B2DA00BA9AC1 /* ShippingLabelPurchaseMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC0786602677B2DA00BA9AC1 /* ShippingLabelPurchaseMapper.swift */; };
472473
CC0786632678F79500BA9AC1 /* shipping-label-purchase-success.json in Resources */ = {isa = PBXBuildFile; fileRef = CC0786622678F79500BA9AC1 /* shipping-label-purchase-success.json */; };
@@ -543,8 +544,6 @@
543544
D823D91022377B4F00C90817 /* ShipmentTrackingProviderGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = D823D90F22377B4F00C90817 /* ShipmentTrackingProviderGroup.swift */; };
544545
D823D91222377DF300C90817 /* ShipmentTrackingProviderListMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D823D91122377DF200C90817 /* ShipmentTrackingProviderListMapper.swift */; };
545546
D823D91422377EE600C90817 /* shipment_tracking_providers.json in Resources */ = {isa = PBXBuildFile; fileRef = D823D91322377EE600C90817 /* shipment_tracking_providers.json */; };
546-
D865CE6E278CC19A002C8520 /* stripe-location.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE6C278CC19A002C8520 /* stripe-location.json */; };
547-
D865CE6F278CC19A002C8520 /* stripe-location-error.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE6D278CC19A002C8520 /* stripe-location-error.json */; };
548547
D865CE5B278CA10B002C8520 /* stripe-payment-intent-requires-payment-method.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE5A278CA10B002C8520 /* stripe-payment-intent-requires-payment-method.json */; };
549548
D865CE5D278CA159002C8520 /* stripe-payment-intent-requires-confirmation.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE5C278CA159002C8520 /* stripe-payment-intent-requires-confirmation.json */; };
550549
D865CE5F278CA183002C8520 /* stripe-payment-intent-requires-action.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE5E278CA183002C8520 /* stripe-payment-intent-requires-action.json */; };
@@ -554,6 +553,8 @@
554553
D865CE67278CA225002C8520 /* stripe-payment-intent-succeeded.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE66278CA225002C8520 /* stripe-payment-intent-succeeded.json */; };
555554
D865CE69278CA245002C8520 /* stripe-payment-intent-unknown-status.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE68278CA245002C8520 /* stripe-payment-intent-unknown-status.json */; };
556555
D865CE6B278CA266002C8520 /* stripe-payment-intent-error.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE6A278CA266002C8520 /* stripe-payment-intent-error.json */; };
556+
D865CE6E278CC19A002C8520 /* stripe-location.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE6C278CC19A002C8520 /* stripe-location.json */; };
557+
D865CE6F278CC19A002C8520 /* stripe-location-error.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE6D278CC19A002C8520 /* stripe-location-error.json */; };
557558
D865CE72278CC215002C8520 /* stripe-customer.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE70278CC215002C8520 /* stripe-customer.json */; };
558559
D865CE73278CC215002C8520 /* stripe-customer-error.json in Resources */ = {isa = PBXBuildFile; fileRef = D865CE71278CC215002C8520 /* stripe-customer-error.json */; };
559560
D87F6151226591E10031A13B /* NullNetwork.swift in Sources */ = {isa = PBXBuildFile; fileRef = D87F6150226591E10031A13B /* NullNetwork.swift */; };
@@ -1112,6 +1113,7 @@
11121113
B5C6FCD320A373BA00A4F8E4 /* OrderMapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderMapper.swift; sourceTree = "<group>"; };
11131114
B5C6FCD520A3768900A4F8E4 /* order.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = order.json; sourceTree = "<group>"; };
11141115
B5DAEFEF2180DD5A0002356A /* NotificationsRemote.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationsRemote.swift; sourceTree = "<group>"; };
1116+
BAB373712795A1FB00837B4A /* OrderTaxLine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderTaxLine.swift; sourceTree = "<group>"; };
11151117
BD9439D9B8F2C1ED2EADAA51 /* Pods-NetworkingTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NetworkingTests.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-NetworkingTests/Pods-NetworkingTests.debug.xcconfig"; sourceTree = "<group>"; };
11161118
C8F9A8CC6F90A8C9B5EF2EE2 /* Pods-Networking.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Networking.release.xcconfig"; path = "../Pods/Target Support Files/Pods-Networking/Pods-Networking.release.xcconfig"; sourceTree = "<group>"; };
11171119
CC07865E267799EE00BA9AC1 /* ShippingLabelPurchase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingLabelPurchase.swift; sourceTree = "<group>"; };
@@ -1191,8 +1193,6 @@
11911193
D823D90F22377B4F00C90817 /* ShipmentTrackingProviderGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShipmentTrackingProviderGroup.swift; sourceTree = "<group>"; };
11921194
D823D91122377DF200C90817 /* ShipmentTrackingProviderListMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShipmentTrackingProviderListMapper.swift; sourceTree = "<group>"; };
11931195
D823D91322377EE600C90817 /* shipment_tracking_providers.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = shipment_tracking_providers.json; sourceTree = "<group>"; };
1194-
D865CE6C278CC19A002C8520 /* stripe-location.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-location.json"; sourceTree = "<group>"; };
1195-
D865CE6D278CC19A002C8520 /* stripe-location-error.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-location-error.json"; sourceTree = "<group>"; };
11961196
D865CE5A278CA10B002C8520 /* stripe-payment-intent-requires-payment-method.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-payment-intent-requires-payment-method.json"; sourceTree = "<group>"; };
11971197
D865CE5C278CA159002C8520 /* stripe-payment-intent-requires-confirmation.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-payment-intent-requires-confirmation.json"; sourceTree = "<group>"; };
11981198
D865CE5E278CA183002C8520 /* stripe-payment-intent-requires-action.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-payment-intent-requires-action.json"; sourceTree = "<group>"; };
@@ -1202,6 +1202,8 @@
12021202
D865CE66278CA225002C8520 /* stripe-payment-intent-succeeded.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-payment-intent-succeeded.json"; sourceTree = "<group>"; };
12031203
D865CE68278CA245002C8520 /* stripe-payment-intent-unknown-status.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-payment-intent-unknown-status.json"; sourceTree = "<group>"; };
12041204
D865CE6A278CA266002C8520 /* stripe-payment-intent-error.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-payment-intent-error.json"; sourceTree = "<group>"; };
1205+
D865CE6C278CC19A002C8520 /* stripe-location.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-location.json"; sourceTree = "<group>"; };
1206+
D865CE6D278CC19A002C8520 /* stripe-location-error.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-location-error.json"; sourceTree = "<group>"; };
12051207
D865CE70278CC215002C8520 /* stripe-customer.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-customer.json"; sourceTree = "<group>"; };
12061208
D865CE71278CC215002C8520 /* stripe-customer-error.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "stripe-customer-error.json"; sourceTree = "<group>"; };
12071209
D87F6150226591E10031A13B /* NullNetwork.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NullNetwork.swift; sourceTree = "<group>"; };
@@ -1695,6 +1697,7 @@
16951697
CEF88DAC233E95B000BED485 /* OrderRefundCondensed.swift */,
16961698
CE12FBD8221F3A6F00C59248 /* OrderStatus.swift */,
16971699
B5BB1D1120A255EC00112D92 /* OrderStatusEnum.swift */,
1700+
BAB373712795A1FB00837B4A /* OrderTaxLine.swift */,
16981701
267313302559CC930026F7EF /* PaymentGateway.swift */,
16991702
314703072670222500EF253A /* PaymentGatewayAccount.swift */,
17001703
D89A01D326D3F8D8008195BE /* ReaderLocation.swift */,
@@ -1720,10 +1723,8 @@
17201723
31799AF7270508C600D78179 /* RemoteReaderLocation.swift */,
17211724
3192F223260D34C40067FEF9 /* WCPayAccountStatusEnum.swift */,
17221725
D8EDFE2125EE88C9003D2213 /* ReaderConnectionToken.swift */,
1723-
318E8FD426C31F9500F519D7 /* WCPayCustomer.swift */,
1724-
31054705262E278100C5C02B /* RemotePaymentIntent.swift */,
17251726
318E8FD426C31F9500F519D7 /* Customer.swift */,
1726-
31054705262E278100C5C02B /* WCPayPaymentIntent.swift */,
1727+
31054705262E278100C5C02B /* RemotePaymentIntent.swift */,
17271728
3105470B262E27F000C5C02B /* WCPayPaymentIntentStatusEnum.swift */,
17281729
FE28F6E126840DED004465C7 /* User.swift */,
17291730
);
@@ -2011,11 +2012,8 @@
20112012
311D412D2783C07D00052F64 /* StripeAccountMapper.swift */,
20122013
3192F21B260D32550067FEF9 /* WCPayAccountMapper.swift */,
20132014
D8EDFE2525EE8A60003D2213 /* ReaderConnectionTokenMapper.swift */,
2014-
318E8FD226C31F1C00F519D7 /* WCPayCustomerMapper.swift */,
2015-
3178A49E2703E5CF00A8B4CA /* RemoteReaderLocationMapper.swift */,
2016-
31054701262E04F700C5C02B /* WCPayPaymentIntentMapper.swift */,
20172015
318E8FD226C31F1C00F519D7 /* CustomerMapper.swift */,
2018-
3178A49E2703E5CF00A8B4CA /* WCPayReaderLocationMapper.swift */,
2016+
3178A49E2703E5CF00A8B4CA /* RemoteReaderLocationMapper.swift */,
20192017
31054701262E04F700C5C02B /* RemotePaymentIntentMapper.swift */,
20202018
45A4B84D25D2E11300776FB4 /* ShippingLabelAddressValidationSuccessMapper.swift */,
20212019
CCF48B272628A4EB0034EA83 /* ShippingLabelAccountSettingsMapper.swift */,
@@ -2645,6 +2643,7 @@
26452643
B5BB1D0C20A2050300112D92 /* DateFormatter+Woo.swift in Sources */,
26462644
743E84EE2217244C00FAC9D7 /* ShipmentTrackingListMapper.swift in Sources */,
26472645
451A97E5260B631E0059D135 /* ShippingLabelPredefinedPackage.swift in Sources */,
2646+
BAB373722795A1FB00837B4A /* OrderTaxLine.swift in Sources */,
26482647
B567AF2520A0CCA300AB6C62 /* AuthenticatedRequest.swift in Sources */,
26492648
453305E92459DF2100264E50 /* PostMapper.swift in Sources */,
26502649
E12552C526385B05001CEE70 /* ShippingLabelAddressValidationSuccess.swift in Sources */,
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import Foundation
2+
import Codegen
3+
4+
/// Represents a TaxLine Entity within an Order.
5+
///
6+
public struct OrderTaxLine: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
7+
public let taxID: Int64
8+
public let rateCode: String
9+
public let rateID: Int64
10+
public let label: String
11+
public let isCompoundTaxRate: Bool
12+
public let totalTax: String
13+
public let totalShippingTax: String
14+
public let ratePercent: Double
15+
public let attributes: [OrderItemAttribute]
16+
17+
/// OrderTaxLine struct initializer.
18+
///
19+
public init(taxID: Int64,
20+
rateCode: String,
21+
rateID: Int64,
22+
label: String,
23+
isCompoundTaxRate: Bool,
24+
totalTax: String,
25+
totalShippingTax: String,
26+
ratePercent: Double,
27+
attributes: [OrderItemAttribute]) {
28+
self.taxID = taxID
29+
self.rateCode = rateCode
30+
self.rateID = rateID
31+
self.label = label
32+
self.isCompoundTaxRate = isCompoundTaxRate
33+
self.totalTax = totalTax
34+
self.totalShippingTax = totalShippingTax
35+
self.ratePercent = ratePercent
36+
self.attributes = attributes
37+
}
38+
}
39+
40+
/// Defines all of the OrderTaxLine's CodingKeys.
41+
///
42+
private extension OrderTaxLine {
43+
44+
enum CodingKeys: String, CodingKey {
45+
case taxID = "id"
46+
case rateCode = "rate_code"
47+
case rateID = "rate_id"
48+
case label
49+
case isCompoundTaxRate = "compound"
50+
case totalTax = "tax_total"
51+
case totalShippingTax = "shipping_tax_total"
52+
case ratePercent = "rate_percent"
53+
case attributes = "meta_data"
54+
}
55+
}

0 commit comments

Comments
 (0)