Skip to content

Commit d45b51e

Browse files
authored
Merge branch 'trunk' into merge/8.3-final-into-trunk
2 parents ffbbe88 + 1010e4a commit d45b51e

File tree

221 files changed

+7902
-2066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+7902
-2066
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
2424
case .orderListFilters:
2525
return true
2626
case .jetpackConnectionPackageSupport:
27-
return buildConfig == .localDeveloper || buildConfig == .alpha
27+
return true
2828
case .orderCreation:
2929
return buildConfig == .localDeveloper || buildConfig == .alpha
3030
case .hubMenu:
31-
return buildConfig == .localDeveloper || buildConfig == .alpha
31+
return true
3232
case .systemStatusReport:
3333
return true
3434
case .stripeExtensionInPersonPayments:
@@ -39,6 +39,8 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
3939
return buildConfig == .localDeveloper || buildConfig == .alpha
4040
case .productSKUInputScanner:
4141
return true
42+
case .taxLinesInSimplePayments:
43+
return buildConfig == .localDeveloper || buildConfig == .alpha
4244
default:
4345
return true
4446
}

Experiments/Experiments/FeatureFlag.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,8 @@ public enum FeatureFlag: Int {
7777
/// Barcode scanner for product SKU input
7878
///
7979
case productSKUInputScanner
80+
81+
/// Displays the tax lines breakup in simple payments summary screen
82+
///
83+
case taxLinesInSimplePayments
8084
}

Fakes/Fakes/Networking.generated.swift

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@ extension Coupon.DiscountType {
159159
.percent
160160
}
161161
}
162+
extension CouponReport {
163+
/// Returns a "ready to use" type filled with fake values.
164+
///
165+
public static func fake() -> CouponReport {
166+
.init(
167+
couponID: .fake(),
168+
amount: .fake(),
169+
ordersCount: .fake()
170+
)
171+
}
172+
}
162173
extension CreateProductVariation {
163174
/// Returns a "ready to use" type filled with fake values.
164175
///
@@ -300,7 +311,8 @@ extension Order {
300311
shippingLines: .fake(),
301312
coupons: .fake(),
302313
refunds: .fake(),
303-
fees: .fake()
314+
fees: .fake(),
315+
taxes: .fake()
304316
)
305317
}
306318
}
@@ -500,6 +512,23 @@ extension OrderStatusEnum {
500512
.pending
501513
}
502514
}
515+
extension OrderTaxLine {
516+
/// Returns a "ready to use" type filled with fake values.
517+
///
518+
public static func fake() -> OrderTaxLine {
519+
.init(
520+
taxID: .fake(),
521+
rateCode: .fake(),
522+
rateID: .fake(),
523+
label: .fake(),
524+
isCompoundTaxRate: .fake(),
525+
totalTax: .fake(),
526+
totalShippingTax: .fake(),
527+
ratePercent: .fake(),
528+
attributes: .fake()
529+
)
530+
}
531+
}
503532
extension PaymentGateway {
504533
/// Returns a "ready to use" type filled with fake values.
505534
///

Hardware/Hardware/CardReader/StripeCardReader/StripeCardReaderService.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ extension StripeCardReaderService: CardReaderService {
306306
promise(.failure(CardReaderServiceError.connection()))
307307
return
308308
}
309-
310309
// Clear cached readers, as per Stripe's documentation.
311310
self.discoveredStripeReadersCache.clear()
312311

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 96 additions & 24 deletions
Large diffs are not rendered by default.

Networking/Networking/Mapper/CouponListMapper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct CouponListMapper: Mapper {
1414
let coupons = try Coupon.decoder.decode(CouponListEnvelope.self, from: response).coupons
1515
return coupons
1616
.map { $0.copy(siteID: siteID) }
17-
.filter { $0.mappedDiscountType != nil }
17+
.filter { $0.discountType != .other }
1818
}
1919
}
2020

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import Foundation
2+
3+
/// Mapper: `CouponReport`
4+
///
5+
struct CouponReportListMapper: Mapper {
6+
7+
/// (Attempts) to convert a dictionary into `[CouponReport]`.
8+
///
9+
func map(response: Data) throws -> [CouponReport] {
10+
let decoder = JSONDecoder()
11+
let reports = try decoder.decode(CouponReportsEnvelope.self, from: response).reports
12+
return reports
13+
}
14+
}
15+
16+
17+
/// CouponReportsEnvelope Disposable Entity:
18+
/// Load Coupon endpoint returns the coupon in the `data` key.
19+
/// This entity allows us to parse all the things with JSONDecoder.
20+
///
21+
private struct CouponReportsEnvelope: Decodable {
22+
let reports: [CouponReport]
23+
24+
private enum CodingKeys: String, CodingKey {
25+
case reports = "data"
26+
}
27+
}

