🐛 Fix Null value issue
This commit is contained in:
@@ -405,7 +405,9 @@ public class SnWalletSubscription : ModelBase
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public Proto.Subscription ToProtoValue() => new()
|
public Proto.Subscription ToProtoValue()
|
||||||
|
{
|
||||||
|
var proto = new Proto.Subscription
|
||||||
{
|
{
|
||||||
Id = Id.ToString(),
|
Id = Id.ToString(),
|
||||||
BegunAt = BegunAt.ToTimestamp(),
|
BegunAt = BegunAt.ToTimestamp(),
|
||||||
@@ -417,8 +419,6 @@ public class SnWalletSubscription : ModelBase
|
|||||||
PaymentMethod = PaymentMethod,
|
PaymentMethod = PaymentMethod,
|
||||||
PaymentDetails = PaymentDetails.ToProtoValue(),
|
PaymentDetails = PaymentDetails.ToProtoValue(),
|
||||||
BasePrice = BasePrice.ToString(CultureInfo.InvariantCulture),
|
BasePrice = BasePrice.ToString(CultureInfo.InvariantCulture),
|
||||||
CouponId = CouponId?.ToString(),
|
|
||||||
Coupon = Coupon?.ToProtoValue(),
|
|
||||||
RenewalAt = RenewalAt?.ToTimestamp(),
|
RenewalAt = RenewalAt?.ToTimestamp(),
|
||||||
AccountId = AccountId.ToString(),
|
AccountId = AccountId.ToString(),
|
||||||
IsAvailable = IsAvailable,
|
IsAvailable = IsAvailable,
|
||||||
@@ -427,6 +427,19 @@ public class SnWalletSubscription : ModelBase
|
|||||||
UpdatedAt = UpdatedAt.ToTimestamp()
|
UpdatedAt = UpdatedAt.ToTimestamp()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (CouponId.HasValue)
|
||||||
|
{
|
||||||
|
proto.CouponId = CouponId.Value.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Coupon != null)
|
||||||
|
{
|
||||||
|
proto.Coupon = Coupon.ToProtoValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
return proto;
|
||||||
|
}
|
||||||
|
|
||||||
public static SnWalletSubscription FromProtoValue(Proto.Subscription proto) => new()
|
public static SnWalletSubscription FromProtoValue(Proto.Subscription proto) => new()
|
||||||
{
|
{
|
||||||
Id = Guid.Parse(proto.Id),
|
Id = Guid.Parse(proto.Id),
|
||||||
|
|||||||
Reference in New Issue
Block a user