Skip to content

Commit

Permalink
Merge pull request #17 from Data-Tech-International/release/3.4.0
Browse files Browse the repository at this point in the history
Release/3.4.0
  • Loading branch information
marsicdev authored Aug 20, 2024
2 parents 62ff854 + 6e0d598 commit 3b71009
Show file tree
Hide file tree
Showing 50 changed files with 920 additions and 443 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/v3-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the code to specific branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3

- name: Make gradlew executable
run: chmod +x ./gradlew
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:

- name: Create Github Release
id: create_release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ env.BUILD_TARGET == 'debug' }}
tag_name: ${{ env.VERSION_TAG }}
Expand Down
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@

All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- **TBD** Invoice catalog search
- **TBD** TaxRates valid from date

### Fixed

- **TBD** Configuration response error handling

## [3.4.0] - 2024-07-22

### Added

- Support for Android 14
- New language Serbian (BA) - `Serbian (Latin) (Bosnia and Herzegovina) (sr-Latn-BA)`

### Changed

- Display tax labels from all category types
- Backup disabled in manifest
- FR translations updated
- Update build gradle version
- Java compatibility version

### Fixed

- Certificate error fallback - PKCS12 key store mac invalid
- Unhandled file import/export exceptions
- Lint warnings for deprecated syntax
- Layout issue for cashiers

## [3.3.0] - 2023-03-03

### Added
Expand Down
55 changes: 29 additions & 26 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'realm-android'
// Add the Firebase Crashlytics plugin.
id 'com.google.firebase.crashlytics'
}

def versionMajor = 3
def versionMinor = 3
def versionMinor = 4
def versionPatch = 0
def versionBuild = 1

