feat: show PaymentStatus on discount orders + failed payment UX
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m25s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m25s
- Updated NuGet to Protobuf v0.0.179 - Added PaymentStatus to DiscountOrderSummary and DiscountOrderDetail records - OrderDetail: show payment status chip (Pending/Success/Failed/Refunded) - OrderDetail: show alert with re-order link for failed payments - Orders: updated desktop table and mobile cards with PaymentStatus chips - Added GetPaymentStatusText() and GetPaymentStatusColor() helpers
This commit is contained in:
@@ -12,6 +12,7 @@ public record DiscountOrderSummary(
|
||||
long DiscountBalanceUsed,
|
||||
long GatewayAmount,
|
||||
bool PaymentCompleted,
|
||||
int PaymentStatus,
|
||||
int DeliveryStatus,
|
||||
string? TrackingCode,
|
||||
int ItemsCount,
|
||||
@@ -24,6 +25,7 @@ public record DiscountOrderDetail(
|
||||
long DiscountBalanceUsed,
|
||||
long GatewayAmount,
|
||||
bool PaymentCompleted,
|
||||
int PaymentStatus,
|
||||
string? TransactionId,
|
||||
int DeliveryStatus,
|
||||
string? TrackingCode,
|
||||
@@ -127,6 +129,7 @@ public class DiscountOrderService
|
||||
DiscountBalanceUsed: m.DiscountBalanceUsed,
|
||||
GatewayAmount: m.GatewayAmount,
|
||||
PaymentCompleted: m.PaymentCompleted,
|
||||
PaymentStatus: (int)m.PaymentStatus,
|
||||
DeliveryStatus: (int)m.DeliveryStatus,
|
||||
TrackingCode: m.TrackingCode,
|
||||
ItemsCount: m.ItemsCount,
|
||||
@@ -172,6 +175,7 @@ public class DiscountOrderService
|
||||
DiscountBalanceUsed: r.DiscountBalanceUsed,
|
||||
GatewayAmount: r.GatewayAmount,
|
||||
PaymentCompleted: r.PaymentCompleted,
|
||||
PaymentStatus: (int)r.PaymentStatus,
|
||||
TransactionId: r.TransactionId,
|
||||
DeliveryStatus: (int)r.DeliveryStatus,
|
||||
TrackingCode: r.TrackingCode,
|
||||
@@ -206,4 +210,23 @@ public class DiscountOrderService
|
||||
4 => Color.Error,
|
||||
_ => Color.Default
|
||||
};
|
||||
|
||||
// PaymentStatus: 0=Pending, 1=Completed, 2=Failed, 3=Refunded
|
||||
public static string GetPaymentStatusText(int status) => status switch
|
||||
{
|
||||
0 => "در انتظار پرداخت",
|
||||
1 => "پرداخت شده",
|
||||
2 => "پرداخت ناموفق",
|
||||
3 => "بازگشت وجه",
|
||||
_ => "نامشخص"
|
||||
};
|
||||
|
||||
public static Color GetPaymentStatusColor(int status) => status switch
|
||||
{
|
||||
0 => Color.Warning,
|
||||
1 => Color.Success,
|
||||
2 => Color.Error,
|
||||
3 => Color.Info,
|
||||
_ => Color.Default
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user