Conversation
implementations in to the journey and to not make use of a domain model anymore
| companion object { | ||
| const val ACCOUNT_NAME = "Alpha" | ||
| const val ACCOUNT_BALANCE = "45.89" | ||
| val ACCOUNT_BALANCE = BigDecimal.valueOf(45.89) |
There was a problem hiding this comment.
This has potential precision and unchecked nullability issues. Better to use BigDecimal("45.89") to be exact.
| import com.backbase.android.client.gen2.arrangementclient2.model.AccountArrangementItem | ||
| import dev.drewhamilton.poko.Poko | ||
|
|
||
| interface AccountDetailUseCase { |
There was a problem hiding this comment.
| interface AccountDetailUseCase { | |
| fun interface GetAccountDetailUseCase { |
There was a problem hiding this comment.
I recommend this change to enforce the SAM nature of this use-case and name it accordingly.
|
|
||
| interface AccountDetailUseCase { | ||
| suspend fun getAccountDetail(params: Params): Result<AccountDetail> | ||
| suspend fun getAccountDetail(params: Params): Result<AccountArrangementItem> |
There was a problem hiding this comment.
| suspend fun getAccountDetail(params: Params): Result<AccountArrangementItem> | |
| suspend operator fun invoke(params: Params): Result<AccountArrangementItem> |
There was a problem hiding this comment.
operator is also a nice addition here to allow:
val getAccountDetails = GetAccountDetailUseCase { params ->
...
}
getAccountDetails(Params{})
| * @return an instance of [ProductSummary] | ||
| */ | ||
| suspend fun getAccountSummary(useCache: Boolean = true): Result<AccountSummary> | ||
| suspend fun getAccountSummary(useCache: Boolean = true): Result<ProductSummary> |
There was a problem hiding this comment.
| suspend fun getAccountSummary(useCache: Boolean = true): Result<ProductSummary> | |
| suspend operator fun invoke(useCache: Boolean = true): Result<ProductSummary> |
There was a problem hiding this comment.
Same recommendations as AccountDetailUseCase
|
|
||
| interface AccountDetailUseCase { | ||
| suspend fun getAccountDetail(params: Params): Result<AccountDetail> | ||
| suspend fun getAccountDetail(params: Params): Result<AccountArrangementItem> |
There was a problem hiding this comment.
I am still not convinced about exposing client objects directly with the journey's APIs. We risk unnecessarily coupling the client API with journey's API. Clients are generated and inherently produce unstable(especially from past experience) API that strongly tied to the BE. I am not sure it's prudent to strongly couple the 2.
Also keep in mind that for certain BE capabilities, their models don't map 1-to-1 to UI models . BE models will still need some mapping/transformation in the journey in some cases.
Architectural alignment journey