Merge pull request #386 from cypherstack/mb-fixes

Mb fixes
This commit is contained in:
Diego Salazar 2023-03-03 14:57:49 -07:00 committed by GitHub
commit 4aedfc6b1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 13 deletions

View file

@ -24,9 +24,18 @@ class MBOrderStatus extends MBObject {
final Decimal received;
final Decimal confirmed;
Map<String, dynamic> toMap() => {
"orderId": orderId,
"status": status,
"fromCurrency": fromCurrency,
"fromAmount": fromAmount,
"receiveCurrency": receiveCurrency,
"receiveAmount": receiveAmount,
"address": address,
"received": received,
"confirmed": confirmed,
};
@override
String toString() {
// todo: full toString
return status;
}
String toString() => toMap().toString();
}

View file

@ -116,9 +116,16 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
}
status = changeNowTransactionStatusFromStringIgnoreCase(statusString);
} on ArgumentError catch (_) {
switch (statusString.toLowerCase()) {
case "funds confirming":
case "processing payment":
return Assets.svg.txExchangePending(context);
case "completed":
return Assets.svg.txExchange(context);
default:
status = ChangeNowTransactionStatus.Failed;
if (statusString == "Processing payment") {
status = ChangeNowTransactionStatus.Sending;
}
}

View file

@ -290,12 +290,22 @@ class _DesktopTradeRowCardState extends ConsumerState<DesktopTradeRowCard> {
ChangeNowTransactionStatus? status;
try {
if (statusString.toLowerCase().startsWith("waiting")) {
statusString = "waiting";
statusString = "Waiting";
}
status = changeNowTransactionStatusFromStringIgnoreCase(statusString);
} on ArgumentError catch (_) {
switch (statusString.toLowerCase()) {
case "funds confirming":
case "processing payment":
return Assets.svg.txExchangePending(context);
case "completed":
return Assets.svg.txExchange(context);
default:
status = ChangeNowTransactionStatus.Failed;
}
}
switch (status) {
case ChangeNowTransactionStatus.New:

View file

@ -349,8 +349,10 @@ class MajesticBankAPI {
return ExchangeResponse(value: status);
} catch (e, s) {
Logging.instance
.log("createOrder exception: $e\n$s", level: LogLevel.Error);
Logging.instance.log(
"trackOrder exception when trying to parse $json: $e\n$s",
level: LogLevel.Error,
);
return ExchangeResponse(
exception: ExchangeException(
e.toString(),

View file

@ -1603,6 +1603,7 @@ class StackColors extends ThemeExtension<StackColors> {
return const Color(0xFFD3A90F);
case "Finished":
case "finished":
case "Completed":
return accentColorGreen;
case "Failed":
case "failed":

View file

@ -25,12 +25,22 @@ class TradeCard extends ConsumerWidget {
ChangeNowTransactionStatus? status;
try {
if (statusString.toLowerCase().startsWith("waiting")) {
statusString = "waiting";
statusString = "Waiting";
}
status = changeNowTransactionStatusFromStringIgnoreCase(statusString);
} on ArgumentError catch (_) {
switch (statusString.toLowerCase()) {
case "funds confirming":
case "processing payment":
return Assets.svg.txExchangePending(context);
case "completed":
return Assets.svg.txExchange(context);
default:
status = ChangeNowTransactionStatus.Failed;
}
}
switch (status) {
case ChangeNowTransactionStatus.New: