public void Pay(PaymentInformation paymentInformation) { if (CalculateTotal() != paymentInformation.Amount) { throw new InvalidPaymentException(); } Status = OrderStatus.Preparing; PaymentDateUtc = DateTime.UtcNow; PaymentInfo = paymentInformation; }
public PaymentRepresentation GetRepresentation(PaymentInformation paymentInformation) { return new PaymentRepresentation() { Amount = paymentInformation.Amount, CardholderName = paymentInformation.CardholderName, CardNumber = paymentInformation.CardNumber, ExpiryMonth = paymentInformation.ExpiryMonth, ExpiryYear = paymentInformation.ExpiryYear }; }