Esempio n. 1
0
        private PaymentLinkService CreateService(IOptions <PaymentLinkOptions> options = null,
                                                 IPaymentLinkNotificationService notificationService = null,
                                                 IPaymentLinksStorage storage = null)
        {
            options ??= GetValidOptions();
            notificationService ??= GetNotificationServiceWithOkResult();
            storage ??= CreateStorageMock().Object;

            return(new PaymentLinkService(options,
                                          notificationService,
                                          storage,
                                          new NullLogger <PaymentLinkService>()));


            IOptions <PaymentLinkOptions> GetValidOptions()
            => Options.Create(new PaymentLinkOptions
            {
                ClientSettings = new ClientSettings
                {
                    Currencies = new List <Currencies> {
                        Currencies.AED, Currencies.EUR
                    },
                    ServiceTypes = new Dictionary <ServiceTypes, string>
                    {
                        { ServiceTypes.HTL, "Hotel booking" },
                        { ServiceTypes.TRN, "Airport transfer" }
                    }
                },
                SupportedVersions = new List <Version> {
                    new Version(0, 2)
                },
                LinkMailTemplateId = "templateId_fkIfu423_-e",
                PaymentUrlPrefix   = new Uri("https://test/prefix")
            });
        }
Esempio n. 2
0
 public PaymentLinkService(IOptions <PaymentLinkOptions> options,
                           IPaymentLinkNotificationService notificationService,
                           IPaymentLinksStorage storage,
                           ILogger <PaymentLinkService> logger)
 {
     _notificationService = notificationService;
     _storage             = storage;
     _logger             = logger;
     _paymentLinkOptions = options.Value;
 }
 public PaymentLinksProcessingService(IPayfortService payfortService,
                                      IPayfortResponseParser payfortResponseParser,
                                      IPaymentLinksStorage storage,
                                      IPayfortSignatureService signatureService,
                                      IOptions <PayfortOptions> payfortOptions,
                                      IPaymentLinkNotificationService notificationService,
                                      IEntityLocker locker)
 {
     _payfortService        = payfortService;
     _payfortResponseParser = payfortResponseParser;
     _storage             = storage;
     _signatureService    = signatureService;
     _notificationService = notificationService;
     _locker         = locker;
     _payfortOptions = payfortOptions.Value;
 }