namespace NTP.Application.Refinery.Wallets; /// /// Row of REFINERY_WALLET: how a truck owner (or a driver, for the tip) gets paid: e-wallet, bank transfer or driver wallet. Same columns as the legacy /// REFINERY_WALLET_VIEW (OwnerNnpn / OwnerName fall back to the driver's when the owner's are empty). Class with settable properties. /// public class WalletRow { public long Id { get; set; } public long? Tn { get; set; } public long? CompanyCode { get; set; } /// 0 = bank transfer, 1 = e-wallet (also the driver wallet). Legacy EPAYMENT. public int Epayment { get; set; } /// Stored OWNER_NNPN (empty for a driver wallet). public long? OwnerNnpn { get; set; } public string? WalletNumber { get; set; } /// Stored OWNER_NAME (empty for a driver wallet). public string? OwnerName { get; set; } /// What the legacy grid shows as national no.: the owner's, else the driver's (view column OWNER_NNPN / NNPN). public long? HolderNnpn { get; set; } /// What the legacy grid shows as owner name: the owner's, else the driver's (view column OWNER_NAME). public string? HolderName { get; set; } public string? OwnerNameEnglish { get; set; } public string? DriverName { get; set; } public long? DriverNnpn { get; set; } public string? Iban { get; set; } public string? BankAccount { get; set; } public string? BankName { get; set; } public string? BankBranch { get; set; } public DateTime? CreationDate { get; set; } public string? CreatedBy { get; set; } public DateTime? UpdateDate { get; set; } public string? UpdatedBy { get; set; } public string? StatusCode { get; set; } /// BANK, EWALLET or DRAIVER_WALLET (legacy view spelling): the kind of the record, see . public string? PaymentMethod { get; set; } } /// One record plus what may be done with it. public sealed class WalletDetail : WalletRow { /// ACTIVE record: edit (deactivates it and creates a new one). public bool CanUpdate { get; set; } public bool CanDeactivate { get; set; } /// INACTIVE record and the truck / driver has no other ACTIVE record (legacy getREFINERY_WALLET sets ACTIONS = ACTIVATE). public bool CanActivate { get; set; } } public class WalletLogRow { public long Id { get; set; } public long EntityId { get; set; } public string? MethodName { get; set; } public string? Login { get; set; } public DateTime? LogDate { get; set; } public string? UserId { get; set; } public string? UserIp { get; set; } /// JSON text (property name -> value); legacy rows may hold one-element arrays as values. public string? OldData { get; set; } public string? NewData { get; set; } } /// Grid filters: tn, walletNumber, bankAccount, nnpn, paymentMethod, statusCode exact; ownerName contains. public sealed record WalletsQuery(string? Tn, string? WalletNumber, string? OwnerName, string? BankAccount, string? PaymentMethod, string? StatusCode, string? Nnpn); /// /// Create / update body. WALLET (e-wallet of a truck), BANK (bank transfer of a truck) or DRIVER_TIP (driver wallet). /// Fields not used by the chosen method are ignored. Numbers travel as text (digits only). /// public sealed class SaveWalletRequest { public string? PaymentMethod { get; set; } /// WALLET / BANK: truck number. public string? Tn { get; set; } /// WALLET / BANK: national number of the owner (optional). public string? OwnerNnpn { get; set; } /// WALLET / DRIVER_TIP: mobile number of the wallet (07xxxxxxxx or 7xxxxxxxx, 77/78/79). public string? WalletNumber { get; set; } /// WALLET / BANK: account owner. public string? OwnerName { get; set; } public string? OwnerNameEnglish { get; set; } public string? BankName { get; set; } public string? BankBranch { get; set; } public string? Iban { get; set; } public string? BankAccount { get; set; } /// DRIVER_TIP. public string? DriverName { get; set; } public string? DriverNnpn { get; set; } } /// Normalised record to insert (what the legacy factory builds into the bean per payment method). public sealed record WalletWrite( int Epayment, long? Tn, long? OwnerNnpn, string? WalletNumber, string? OwnerName, string? OwnerNameEnglish, long? DriverNnpn, string? DriverName, string? Iban, string? BankAccount, string? BankName, string? BankBranch); public sealed record WalletsResult(string Message, long? Id = null); public static class WalletValues { public const string Active = "ACTIVE"; public const string Inactive = "INACTIVE"; // request codes (the select of the legacy form) public const string MethodWallet = "WALLET"; public const string MethodBank = "BANK"; public const string MethodDriverTip = "DRIVER_TIP"; // kinds of a stored record (legacy REFINERY_WALLET_VIEW.PAYMENT_METHOD, spelling kept) public const string KindBank = "BANK"; public const string KindEWallet = "EWALLET"; public const string KindDriverWallet = "DRAIVER_WALLET"; // log METHOD_NAME values public const string LogCreate = "CREATE"; public const string LogUpdate = "UPDATE"; public const string LogActivate = "ACTIVATE"; public const string LogDeactivate = "DEACTIVATE"; }