🐛 Fix bugs

This commit is contained in:
2025-09-08 02:04:13 +08:00
parent f9269d7558
commit 92e4988114
2 changed files with 9 additions and 9 deletions

View File

@@ -25,7 +25,7 @@ public enum OrderStatus
public class Order : ModelBase
{
public const string InternalAppIdentifier = "internal";
public Guid Id { get; set; } = Guid.NewGuid();
public OrderStatus Status { get; set; } = OrderStatus.Unpaid;
[MaxLength(128)] public string Currency { get; set; } = null!;
@@ -72,7 +72,7 @@ public class Order : ModelBase
: null,
Amount = decimal.Parse(proto.Amount),
ExpiredAt = proto.ExpiredAt.ToInstant(),
PayeeWalletId = proto.HasPayeeWalletId ? Guid.Parse(proto.PayeeWalletId) : null,
PayeeWalletId = proto.PayeeWalletId is not null ? Guid.Parse(proto.PayeeWalletId) : null,
TransactionId = proto.TransactionId is not null ? Guid.Parse(proto.TransactionId) : null,
Transaction = proto.Transaction is not null ? Transaction.FromProtoValue(proto.Transaction) : null,
};
@@ -106,7 +106,7 @@ public class Transaction : ModelBase
{
Id = Id.ToString(),
Currency = Currency,
Amount = Amount.ToString(),
Amount = Amount.ToString(CultureInfo.InvariantCulture),
Remarks = Remarks,
Type = (Shared.Proto.TransactionType)Type,
PayerWalletId = PayerWalletId?.ToString(),
@@ -120,7 +120,7 @@ public class Transaction : ModelBase
Amount = decimal.Parse(proto.Amount),
Remarks = proto.Remarks,
Type = (TransactionType)proto.Type,
PayerWalletId = proto.HasPayerWalletId ? Guid.Parse(proto.PayerWalletId) : null,
PayeeWalletId = proto.HasPayeeWalletId ? Guid.Parse(proto.PayeeWalletId) : null,
PayerWalletId = proto.PayerWalletId is not null ? Guid.Parse(proto.PayerWalletId) : null,
PayeeWalletId = proto.PayeeWalletId is not null ? Guid.Parse(proto.PayeeWalletId) : null,
};
}

View File

@@ -132,7 +132,7 @@ message CreateOrderRequest {
message Order {
string id = 1;
optional string payee_wallet_id = 2;
google.protobuf.StringValue payee_wallet_id = 2;
google.protobuf.StringValue currency = 3;
string amount = 4;
google.protobuf.Timestamp expired_at = 5;
@@ -157,11 +157,11 @@ enum OrderStatus {
message Transaction {
string id = 1;
optional string payer_wallet_id = 2;
optional string payee_wallet_id = 3;
google.protobuf.StringValue payer_wallet_id = 2;
google.protobuf.StringValue payee_wallet_id = 3;
string currency = 4;
string amount = 5;
optional string remarks = 6;
google.protobuf.StringValue remarks = 6;
TransactionType type = 7;
}