Expand All @@ -17,19 +18,23 @@ def appVersionBuild = Integer.valueOf(System.env.GITHUB_RUN_NUMBER ?: versionBui
android {
namespace 'online.taxcore.pos'

compileSdkVersion 33
compileSdk 34

bundle {
language {
enableSplit = false
}
}

buildFeatures {
viewBinding true
}

defaultConfig {
applicationId "online.taxcore.pos"

minSdkVersion 24
targetSdkVersion 33
minSdk 24
targetSdk 34

versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch * 10 + appVersionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
Expand Down Expand Up @@ -67,11 +72,11 @@ android {
}

compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

task printVersionInformation {
tasks.register("printVersionInformation") {
// Full version with build number
println defaultConfig.versionName
// Version without build number
Expand All @@ -92,19 +97,19 @@ dependencies {

implementation 'org.bouncycastle:bcpkix-jdk15on:1.67'

implementation "com.pawegio.kandroid:kandroid:0.8.7@aar"
implementation 'com.github.pawegio:kandroid:0.8.7@aar'

//Android libs
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.appcompat:appcompat:1.7.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.preference:preference-ktx:1.2.0"
implementation "androidx.preference:preference-ktx:1.2.1"
implementation "androidx.security:security-crypto:1.0.0"
implementation "androidx.core:core-ktx:1.9.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation "androidx.core:core-ktx:1.13.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.3"

implementation "com.android.support:design:$support"
implementation "com.android.support.constraint:constraint-layout:2.0.4"
implementation "com.google.android.material:material:1.8.0"
implementation "com.google.android.material:material:1.12.0"

// dagger
implementation "com.google.dagger:dagger:$dagger"
Expand All @@ -118,7 +123,7 @@ dependencies {
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.2"
implementation "com.google.code.gson:gson:2.8.9"
implementation "com.google.code.gson:gson:2.10.1"

//Glide
implementation "com.github.bumptech.glide:glide:4.12.0"
Expand All @@ -131,20 +136,18 @@ dependencies {
implementation 'com.afollestad.material-dialogs:bottomsheets:3.3.0'
implementation 'com.afollestad.material-dialogs:datetime:3.3.0'

implementation 'com.chaos.view:pinview:1.4.3'
implementation 'io.github.chaosleung:pinview:1.4.4'

implementation "org.greenrobot:eventbus:3.0.0"
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
implementation "com.itextpdf:itextpdf:5.5.13.3"
implementation "com.madgag:scpkix-jdk15on:1.47.0.1"
implementation "net.cachapa.expandablelayout:expandablelayout:2.9.2"

implementation "com.github.vicpinm:krealmextensions:2.5.0"

// Kotlin
implementation "org.jetbrains.anko:anko-commons:0.10.5"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"

implementation platform('com.google.firebase:firebase-bom:26.2.0')

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<application
android:name="online.taxcore.pos.TaxCoreApp"
android:allowBackup="true"
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/online/taxcore/pos/TaxCoreApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class TaxCoreApp : Application(), HasActivityInjector {
private fun initRealm() {
Realm.init(this)
val config = RealmConfiguration.Builder()
.schemaVersion(1)
.name("taxcore3.realm")
.schemaVersion(2)
.allowQueriesOnUiThread(true)
.allowWritesOnUiThread(true)
.name("taxcore3.realm")
.build()

Realm.setDefaultConfiguration(config)
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/java/online/taxcore/pos/data/api/ApiService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ import retrofit2.http.*
interface ApiService {

@Headers(
"Accept: application/json",
"Content-Type: application/json"
"Accept: application/json",
"Content-Type: application/json"
)
@POST("api/v3/invoices")
fun createInvoice(
@Header("PAC") pacValue: String,
@Body payload: InvoiceRequest
@Header("PAC") pacValue: String,
@Body payload: InvoiceRequest
): Call<InvoiceResponse>

@Headers(
"Accept: application/json",
"Content-Type: application/json"
"Accept: application/json",
"Content-Type: application/json"
)
@GET("api/v3/status")
fun getTaxes(
@Header("PAC") pacValue: String
@Header("PAC") pacValue: String
): Call<StatusResponse>

@GET("api/v3/environment-parameters")
fun fetchEnvParams(
@Header("PAC") pacValue: String
@Header("PAC") pacValue: String
): Call<EnvResponse>

}
21 changes: 0 additions & 21 deletions app/src/main/java/online/taxcore/pos/data/local/TaxesManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,6 @@ object TaxesManager {
}
}

fun addItemToDatabase(taxItem: TaxItem) {
val realm = Realm.getDefaultInstance()
try {
realm.executeTransaction {
// Add a appliedTaxes
val taxes = realm.createObject<TaxesSettings>()
with(taxes) {
code = taxItem.label
name = taxItem.name
rate = taxItem.rate
value = taxItem.value
}
addItem(0, taxes)
}
} catch (e: Exception) {
print(e)
} finally {
realm.close()
}
}

fun getAllTaxes(): ArrayList<TaxesSettings> {
val realm = Realm.getDefaultInstance()
try {
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/online/taxcore/pos/data/models/Item.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class Item {
var name: String = ""
var gtin: String? = null
var quantity: Double = 0.000
var discount: Double = 0.00
var labels: List<String> = arrayListOf()
var unitPrice: Double = 0.00
var totalAmount: Double = 0.00
Expand Down
30 changes: 20 additions & 10 deletions app/src/main/java/online/taxcore/pos/data/models/StatusResponse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package online.taxcore.pos.data.models

import online.taxcore.pos.utils.TCUtil

private const val AmountPerQuantityCategory = "2"

class StatusResponse {
var sdcDateTime: String = ""
var supportedLanguages: List<String> = arrayListOf()
Expand All @@ -11,19 +13,27 @@ class StatusResponse {
var currentTaxRates: CurrentTaxRate? = null
var gsc: List<String> = arrayListOf()

fun getTaxLabels(countryCode: String = ""): List<TaxItem>? {
fun getTaxLabels(countryCode: String = ""): List<TaxItem> {
val currencySymbol = TCUtil.getCurrencyBy(countryCode)
return currentTaxRates?.taxCategories?.map { taxCategory ->
val mappedTaxLabels = arrayListOf<TaxItem>()

currentTaxRates?.taxCategories?.forEach { taxCategory ->
val taxValue =
if (taxCategory.categoryType == "AmountPerQuantity") currencySymbol else "%"

TaxItem(
name = taxCategory.name,
label = taxCategory.taxRates.first().label, // FIXME: 29.7.21. Map all taxRates
rate = taxCategory.taxRates.first().rate, // FIXME: 29.7.21. Map all taxRates
value = taxValue,
)
if (taxCategory.categoryType == AmountPerQuantityCategory) currencySymbol else "%"

taxCategory.taxRates.forEach { taxRate ->
val tItem = TaxItem(
name = taxCategory.name,
label = taxRate.label,
rate = taxRate.rate,
value = taxValue,
)

mappedTaxLabels.add(tItem)
}
}

return mappedTaxLabels
}

fun hasErrors(): Boolean {
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/online/taxcore/pos/data/models/TaxItem.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package online.taxcore.pos.data.models

data class TaxItem(
// val categoryType: Int,
val label: String,
// val amount: Double,
val rate: Double,
// val categoryName: String,
val name: String,
var value: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ class PaymentItem(
var amount: Double = 0.0,
var paymentType: String = ""
)

enum class InvoiceRequestType {
VSDC,
ESDC
}
15 changes: 4 additions & 11 deletions app/src/main/java/online/taxcore/pos/data/services/SdcService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,12 @@ object SdcService {
}

pingRequest?.enqueue(object : Callback<ResponseBody> {
override fun onFailure(call: Call<ResponseBody>?, t: Throwable?) {
override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
onError(null)
onEnd()
}

override fun onResponse(
call: Call<ResponseBody>?,
response: Response<ResponseBody>?
) {
response ?: return onEnd()

override fun onResponse(call: Call<ResponseBody>, response: Response<ResponseBody>) {
if (response.isSuccessful) {
onSuccess()
return onEnd()
Expand Down Expand Up @@ -118,9 +113,7 @@ object SdcService {
val environment = response.body() ?: return onEnd()
val activeTaxItems = statusResponse.getTaxLabels(environment.country)

activeTaxItems?.let { taxItems ->
TaxesManager.replaceActiveTaxItems(taxItems)
}
TaxesManager.replaceActiveTaxItems(activeTaxItems)

AppSession.let {
it.isAppConfigured = true
Expand Down Expand Up @@ -203,7 +196,7 @@ object SdcService {
}

val taxes =
statusResponse.getTaxLabels(environment.country) ?: arrayListOf()
statusResponse.getTaxLabels(environment.country)

// Remove previous taxes from DB
TaxesManager.replaceActiveTaxItems(taxes)
Expand Down
Loading

0 comments on commit 3b71009

Please sign in to comment.