Skip to content

Commit a3b4fd3

Browse files
authored
Feat: [:core:model] - Migrated to KMM (#1770)
1 parent 348ec06 commit a3b4fd3

File tree

134 files changed

+1553
-2017
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+1553
-2017
lines changed

core/model/build.gradle.kts

-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,5 @@ kotlin {
2323
api(libs.kotlinx.datetime)
2424
implementation(libs.kotlinx.serialization.json)
2525
}
26-
androidMain.dependencies {
27-
implementation(libs.squareup.retrofit.converter.gson)
28-
}
2926
}
3027
}

core/model/consumer-rules.pro

Whitespace-only changes.

core/model/proguard-rules.pro

-21
This file was deleted.

core/model/src/main/java/com/mifospay/core/model/City.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/City.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model
10+
package org.mifospay.core.model
1111

1212
import kotlinx.serialization.SerialName
1313
import kotlinx.serialization.Serializable

core/model/src/main/java/com/mifospay/core/model/Country.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/Country.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model
10+
package org.mifospay.core.model
1111

1212
import kotlinx.serialization.Serializable
1313

core/model/src/main/java/com/mifospay/core/model/State.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/State.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model
10+
package org.mifospay.core.model
1111

1212
import kotlinx.serialization.SerialName
1313
import kotlinx.serialization.Serializable

core/model/src/main/java/com/mifospay/core/model/UserData.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/UserData.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model
10+
package org.mifospay.core.model
1111

