Ref(DeviceInfo-PaymentResult-WebView):

- Refactor `PaymentResultEntity` to include a nested `PaymentResultDataEntity` and companion factory methods for success and failure.
- Update `PaymentResultStatus` enum members from `OK`/`ERROR` to `SUCCESS`/`FAILURE`.
- Modify `PspService` and its implementations (`P3`, `PS4`, `Stage`) to return a non-nullable `PaymentResultEntity`.
- Enhance `PspWebView` with improved instance lifecycle management, `rememberUpdatedState` for callbacks, and new `onWebViewReady` and `onPageFinished` hooks.
- Optimize `PspWebView` to prevent redundant `loadUrl` calls during recomposition.
- Add `README.md` and `AGENT.md` to provide project architecture overviews and hardware-specific development guidelines.
- Update `TisWebViewScreen` and `StageWebViewScreen` to handle the refactored result models and utilize new WebView callbacks.
This commit is contained in:
Amir Mousavi
2026-05-17 13:40:32 +03:30
parent 2b03af6e52
commit 08060001e1
14 changed files with 254 additions and 72 deletions
@@ -12,5 +12,5 @@ interface PspService {
fun decodePosResponse(
id: String?,
activityResult: ActivityResult
): PaymentResultEntity?
): PaymentResultEntity
}
@@ -1,15 +1,48 @@
package com.example.core.model
import com.google.gson.annotations.SerializedName
data class PaymentResultEntity(
val id : String? = null,
val status : PaymentResultStatus,
val terminalId : String,
val stan : String,
val rrn : String,
val responseCode : String,
val customerCardNO : String,
val transactionDateTime : String,
val description : String?,
val id: String? = null,
val status: PaymentResultStatus,
val message: String?,
@SerializedName("data")
val paymentResultDataEntity: PaymentResultDataEntity? = null,
) {
data class PaymentResultDataEntity(
val terminalId: String,
val stan: String,
val rrn: String,
val responseCode: String,
val customerCardNO: String,
val transactionDateTime: String,
)
companion object {
fun success(
id: String? = null,
message: String? = "Success",
data: PaymentResultDataEntity? = null
): PaymentResultEntity {
return PaymentResultEntity(
id = id,
status = PaymentResultStatus.SUCCESS,
message = message,
paymentResultDataEntity = data
)
}
)
fun failure(
id: String? = null,
message: String? = "Failure",
data: PaymentResultDataEntity? = null
): PaymentResultEntity {
return PaymentResultEntity(
id = id,
status = PaymentResultStatus.FAILURE,
message = message,
paymentResultDataEntity = data
)
}
}
}
@@ -1,6 +1,6 @@
package com.example.core.model
enum class PaymentResultStatus {
OK,
ERROR
SUCCESS,
FAILURE
}