diff --git a/DysonNetwork.Pass/Wallet/Payment.cs b/DysonNetwork.Pass/Wallet/Payment.cs index 2b915f8..bee8cbc 100644 --- a/DysonNetwork.Pass/Wallet/Payment.cs +++ b/DysonNetwork.Pass/Wallet/Payment.cs @@ -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, }; } \ No newline at end of file diff --git a/DysonNetwork.Shared/Proto/wallet.proto b/DysonNetwork.Shared/Proto/wallet.proto index 3a87c0e..b91debb 100644 --- a/DysonNetwork.Shared/Proto/wallet.proto +++ b/DysonNetwork.Shared/Proto/wallet.proto @@ -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; }