Beispiel #1
0
        public async Task <PaymentViewModel> GetLastPaymentReceivedAsync(Guid shopperID)
        {
            var findPaymentQuery = new FindPaymentQuery(Guid.Empty, Guid.Empty, shopperID);
            var payment          = await this.paymentRepository.GetLastPaymentReceivedAsync(findPaymentQuery);

            return(paymentAdapter.Adapt(payment, typeMapper));
        }
Beispiel #2
0
        public async Task <IEnumerable <PaymentViewModel> > GetAllAsync()
        {
            var findPaymentQuery = new FindPaymentQuery();
            var payments         = await this.paymentRepository.GetAllAsync(findPaymentQuery);

            return(paymentAdapter.Adapt(payments, typeMapper));
        }
        public async Task HandleAsync(CreateTransactionEvent message)
        {
            var findPaymentQuery = new FindPaymentQuery(message.EventID);

            Enum.TryParse(message.TransactionStatus, out PaymentStatus status);

            var payment = await this.findPaymentRepository.GetAsync(findPaymentQuery.PaymentID);

            if (payment != null)
            {
                //TODO: Review here
                //await new PaymentCommandHandler().UpdateAsync(payment);
            }
        }
Beispiel #4
0
        public async Task <IEnumerable <Payment> > GetAllAsync(FindPaymentQuery findPaymentQuery)
        {
            var paymentFilter = EventFiltersDefinition <PaymentMongo> .ApplyPaymentIDFilter(findPaymentQuery.PaymentID);

            var merchantFilter = EventFiltersDefinition <PaymentMongo> .ApplyMerchantIDFilter(findPaymentQuery.MerchantID);

            var shopperFilter = EventFiltersDefinition <PaymentMongo> .ApplyShooperIDFilter(findPaymentQuery.ShopperID);

            var options = new FindOptions <PaymentMongo>
            {
                Sort = Builders <PaymentMongo> .Sort.Descending(p => p.DateCreated)
            };

            var payments = await this.paymentEvents
                           .FindAsync(paymentFilter& merchantFilter& shopperFilter, options)
                           .Result.ToListAsync()
                           .ConfigureAwait(false);

            return(this.typeMapper.Map <IEnumerable <Payment> >(payments));
        }
Beispiel #5
0
        public async Task <Payment> GetAsync(Guid paymentID)
        {
            var findPaymentQuery = new FindPaymentQuery(paymentID);

            return((await GetAllAsync(findPaymentQuery)).FirstOrDefault <Payment>());
        }
Beispiel #6
0
 public async Task <Payment> GetLastPaymentReceivedAsync(FindPaymentQuery findPaymentQuery)
 {
     return((await GetAllAsync(findPaymentQuery)).FirstOrDefault <Payment>());
 }