Skip to content

Commit 16feecf

Browse files
authored
Merge pull request #12961 from woocommerce/issue/12905-rename-deposit-to-payouts
Rename deposits to payouts
2 parents 7ea476b + baf5b0e commit 16feecf

19 files changed

+356
-354
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [*] Fixed a crash that occurred when tapping on the customer shipping address in the order details screen [https://github.com/woocommerce/woocommerce-android/pull/12920]
1212
- [*][Payments] Fixed a bug when loading indicator was shown forever after fetching of a receipt failed [https://github.com/woocommerce/woocommerce-android/pull/12950]
1313
- [**] Enables creating a new WP.com account during Jetpack activation flow [https://github.com/woocommerce/woocommerce-android/issues/11114]
14+
- [*] Renamed Deposits to Payouts [https://github.com/woocommerce/woocommerce-android/pull/12961]
1415

1516
21.1
1617
-----

WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv
539539
PAYMENTS_HUB_TAP_TO_PAY_FEEDBACK_TAPPED,
540540
PAYMENTS_HUB_TAP_TO_PAY_ABOUT_TAPPED,
541541

542-
// -- Payments Hub - Deposit Summary
542+
// -- Payments Hub - Payout Summary (Previously called Deposit summary)
543543
PAYMENTS_HUB_DEPOSIT_SUMMARY_SHOWN,
544544
PAYMENTS_HUB_DEPOSIT_SUMMARY_EXPANDED,
545545
PAYMENTS_HUB_DEPOSIT_SUMMARY_ERROR,

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/payments/hub/PaymentsHubAdapter.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class PaymentsHubAdapter :
3030
is LearnMoreListItem -> {
3131
VIEW_TYPE_LEARN_MORE
3232
}
33-
is PaymentsHubViewState.ListItem.DepositSummaryListItem -> {
34-
VIEW_TYPE_DEPOSIT_SUMMARY
33+
is PaymentsHubViewState.ListItem.PayoutSummaryListItem -> {
34+
VIEW_TYPE_PAYOUT_SUMMARY
3535
}
3636
}
3737
}
@@ -53,8 +53,8 @@ class PaymentsHubAdapter :
5353
VIEW_TYPE_LEARN_MORE -> {
5454
PaymentsHubViewHolder.LearnMoreViewHolder(parent)
5555
}
56-
VIEW_TYPE_DEPOSIT_SUMMARY -> {
57-
PaymentsHubViewHolder.DepositSummaryViewHolder(ComposeView(parent.context))
56+
VIEW_TYPE_PAYOUT_SUMMARY -> {
57+
PaymentsHubViewHolder.PayoutSummaryViewHolder(ComposeView(parent.context))
5858
}
5959
else -> error("Unknown section")
6060
}
@@ -91,6 +91,6 @@ class PaymentsHubAdapter :
9191
const val VIEW_TYPE_NON_TOGGELABLE = 2
9292
const val VIEW_TYPE_GAP_BETWEEN_SECTIONS = 3
9393
const val VIEW_TYPE_LEARN_MORE = 4
94-
const val VIEW_TYPE_DEPOSIT_SUMMARY = 5
94+
const val VIEW_TYPE_PAYOUT_SUMMARY = 5
9595
}
9696
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/payments/hub/PaymentsHubViewHolder.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import com.woocommerce.android.databinding.CardReaderLearnMoreSectionBinding
1313
import com.woocommerce.android.databinding.PaymentsHubHeaderBinding
1414
import com.woocommerce.android.databinding.PaymentsHubListItemBinding
1515
import com.woocommerce.android.databinding.PaymentsHubToggelableItemBinding
16-
import com.woocommerce.android.ui.payments.hub.depositsummary.PaymentsHubDepositSummaryView
16+
import com.woocommerce.android.ui.payments.hub.payoutsummary.PaymentsHubPayoutSummaryView
1717
import com.woocommerce.android.util.UiHelpers
1818

1919
private const val DISABLED_BUTTON_ALPHA = 0.5f
@@ -122,10 +122,10 @@ abstract class PaymentsHubViewHolder(val view: View) : RecyclerView.ViewHolder(v
122122
}
123123
}
124124

125-
class DepositSummaryViewHolder(private val composeView: ComposeView) : PaymentsHubViewHolder(composeView) {
125+
class PayoutSummaryViewHolder(private val composeView: ComposeView) : PaymentsHubViewHolder(composeView) {
126126
override fun onBind(uiState: PaymentsHubViewState.ListItem) {
127127
composeView.setContent {
128-
PaymentsHubDepositSummaryView()
128+
PaymentsHubPayoutSummaryView()
129129
}
130130
}
131131
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/payments/hub/PaymentsHubViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ import com.woocommerce.android.ui.payments.hub.PaymentsHubViewModel.CashOnDelive
3939
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewModel.PaymentsHubEvents.ShowToast
4040
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewModel.PaymentsHubEvents.ShowToastString
4141
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem
42-
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.DepositSummaryListItem
4342
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.HeaderItem
4443
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.LearnMoreListItem
4544
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.NonToggleableListItem
45+
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.PayoutSummaryListItem
4646
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.ToggleableListItem
4747
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.OnboardingErrorAction
4848
import com.woocommerce.android.ui.payments.taptopay.TapToPayAvailabilityStatus
@@ -185,7 +185,7 @@ class PaymentsHubViewModel @Inject constructor(
185185
isOnboardingComplete: Boolean,
186186
cashOnDeliveryItem: ToggleableListItem
187187
): List<ListItem> = mutableListOf(
188-
DepositSummaryListItem(index = 0),
188+
PayoutSummaryListItem(index = 0),
189189
HeaderItem(
190190
label = UiStringRes(R.string.card_reader_hub_actions_category_header),
191191
index = 1

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/payments/hub/PaymentsHubViewState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ data class PaymentsHubViewState(
1515
abstract val index: Int
1616
abstract var isEnabled: Boolean
1717

18-
data class DepositSummaryListItem(override val index: Int = 0) : ListItem() {
18+
data class PayoutSummaryListItem(override val index: Int = 0) : ListItem() {
1919
override val label: UiString? = null
2020
override val icon: Int? = null
2121
override val onClick: (() -> Unit)? = null
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.woocommerce.android.ui.payments.hub.depositsummary
1+
package com.woocommerce.android.ui.payments.hub.payoutsummary
22

33
import com.woocommerce.android.tools.SelectedSite
44
import kotlinx.coroutines.flow.flow
@@ -7,34 +7,34 @@ import org.wordpress.android.fluxc.network.rest.wpcom.wc.WooError
77
import org.wordpress.android.fluxc.store.WCWooPaymentsStore
88
import javax.inject.Inject
99

10-
class PaymentsHubDepositSummaryRepository @Inject constructor(
10+
class PaymentsHubPayoutSummaryRepository @Inject constructor(
1111
private val store: WCWooPaymentsStore,
1212
private val site: SelectedSite,
1313
) {
14-
suspend fun retrieveDepositOverview() =
14+
suspend fun retrievePayoutOverview() =
1515
flow {
1616
val cachedData = store.getDepositsOverviewAll(site.get())
1717
if (cachedData != null) {
18-
emit(RetrieveDepositOverviewResult.Cache(cachedData))
18+
emit(RetrievePayoutOverviewResult.Cache(cachedData))
1919
}
2020

2121
val fetchedData = store.fetchDepositsOverview(site.get())
2222
val data = fetchedData.result
2323
if (fetchedData.isError || data == null) {
2424
store.deleteDepositsOverview(site.get())
25-
emit(RetrieveDepositOverviewResult.Error(fetchedData.error))
25+
emit(RetrievePayoutOverviewResult.Error(fetchedData.error))
2626
} else {
2727
store.insertDepositsOverview(site.get(), data)
28-
emit(RetrieveDepositOverviewResult.Remote(data))
28+
emit(RetrievePayoutOverviewResult.Remote(data))
2929
}
3030
}
3131
}
3232

33-
sealed class RetrieveDepositOverviewResult {
34-
data class Error(val error: WooError) : RetrieveDepositOverviewResult()
33+
sealed class RetrievePayoutOverviewResult {
34+
data class Error(val error: WooError) : RetrievePayoutOverviewResult()
3535
data class Cache(val overview: WooPaymentsDepositsOverview) :
36-
RetrieveDepositOverviewResult()
36+
RetrievePayoutOverviewResult()
3737

3838
data class Remote(val overview: WooPaymentsDepositsOverview) :
39-
RetrieveDepositOverviewResult()
39+
RetrievePayoutOverviewResult()
4040
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
package com.woocommerce.android.ui.payments.hub.depositsummary
1+
package com.woocommerce.android.ui.payments.hub.payoutsummary
22

33
import org.wordpress.android.fluxc.network.rest.wpcom.wc.WooError
44
import java.util.SortedMap
55

6-
sealed class PaymentsHubDepositSummaryState {
7-
object Loading : PaymentsHubDepositSummaryState()
8-
data class Error(val error: WooError) : PaymentsHubDepositSummaryState()
6+
sealed class PaymentsHubPayoutSummaryState {
7+
object Loading : PaymentsHubPayoutSummaryState()
8+
data class Error(val error: WooError) : PaymentsHubPayoutSummaryState()
99
data class Success(
1010
val overview: Overview,
1111
val fromCache: Boolean,
1212
val onLearnMoreClicked: () -> Unit,
1313
val onExpandCollapseClicked: (Boolean) -> Unit,
1414
val onCurrencySelected: (String) -> Unit,
15-
) : PaymentsHubDepositSummaryState()
15+
) : PaymentsHubPayoutSummaryState()
1616

1717
data class Overview(
1818
val defaultCurrency: String,
@@ -25,8 +25,8 @@ sealed class PaymentsHubDepositSummaryState {
2525
val availableFundsAmount: Long,
2626
val pendingFundsAmount: Long,
2727
val fundsAvailableInDays: Int?,
28-
val fundsDepositInterval: Interval?,
29-
val lastDeposit: Deposit?,
28+
val fundsPayoutInterval: Interval?,
29+
val lastPayout: Payout?,
3030
) {
3131
sealed class Interval {
3232
object Daily : Interval()
@@ -35,7 +35,7 @@ sealed class PaymentsHubDepositSummaryState {
3535
}
3636
}
3737

38-
data class Deposit(
38+
data class Payout(
3939
val amount: String,
4040
val status: Status,
4141
val date: String,
Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
package com.woocommerce.android.ui.payments.hub.depositsummary
1+
package com.woocommerce.android.ui.payments.hub.payoutsummary
22

33
import com.woocommerce.android.extensions.formatToDDMMMYYYY
44
import com.woocommerce.android.util.CurrencyFormatter
55
import org.wordpress.android.fluxc.model.payments.woo.WooPaymentsDepositsOverview
66
import java.util.Date
77
import javax.inject.Inject
88

9-
class PaymentsHubDepositSummaryStateMapper @Inject constructor(
9+
class PaymentsHubPayoutSummaryStateMapper @Inject constructor(
1010
private val currencyFormatter: CurrencyFormatter,
1111
private val dateFormatter: DateToDDMMMYYYYStringFormatter
1212
) {
13-
fun mapDepositOverviewToViewModelOverviews(
13+
fun mapPayoutOverviewToViewModelOverviews(
1414
overview: WooPaymentsDepositsOverview
1515
): Result {
1616
val pendingBalances = overview.balance?.pending.orEmpty()
@@ -30,10 +30,10 @@ class PaymentsHubDepositSummaryStateMapper @Inject constructor(
3030
Result.InvalidInputData
3131
} else {
3232
Result.Success(
33-
PaymentsHubDepositSummaryState.Overview(
33+
PaymentsHubPayoutSummaryState.Overview(
3434
defaultCurrency = defaultCurrency,
3535
infoPerCurrency = currencies.associateWith { currency ->
36-
PaymentsHubDepositSummaryState.Info(
36+
PaymentsHubPayoutSummaryState.Info(
3737
availableFundsFormatted = formatMoney(
3838
amount = availableBalances.firstOrNull { it.currency == currency }?.amount ?: 0,
3939
currency = currency
@@ -42,11 +42,12 @@ class PaymentsHubDepositSummaryStateMapper @Inject constructor(
4242
amount = pendingBalances.firstOrNull { it.currency == currency }?.amount ?: 0,
4343
currency = currency
4444
),
45-
availableFundsAmount = availableBalances.firstOrNull { it.currency == currency }?.amount ?: 0,
45+
availableFundsAmount = availableBalances.firstOrNull { it.currency == currency }?.amount
46+
?: 0,
4647
pendingFundsAmount = pendingBalances.firstOrNull { it.currency == currency }?.amount ?: 0,
4748
fundsAvailableInDays = overview.account?.depositsSchedule?.delayDays,
48-
fundsDepositInterval = overview.account.fundsAvailableIn(),
49-
lastDeposit = lastPaidDeposits.firstOrNull { it.currency == currency }?.let {
49+
fundsPayoutInterval = overview.account.fundsAvailableIn(),
50+
lastPayout = lastPaidDeposits.firstOrNull { it.currency == currency }?.let {
5051
mapDeposit(it)
5152
}
5253
)
@@ -59,7 +60,7 @@ class PaymentsHubDepositSummaryStateMapper @Inject constructor(
5960
}
6061

6162
private fun mapDeposit(info: WooPaymentsDepositsOverview.Deposit.Info) =
62-
PaymentsHubDepositSummaryState.Deposit(
63+
PaymentsHubPayoutSummaryState.Payout(
6364
amount = formatMoney(info.amount ?: 0L, info.currency.orEmpty()),
6465
status = info.status.toDepositStatus(),
6566
date = if (info.date != null) dateFormatter(Date(info.date!!)) else ""
@@ -72,14 +73,14 @@ class PaymentsHubDepositSummaryStateMapper @Inject constructor(
7273
)
7374

7475
@Suppress("ReturnCount")
75-
private fun WooPaymentsDepositsOverview.Account?.fundsAvailableIn(): PaymentsHubDepositSummaryState.Info.Interval? {
76+
private fun WooPaymentsDepositsOverview.Account?.fundsAvailableIn(): PaymentsHubPayoutSummaryState.Info.Interval? {
7677
return when (this?.depositsSchedule?.interval?.lowercase()) {
77-
"daily" -> PaymentsHubDepositSummaryState.Info.Interval.Daily
78-
"weekly" -> PaymentsHubDepositSummaryState.Info.Interval.Weekly(
78+
"daily" -> PaymentsHubPayoutSummaryState.Info.Interval.Daily
79+
"weekly" -> PaymentsHubPayoutSummaryState.Info.Interval.Weekly(
7980
this.depositsSchedule?.weeklyAnchor ?: return null
8081
)
8182

82-
"monthly" -> PaymentsHubDepositSummaryState.Info.Interval.Monthly(
83+
"monthly" -> PaymentsHubPayoutSummaryState.Info.Interval.Monthly(
8384
this.depositsSchedule?.monthlyAnchor ?: return null
8485
)
8586

@@ -89,17 +90,17 @@ class PaymentsHubDepositSummaryStateMapper @Inject constructor(
8990

9091
private fun String?.toDepositStatus() =
9192
when (this?.uppercase()) {
92-
"ESTIMATED" -> PaymentsHubDepositSummaryState.Deposit.Status.ESTIMATED
93-
"PENDING" -> PaymentsHubDepositSummaryState.Deposit.Status.PENDING
94-
"IN_TRANSIT" -> PaymentsHubDepositSummaryState.Deposit.Status.IN_TRANSIT
95-
"PAID" -> PaymentsHubDepositSummaryState.Deposit.Status.PAID
96-
"CANCELED" -> PaymentsHubDepositSummaryState.Deposit.Status.CANCELED
97-
"FAILED" -> PaymentsHubDepositSummaryState.Deposit.Status.FAILED
98-
else -> PaymentsHubDepositSummaryState.Deposit.Status.UNKNOWN
93+
"ESTIMATED" -> PaymentsHubPayoutSummaryState.Payout.Status.ESTIMATED
94+
"PENDING" -> PaymentsHubPayoutSummaryState.Payout.Status.PENDING
95+
"IN_TRANSIT" -> PaymentsHubPayoutSummaryState.Payout.Status.IN_TRANSIT
96+
"PAID" -> PaymentsHubPayoutSummaryState.Payout.Status.PAID
97+
"CANCELED" -> PaymentsHubPayoutSummaryState.Payout.Status.CANCELED
98+
"FAILED" -> PaymentsHubPayoutSummaryState.Payout.Status.FAILED
99+
else -> PaymentsHubPayoutSummaryState.Payout.Status.UNKNOWN
99100
}
100101

101102
sealed class Result {
102-
data class Success(val overview: PaymentsHubDepositSummaryState.Overview) : Result()
103+
data class Success(val overview: PaymentsHubPayoutSummaryState.Overview) : Result()
103104
object InvalidInputData : Result()
104105
}
105106
}

0 commit comments

Comments
 (0)