Networking/Networking/Mapper/WCPayCustomerMapper.swift renamed to Networking/Networking/Mapper/CustomerMapper.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import Foundation
22

33
/// Mapper: WCPay Customer
44
///
5-
struct WCPayCustomerMapper: Mapper {
5+
struct CustomerMapper: Mapper {
66

77
/// (Attempts) to convert a dictionary into a customer.
88
///
9-
func map(response: Data) throws -> WCPayCustomer {
9+
func map(response: Data) throws -> Customer {
1010
let decoder = JSONDecoder()
1111

12-
return try decoder.decode(WCPayCustomerEnvelope.self, from: response).customer
12+
return try decoder.decode(CustomerEnvelope.self, from: response).customer
1313
}
1414
}
1515

@@ -18,8 +18,8 @@ struct WCPayCustomerMapper: Mapper {
1818
/// Endpoint returns the customer in the `data` key. This entity
1919
/// allows us to parse it with JSONDecoder.
2020
///
21-
private struct WCPayCustomerEnvelope: Decodable {
22-
let customer: WCPayCustomer
21+
private struct CustomerEnvelope: Decodable {
22+
let customer: Customer
2323

2424
private enum CodingKeys: String, CodingKey {
2525
case customer = "data"

Networking/Networking/Mapper/WCPayPaymentIntentMapper.swift renamed to Networking/Networking/Mapper/RemotePaymentIntentMapper.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import Foundation
22

33
/// Mapper: WCPay Payment Intent
44
///
5-
struct WCPayPaymentIntentMapper: Mapper {
5+
struct RemotePaymentIntentMapper: Mapper {
66

77
/// (Attempts) to convert a dictionary into an payment intent.
88
///
9-
func map(response: Data) throws -> WCPayPaymentIntent {
9+
func map(response: Data) throws -> RemotePaymentIntent {
1010
let decoder = JSONDecoder()
1111

1212
return try decoder.decode(WCPayPaymentIntentEnvelope.self, from: response).paymentIntent
@@ -19,7 +19,7 @@ struct WCPayPaymentIntentMapper: Mapper {
1919
/// allows us to parse it with JSONDecoder.
2020
///
2121
private struct WCPayPaymentIntentEnvelope: Decodable {
22-
let paymentIntent: WCPayPaymentIntent
22+
let paymentIntent: RemotePaymentIntent
2323

2424
private enum CodingKeys: String, CodingKey {
2525
case paymentIntent = "data"

Networking/Networking/Mapper/WCPayReaderLocationMapper.swift renamed to Networking/Networking/Mapper/RemoteReaderLocationMapper.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import Foundation
22

33
/// Mapper: WCPay Reader Location
44
///
5-
struct WCPayReaderLocationMapper: Mapper {
5+
struct RemoteReaderLocationMapper: Mapper {
66

77
/// (Attempts) to convert a dictionary into a location.
88
///
9-
func map(response: Data) throws -> WCPayReaderLocation {
9+
func map(response: Data) throws -> RemoteReaderLocation {
1010
let decoder = JSONDecoder()
1111

12-
return try decoder.decode(WCPayReaderLocationEnvelope.self, from: response).location
12+
return try decoder.decode(RemoteReaderLocationEnvelope.self, from: response).location
1313
}
1414
}
1515

@@ -18,8 +18,8 @@ struct WCPayReaderLocationMapper: Mapper {
1818
/// Endpoint returns the location in the `data` key. This entity
1919
/// allows us to parse it with JSONDecoder.
2020
///
21-
private struct WCPayReaderLocationEnvelope: Decodable {
22-
let location: WCPayReaderLocation
21+
private struct RemoteReaderLocationEnvelope: Decodable {
22+
let location: RemoteReaderLocation
2323

2424
private enum CodingKeys: String, CodingKey {
2525
case location = "data"

0 commit comments

Comments
 (0)