commit d5c0b3a885ad522c2c6f8575f25ea0965fc43df1
parent 8e35e0df1e5f40d06adbcea56f1934b96f6b9730
Author: Joel-Haeberli <haebu@rubigen.ch>
Date: Tue, 21 May 2024 23:41:15 +0200
fix: last retry will be set infinitely often
Diffstat:
7 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/c2ec/api-terminals.go b/c2ec/api-terminals.go
@@ -212,6 +212,7 @@ func handleWithdrawalCheck(res http.ResponseWriter, req *http.Request) {
return
}
+ LogInfo("terminals-api", "received check request for provider_transactio_id="+paymentNotification.ProviderTransactionId)
err = DB.NotifyPayment(
wpd,
paymentNotification.ProviderTransactionId,
diff --git a/c2ec/proc-attestor.go b/c2ec/proc-attestor.go
@@ -131,37 +131,38 @@ func finaliseOrSetRetry(
prepareRetryOrAbort(withdrawalRowId, errs)
}
-// Checks wether the maximal amount of retries was already
-// reached and the withdrawal operation shall be aborted or
-// triggers the next retry by setting the last_retry_ts field
-// which will trigger the stored procedure triggering the retry
-// process. The retry counter of the retries is handled by the
-// retrier logic and shall not be set here!
+// sets the last retry timestamp.
func prepareRetryOrAbort(
withdrawalRowId int,
errs chan error,
) {
- withdrawal, err := DB.GetWithdrawalById(withdrawalRowId)
+ // withdrawal, err := DB.GetWithdrawalById(withdrawalRowId)
+ // if err != nil {
+ // LogError("proc-attestor", err)
+ // errs <- err
+ // return
+ // }
+
+ lastRetryTs := time.Now().Unix()
+ err := DB.SetLastRetry(withdrawalRowId, lastRetryTs)
if err != nil {
LogError("proc-attestor", err)
- errs <- err
- return
}
- if withdrawal.RetryCounter >= CONFIG.Server.MaxRetries {
-
- LogInfo("proc-attestor", fmt.Sprintf("max retries for withdrawal with id=%d was reached. withdrawal is aborted.", withdrawal.WithdrawalRowId))
- err := DB.FinaliseWithdrawal(withdrawalRowId, ABORTED, make([]byte, 0))
- if err != nil {
- LogError("proc-attestor", err)
- }
- } else {
-
- lastRetryTs := time.Now().Unix()
- err := DB.SetLastRetry(withdrawalRowId, lastRetryTs)
- if err != nil {
- LogError("proc-attestor", err)
- }
- }
+ // if withdrawal.RetryCounter >= CONFIG.Server.MaxRetries {
+
+ // LogInfo("proc-attestor", fmt.Sprintf("max retries for withdrawal with id=%d was reached. withdrawal is aborted.", withdrawal.WithdrawalRowId))
+ // err := DB.FinaliseWithdrawal(withdrawalRowId, ABORTED, make([]byte, 0))
+ // if err != nil {
+ // LogError("proc-attestor", err)
+ // }
+ // } else {
+
+ // lastRetryTs := time.Now().Unix()
+ // err := DB.SetLastRetry(withdrawalRowId, lastRetryTs)
+ // if err != nil {
+ // LogError("proc-attestor", err)
+ // }
+ // }
}
diff --git a/wallee-c2ec/app/release/app-release.apk b/wallee-c2ec/app/release/app-release.apk
Binary files differ.
diff --git a/wallee-c2ec/app/release/baselineProfiles/0/app-release.dm b/wallee-c2ec/app/release/baselineProfiles/0/app-release.dm
Binary files differ.
diff --git a/wallee-c2ec/app/release/baselineProfiles/1/app-release.dm b/wallee-c2ec/app/release/baselineProfiles/1/app-release.dm
Binary files differ.
diff --git a/wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/client/taler/model/TerminalsApiModel.kt b/wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/client/taler/model/TerminalsApiModel.kt
@@ -27,7 +27,7 @@ data class TerminalWithdrawalSetupResponse(
data class TerminalWithdrawalConfirmationRequest(
@Json(name = "provider_transaction_id") val providerTransactionId: String,
- @Json(name = "terminal_fees") val terminalFees: Amount
+ @Json(name = "terminal_fees") val terminalFees: String
)
enum class WithdrawalOperationStatus(val value: String) {
diff --git a/wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/withdrawal/WithdrawalViewModel.kt b/wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/withdrawal/WithdrawalViewModel.kt
@@ -253,7 +253,7 @@ class WithdrawalViewModel(
_uiState.value.encodedWopid,
TerminalWithdrawalConfirmationRequest(
_uiState.value.encodedWopid,
- Amount(0, 0)
+ TerminalClient.FormatAmount(Amount(0,0,_uiState.value.currency))
)
) {
if (!it) {