Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
c3fd04f
fix(capture-sdk): add break statement to prevent fall-through in swit…
MozhganPeivandianSharbaf Sep 24, 2025
479ed34
fix(bank-sdk): DocumentAnalyzer screen issues
MozhganPeivandianSharbaf Sep 24, 2025
dd13d3b
fix(bank-sdk): correct logging of document analysis failure message
MozhganPeivandianSharbaf Sep 24, 2025
8e6135a
fix(bank-sdk): DigitalInvoiceScreenPresenter.kt issues
MozhganPeivandianSharbaf Sep 24, 2025
5af36d8
fix(bank-sdk): update DigitalInvoiceScreenPresenter to implement stop…
MozhganPeivandianSharbaf Sep 24, 2025
44e67c7
fix(bank-sdk): LineItemsAdapter.kt issues
MozhganPeivandianSharbaf Sep 24, 2025
8031836
fix(bank-sdk): add no-op comments for default implementations in vari…
MozhganPeivandianSharbaf Sep 24, 2025
79eb9ed
feat(bank-sdk): shifting the logic of transforming to separate method…
obaidgini Sep 29, 2025
5027b0f
feat(bank-sdk): Removed extra space
obaidgini Sep 29, 2025
2be3962
Merge pull request #841 from gini/PP-1761-blocker-analysisScreenPrese…
MozhganPeivandianSharbaf Oct 1, 2025
a597def
Merge pull request #844 from gini/PP-1771-DigitalInvoiceScreenPresent…
MozhganPeivandianSharbaf Oct 1, 2025
df5644b
fix(bank-sdk): reorganize companion object and improve code formatting
MozhganPeivandianSharbaf Oct 13, 2025
e442076
Merge pull request #843 from gini/PP-1763-DocumentAnalyzer-screen-issues
MozhganPeivandianSharbaf Oct 14, 2025
9ca3c14
fix(bank-sdk): standardize no-op comments across multiple files
MozhganPeivandianSharbaf Oct 14, 2025
d9b681e
Merge pull request #845 from gini/PP-1772-LineItemsAdapter.kt-issues
MozhganPeivandianSharbaf Oct 14, 2025
02e258f
Merge pull request #848 from gini/PP-1769-Digital-invoice-issues
obaidgini Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,26 @@ class DocumentAnalyzer @JvmOverloads internal constructor(
filename = null,
documentType = null
).mapSuccess { partialDocumentResource ->
Log.d("gini-api", "Partial document created: " + partialDocumentResource.data.id)
Log.d(LOG_TAG, "Partial document created: " + partialDocumentResource.data.id)
Log.d(
"gini-api", "Creating composite document for partial document: " + partialDocumentResource.data.id
LOG_TAG, "Creating composite document for partial document: " + partialDocumentResource.data.id
)
documentManager.createCompositeDocument(listOf(partialDocumentResource.data))
}.mapSuccess { compositeDocumentResource ->
Log.d("gini-api", "Composite document created: " + compositeDocumentResource.data.id)
Log.d(LOG_TAG, "Composite document created: " + compositeDocumentResource.data.id)
giniApiDocument = compositeDocumentResource.data
Log.d(
"gini-api", "Getting extractions for composite document: " + compositeDocumentResource.data.id
LOG_TAG, "Getting extractions for composite document: " + compositeDocumentResource.data.id
)
documentManager.getAllExtractionsWithPolling(compositeDocumentResource.data)
}
when (extractionsResource) {
is Resource.Success -> {
Log.d("gini-api", "Analysis completed for document: ${giniApiDocument?.id}")
Log.d(LOG_TAG, "Analysis completed for document: ${giniApiDocument?.id}")
listener?.onExtractionsReceived(extractionsResource.data.specificExtractions)
}
is Resource.Error -> {
Log.d("gini-api", "Analysis failed for document ${giniApiDocument?.id}: ${extractionsResource!!.message}")
Log.d(LOG_TAG, "Analysis failed for document ${giniApiDocument?.id}: ${extractionsResource.message}")
listener?.onException(Exception(extractionsResource.message, extractionsResource.exception))
}
is Resource.Cancelled -> {}
Expand All @@ -82,4 +82,8 @@ class DocumentAnalyzer @JvmOverloads internal constructor(
fun onException(exception: Exception)
fun onExtractionsReceived(extractions: Map<String, SpecificExtraction>)
}

companion object {
private const val LOG_TAG = "gini-api"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -301,51 +301,7 @@ internal class DigitalInvoice(
_compoundExtractions = compoundExtractions.mapValues { (name, extraction) ->
when (name) {
"lineItems" -> {
val cameraExtractions =
extraction.specificExtractionMaps.mapIndexed { index, lineItemExtractions ->
selectableLineItems.find { it.lineItem.id.toInt() == index }
?.let { sli ->
val extractions =
lineItemExtractions.mapValues { (name, lineItemExtraction) ->
when (name) {
"description" -> copyGiniCaptureSpecificExtraction(
lineItemExtraction,
sli.lineItem.description
)

"baseGross" -> copyGiniCaptureSpecificExtraction(
lineItemExtraction,
sli.lineItem.rawGrossPrice
)

"quantity" -> copyGiniCaptureSpecificExtraction(
lineItemExtraction,
if (sli.selected) {
sli.lineItem.quantity.toString()
} else {
"0"
}
)

else -> lineItemExtraction
}
}.toMutableMap()
sli.reason?.let { returnReason ->
extractions.put(
"returnReason", GiniCaptureSpecificExtraction(
"returnReason",
returnReason.id,
"",
null,
emptyList()
)
)
}
extractions
}
}.filterNotNull().toMutableList()


val cameraExtractions = transformLineItemExtractions(extraction)
val userAddedExtractions = selectableLineItems.filter { it.addedByUser }
.map {
it.lineItem.asGiniExtractionMap()
Expand All @@ -364,6 +320,51 @@ internal class DigitalInvoice(
}
}

private fun transformLineItemExtractions(extraction: GiniCaptureCompoundExtraction): MutableList<MutableMap<String, GiniCaptureSpecificExtraction>> {
return extraction.specificExtractionMaps.mapIndexed { index, lineItemExtractions ->
selectableLineItems.find { it.lineItem.id.toInt() == index }
?.let { sli ->
val extractions =
lineItemExtractions.mapValues { (name, lineItemExtraction) ->
when (name) {
"description" -> copyGiniCaptureSpecificExtraction(
lineItemExtraction,
sli.lineItem.description
)

"baseGross" -> copyGiniCaptureSpecificExtraction(
lineItemExtraction,
sli.lineItem.rawGrossPrice
)

"quantity" -> copyGiniCaptureSpecificExtraction(
lineItemExtraction,
if (sli.selected) {
sli.lineItem.quantity.toString()
} else {
"0"
}
)

else -> lineItemExtraction
}
}.toMutableMap()
sli.reason?.let { returnReason ->
extractions.put(
"returnReason", GiniCaptureSpecificExtraction(
"returnReason",
returnReason.id,
"",
null,
emptyList()
)
)
}
extractions
}
}.filterNotNull().toMutableList()
}

fun updateAmountToPayExtractionWithTotalPrice() {
val totalPrice = getAmountToPay().toPriceString(
selectableLineItems.firstOrNull()?.lineItem?.rawCurrency ?: "EUR"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ internal class DigitalInvoiceScreenPresenter(
}

override fun stop() {
// No-op
}

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ internal sealed class ViewHolder<in T>(itemView: View, val viewType: ViewType) :
}

override fun unbind() {
/* no-op */
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import android.widget.EditText
internal fun EditText.doAfterTextChanged(afterTextChanged: (String) -> Unit): TextWatcher =
object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
/* no-op */
}

override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
/* no-op */
}

override fun afterTextChanged(editable: Editable?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ internal class LineItemDetailsScreenPresenter(
}

override fun stop() {
/* no-op */
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ internal class DigitalOnboardingScreenPresenter(
}

override fun start() {
/* no-op */
}

override fun stop() {
/* no-op */
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interface DigitalInvoiceNavigationBarBottomAdapter : InjectedViewAdapter {
* Example value: "3% Skonto discount"
*/
fun onSkontoPercentageBadgeUpdated(text: String) {

/* no-op */
}

/**
Expand All @@ -57,7 +57,7 @@ interface DigitalInvoiceNavigationBarBottomAdapter : InjectedViewAdapter {
* @param isVisible visibility flag
*/
fun onSkontoPercentageBadgeVisibilityUpdate(isVisible: Boolean) {

/* no-op */
}

/**
Expand All @@ -67,7 +67,7 @@ interface DigitalInvoiceNavigationBarBottomAdapter : InjectedViewAdapter {
* Example value: `"Save 100.00 EUR"`
*/
fun onSkontoSavingsAmountUpdated(text: String) {

/* no-op */
}

/**
Expand All @@ -76,7 +76,7 @@ interface DigitalInvoiceNavigationBarBottomAdapter : InjectedViewAdapter {
* @param isVisible visibility flag
*/
fun onSkontoSavingsAmountVisibilityUpdated(isVisible: Boolean) {

/* no-op */
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ public Void apply(final AnalysisInteractor.ResultHolder resultHolder,
} else {
proceedWithExtractions(resultHolder);
}
break;
case NO_NETWORK_SERVICE:
break;
default:
Expand Down