119 lines
5.6 KiB
C#
119 lines
5.6 KiB
C#
namespace NTP.Application.Refinery.Wallets;
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
public class WalletRow
|
|
{
|
|
public long Id { get; set; }
|
|
public long? Tn { get; set; }
|
|
public long? CompanyCode { get; set; }
|
|
/// <summary>0 = bank transfer, 1 = e-wallet (also the driver wallet). Legacy EPAYMENT.</summary>
|
|
public int Epayment { get; set; }
|
|
/// <summary>Stored OWNER_NNPN (empty for a driver wallet).</summary>
|
|
public long? OwnerNnpn { get; set; }
|
|
public string? WalletNumber { get; set; }
|
|
/// <summary>Stored OWNER_NAME (empty for a driver wallet).</summary>
|
|
public string? OwnerName { get; set; }
|
|
/// <summary>What the legacy grid shows as national no.: the owner's, else the driver's (view column OWNER_NNPN / NNPN).</summary>
|
|
public long? HolderNnpn { get; set; }
|
|
/// <summary>What the legacy grid shows as owner name: the owner's, else the driver's (view column OWNER_NAME).</summary>
|
|
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; }
|
|
/// <summary>BANK, EWALLET or DRAIVER_WALLET (legacy view spelling): the kind of the record, see <see cref="WalletValues"/>.</summary>
|
|
public string? PaymentMethod { get; set; }
|
|
}
|
|
|
|
/// <summary>One record plus what may be done with it.</summary>
|
|
public sealed class WalletDetail : WalletRow
|
|
{
|
|
/// <summary>ACTIVE record: edit (deactivates it and creates a new one).</summary>
|
|
public bool CanUpdate { get; set; }
|
|
public bool CanDeactivate { get; set; }
|
|
/// <summary>INACTIVE record and the truck / driver has no other ACTIVE record (legacy getREFINERY_WALLET sets ACTIONS = ACTIVATE).</summary>
|
|
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; }
|
|
/// <summary>JSON text (property name -> value); legacy rows may hold one-element arrays as values.</summary>
|
|
public string? OldData { get; set; }
|
|
public string? NewData { get; set; }
|
|
}
|
|
|
|
/// <summary>Grid filters: tn, walletNumber, bankAccount, nnpn, paymentMethod, statusCode exact; ownerName contains.</summary>
|
|
public sealed record WalletsQuery(string? Tn, string? WalletNumber, string? OwnerName, string? BankAccount, string? PaymentMethod, string? StatusCode, string? Nnpn);
|
|
|
|
/// <summary>
|
|
/// Create / update body. <see cref="PaymentMethod"/> 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).
|
|
/// </summary>
|
|
public sealed class SaveWalletRequest
|
|
{
|
|
public string? PaymentMethod { get; set; }
|
|
/// <summary>WALLET / BANK: truck number.</summary>
|
|
public string? Tn { get; set; }
|
|
/// <summary>WALLET / BANK: national number of the owner (optional).</summary>
|
|
public string? OwnerNnpn { get; set; }
|
|
/// <summary>WALLET / DRIVER_TIP: mobile number of the wallet (07xxxxxxxx or 7xxxxxxxx, 77/78/79).</summary>
|
|
public string? WalletNumber { get; set; }
|
|
/// <summary>WALLET / BANK: account owner.</summary>
|
|
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; }
|
|
/// <summary>DRIVER_TIP.</summary>
|
|
public string? DriverName { get; set; }
|
|
public string? DriverNnpn { get; set; }
|
|
}
|
|
|
|
/// <summary>Normalised record to insert (what the legacy factory builds into the bean per payment method).</summary>
|
|
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";
|
|
}
|