forked from openMF/android-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes openMF#2035 : Fineract SDK Implementation : Client, Center,Data…
…Table services (openMF#2039) * Sdk implementation of client service * Implemented sdk for center client group services
- Loading branch information
1 parent
5f0ff47
commit 67a1f0c
Showing
16 changed files
with
352 additions
and
39 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
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
150 changes: 150 additions & 0 deletions
150
mifosng-android/src/main/java/com/mifos/mappers/clients/GetClientsClientIdAccountMapper.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,150 @@ | ||
package com.mifos.mappers.clients | ||
|
||
import com.mifos.objects.accounts.ClientAccounts | ||
import com.mifos.objects.accounts.loan.LoanAccount | ||
import com.mifos.objects.accounts.loan.LoanType | ||
import com.mifos.objects.accounts.savings.Currency | ||
import com.mifos.objects.accounts.savings.DepositType | ||
import com.mifos.objects.accounts.savings.SavingsAccount | ||
import com.mifos.objects.accounts.savings.Status | ||
import org.apache.fineract.client.models.GetClientsClientIdAccountsResponse | ||
import org.apache.fineract.client.models.GetClientsLoanAccounts | ||
import org.apache.fineract.client.models.GetClientsLoanAccountsStatus | ||
import org.apache.fineract.client.models.GetClientsLoanAccountsType | ||
import org.apache.fineract.client.models.GetClientsSavingsAccounts | ||
import org.apache.fineract.client.models.GetClientsSavingsAccountsCurrency | ||
import org.apache.fineract.client.models.GetClientsSavingsAccountsStatus | ||
import org.mifos.core.data.AbstractMapper | ||
|
||
/** | ||
* Created by Aditya Gupta on 30/08/23. | ||
*/ | ||
|
||
object GetClientsClientIdAccountMapper : | ||
AbstractMapper<GetClientsClientIdAccountsResponse, ClientAccounts>() { | ||
|
||
override fun mapFromEntity(entity: GetClientsClientIdAccountsResponse): ClientAccounts { | ||
return ClientAccounts().apply { | ||
savingsAccounts = entity.savingsAccounts?.map { | ||
SavingsAccount().apply { | ||
id = it.id | ||
accountNo = it.accountNo | ||
productId = it.productId | ||
productName = it.productName | ||
depositType = DepositType().apply { | ||
id = it.depositType!!.id | ||
code = it.depositType!!.code | ||
value = it.depositType!!.value | ||
} | ||
status = Status().apply { | ||
id = it.status?.id | ||
code = it.status?.code | ||
value = it.status?.value | ||
submittedAndPendingApproval = it.status?.submittedAndPendingApproval | ||
approved = it.status?.approved | ||
rejected = it.status?.rejected | ||
withdrawnByApplicant = it.status?.withdrawnByApplicant | ||
active = it.status?.active | ||
closed = it.status?.closed | ||
} | ||
currency = Currency().apply { | ||
code = it.currency!!.code | ||
name = it.currency!!.name | ||
nameCode = it.currency!!.nameCode | ||
decimalPlaces = it.currency!!.decimalPlaces | ||
displaySymbol = it.currency!!.displaySymbol | ||
displayLabel = it.currency!!.displayLabel | ||
} | ||
} | ||
}!! | ||
loanAccounts = entity.loanAccounts?.map { | ||
LoanAccount().apply { | ||
id = it.id | ||
accountNo = it.accountNo | ||
externalId = it.externalId.toString() | ||
productId = it.productId | ||
productName = it.productName | ||
status = com.mifos.objects.accounts.loan.Status().apply { | ||
id = it.status?.id | ||
code = it.status?.code | ||
value = it.status?.description | ||
pendingApproval = it.status?.pendingApproval | ||
waitingForDisbursal = it.status?.waitingForDisbursal | ||
active = it.status?.active | ||
closedObligationsMet = it.status?.closedObligationsMet | ||
closedWrittenOff = it.status?.closedWrittenOff | ||
closedRescheduled = it.status?.closedRescheduled | ||
closed = it.status?.closed | ||
overpaid = it.status?.overpaid | ||
} | ||
loanType = LoanType().apply { | ||
id = it.loanType?.id | ||
code = it.loanType?.code | ||
value = it.loanType?.description | ||
} | ||
loanCycle = it.loanCycle | ||
} | ||
}!! | ||
} | ||
} | ||
|
||
override fun mapToEntity(domainModel: ClientAccounts): GetClientsClientIdAccountsResponse { | ||
return GetClientsClientIdAccountsResponse().apply { | ||
savingsAccounts = domainModel.savingsAccounts.map { | ||
GetClientsSavingsAccounts().apply { | ||
id = it.id | ||
accountNo = it.accountNo | ||
productId = it.productId | ||
productName = it.productName | ||
status = GetClientsSavingsAccountsStatus().apply { | ||
id = it.status?.id | ||
code = it.status?.code | ||
value = it.status?.value | ||
submittedAndPendingApproval = it.status?.submittedAndPendingApproval | ||
approved = it.status?.approved | ||
rejected = it.status?.rejected | ||
withdrawnByApplicant = it.status?.withdrawnByApplicant | ||
active = it.status?.active | ||
closed = it.status?.closed | ||
} | ||
currency = GetClientsSavingsAccountsCurrency().apply { | ||
code = it.currency!!.code | ||
name = it.currency!!.name | ||
nameCode = it.currency!!.nameCode | ||
decimalPlaces = it.currency!!.decimalPlaces | ||
displaySymbol = it.currency!!.displaySymbol | ||
displayLabel = it.currency!!.displayLabel | ||
} | ||
} | ||
} | ||
loanAccounts = domainModel.loanAccounts.map { | ||
GetClientsLoanAccounts().apply { | ||
id = it.id | ||
accountNo = it.accountNo | ||
externalId = it.externalId?.toInt() | ||
productId = it.productId | ||
productName = it.productName | ||
status = GetClientsLoanAccountsStatus().apply { | ||
id = it.status?.id | ||
code = it.status?.code | ||
description = it.status?.value | ||
pendingApproval = it.status?.pendingApproval | ||
waitingForDisbursal = it.status?.waitingForDisbursal | ||
active = it.status?.active | ||
closedObligationsMet = it.status?.closedObligationsMet | ||
closedWrittenOff = it.status?.closedWrittenOff | ||
closedRescheduled = it.status?.closedRescheduled | ||
closed = it.status?.closed | ||
overpaid = it.status?.overpaid | ||
} | ||
loanType = GetClientsLoanAccountsType().apply { | ||
id = it.loanType?.id | ||
code = it.loanType?.code | ||
description = it.loanType?.value | ||
} | ||
loanCycle = it.loanCycle | ||
} | ||
} | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
mifosng-android/src/main/java/com/mifos/mappers/clients/GetIdentifiersTemplateMapper.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,39 @@ | ||
package com.mifos.mappers.clients | ||
|
||
import com.mifos.objects.noncore.DocumentType | ||
import com.mifos.objects.noncore.IdentifierTemplate | ||
import org.apache.fineract.client.models.GetClientsAllowedDocumentTypes | ||
import org.apache.fineract.client.models.GetClientsClientIdIdentifiersTemplateResponse | ||
import org.mifos.core.data.AbstractMapper | ||
|
||
/** | ||
* Created by Aditya Gupta on 30/08/23. | ||
*/ | ||
|
||
object GetIdentifiersTemplateMapper : | ||
AbstractMapper<GetClientsClientIdIdentifiersTemplateResponse, IdentifierTemplate>() { | ||
|
||
override fun mapFromEntity(entity: GetClientsClientIdIdentifiersTemplateResponse): IdentifierTemplate { | ||
return IdentifierTemplate().apply { | ||
allowedDocumentTypes = entity.allowedDocumentTypes?.map { | ||
DocumentType().apply { | ||
id = it.id | ||
name = it.name | ||
position = it.position | ||
} | ||
} | ||
} | ||
} | ||
|
||
override fun mapToEntity(domainModel: IdentifierTemplate): GetClientsClientIdIdentifiersTemplateResponse { | ||
return GetClientsClientIdIdentifiersTemplateResponse().apply { | ||
allowedDocumentTypes = domainModel.allowedDocumentTypes?.map { | ||
GetClientsAllowedDocumentTypes().apply { | ||
id = it.id | ||
name = it.name | ||
position = it.position | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.