Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
A bit of cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyzimarev committed Nov 26, 2022
1 parent 6677359 commit c5dc6db
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Bookings.Domain/Bookings/BookingState.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
using System.Collections.Immutable;
using Eventuous;
using static Bookings.Domain.Bookings.BookingEvents;
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable NotAccessedPositionalProperty.Global

namespace Bookings.Domain.Bookings;

public record BookingState : AggregateState<BookingState> {
public string GuestId { get; init; }
public RoomId RoomId { get; init; }
public StayPeriod Period { get; init; }
public Money Price { get; init; }
public Money Outstanding { get; init; }
public record BookingState : State<BookingState> {
public string GuestId { get; init; } = null!;
public RoomId RoomId { get; init; } = null!;
public StayPeriod Period { get; init; } = null!;
public Money Price { get; init; } = null!;
public Money Outstanding { get; init; } = null!;
public bool Paid { get; init; }

public ImmutableList<PaymentRecord> PaymentRecords { get; init; } = ImmutableList<PaymentRecord>.Empty;
Expand All @@ -36,11 +39,11 @@ static BookingState HandleBooked(BookingState state, V1.RoomBooked booked)
RoomId = new RoomId(booked.RoomId),
Period = new StayPeriod(booked.CheckInDate, booked.CheckOutDate),
GuestId = booked.GuestId,
Price = new Money { Amount = booked.BookingPrice, Currency = booked.Currency },
Price = new Money { Amount = booked.BookingPrice, Currency = booked.Currency },
Outstanding = new Money { Amount = booked.OutstandingAmount, Currency = booked.Currency }
};
}

public record PaymentRecord(string PaymentId, Money PaidAmount);

public record DiscountRecord(Money Discount, string Reason);
public record DiscountRecord(Money Discount, string Reason);

0 comments on commit c5dc6db

Please sign in to comment.