|
|
|
@ -1,7 +1,6 @@ |
|
|
|
using System; |
|
|
|
using EShopOnAbp.PaymentService.PaymentRequests; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using PayPalCheckoutSdk.Core; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
|
|
@ -10,13 +9,10 @@ namespace EShopOnAbp.PaymentService.PaymentServices; |
|
|
|
public class PaymentServiceFactory : ITransientDependency |
|
|
|
{ |
|
|
|
private readonly IServiceProvider _serviceProvider; |
|
|
|
private readonly ILogger<PaymentServiceFactory> _logger; |
|
|
|
|
|
|
|
public PaymentServiceFactory(IServiceProvider serviceProvider, ILogger<PaymentServiceFactory> logger) |
|
|
|
public PaymentServiceFactory(IServiceProvider serviceProvider) |
|
|
|
{ |
|
|
|
logger.LogInformation("== Payment SErvice Factory == "); |
|
|
|
_serviceProvider = serviceProvider; |
|
|
|
_logger = logger; |
|
|
|
} |
|
|
|
|
|
|
|
public IPaymentStrategy Create(int paymentTypeId) |
|
|
|
@ -29,9 +25,7 @@ public class PaymentServiceFactory : ITransientDependency |
|
|
|
if (paymentTypeId == 1) |
|
|
|
{ |
|
|
|
var paypalService = _serviceProvider.GetRequiredService<PayPalHttpClient>(); |
|
|
|
_logger.LogInformation($"=== Resolved PaypalService {paypalService} ==="); |
|
|
|
var requestDomainService = _serviceProvider.GetRequiredService<PaymentRequestDomainService>(); |
|
|
|
_logger.LogInformation($"=== Resolved PaymentRequestDomainService {requestDomainService} ==="); |
|
|
|
|
|
|
|
return new PaypalService(paypalService, requestDomainService); |
|
|
|
} |
|
|
|
|