Skip to content

Commit

Permalink
Feat: [:core:model] - Migrated to KMM (#1770)
Browse files Browse the repository at this point in the history
  • Loading branch information
niyajali authored Sep 26, 2024
1 parent 348ec06 commit a3b4fd3
Show file tree
Hide file tree
Showing 134 changed files with 1,553 additions and 2,017 deletions.
3 changes: 0 additions & 3 deletions core/model/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,5 @@ kotlin {
api(libs.kotlinx.datetime)
implementation(libs.kotlinx.serialization.json)
}
androidMain.dependencies {
implementation(libs.squareup.retrofit.converter.gson)
}
}
}
Empty file removed core/model/consumer-rules.pro
Empty file.
21 changes: 0 additions & 21 deletions core/model/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model
package org.mifospay.core.model

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model
package org.mifospay.core.model

import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model
package org.mifospay.core.model

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model
package org.mifospay.core.model

data class UserData(
val isAuthenticated: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.domain
package org.mifospay.core.model.domain

import kotlinx.serialization.Serializable

@Serializable
data class Account(
var image: String = "",
var name: String,
var number: String,
var balance: Double = 0.0,
var id: Long = 0L,
var productId: Long = 0L,
var currency: Currency,
val image: String = "",
val name: String,
val number: String,
val balance: Double = 0.0,
val id: Long = 0L,
val productId: Long = 0L,
val currency: Currency,
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.domain
package org.mifospay.core.model.domain

class Bank(
data class Bank(
val name: String,
val image: Int,
val bankType: BankType = BankType.OTHER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.domain
package org.mifospay.core.model.domain

import android.os.Parcelable
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable

@Parcelize
@Serializable
data class BankAccountDetails(
var bankName: String? = null,
var accountholderName: String? = null,
Expand All @@ -21,6 +20,14 @@ data class BankAccountDetails(
var type: String? = null,
var isUpiEnabled: Boolean = false,
var upiPin: String? = null,
) : Parcelable {
constructor() : this("", "", "", "", "", false, "")
) {
constructor() : this(
bankName = "",
accountholderName = "",
branch = "",
ifsc = "",
type = "",
isUpiEnabled = false,
upiPin = "",
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package org.mifospay.core.model.domain

import kotlinx.serialization.Serializable

@Serializable
data class Currency(
val code: String,
val displaySymbol: String,
val displayLabel: String,
) {
constructor() : this(
code = "",
displaySymbol = "",
displayLabel = "",
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.domain
package org.mifospay.core.model.domain

import kotlinx.datetime.LocalDate

import java.util.Date
data class NewAccount(
var clientId: Int,
var productId: String? = null,
var submittedOnDate: Date? = null,
var accountNo: String,
var locale: String? = null,
var dateFormat: String? = null,
val clientId: Int,
val productId: String? = null,
val submittedOnDate: LocalDate? = null,
val accountNo: String,
val locale: String? = null,
val dateFormat: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.domain
package org.mifospay.core.model.domain

import kotlinx.serialization.Serializable

@Serializable
data class Currency(
var code: String,
var displaySymbol: String,
var displayLabel: String,
) {
constructor() : this("", "", "")
}
data class NotificationPayload(
val title: String? = null,
val body: String? = null,
val timestamp: String? = null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package org.mifospay.core.model.domain

import kotlinx.serialization.Serializable

@Serializable
data class SearchResult(
val resultId: Int = 0,
val resultName: String,
val resultType: String,
) {
constructor() : this(
resultId = 0,
resultName = "",
resultType = "",
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package org.mifospay.core.model.domain

import kotlinx.serialization.Serializable
import org.mifospay.core.model.entity.accounts.savings.TransferDetail

@Serializable
data class Transaction(
val transactionId: String? = null,
val clientId: Long = 0,
val accountId: Long = 0,
val amount: Double = 0.0,
val date: String? = null,
val currency: Currency = Currency(),
val transactionType: TransactionType = TransactionType.OTHER,
val transferId: Long = 0,
val transferDetail: TransferDetail = TransferDetail(),
val receiptId: String? = null,
) {
constructor() : this(
transactionId = "",
clientId = 0,
accountId = 0,
amount = 0.0,
date = "",
currency = Currency(),
transactionType = TransactionType.OTHER,
transferId = 0,
transferDetail = TransferDetail(),
receiptId = "",
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.domain
package org.mifospay.core.model.domain

enum class TransactionType {
DEBIT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.domain.client
package org.mifospay.core.model.domain.client

import kotlinx.serialization.Serializable

@Serializable
data class Client(
var name: String? = null,
var image: String,
var externalId: String? = null,
var clientId: Long = 0L,
var displayName: String,
var mobileNo: String,
val name: String? = null,
val image: String,
val externalId: String? = null,
val clientId: Long = 0L,
val displayName: String,
val mobileNo: String,
) {
constructor() : this("", "", "", 0L, "", "")
constructor() : this(
name = "",
image = "",
externalId = "",
clientId = 0L,
displayName = "",
mobileNo = "",
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.domain.client
package org.mifospay.core.model.domain.client

import com.mifospay.core.model.utils.DateHelper
import org.mifospay.core.model.utils.DateHelper

data class NewClient(
val fullname: String?,
Expand All @@ -23,21 +23,21 @@ data class NewClient(
val mobileNo: String?,
val mifosSavingsProductId: Int?,
) {
val address: MutableList<com.mifospay.core.model.domain.client.NewClient.Address> = mutableListOf()
val activationDate: String = DateHelper.getDateAsStringFromLong(System.currentTimeMillis())
private val address: MutableList<Address> = mutableListOf()
private val activationDate: String = DateHelper.formattedDate
val submittedOnDate: String = activationDate
val savingsProductId: Int = mifosSavingsProductId ?: 0
val externalId: String = userName + "@mifos"
val externalId: String = "$userName@mifos"

init {
address.add(
com.mifospay.core.model.domain.client.NewClient.Address(
addressLine1,
addressLine2,
city,
postalCode,
stateProvinceId,
countryId,
Address(
addressLine1 = addressLine1,
addressLine2 = addressLine2,
street = city,
postalCode = postalCode,
stateProvinceId = stateProvinceId,
countryId = countryId,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.domain.client
package org.mifospay.core.model.domain.client

data class UpdateClientEntityMobile(val mobileNo: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
package org.mifospay.core.model.domain.twofactor

import kotlinx.serialization.Serializable

@Serializable
data class AccessToken(
val token: String? = null,
val validFrom: Long? = null,
val validTo: Long? = null,
)
Loading

0 comments on commit a3b4fd3

Please sign in to comment.