From 20a67cf71d6f2151fc80dc5db74e0985e3b07b20 Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 28 Dec 2021 10:59:14 +0300 Subject: [PATCH] Add details to PaymentRequest --- .../PaymentRequests/PaymentRequestAppService.cs | 2 +- .../PaymentRequests/EfCorePaymentRequestRepository.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/services/payment/src/EShopOnAbp.PaymentService.Application/PaymentRequests/PaymentRequestAppService.cs b/services/payment/src/EShopOnAbp.PaymentService.Application/PaymentRequests/PaymentRequestAppService.cs index 4fd1caa1..d07b7d77 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.Application/PaymentRequests/PaymentRequestAppService.cs +++ b/services/payment/src/EShopOnAbp.PaymentService.Application/PaymentRequests/PaymentRequestAppService.cs @@ -46,7 +46,7 @@ namespace EShopOnAbp.PaymentService.PaymentRequests public async Task StartAsync(PaymentRequestStartDto input) { - var paymentRequest = await PaymentRequestRepository.GetAsync(input.PaymentRequestId); + var paymentRequest = await PaymentRequestRepository.GetAsync(input.PaymentRequestId, includeDetails: true); var totalCheckoutPrice = paymentRequest.Products.Sum(s => s.TotalPrice); diff --git a/services/payment/src/EShopOnAbp.PaymentService.EntityFrameworkCore/PaymentRequests/EfCorePaymentRequestRepository.cs b/services/payment/src/EShopOnAbp.PaymentService.EntityFrameworkCore/PaymentRequests/EfCorePaymentRequestRepository.cs index 8c1acc3c..8d5cffa7 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.EntityFrameworkCore/PaymentRequests/EfCorePaymentRequestRepository.cs +++ b/services/payment/src/EShopOnAbp.PaymentService.EntityFrameworkCore/PaymentRequests/EfCorePaymentRequestRepository.cs @@ -1,5 +1,8 @@ using EShopOnAbp.PaymentService.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using System; +using System.Linq; +using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; @@ -18,5 +21,11 @@ namespace EShopOnAbp.PaymentService.PaymentRequests { } + + public override async Task> WithDetailsAsync() + { + return (await base.WithDetailsAsync()) + .Include(p => p.Products); + } } }