Skip to content

Commit

Permalink
Merge branch 'trunk' into issue/14419-jetpack-setup-account-creation-1
Browse files Browse the repository at this point in the history
# Conflicts:
#	Experiments/Experiments/DefaultFeatureFlagService.swift
#	Experiments/Experiments/FeatureFlag.swift
  • Loading branch information
hichamboushaba committed Nov 19, 2024
2 parents 99ad008 + 09e8f0e commit 20a0bfc
Show file tree
Hide file tree
Showing 119 changed files with 2,090 additions and 1,535 deletions.
15 changes: 2 additions & 13 deletions .buildkite/commands/checkout-release-branch.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
#!/bin/bash -eu

echo "--- :git: Checkout Release Branch"

# Note: `BUILDKITE_RELEASE_VERSION` is the legacy environment variable passed to Buildkite by ReleaseV2.
# It used the `BUILDKITE_` prefix so it was not filtered out when passed to the MacOS VMs, due to how `hostmgr` works.
# This is considered legacy: we should eventually remove all use of custom `BUILDKITE_` variables, and instead
# resolve the value of those sooner (i.e. in the YML pipeline) then pass it as parameter to the `.sh` calls instead.
RELEASE_VERSION="${1:?RELEASE_VERSION parameter missing}"

# Use the provided argument if there's one, otherwise fall back to the legacy BUILDKITE_RELEASE_VERSION
RELEASE_VERSION=${1:-$BUILDKITE_RELEASE_VERSION}

if [[ -z "${RELEASE_VERSION}" ]]; then
echo "RELEASE_VERSION is not set and BUILDKITE_RELEASE_VERSION is not available."
exit 1
fi
echo "--- :git: Checkout Release Branch"

