Merge pull request 'fixed processing status' (#566) from fr-568 into main
All checks were successful
ci/woodpecker/push/frontend Pipeline was successful
All checks were successful
ci/woodpecker/push/frontend Pipeline was successful
Reviewed-on: #566
This commit was merged in pull request #566.
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import 'package:pshared/models/payment/operation.dart';
|
import 'package:pshared/models/payment/operation.dart';
|
||||||
import 'package:pshared/models/payment/payment.dart';
|
import 'package:pshared/models/payment/payment.dart';
|
||||||
|
import 'package:pshared/models/payment/state.dart';
|
||||||
import 'package:pshared/models/payment/status.dart';
|
import 'package:pshared/models/payment/status.dart';
|
||||||
import 'package:pshared/utils/money.dart';
|
import 'package:pshared/utils/money.dart';
|
||||||
|
|
||||||
import 'package:pweb/models/payment/payment_state.dart';
|
|
||||||
|
|
||||||
OperationItem mapPaymentToOperation(Payment payment) {
|
OperationItem mapPaymentToOperation(Payment payment) {
|
||||||
final debit = payment.lastQuote?.amounts?.sourceDebitTotal;
|
final debit = payment.lastQuote?.amounts?.sourceDebitTotal;
|
||||||
@@ -51,15 +51,15 @@ OperationItem mapPaymentToOperation(Payment payment) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OperationStatus statusFromPayment(Payment payment) {
|
OperationStatus statusFromPayment(Payment payment) {
|
||||||
final state = paymentStateFromRaw(payment.state);
|
switch (payment.orchestrationState) {
|
||||||
switch (state) {
|
case PaymentOrchestrationState.failed:
|
||||||
case PaymentState.success:
|
|
||||||
return OperationStatus.success;
|
|
||||||
case PaymentState.failed:
|
|
||||||
case PaymentState.cancelled:
|
|
||||||
return OperationStatus.error;
|
return OperationStatus.error;
|
||||||
case PaymentState.processing:
|
case PaymentOrchestrationState.settled:
|
||||||
case PaymentState.unknown:
|
return OperationStatus.success;
|
||||||
|
case PaymentOrchestrationState.created:
|
||||||
|
case PaymentOrchestrationState.executing:
|
||||||
|
case PaymentOrchestrationState.needsAttention:
|
||||||
|
case PaymentOrchestrationState.unspecified:
|
||||||
return OperationStatus.processing;
|
return OperationStatus.processing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user