1212
data class UserData(
1313
val isAuthenticated: Boolean,

core/model/src/main/java/com/mifospay/core/model/domain/Account.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/domain/Account.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model.domain
10+
package org.mifospay.core.model.domain
1111

1212
import kotlinx.serialization.Serializable
1313

1414
@Serializable
1515
data class Account(
16-
var image: String = "",
17-
var name: String,
18-
var number: String,
19-
var balance: Double = 0.0,
20-
var id: Long = 0L,
21-
var productId: Long = 0L,
22-
var currency: Currency,
16+
val image: String = "",
17+
val name: String,
18+
val number: String,
19+
val balance: Double = 0.0,
20+
val id: Long = 0L,
21+
val productId: Long = 0L,
22+
val currency: Currency,
2323
)

core/model/src/main/java/com/mifospay/core/model/domain/Bank.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/domain/Bank.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model.domain
10+
package org.mifospay.core.model.domain
1111

12-
class Bank(
12+
data class Bank(
1313
val name: String,
1414
val image: Int,
1515
val bankType: BankType = BankType.OTHER,

core/model/src/main/java/com/mifospay/core/model/domain/BankAccountDetails.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/domain/BankAccountDetails.kt

+13-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model.domain
10+
package org.mifospay.core.model.domain
1111

12-
import android.os.Parcelable
13-
import kotlinx.parcelize.Parcelize
12+
import kotlinx.serialization.Serializable
1413

15-
@Parcelize
14+
@Serializable
1615
data class BankAccountDetails(
1716
var bankName: String? = null,
1817
var accountholderName: String? = null,
@@ -21,6 +20,14 @@ data class BankAccountDetails(
2120
var type: String? = null,
2221
var isUpiEnabled: Boolean = false,
2322
var upiPin: String? = null,
24-
) : Parcelable {
25-
constructor() : this("", "", "", "", "", false, "")
23+
) {
24+
constructor() : this(
25+
bankName = "",
26+
accountholderName = "",
27+
branch = "",
28+
ifsc = "",
29+
type = "",
30+
isUpiEnabled = false,
31+
upiPin = "",
32+
)
2633
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
9+
*/
10+
package org.mifospay.core.model.domain
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class Currency(
16+
val code: String,
17+
val displaySymbol: String,
18+
val displayLabel: String,
19+
) {
20+
constructor() : this(
21+
code = "",
22+
displaySymbol = "",
23+
displayLabel = "",
24+
)
25+
}

core/model/src/main/java/com/mifospay/core/model/domain/NewAccount.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/domain/NewAccount.kt

+9-8
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model.domain
10+
package org.mifospay.core.model.domain
11+
12+
import kotlinx.datetime.LocalDate
1113

12-
import java.util.Date
1314
data class NewAccount(
14-
var clientId: Int,
15-
var productId: String? = null,
16-
var submittedOnDate: Date? = null,
17-
var accountNo: String,
18-
var locale: String? = null,
19-
var dateFormat: String? = null,
15+
val clientId: Int,
16+
val productId: String? = null,
17+
val submittedOnDate: LocalDate? = null,
18+
val accountNo: String,
19+
val locale: String? = null,
20+
val dateFormat: String? = null,
2021
)

core/model/src/main/java/com/mifospay/core/model/domain/Currency.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/domain/NotificationPayload.kt

+6-8
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model.domain
10+
package org.mifospay.core.model.domain
1111

1212
import kotlinx.serialization.Serializable
1313

1414
@Serializable
15-
data class Currency(
16-
var code: String,
17-
var displaySymbol: String,
18-
var displayLabel: String,
19-
) {
20-
constructor() : this("", "", "")
21-
}
15+
data class NotificationPayload(
16+
val title: String? = null,
17+
val body: String? = null,
18+
val timestamp: String? = null,
19+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
9+
*/
10+
package org.mifospay.core.model.domain
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class SearchResult(
16+
val resultId: Int = 0,
17+
val resultName: String,
18+
val resultType: String,
19+
) {
20+
constructor() : this(
21+
resultId = 0,
22+
resultName = "",
23+
resultType = "",
24+
)
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
9+
*/
10+
package org.mifospay.core.model.domain
11+
12+
import kotlinx.serialization.Serializable
13+
import org.mifospay.core.model.entity.accounts.savings.TransferDetail
14+
15+
@Serializable
16+
data class Transaction(
17+
val transactionId: String? = null,
18+
val clientId: Long = 0,
19+
val accountId: Long = 0,
20+
val amount: Double = 0.0,
21+
val date: String? = null,
22+
val currency: Currency = Currency(),
23+
val transactionType: TransactionType = TransactionType.OTHER,
24+
val transferId: Long = 0,
25+
val transferDetail: TransferDetail = TransferDetail(),
26+
val receiptId: String? = null,
27+
) {
28+
constructor() : this(
29+
transactionId = "",
30+
clientId = 0,
31+
accountId = 0,
32+
amount = 0.0,
33+
date = "",
34+
currency = Currency(),
35+
transactionType = TransactionType.OTHER,
36+
transferId = 0,
37+
transferDetail = TransferDetail(),
38+
receiptId = "",
39+
)
40+
}

core/model/src/main/java/com/mifospay/core/model/domain/TransactionType.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/domain/TransactionType.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model.domain
10+
package org.mifospay.core.model.domain
1111

1212
enum class TransactionType {
1313
DEBIT,

core/model/src/main/java/com/mifospay/core/model/domain/client/Client.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/domain/client/Client.kt

+15-8
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,25 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model.domain.client
10+
package org.mifospay.core.model.domain.client
1111

1212
import kotlinx.serialization.Serializable
1313

1414
@Serializable
1515
data class Client(
16-
var name: String? = null,
17-
var image: String,
18-
var externalId: String? = null,
19-
var clientId: Long = 0L,
20-
var displayName: String,
21-
var mobileNo: String,
16+
val name: String? = null,
17+
val image: String,
18+
val externalId: String? = null,
19+
val clientId: Long = 0L,
20+
val displayName: String,
21+
val mobileNo: String,
2222
) {
23-
constructor() : this("", "", "", 0L, "", "")
23+
constructor() : this(
24+
name = "",
25+
image = "",
26+
externalId = "",
27+
clientId = 0L,
28+
displayName = "",
29+
mobileNo = "",
30+
)
2431
}

core/model/src/main/java/com/mifospay/core/model/domain/client/NewClient.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/domain/client/NewClient.kt

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model.domain.client
10+
package org.mifospay.core.model.domain.client
1111

12-
import com.mifospay.core.model.utils.DateHelper
12+
import org.mifospay.core.model.utils.DateHelper
1313

1414
data class NewClient(
1515
val fullname: String?,
@@ -23,21 +23,21 @@ data class NewClient(
2323
val mobileNo: String?,
2424
val mifosSavingsProductId: Int?,
2525
) {
26-
val address: MutableList<com.mifospay.core.model.domain.client.NewClient.Address> = mutableListOf()
27-
val activationDate: String = DateHelper.getDateAsStringFromLong(System.currentTimeMillis())
26+
private val address: MutableList<Address> = mutableListOf()
27+
private val activationDate: String = DateHelper.formattedDate
2828
val submittedOnDate: String = activationDate
2929
val savingsProductId: Int = mifosSavingsProductId ?: 0
30-
val externalId: String = userName + "@mifos"
30+
val externalId: String = "$userName@mifos"
3131

3232
init {
3333
address.add(
34-
com.mifospay.core.model.domain.client.NewClient.Address(
35-
addressLine1,
36-
addressLine2,
37-
city,
38-
postalCode,
39-
stateProvinceId,
40-
countryId,
34+
Address(
35+
addressLine1 = addressLine1,
36+
addressLine2 = addressLine2,
37+
street = city,
38+
postalCode = postalCode,
39+
stateProvinceId = stateProvinceId,
40+
countryId = countryId,
4141
),
4242
)
4343
}

core/model/src/main/java/com/mifospay/core/model/domain/client/UpdateClientEntityMobile.kt core/model/src/commonMain/kotlin/org/mifospay/core/model/domain/client/UpdateClientEntityMobile.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package com.mifospay.core.model.domain.client
10+
package org.mifospay.core.model.domain.client
1111

1212
data class UpdateClientEntityMobile(val mobileNo: String)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
9+
*/
10+
package org.mifospay.core.model.domain.twofactor
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class AccessToken(
16+
val token: String? = null,
17+
val validFrom: Long? = null,
18+
val validTo: Long? = null,
19+
)

0 commit comments

Comments
 (0)