# Buildkite, by default, checks out a specific commit. For many release actions, we need to be
# on a release branch instead.
Expand Down
6 changes: 3 additions & 3 deletions Experiments/Experiments/DefaultFeatureFlagService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
return true
case .giftCardInOrderForm:
return true
case .wooPaymentsDepositsOverviewInPaymentsMenu:
case .wooPaymentsPayoutsOverviewInPaymentsMenu:
return true
case .tapToPayOnIPhoneInUK:
return true
Expand Down Expand Up @@ -91,8 +91,8 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
return buildConfig == .localDeveloper || buildConfig == .alpha
case .paymentsOnboardingInPointOfSale:
return buildConfig == .localDeveloper
case .displayInfiniteScrollingUIDetailsInPointOfSale:
return buildConfig == .localDeveloper || buildConfig == .alpha
case .sendReceiptAfterPayment:
return false
case .jetpackSetupWPComAccountCreation:
return buildConfig == .localDeveloper || buildConfig == .alpha
default:
Expand Down
9 changes: 4 additions & 5 deletions Experiments/Experiments/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ public enum FeatureFlag: Int {
///
case giftCardInOrderForm

/// Enables the Woo Payments Deposits item in the Payments menu
/// Enables the Woo Payments Payouts item in the Payments menu
///
case wooPaymentsDepositsOverviewInPaymentsMenu
case wooPaymentsPayoutsOverviewInPaymentsMenu

/// Enables Tap to Pay for UK Woo Payments stores
///
Expand Down Expand Up @@ -197,9 +197,8 @@ public enum FeatureFlag: Int {
///
case paymentsOnboardingInPointOfSale

/// Enables UI-related aspects of infinite scrolling in POS. It does not affect the actual infinite scrolling behaviour.
///
case displayInfiniteScrollingUIDetailsInPointOfSale
/// Enables sending receipt after the payment via the API
case sendReceiptAfterPayment

/// Enables WPCom account creation during Jetpack setup
///
Expand Down
60 changes: 30 additions & 30 deletions Fakes/Fakes/Networking.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2637,14 +2637,14 @@ extension Networking.WCPayPaymentMethodType {
.card
}
}
extension Networking.WooPaymentsAccountDepositSummary {
extension Networking.WooPaymentsAccountPayoutSummary {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsAccountDepositSummary {
public static func fake() -> Networking.WooPaymentsAccountPayoutSummary {
.init(
depositsEnabled: .fake(),
depositsBlocked: .fake(),
depositsSchedule: .fake(),
payoutsEnabled: .fake(),
payoutsBlocked: .fake(),
payoutsSchedule: .fake(),
defaultCurrency: .fake()
)
}
Expand All @@ -2670,20 +2670,30 @@ extension Networking.WooPaymentsCurrencyBalances {
)
}
}
extension Networking.WooPaymentsCurrencyDeposits {
extension Networking.WooPaymentsCurrencyPayouts {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsCurrencyDeposits {
public static func fake() -> Networking.WooPaymentsCurrencyPayouts {
.init(
lastPaid: .fake(),
lastManualDeposits: .fake()
lastManualPayouts: .fake()
)
}
}
extension Networking.WooPaymentsDeposit {
extension Networking.WooPaymentsManualPayout {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsDeposit {
public static func fake() -> Networking.WooPaymentsManualPayout {
.init(
currency: .fake(),
date: .fake()
)
}
}
extension Networking.WooPaymentsPayout {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsPayout {
.init(
id: .fake(),
date: .fake(),
Expand All @@ -2699,58 +2709,48 @@ extension Networking.WooPaymentsDeposit {
)
}
}
extension Networking.WooPaymentsDepositInterval {
extension Networking.WooPaymentsPayoutInterval {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsDepositInterval {
public static func fake() -> Networking.WooPaymentsPayoutInterval {
.daily
}
}
extension Networking.WooPaymentsDepositStatus {
extension Networking.WooPaymentsPayoutStatus {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsDepositStatus {
public static func fake() -> Networking.WooPaymentsPayoutStatus {
.estimated
}
}
extension Networking.WooPaymentsDepositType {
extension Networking.WooPaymentsPayoutType {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsDepositType {
public static func fake() -> Networking.WooPaymentsPayoutType {
.withdrawal
}
}
extension Networking.WooPaymentsDepositsOverview {
extension Networking.WooPaymentsPayoutsOverview {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsDepositsOverview {
public static func fake() -> Networking.WooPaymentsPayoutsOverview {
.init(
deposit: .fake(),
balance: .fake(),
account: .fake()
)
}
}
extension Networking.WooPaymentsDepositsSchedule {
extension Networking.WooPaymentsPayoutsSchedule {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsDepositsSchedule {
public static func fake() -> Networking.WooPaymentsPayoutsSchedule {
.init(
delayDays: .fake(),
interval: .fake()
)
}
}
extension Networking.WooPaymentsManualDeposit {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Networking.WooPaymentsManualDeposit {
.init(
currency: .fake(),
date: .fake()
)
}
}
extension Networking.WooShippingCreatePackageResponse {
/// Returns a "ready to use" type filled with fake values.
///
Expand Down
12 changes: 6 additions & 6 deletions Fakes/Fakes/Yosemite.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ extension Yosemite.SystemInformation {
)
}
}
extension Yosemite.WooPaymentsDepositsOverviewByCurrency {
extension Yosemite.WooPaymentsPayoutsOverviewByCurrency {
/// Returns a "ready to use" type filled with fake values.
///
public static func fake() -> Yosemite.WooPaymentsDepositsOverviewByCurrency {
public static func fake() -> Yosemite.WooPaymentsPayoutsOverviewByCurrency {
.init(
currency: .fake(),
automaticDeposits: .fake(),
depositInterval: .fake(),
automaticPayouts: .fake(),
payoutInterval: .fake(),
pendingBalanceAmount: .fake(),
pendingDepositDays: .fake(),
lastDeposit: .fake(),
pendingPayoutDays: .fake(),
lastPayout: .fake(),
availableBalance: .fake()
)
}
Expand Down
8 changes: 4 additions & 4 deletions Networking/Networking.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
077F39E626A5D15800ABEADC /* SystemPluginMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39DB26A58F4800ABEADC /* SystemPluginMapperTests.swift */; };
09885C8027C3FFD200910A62 /* product-variations-bulk-update.json in Resources */ = {isa = PBXBuildFile; fileRef = 09885C7F27C3FFD200910A62 /* product-variations-bulk-update.json */; };
09EA564B27C75FCE00407D40 /* ProductVariationsBulkUpdateMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09EA564A27C75FCE00407D40 /* ProductVariationsBulkUpdateMapper.swift */; };
209AD3C32AC196E300825D76 /* WooPaymentsDepositsOverview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 209AD3C22AC196E300825D76 /* WooPaymentsDepositsOverview.swift */; };
209AD3C32AC196E300825D76 /* WooPaymentsPayoutsOverview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 209AD3C22AC196E300825D76 /* WooPaymentsPayoutsOverview.swift */; };
209AD3C52AC19E7500825D76 /* WooPaymentsDepositsOverviewMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 209AD3C42AC19E7500825D76 /* WooPaymentsDepositsOverviewMapper.swift */; };
20D210C32B1780CE0099E517 /* deposits-overview-all.json in Resources */ = {isa = PBXBuildFile; fileRef = 20D210C22B1780CE0099E517 /* deposits-overview-all.json */; };
20D210C52B1788E60099E517 /* deposits-overview-all-no-default-currency.json in Resources */ = {isa = PBXBuildFile; fileRef = 20D210C42B1788E60099E517 /* deposits-overview-all-no-default-currency.json */; };
Expand Down Expand Up @@ -1452,7 +1452,7 @@
09885C7F27C3FFD200910A62 /* product-variations-bulk-update.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "product-variations-bulk-update.json"; sourceTree = "<group>"; };
09EA564A27C75FCE00407D40 /* ProductVariationsBulkUpdateMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductVariationsBulkUpdateMapper.swift; sourceTree = "<group>"; };
14CE248C7246705417A41DE1 /* Pods-NetworkingWatchOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NetworkingWatchOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-NetworkingWatchOS/Pods-NetworkingWatchOS.release.xcconfig"; sourceTree = "<group>"; };
209AD3C22AC196E300825D76 /* WooPaymentsDepositsOverview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WooPaymentsDepositsOverview.swift; sourceTree = "<group>"; };
209AD3C22AC196E300825D76 /* WooPaymentsPayoutsOverview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WooPaymentsPayoutsOverview.swift; sourceTree = "<group>"; };
209AD3C42AC19E7500825D76 /* WooPaymentsDepositsOverviewMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WooPaymentsDepositsOverviewMapper.swift; sourceTree = "<group>"; };
20D210C22B1780CE0099E517 /* deposits-overview-all.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "deposits-overview-all.json"; sourceTree = "<group>"; };
20D210C42B1788E60099E517 /* deposits-overview-all-no-default-currency.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "deposits-overview-all-no-default-currency.json"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3029,7 +3029,7 @@
0359EA0C27AAC5F80048DE2D /* WCPayChargeStatus.swift */,
3105470B262E27F000C5C02B /* WCPayPaymentIntentStatusEnum.swift */,
0359EA0E27AAC6410048DE2D /* WCPayPaymentMethodDetails.swift */,
209AD3C22AC196E300825D76 /* WooPaymentsDepositsOverview.swift */,
209AD3C22AC196E300825D76 /* WooPaymentsPayoutsOverview.swift */,
E1BAB2C62913FB5800C3982B /* WordPressApiError.swift */,
DE2E8E9C29530EEF002E4B14 /* WordPressSite.swift */,
EE2C09C729AF6357009396F9 /* StoreOnboardingTask.swift */,
Expand Down Expand Up @@ -4975,7 +4975,7 @@
74ABA1CD213F1B6B00FFAD30 /* TopEarnerStats.swift in Sources */,
CCAAD10F2683974000909664 /* ShippingLabelPackagePurchase.swift in Sources */,
265EFBDC285257950033BD33 /* Order+Fallbacks.swift in Sources */,
209AD3C32AC196E300825D76 /* WooPaymentsDepositsOverview.swift in Sources */,
209AD3C32AC196E300825D76 /* WooPaymentsPayoutsOverview.swift in Sources */,
CEC7D5932CDD0D9900111B79 /* WooShippingPredefinedOption.swift in Sources */,
021940E2291E3CFD0090354E /* SiteRemote.swift in Sources */,
B557DA0220975500005962F4 /* JetpackRequest.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import Foundation

struct WooPaymentsDepositsOverviewMapper: Mapper {
func map(response: Data) throws -> WooPaymentsDepositsOverview {
struct WooPaymentsPayoutsOverviewMapper: Mapper {
func map(response: Data) throws -> WooPaymentsPayoutsOverview {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .millisecondsSince1970

if hasDataEnvelope(in: response) {
return try decoder.decode(WooPaymentsDepositsOverviewEnvelope.self, from: response).depositsOverview
return try decoder.decode(WooPaymentsPayoutsOverviewEnvelope.self, from: response).payoutsOverview
} else {
return try decoder.decode(WooPaymentsDepositsOverview.self, from: response)
return try decoder.decode(WooPaymentsPayoutsOverview.self, from: response)
}
}
}

private struct WooPaymentsDepositsOverviewEnvelope: Decodable {
let depositsOverview: WooPaymentsDepositsOverview
private struct WooPaymentsPayoutsOverviewEnvelope: Decodable {
let payoutsOverview: WooPaymentsPayoutsOverview

private enum CodingKeys: String, CodingKey {
case depositsOverview = "data"
case payoutsOverview = "data"
}
}
Loading

0 comments on commit 20a0bfc

Please sign in to comment.