Skip to content

Commit 3ea2dbf

Browse files
committed
Merge branch 'trunk' into issue/6204-remove-stripe-ipp-from-experimental
2 parents 875bb13 + 06ee43b commit 3ea2dbf

File tree

67 files changed

+2000
-247
lines changed

Some content is hidden

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

67 files changed

+2000
-247
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
2727
return true
2828
case .orderCreation:
2929
return buildConfig == .localDeveloper || buildConfig == .alpha
30+
case .orderCreationRemoteSynchronizer:
31+
return false
3032
case .hubMenu:
3133
return true
3234
case .systemStatusReport:
@@ -35,8 +37,8 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
3537
return buildConfig == .localDeveloper || buildConfig == .alpha
3638
case .myStoreTabUpdates:
3739
return true
38-
case .couponManagement:
39-
return buildConfig == .localDeveloper || buildConfig == .alpha
40+
case .couponView:
41+
return true
4042
case .productSKUInputScanner:
4143
return true
4244
case .canadaInPersonPayments:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ public enum FeatureFlag: Int {
5454
///
5555
case orderCreation
5656

57+
/// Allows new orders to be created and synced as drafts
58+
///
59+
case orderCreationRemoteSynchronizer
60+
5761
/// Display the new tab "Menu" in the tab bar.
5862
///
5963
case hubMenu
@@ -70,9 +74,9 @@ public enum FeatureFlag: Int {
7074
///
7175
case myStoreTabUpdates
7276

73-
/// Displays the option to manage coupons
77+
/// Displays the option to view coupons
7478
///
75-
case couponManagement
79+
case couponView
7680

7781
/// Barcode scanner for product SKU input
7882
///

Fakes/Fakes/Networking.generated.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ extension OrderStatusEnum {
542542
/// Returns a "ready to use" type filled with fake values.
543543
///
544544
public static func fake() -> OrderStatusEnum {
545-
.pending
545+
.autoDraft
546546
}
547547
}
548548
extension OrderTaxLine {

Networking/Networking/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ extension Order {
334334
extension OrderFeeLine {
335335
public func copy(
336336
feeID: CopiableProp<Int64> = .copy,
337-
name: CopiableProp<String> = .copy,
337+
name: NullableCopiableProp<String> = .copy,
338338
taxClass: CopiableProp<String> = .copy,
339339
taxStatus: CopiableProp<OrderFeeTaxStatus> = .copy,
340340
total: CopiableProp<String> = .copy,
@@ -1468,6 +1468,33 @@ extension ShippingLabelPurchase {
14681468
}
14691469
}
14701470

1471+
extension ShippingLine {
1472+
public func copy(
1473+
shippingID: CopiableProp<Int64> = .copy,
1474+
methodTitle: CopiableProp<String> = .copy,
1475+
methodID: NullableCopiableProp<String> = .copy,
1476+
total: CopiableProp<String> = .copy,
1477+
totalTax: CopiableProp<String> = .copy,
1478+
taxes: CopiableProp<[ShippingLineTax]> = .copy
1479+
) -> ShippingLine {
1480+
let shippingID = shippingID ?? self.shippingID
1481+
let methodTitle = methodTitle ?? self.methodTitle
1482+
let methodID = methodID ?? self.methodID
1483+
let total = total ?? self.total
1484+
let totalTax = totalTax ?? self.totalTax
1485+
let taxes = taxes ?? self.taxes
1486+
1487+
return ShippingLine(
1488+
shippingID: shippingID,
1489+
methodTitle: methodTitle,
1490+
methodID: methodID,
1491+
total: total,
1492+
totalTax: totalTax,
1493+
taxes: taxes
1494+
)
1495+
}
1496+
}
1497+
14711498
extension Site {
14721499
public func copy(
14731500
siteID: CopiableProp<Int64> = .copy,

Networking/Networking/Model/OrderFeeLine.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ import Codegen
55
///
66
public struct OrderFeeLine: Equatable, Codable, GeneratedFakeable, GeneratedCopiable {
77
public let feeID: Int64
8-
public let name: String
8+
9+
/// Fee Name
10+
///
11+
/// Sending a null value to the REST API removes the Fee Line from the Order.
12+
///
13+
public let name: String?
14+
915
public let taxClass: String
1016
public let taxStatus: OrderFeeTaxStatus
1117
public let total: String
@@ -16,7 +22,7 @@ public struct OrderFeeLine: Equatable, Codable, GeneratedFakeable, GeneratedCopi
1622
/// OrderFeeLine struct initializer.
1723
///
1824
public init(feeID: Int64,
19-
name: String,
25+
name: String?,
2026
taxClass: String,
2127
taxStatus: OrderFeeTaxStatus,
2228
total: String,

Networking/Networking/Model/OrderStatusEnum.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Codegen
77
/// and it is used to determine the user facing display order
88
///
99
public enum OrderStatusEnum: Codable, Hashable, Comparable, GeneratedFakeable {
10+
case autoDraft
1011
case pending
1112
case processing
1213
case onHold
@@ -25,6 +26,8 @@ extension OrderStatusEnum: RawRepresentable {
2526
///
2627
public init(rawValue: String) {
2728
switch rawValue {
29+
case Keys.autoDraft:
30+
self = .autoDraft
2831
case Keys.pending:
2932
self = .pending
3033
case Keys.processing:
@@ -48,6 +51,7 @@ extension OrderStatusEnum: RawRepresentable {
4851
///
4952
public var rawValue: String {
5053
switch self {
54+
case .autoDraft: return Keys.autoDraft
5155
case .pending: return Keys.pending
5256
case .processing: return Keys.processing
5357
case .onHold: return Keys.onHold
@@ -64,6 +68,7 @@ extension OrderStatusEnum: RawRepresentable {
6468
/// Enum containing the 'Known' OrderStatus Keys
6569
///
6670
private enum Keys {
71+
static let autoDraft = "auto-draft"
6772
static let pending = "pending"
6873
static let processing = "processing"
6974
static let onHold = "on-hold"

Networking/Networking/Model/ShippingLine.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Codegen
33

44
/// Represents a Shipping Line Entity.
55
///
6-
public struct ShippingLine: Codable, Equatable, GeneratedFakeable {
6+
public struct ShippingLine: Codable, Equatable, GeneratedFakeable, GeneratedCopiable {
77
public let shippingID: Int64
88
public let methodTitle: String
99

Networking/NetworkingTests/Remote/OrdersRemoteTests.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,28 @@ final class OrdersRemoteTests: XCTestCase {
232232
assertEqual(received, expected)
233233
}
234234

235+
func test_update_order_properly_encodes_fee_lines_for_removal_from_order() throws {
236+
// Given
237+
let remote = OrdersRemote(network: network)
238+
let fee = OrderFeeLine(feeID: 333, name: nil, taxClass: "", taxStatus: .none, total: "12.34", totalTax: "", taxes: [], attributes: [])
239+
let order = Order.fake().copy(fees: [fee])
240+
241+
// When
242+
remote.updateOrder(from: 123, order: order, fields: [.fees]) { result in }
243+
244+
// Then
245+
let request = try XCTUnwrap(network.requestsForResponseData.last as? JetpackRequest)
246+
let received = try XCTUnwrap(request.parameters["fee_lines"] as? [[String: AnyHashable]]).first
247+
let expected: [String: AnyHashable] = [
248+
"id": fee.feeID,
249+
"name": NSNull(),
250+
"tax_status": fee.taxStatus.rawValue,
251+
"tax_class": fee.taxClass,
252+
"total": fee.total
253+
]
254+
assertEqual(expected, received)
255+
}
256+
235257

236258
// MARK: - Load Order Notes Tests
237259

@@ -301,7 +323,7 @@ final class OrdersRemoteTests: XCTestCase {
301323
let received = try XCTUnwrap(request.parameters["fee_lines"] as? [[String: AnyHashable]]).first
302324
let expected: [String: AnyHashable] = [
303325
"id": fee.feeID,
304-
"name": fee.name,
326+
"name": fee.name ?? "",
305327
"tax_status": fee.taxStatus.rawValue,
306328
"tax_class": fee.taxClass,
307329
"total": fee.total

RELEASE-NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
8.6
44
-----
5+
- [***] Merchants can now view coupons in their stores by enabling Coupon Management in Experimental Features. [https://github.com/woocommerce/woocommerce-ios/pull/6209]
56
- [*] Orders: In the experimental Order Creation feature, product variations added to a new order now show a list of their attributes. [https://github.com/woocommerce/woocommerce-ios/pull/6131]
67
- [*] Enlarged the tap area for the action button on the notice view. [https://github.com/woocommerce/woocommerce-ios/pull/6146]
78
- [*] Reviews: Fixed crash on iPad when tapping the More button. [https://github.com/woocommerce/woocommerce-ios/pull/6187]
89
- [*] In-Person Payments: Remove Stripe from Experimental Features as it is always enabled now. [https://github.com/woocommerce/woocommerce-ios/pull/6205]
10+
- [*] Disabled unneccesary selection of the "Refund via" row on the Refund Confirmation screen [https://github.com/woocommerce/woocommerce-ios/pull/6198]
911

1012
8.5
1113
-----

0 commit comments

Comments
 (0)