feat(payment): enhance order details with payment status indicators and update proto version
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m37s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m37s
- Updated OrderDetailsDialog.razor to display payment status using dynamic color and icon based on the payment status value. - Added helper methods in OrderDetailsDialog.razor.cs to determine payment status color, text, and icon. - Enhanced UserOrderDetailsDialog.razor to conditionally display postal code and user mobile information. - Updated DiscountOrderService to include PaymentStatusValue from the response. - Bumped Foursat.CMSMicroservice.Protobuf version to 0.0.206 for compatibility with new payment features.
This commit is contained in:
@@ -143,7 +143,7 @@
|
||||
<ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!Exists('../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj')">
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.205" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.206" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ============================================================ -->
|
||||
|
||||
@@ -64,23 +64,17 @@
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudPaper Class="pa-4" Elevation="1">
|
||||
<MudText Typo="Typo.h6" GutterBottom="true">وضعیت پرداخت</MudText>
|
||||
@if (Order.PaymentCompleted)
|
||||
<MudChip T="string"
|
||||
Size="Size.Large"
|
||||
Color="@GetPaymentStatusColor(Order.PaymentStatusValue)"
|
||||
Icon="@GetPaymentStatusIcon(Order.PaymentStatusValue)">
|
||||
@GetPaymentStatusText(Order.PaymentStatusValue)
|
||||
</MudChip>
|
||||
@if (!string.IsNullOrEmpty(Order.TransactionId))
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Filled.CheckCircle">
|
||||
پرداخت شده
|
||||
</MudChip>
|
||||
@if (!string.IsNullOrEmpty(Order.TransactionId))
|
||||
{
|
||||
<MudText Typo="Typo.body2" Class="mt-2">
|
||||
کد تراکنش: @Order.TransactionId
|
||||
</MudText>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string" Color="Color.Warning" Size="Size.Large" Icon="@Icons.Material.Filled.Schedule">
|
||||
در انتظار پرداخت
|
||||
</MudChip>
|
||||
<MudText Typo="Typo.body2" Class="mt-2">
|
||||
کد تراکنش: @Order.TransactionId
|
||||
</MudText>
|
||||
}
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
@@ -96,10 +90,13 @@
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body1"><strong>@Order.Address.Title</strong></MudText>
|
||||
<MudText Typo="Typo.body2">@Order.Address.Address</MudText>
|
||||
<MudText Typo="Typo.body2">کد پستی: @Order.Address.PostalCode</MudText>
|
||||
@if (!string.IsNullOrEmpty(Order.Address.Phone))
|
||||
@if (!string.IsNullOrWhiteSpace(Order.Address.PostalCode))
|
||||
{
|
||||
<MudText Typo="Typo.body2">تلفن: @Order.Address.Phone</MudText>
|
||||
<MudText Typo="Typo.body2">کد پستی: @Order.Address.PostalCode</MudText>
|
||||
}
|
||||
@if (!string.IsNullOrWhiteSpace(Order.Address.Phone))
|
||||
{
|
||||
<MudText Typo="Typo.body2">تلفن سفارشدهنده: @Order.Address.Phone</MudText>
|
||||
}
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
||||
@@ -157,6 +157,32 @@ public partial class OrderDetailsDialog
|
||||
};
|
||||
}
|
||||
|
||||
private Color GetPaymentStatusColor(int status) => status switch
|
||||
{
|
||||
0 => Color.Warning,
|
||||
1 => Color.Success,
|
||||
2 => Color.Error,
|
||||
3 => Color.Info,
|
||||
_ => Color.Default
|
||||
};
|
||||
|
||||
private string GetPaymentStatusText(int status) => status switch
|
||||
{
|
||||
0 => "در انتظار پرداخت",
|
||||
1 => "پرداخت شده",
|
||||
2 => "ناموفق",
|
||||
3 => "بازپرداخت شده",
|
||||
_ => "نامشخص"
|
||||
};
|
||||
|
||||
private string GetPaymentStatusIcon(int status) => status switch
|
||||
{
|
||||
1 => Icons.Material.Filled.CheckCircle,
|
||||
2 => Icons.Material.Filled.Cancel,
|
||||
3 => Icons.Material.Filled.Replay,
|
||||
_ => Icons.Material.Filled.Schedule
|
||||
};
|
||||
|
||||
private enum StepState
|
||||
{
|
||||
Inactive = 0,
|
||||
|
||||
@@ -123,6 +123,14 @@
|
||||
{
|
||||
<MudText Typo="Typo.caption">آدرسی ثبت نشده است.</MudText>
|
||||
}
|
||||
@if (!string.IsNullOrWhiteSpace(_model.PostalCode))
|
||||
{
|
||||
<MudText Typo="Typo.body2">کد پستی: @_model.PostalCode</MudText>
|
||||
}
|
||||
@if (!string.IsNullOrWhiteSpace(_model.UserMobile))
|
||||
{
|
||||
<MudText Typo="Typo.body2">تلفن سفارشدهنده: @_model.UserMobile</MudText>
|
||||
}
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ public class DiscountOrderService : IDiscountOrderService
|
||||
DiscountBalanceUsed = response.DiscountBalanceUsed,
|
||||
GatewayAmount = response.GatewayAmount,
|
||||
PaymentCompleted = response.PaymentCompleted,
|
||||
PaymentStatusValue = (int)response.PaymentStatus,
|
||||
TransactionId = response.TransactionId,
|
||||
Status = MapFromProtoStatus(response.DeliveryStatus, response.PaymentCompleted),
|
||||
TrackingCode = response.TrackingCode,
|
||||
|
||||
@@ -67,6 +67,8 @@ public class DiscountOrderDetailsDto
|
||||
public long DiscountBalanceUsed { get; set; }
|
||||
public long GatewayAmount { get; set; }
|
||||
public bool PaymentCompleted { get; set; }
|
||||
/// <summary>مقدار proto PaymentStatus: 0 Pending, 1 Completed, 2 Failed, 3 Refunded</summary>
|
||||
public int PaymentStatusValue { get; set; }
|
||||
public string? TransactionId { get; set; }
|
||||
public OrderStatus Status { get; set; }
|
||||
public string? TrackingCode { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user