-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into homeOldPresenter-mvvm
- Loading branch information
Showing
107 changed files
with
4,825 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
app/src/main/java/org/mifos/mobile/repositories/BeneficiaryRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.models.beneficiary.Beneficiary | ||
import org.mifos.mobile.models.beneficiary.BeneficiaryPayload | ||
import org.mifos.mobile.models.beneficiary.BeneficiaryUpdatePayload | ||
import org.mifos.mobile.models.templates.beneficiary.BeneficiaryTemplate | ||
|
||
interface BeneficiaryRepository { | ||
|
||
fun beneficiaryTemplate(): Observable<BeneficiaryTemplate?>? | ||
|
||
fun createBeneficiary(beneficiaryPayload: BeneficiaryPayload?): Observable<ResponseBody?>? | ||
|
||
fun updateBeneficiary( | ||
beneficiaryId: Long?, | ||
payload: BeneficiaryUpdatePayload?, | ||
): Observable<ResponseBody?>? | ||
|
||
fun deleteBeneficiary(beneficiaryId: Long?): Observable<ResponseBody?>? | ||
|
||
fun beneficiaryList(): Observable<List<Beneficiary?>?>? | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
app/src/main/java/org/mifos/mobile/repositories/BeneficiaryRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.api.DataManager | ||
import org.mifos.mobile.models.beneficiary.Beneficiary | ||
import org.mifos.mobile.models.beneficiary.BeneficiaryPayload | ||
import org.mifos.mobile.models.beneficiary.BeneficiaryUpdatePayload | ||
import org.mifos.mobile.models.templates.beneficiary.BeneficiaryTemplate | ||
import javax.inject.Inject | ||
|
||
class BeneficiaryRepositoryImp @Inject constructor(private val dataManager: DataManager) : | ||
BeneficiaryRepository { | ||
|
||
override fun beneficiaryTemplate(): Observable<BeneficiaryTemplate?>? { | ||
return dataManager.beneficiaryTemplate | ||
} | ||
|
||
override fun createBeneficiary(beneficiaryPayload: BeneficiaryPayload?): Observable<ResponseBody?>? { | ||
return dataManager.createBeneficiary(beneficiaryPayload) | ||
} | ||
|
||
override fun updateBeneficiary( | ||
beneficiaryId: Long?, | ||
payload: BeneficiaryUpdatePayload? | ||
): Observable<ResponseBody?>? { | ||
return dataManager.updateBeneficiary(beneficiaryId, payload) | ||
} | ||
|
||
override fun deleteBeneficiary(beneficiaryId: Long?): Observable<ResponseBody?>? { | ||
return dataManager.deleteBeneficiary(beneficiaryId) | ||
} | ||
|
||
override fun beneficiaryList(): Observable<List<Beneficiary?>?>? { | ||
return dataManager.beneficiaryList | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
app/src/main/java/org/mifos/mobile/repositories/ClientRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import org.mifos.mobile.models.Page | ||
import org.mifos.mobile.models.User | ||
import org.mifos.mobile.models.client.Client | ||
|
||
interface ClientRepository { | ||
|
||
fun loadClient() : Observable<Page<Client?>?>? | ||
|
||
fun saveAuthenticationTokenForSession(user: User) | ||
|
||
fun reInitializeService() | ||
|
||
fun setClientId(clientId: Long?) | ||
|
||
fun clearPrefHelper() | ||
|
||
fun updateAuthenticationToken(password: String) | ||
} |
63 changes: 63 additions & 0 deletions
63
app/src/main/java/org/mifos/mobile/repositories/ClientRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.Credentials | ||
import org.mifos.mobile.api.BaseApiManager | ||
import org.mifos.mobile.api.DataManager | ||
import org.mifos.mobile.api.local.PreferencesHelper | ||
import org.mifos.mobile.models.Page | ||
import org.mifos.mobile.models.User | ||
import org.mifos.mobile.models.client.Client | ||
import org.mifos.mobile.utils.Constants | ||
import javax.inject.Inject | ||
|
||
class ClientRepositoryImp @Inject constructor( | ||
private val dataManager: DataManager, private val preferencesHelper: PreferencesHelper | ||
) : ClientRepository { | ||
|
||
override fun loadClient(): Observable<Page<Client?>?>? { | ||
return dataManager.clients | ||
} | ||
|
||
/** | ||
* Save the authentication token from the server and the user ID. | ||
* The authentication token would be used for accessing the authenticated | ||
* APIs. | ||
* | ||
* @param user - The user that is to be saved. | ||
*/ | ||
override fun saveAuthenticationTokenForSession(user: User) { | ||
val authToken = Constants.BASIC + user.base64EncodedAuthenticationKey | ||
preferencesHelper.userName = user.username | ||
preferencesHelper.userId = user.userId | ||
preferencesHelper.saveToken(authToken) | ||
reInitializeService() | ||
} | ||
|
||
override fun reInitializeService() { | ||
BaseApiManager.createService( | ||
preferencesHelper.baseUrl, | ||
preferencesHelper.tenant, | ||
preferencesHelper.token, | ||
) | ||
} | ||
|
||
override fun setClientId(clientId: Long?) { | ||
preferencesHelper.clientId = clientId | ||
dataManager.clientId = clientId | ||
} | ||
|
||
override fun clearPrefHelper() { | ||
preferencesHelper.clear() | ||
} | ||
|
||
override fun updateAuthenticationToken(password: String) { | ||
val authenticationToken = Credentials.basic(preferencesHelper.userName!!, password) | ||
preferencesHelper.saveToken(authenticationToken) | ||
BaseApiManager.createService( | ||
preferencesHelper.baseUrl, | ||
preferencesHelper.tenant, | ||
preferencesHelper.token, | ||
) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app/src/main/java/org/mifos/mobile/repositories/GuarantorRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.models.guarantor.GuarantorApplicationPayload | ||
import org.mifos.mobile.models.guarantor.GuarantorPayload | ||
import org.mifos.mobile.models.guarantor.GuarantorTemplatePayload | ||
|
||
interface GuarantorRepository { | ||
|
||
fun getGuarantorTemplate(loanId: Long?): Observable<GuarantorTemplatePayload?>? | ||
|
||
fun createGuarantor( | ||
loanId: Long?, | ||
payload: GuarantorApplicationPayload?, | ||
): Observable<ResponseBody?>? | ||
|
||
fun updateGuarantor( | ||
payload: GuarantorApplicationPayload?, | ||
loanId: Long?, | ||
guarantorId: Long?, | ||
): Observable<ResponseBody?>? | ||
|
||
fun deleteGuarantor(loanId: Long?, guarantorId: Long?): Observable<ResponseBody?>? | ||
|
||
fun getGuarantorList(loanId: Long): Observable<List<GuarantorPayload?>?>? | ||
} |
40 changes: 40 additions & 0 deletions
40
app/src/main/java/org/mifos/mobile/repositories/GuarantorRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.api.DataManager | ||
import org.mifos.mobile.models.guarantor.GuarantorApplicationPayload | ||
import org.mifos.mobile.models.guarantor.GuarantorPayload | ||
import org.mifos.mobile.models.guarantor.GuarantorTemplatePayload | ||
import javax.inject.Inject | ||
|
||
class GuarantorRepositoryImp @Inject constructor(private val dataManager: DataManager) : | ||
GuarantorRepository { | ||
|
||
override fun getGuarantorTemplate(loanId: Long?): Observable<GuarantorTemplatePayload?>? { | ||
return dataManager.getGuarantorTemplate(loanId) | ||
} | ||
|
||
override fun createGuarantor( | ||
loanId: Long?, | ||
payload: GuarantorApplicationPayload? | ||
): Observable<ResponseBody?>? { | ||
return dataManager.createGuarantor(loanId, payload) | ||
} | ||
|
||
override fun updateGuarantor( | ||
payload: GuarantorApplicationPayload?, | ||
loanId: Long?, | ||
guarantorId: Long? | ||
): Observable<ResponseBody?>? { | ||
return dataManager.updateGuarantor(payload, loanId, guarantorId) | ||
} | ||
|
||
override fun deleteGuarantor(loanId: Long?, guarantorId: Long?): Observable<ResponseBody?>? { | ||
return dataManager.deleteGuarantor(loanId, guarantorId) | ||
} | ||
|
||
override fun getGuarantorList(loanId: Long): Observable<List<GuarantorPayload?>?>? { | ||
return dataManager.getGuarantorList(loanId) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
app/src/main/java/org/mifos/mobile/repositories/LoanRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.models.accounts.loan.LoanWithAssociations | ||
import org.mifos.mobile.models.accounts.loan.LoanWithdraw | ||
import org.mifos.mobile.models.templates.loans.LoanTemplate | ||
|
||
interface LoanRepository { | ||
|
||
fun getLoanWithAssociations( | ||
associationType: String?, | ||
loanId: Long? | ||
): Observable<LoanWithAssociations?>? | ||
|
||
fun withdrawLoanAccount( | ||
loanId: Long?, | ||
loanWithdraw: LoanWithdraw?, | ||
): Observable<ResponseBody?>? | ||
|
||
fun template(): Observable<LoanTemplate?>? | ||
|
||
fun getLoanTemplateByProduct( | ||
productId: Int? | ||
): Observable<LoanTemplate?>? | ||
} |
34 changes: 34 additions & 0 deletions
34
app/src/main/java/org/mifos/mobile/repositories/LoanRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.api.DataManager | ||
import org.mifos.mobile.models.accounts.loan.LoanWithAssociations | ||
import org.mifos.mobile.models.accounts.loan.LoanWithdraw | ||
import org.mifos.mobile.models.templates.loans.LoanTemplate | ||
import javax.inject.Inject | ||
|
||
class LoanRepositoryImp @Inject constructor(private val dataManager: DataManager) : LoanRepository { | ||
|
||
override fun getLoanWithAssociations( | ||
associationType: String?, | ||
loanId: Long? | ||
): Observable<LoanWithAssociations?>? { | ||
return dataManager.getLoanWithAssociations(associationType, loanId) | ||
} | ||
|
||
override fun withdrawLoanAccount( | ||
loanId: Long?, | ||
loanWithdraw: LoanWithdraw? | ||
): Observable<ResponseBody?>? { | ||
return dataManager.withdrawLoanAccount(loanId, loanWithdraw) | ||
} | ||
|
||
override fun template(): Observable<LoanTemplate?>? { | ||
return dataManager.loanTemplate | ||
} | ||
|
||
override fun getLoanTemplateByProduct(productId: Int?): Observable<LoanTemplate?>? { | ||
return dataManager.getLoanTemplateByProduct(productId) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/mifos/mobile/repositories/NotificationRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import org.mifos.mobile.models.notification.MifosNotification | ||
|
||
interface NotificationRepository { | ||
|
||
fun loadNotifications(): Observable<List<MifosNotification?>?> | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/org/mifos/mobile/repositories/NotificationRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import org.mifos.mobile.api.DataManager | ||
import org.mifos.mobile.models.notification.MifosNotification | ||
import javax.inject.Inject | ||
|
||
class NotificationRepositoryImp @Inject constructor(private val dataManager: DataManager) : NotificationRepository { | ||
|
||
override fun loadNotifications(): Observable<List<MifosNotification?>?> { | ||
return dataManager.notifications | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/mifos/mobile/repositories/RecentTransactionRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
|
||
import io.reactivex.Observable | ||
import org.mifos.mobile.models.Page | ||
import org.mifos.mobile.models.Transaction | ||
|
||
interface RecentTransactionRepository { | ||
|
||
fun recentTransactions( | ||
offset: Int?, | ||
limit: Int? | ||
): Observable<Page<Transaction?>?>? | ||
} |
Oops, something went wrong.