refactor: update user address models and methods to use CustomerAddressModel across multiple components
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 3m8s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 3m8s
This commit is contained in:
@@ -6,7 +6,17 @@ using Google.Protobuf.WellKnownTypes;
|
||||
namespace FrontOffice.Main.Utilities;
|
||||
|
||||
public record WalletBalances(long CreditBalance, long DiscountBalance, long NetworkBalance);
|
||||
public record WalletTransaction(string Date, long Amount, string Channel, string Description);
|
||||
public record WalletTransaction(
|
||||
string Date,
|
||||
long CreditChange,
|
||||
long CreditBalance,
|
||||
long NetworkChange,
|
||||
long NetworkBalance,
|
||||
long DiscountChange,
|
||||
long DiscountBalance,
|
||||
string Channel,
|
||||
string Description
|
||||
);
|
||||
public record WalletWithdrawal(long Id, long WeekDefinitionId, string WeekDisplayName, long Amount, int Status, int? Method, string? Iban, string Created);
|
||||
public enum WithdrawalMethodClient
|
||||
{
|
||||
@@ -52,12 +62,19 @@ public class WalletService
|
||||
request.IsIncrease = isIncrease.Value;
|
||||
}
|
||||
var response = await _client.GetCustomerWalletChangeLogAsync(request);
|
||||
|
||||
return response.Models
|
||||
.Select(t => new WalletTransaction(
|
||||
ResolveTransactionDate(t),
|
||||
t.ChangeValue != 0 ? t.ChangeValue : t.CurrentBalance,
|
||||
t.RefrenceId?.ToString() ?? "-",
|
||||
ResolveDescription(t)))
|
||||
.Select(log => new WalletTransaction(
|
||||
ResolveTransactionDate(log),
|
||||
log.ChangeValue,
|
||||
log.CurrentBalance,
|
||||
log.ChangeNerworkValue,
|
||||
log.CurrentNetworkBalance,
|
||||
log.ChangeDiscountValue,
|
||||
log.CurrentDiscountBalance,
|
||||
log.RefrenceId?.ToString() ?? "-",
|
||||
ResolveDescription(log)
|
||||
))
|
||||
.OrderByDescending(t => t.Date)
|
||||
.ToList();
|
||||
}
|
||||
@@ -74,7 +91,8 @@ public class WalletService
|
||||
{
|
||||
try
|
||||
{
|
||||
return model.CreatedAt.ToDateTime().MiladiToJalaliWithTime();
|
||||
var utcDate = model.CreatedAt.ToDateTime();
|
||||
return utcDate.ToLocalTime().MiladiToJalaliWithTime();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -87,9 +105,18 @@ public class WalletService
|
||||
|
||||
private static string ResolveDescription(CustomerWalletChangeLogModel model)
|
||||
{
|
||||
if (model.ChangeValue > 0) return "شارژ کیف پول";
|
||||
if (model.ChangeValue < 0) return "برداشت/خرید";
|
||||
return "تراکنش کیف پول";
|
||||
var parts = new List<string>();
|
||||
|
||||
if (model.ChangeValue != 0)
|
||||
parts.Add(model.ChangeValue > 0 ? "شارژ عادی" : "برداشت عادی");
|
||||
|
||||
if (model.ChangeNerworkValue != 0)
|
||||
parts.Add(model.ChangeNerworkValue > 0 ? "دریافت شبکه" : "برداشت شبکه");
|
||||
|
||||
if (model.ChangeDiscountValue != 0)
|
||||
parts.Add(model.ChangeDiscountValue > 0 ? "شارژ تخفیفی" : "خرید تخفیفی");
|
||||
|
||||
return parts.Count > 0 ? string.Join(" | ", parts) : "تراکنش کیف پول";
|
||||
}
|
||||
|
||||
public async Task<bool> RequestWithdrawalAsync(long payoutId, WithdrawalMethodClient method, string? iban)
|
||||
|
||||
Reference in New Issue
Block a user