public void Handle(DepositPaid depositPaid)
        {
            var tenantNotificationCreated =
                new NotificationCreated(depositPaid.TenantId, depositPaid.PaymentId, depositPaid.AgreementId);

            _eventRegistry.Publish(tenantNotificationCreated);

            var ownerNotificationCreated =
                new NotificationCreated(depositPaid.OwnerId, depositPaid.PaymentId, depositPaid.AgreementId);

            _eventRegistry.Publish(ownerNotificationCreated);
        }
예제 #2
0
        public Agreement Accept()
        {
            var draftAcceptedEvent = new DraftAccepted(_agreementNumber.ToString(), _ownerId.ToString(), _tenantId.ToString(), TotalPrice.ToDecimal());
            var agreement          = new Agreement(_ownerId, _tenantId, _apartment, _period, _pricePerDay, _agreementNumber, _deposit);

            _eventRegistry.Publish(draftAcceptedEvent);

            return(agreement);
        }
예제 #3
0
        public void Pay(Title title)
        {
            _source.Withdraw(_money, title);
            _destination.Deposit(_money, title);

            var depositPaid = new DepositPaid(_source.AccountOwnerId.ToString(), _destination.AccountOwnerId.ToString(),
                                              title.ToString(), _paymentId.ToString());

            _eventRegistry.Publish(depositPaid);
        }
        public void PayDeposit(AccountOwnerId accountId, Title title, Domain.Payment.Payment payment, PaymentId paymentId)
        {
            if (_balanceService.HasFounds(accountId, payment.Money))
            {
                payment.Pay(title);
                return;
            }

            _eventRegistry.Publish(new InsufficientFundsNoticed(accountId.ToString(), paymentId.ToString()));
        }