IO format fixes and implemented res payment
This is a small commit to include the feature for paying for a reservation, specifically only the 60-day-in-advance reservation type as the others are paid for at specific periods. Other fixes include just some formatting for reports.
This commit is contained in:
@@ -107,11 +107,19 @@ namespace Ophelias.Models
|
||||
cmd.Parameters.AddWithValue("@PayBy", this.PayBy.ToString("yyyy-MM-dd"));
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
internal void Pay(double Amount)
|
||||
internal PaymentStatus Pay(double Amount, string cc)
|
||||
{
|
||||
if (string.IsNullOrEmpty(cc))
|
||||
{
|
||||
return PaymentStatus.MissingCreditCard;
|
||||
}
|
||||
if (Amount >= Owed)
|
||||
{
|
||||
return PaymentStatus.AlreadyPaid;
|
||||
}
|
||||
if (Amount <= 0)
|
||||
{
|
||||
return;
|
||||
return PaymentStatus.AmountCannotZero;
|
||||
}
|
||||
|
||||
LastPaid = DateTime.Now;
|
||||
@@ -144,6 +152,7 @@ namespace Ophelias.Models
|
||||
throw new Exception();
|
||||
cmd.Parameters.AddWithValue("@PaidOn", PaidOn.Value.ToString("yyyy-MM-dd"));
|
||||
cmd.ExecuteNonQuery();
|
||||
return PaymentStatus.SuccessfulPayment;
|
||||
}
|
||||
internal void Refund()
|
||||
{
|
||||
@@ -200,13 +209,12 @@ namespace Ophelias.Models
|
||||
|
||||
|
||||
}
|
||||
internal class TransactionList
|
||||
internal enum PaymentStatus
|
||||
{
|
||||
internal List<Transaction> Transactions;
|
||||
|
||||
internal TransactionList()
|
||||
{
|
||||
Transactions = new();
|
||||
}
|
||||
SuccessfulPayment,
|
||||
AlreadyPaid,
|
||||
FailedPayment,
|
||||
AmountCannotZero,
|
||||
MissingCreditCard
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user