public PaymentOrderRequestBuilder WithTestValues(string payeeId)
 {
     this.operation               = Operation.Purchase;
     this.currency                = new Currency("SEK");
     this.amount                  = new Amount(1700);
     this.vatAmount               = new Amount(0);
     this.description             = "Test Description";
     this.generateRecurrenceToken = false;
     this.urls = new UrlsResponse(new UrlsDto
     {
         HostUrls = new List <Uri> {
             new Uri("https://example.com")
         },
         CompleteUrl       = new Uri("https://example.com/payment-completed"),
         TermsOfServiceUrl = new Uri("https://example.com/termsandconditoons.pdf"),
         CancelUrl         = new Uri("https://example.com/payment-canceled"),
         Id = "https://example.com"
     });
     this.userAgent = "useragent";
     this.language  = new Language("sv-SE");
     this.payeeInfo = new PayeeInfo(payeeId, DateTime.Now.Ticks.ToString());
     this.metadata  = new Metadata {
         { "key1", "value1" }, { "key2", 2 }, { "key3", 3.1 }, { "key4", false }
     };
     return(this);
 }
        /// <summary>
        /// Instantiates a <see cref="VippsPaymentRequestDetails"/> with the provided parameters.
        /// </summary>
        /// <param name="operation">The initial operation of this payment.</param>
        /// <param name="intent">The intent of this payment.</param>
        /// <param name="currency">The wanted currency of the payment.</param>
        /// <param name="prices">List of payment instrument prices.</param>
        /// <param name="description">Textual description of the payment.</param>
        /// <param name="payerReference">Merchant reference to the payer.</param>
        /// <param name="userAgent">The payers UserAgent string.</param>
        /// <param name="language">The payers prefered language.</param>
        /// <param name="urls">Object with relevant URLs for the payment.</param>
        /// <param name="payeeInfo">Object with information about the merchant.</param>
        protected internal VippsPaymentRequestDetails(Operation operation,
                                                      PaymentIntent intent,
                                                      Currency currency,
                                                      IEnumerable <IPrice> prices,
                                                      string description,
                                                      string payerReference,
                                                      string userAgent,
                                                      Language language,
                                                      IUrls urls,
                                                      IPayeeInfo payeeInfo)
        {
            Operation      = operation ?? throw new ArgumentNullException(nameof(operation));
            Intent         = intent;
            Currency       = currency;
            Description    = description;
            PayerReference = payerReference;
            UserAgent      = userAgent;
            Language       = language;
            Urls           = urls;
            PayeeInfo      = payeeInfo;

            foreach (var price in prices)
            {
                Prices.Add(price);
            }
        }
Example #3
0
        /// <summary>
        /// Instantiates a new <see cref="SwishPaymentRequestDetails"/> with the provided parameters.
        /// </summary>
        /// <param name="prices">List of prices object to give discounts.</param>
        /// <param name="description">Textual description of the payment.</param>
        /// <param name="payerReference">Refence to the payer in the merchant systems.</param>
        /// <param name="userAgent">The UserAgent string of the payers device.</param>
        /// <param name="language">The payers prefered langauge.</param>
        /// <param name="urls">Object describing relevant URLs for this payment.</param>
        /// <param name="payeeInfo">Object holding information about the merchant-</param>
        /// <param name="prefillInfo">Known information about the payer than can be
        /// pre-filled in the payment window.</param>
        /// <param name="swishRequest">Sets Swish payment specific options.</param>
        protected internal SwishPaymentRequestDetails(IEnumerable <IPrice> prices,
                                                      string description,
                                                      string payerReference,
                                                      string userAgent,
                                                      Language language,
                                                      IUrls urls,
                                                      IPayeeInfo payeeInfo,
                                                      PrefillInfo prefillInfo,
                                                      SwishRequestData swishRequest)
        {
            Operation      = Operation.Purchase;
            Intent         = PaymentIntent.Sale;
            Currency       = new Currency("SEK");
            Description    = description;
            PayerReference = payerReference;
            UserAgent      = userAgent;
            Language       = language;
            Urls           = urls;
            PayeeInfo      = payeeInfo;
            PrefillInfo    = prefillInfo;
            Swish          = swishRequest;

            foreach (var price in prices)
            {
                Prices.Add(price);
            }
        }
Example #4
0
 public LighthouseRunner(IPaths paths, IUrls urls, ISitecoreData sitecoreData, IItemsProvider itemsProvider)
 {
     _paths         = paths;
     _urls          = urls;
     _sitecoreData  = sitecoreData;
     _itemsProvider = itemsProvider;
 }
 public Connectors(IUrls urls, ICredentials credentials)
 {
     if (urls == null) throw new ArgumentNullException("urls");
     if (credentials == null) throw new ArgumentNullException("credentials");
     _urls = urls;
     _credentials = credentials;
     InitializeInternal();
 }
 public Connectors(IUrls urls, OAuth2Client.IStorage storage)
 {
     if (urls == null) throw new ArgumentNullException("urls");
     if (storage == null) throw new ArgumentNullException("storage");
     _urls = urls;
     _storage = storage;
     InitializeInternal();
 }
Example #7
0
 public UrlsDto(IUrls urls)
 {
     CallbackUrl       = urls.CallbackUrl;
     CancelUrl         = urls.CancelUrl;
     CompleteUrl       = urls.CompleteUrl;
     LogoUrl           = urls.LogoUrl;
     PaymentUrl        = urls.PaymentUrl;
     TermsOfServiceUrl = urls.TermsOfServiceUrl;
     HostUrls          = urls.HostUrls;
 }
 /// <summary>
 /// Instantiates a new Verify request for a card payment.
 /// </summary>
 /// <param name="intent"></param>
 /// <param name="currency"></param>
 /// <param name="description"></param>
 /// <param name="userAgent"></param>
 /// <param name="language"></param>
 /// <param name="urls"></param>
 /// <param name="payeeInfo"></param>
 public CardPaymentVerifyRequestDetails(PaymentIntent intent, Currency currency, string description, string userAgent, Language language, IUrls urls, IPayeeInfo payeeInfo)
 {
     Intent      = intent;
     Currency    = currency;
     Description = description;
     UserAgent   = userAgent;
     Language    = language;
     Urls        = urls;
     PayeeInfo   = payeeInfo;
 }
 /// <summary>
 /// Instantiates a new <see cref="CardPaymentRequest"/> using the provided parameters.
 /// </summary>
 /// <param name="intent">The initial intent of this payment.</param>
 /// <param name="currency">The wanted <seealso cref="Currency"/> for the payment to be paid in.</param>
 /// <param name="description">A textual description of the payment.</param>
 /// <param name="userAgent">The payers UserAgent.</param>
 /// <param name="language">The prefered <seealso cref="Language"/> of the payer.</param>
 /// <param name="urls">Object holding relevant <seealso cref="IUrls"/> for the payment.</param>
 /// <param name="payeeInfo">Object identifying the payee.</param>
 public CardPaymentVerifyRequest(PaymentIntent intent,
                                 Currency currency,
                                 string description,
                                 string userAgent,
                                 Language language,
                                 IUrls urls,
                                 IPayeeInfo payeeInfo)
 {
     Payment = new CardPaymentVerifyRequestDetails(intent, currency, description,
                                                   userAgent, language, urls, payeeInfo);
 }
Example #10
0
        /// <summary>
        /// Instantiates a new <see cref="SwishPaymentRequest"/> with the provided parameters.
        /// </summary>
        /// <param name="prices">List of prices object to give discounts.</param>
        /// <param name="description">Textual description of the payment.</param>
        /// <param name="payerReference">Refence to the payer in the merchant systems.</param>
        /// <param name="userAgent">The UserAgent string of the payers device.</param>
        /// <param name="language">The payers prefered langauge.</param>
        /// <param name="urls">Object describing relevant URLs for this payment.</param>
        /// <param name="payeeInfo">Object holding information about the merchant-</param>
        /// <param name="prefillInfo">Known information about the payer than can be
        /// pre-filled in the payment window.</param>
        public SwishPaymentRequest(IEnumerable <IPrice> prices,
                                   string description,
                                   string payerReference,
                                   string userAgent,
                                   Language language,
                                   IUrls urls,
                                   IPayeeInfo payeeInfo,
                                   PrefillInfo prefillInfo)
        {
            var swishRequest = new SwishRequestData();

            Payment = new SwishPaymentRequestDetails(prices, description, payerReference, userAgent, language, urls, payeeInfo, prefillInfo, swishRequest);
        }
 /// <summary>
 /// Instantiates a new <see cref="TrustlyPaymentRequest"/> with the provided parameters.
 /// </summary>
 /// <param name="currency">The wanted currency of the payment.</param>
 /// <param name="prices">Prices object describing the payment price with different payment methods.</param>
 /// <param name="description">Textual descroption of the payment.</param>
 /// <param name="payerReference">A reference to the payer in the merchant system.</param>
 /// <param name="userAgent">The payers UserAgent string.</param>
 /// <param name="language">The payers prefered language.</param>
 /// <param name="urls">Object holding relevant URLs for this payment.</param>
 /// <param name="payeeInfo">Object with merchant information.</param>
 public TrustlyPaymentRequest(
     Currency currency,
     IEnumerable <IPrice> prices,
     string description,
     string payerReference,
     string userAgent,
     Language language,
     IUrls urls,
     IPayeeInfo payeeInfo)
 {
     Payment = new TrustlyPaymentDetails(currency, prices, description, payerReference, userAgent, language,
                                         urls, payeeInfo);
 }
Example #12
0
 /// <summary>
 /// Instantiates a new <see cref="InvoicePaymentAuthorizationRequest"/>.
 /// </summary>
 /// <param name="operation">The initial API operation for this invoice request.</param>
 /// <param name="intent">The initial payment intent for this invoice.</param>
 /// <param name="currency">The <seealso cref="Currency"/> this payment will be paid in.</param>
 /// <param name="prices">A list of objects detailing price differences between different payment instruments.</param>
 /// <param name="description">A textual description of what is being paid.</param>
 /// <param name="userAgent">The payers UserAgent string.</param>
 /// <param name="language">The payers prefered <seealso cref="Language"/>.</param>
 /// <param name="urls">Object containing relevant URLs for this payment.</param>
 /// <param name="payeeInfo">Object with merchant information.</param>
 /// <param name="invoiceType">Specifies the invoice type, country, of the invoice.</param>
 public InvoicePaymentAuthorizationRequest(Operation operation,
                                           PaymentIntent intent,
                                           Currency currency,
                                           IEnumerable <IPrice> prices,
                                           string description,
                                           string userAgent,
                                           Language language,
                                           IUrls urls,
                                           IPayeeInfo payeeInfo,
                                           InvoiceType invoiceType)
 {
     Payment = new InvoicePaymentRequestDetails(operation, intent, currency, prices, description, userAgent, language, urls, payeeInfo);
     Invoice = new InvoicePaymentRequestData(invoiceType);
 }
 public Connectors(IUrls urls, OAuth2Client.IStorage storage)
 {
     if (urls == null)
     {
         throw new ArgumentNullException("urls");
     }
     if (storage == null)
     {
         throw new ArgumentNullException("storage");
     }
     _urls    = urls;
     _storage = storage;
     InitializeInternal();
 }
Example #14
0
 /// <summary>
 /// Request details for creating a payment order.
 /// </summary>
 /// <param name="operation">Initial API operation to perform.</param>
 /// <param name="currency">The wanted currency for the payment.</param>
 /// <param name="amount">The amount to pay in the payment.</param>
 /// <param name="vatAmount">The amount to pay that is value added taxes.</param>
 /// <param name="description">Textual description of the payment order.</param>
 /// <param name="userAgent">The payers UserAgent string.</param>
 /// <param name="language">The payers prefered languae.</param>
 /// <param name="generateRecurrenceToken">Set if you want a recurrence token for recur payments.</param>
 /// <param name="urls">Object with URLs relevant for the payment.</param>
 /// <param name="payeeInfo">Object with information about the Merchant.</param>
 public PaymentOrderRequest(Operation operation,
                            Currency currency,
                            Amount amount,
                            Amount vatAmount,
                            string description,
                            string userAgent,
                            Language language,
                            bool generateRecurrenceToken,
                            IUrls urls,
                            IPayeeInfo payeeInfo)
 {
     PaymentOrder = new PaymentOrderRequestDetails(operation, currency, amount, vatAmount, description, userAgent, language,
                                                   generateRecurrenceToken, urls, payeeInfo);
 }
 public Connectors(IUrls urls, ICredentials credentials)
 {
     if (urls == null)
     {
         throw new ArgumentNullException("urls");
     }
     if (credentials == null)
     {
         throw new ArgumentNullException("credentials");
     }
     _urls        = urls;
     _credentials = credentials;
     InitializeInternal();
 }
Example #16
0
 private void SetUrls()
 {
     this.urls = new UrlsResponse(new UrlsDto
     {
         HostUrls = new List <Uri> {
             new Uri("https://example.com")
         },
         CompleteUrl       = new Uri("https://example.com/payment-completed"),
         CallbackUrl       = new Uri("https://example.com/payment-callback"),
         TermsOfServiceUrl = new Uri("https://example.com/termsandconditoons.pdf"),
         CancelUrl         = new Uri("https://example.com/payment-canceled"),
         Id = "https://example.com"
     });
 }
        /// <summary>
        /// Instantiates a <see cref="VippsPaymentRequest"/> with the provided parameters.
        /// </summary>
        /// <param name="operation">The initial operation of this payment.</param>
        /// <param name="intent">The intent of this payment.</param>
        /// <param name="currency">The wanted currency of the payment.</param>
        /// <param name="prices">List of payment instrument prices.</param>
        /// <param name="description">Textual description of the payment.</param>
        /// <param name="payerReference">Merchant reference to the payer.</param>
        /// <param name="userAgent">The payers UserAgent string.</param>
        /// <param name="language">The payers prefered language.</param>
        /// <param name="urls">Object with relevant URLs for the payment.</param>
        /// <param name="payeeInfo">Object with information about the merchant.</param>
        public VippsPaymentRequest(Operation operation,
                                   PaymentIntent intent,
                                   Currency currency,
                                   IEnumerable <IPrice> prices,
                                   string description,
                                   string userAgent,
                                   Language language,
                                   IUrls urls,
                                   IPayeeInfo payeeInfo,
                                   string payerReference)

        {
            Payment = new VippsPaymentRequestDetails(operation, intent, currency, prices, description, payerReference,
                                                     userAgent, language, urls, payeeInfo);
        }
        /// <summary>
        /// Instantiates a new <see cref="MobilePayPaymentRequest"/> with the provided parameters.
        /// </summary>
        /// <param name="operation">The initial API operation for this payment.</param>
        /// <param name="intent">The initial <seealso cref="PaymentIntent"/> for this payment.</param>
        /// <param name="currency">The wanted <seealso cref="Currency"/> for this payment.</param>
        /// <param name="prices">Object describing the amount to pay in different payment instruments.</param>
        /// <param name="description">A textual description of this payment.</param>
        /// <param name="userAgent">The payers UserAgent string.</param>
        /// <param name="language">THe payers prefered <seealso cref="Language"/>.</param>
        /// <param name="urls">Object describing relevant URLs for this payment.</param>
        /// <param name="payeeInfo">Information about the merchant performing this payment.</param>
        /// <param name="shopslogoUrl">Custom logo to use for the payment window.</param>
        public MobilePayPaymentRequest(Operation operation,
                                       PaymentIntent intent,
                                       Currency currency,
                                       IEnumerable <IPrice> prices,
                                       string description,
                                       string userAgent,
                                       Language language,
                                       IUrls urls,
                                       IPayeeInfo payeeInfo,
                                       Uri shopslogoUrl)

        {
            Payment   = new MobilePayPaymentDetails(operation, intent, currency, prices, description, userAgent, language, urls, payeeInfo);
            MobilePay = new MobilePayRequestData
            {
                ShoplogoUrl = shopslogoUrl
            };
        }
Example #19
0
 /// <summary>
 /// Instantiates a new <see cref="CardPaymentDetails"/> with the provided parameters.
 /// </summary>
 /// <param name="operation">The <see cref="Sdk.Operation"/> to perform.</param>
 /// <param name="intent">The initial <seealso cref="PaymentIntent"/> of the payment.</param>
 /// <param name="currency">The <seealso cref="Sdk.Currency"/> to be paid in.</param>
 /// <param name="description">A textual description of the purchase.</param>
 /// <param name="userAgent">The payers user agent.</param>
 /// <param name="language">The payers prefered langauge.</param>
 /// <param name="urls">URLs relevant for this payment.</param>
 /// <param name="payeeInfo">Identifies the merchant.</param>
 public CardPaymentDetails(Operation operation,
                           PaymentIntent intent,
                           Currency currency,
                           string description,
                           string userAgent,
                           Language language,
                           IUrls urls,
                           IPayeeInfo payeeInfo)
 {
     Operation   = operation ?? throw new ArgumentNullException(nameof(operation));
     Intent      = intent;
     Currency    = currency;
     Description = description;
     UserAgent   = userAgent;
     Language    = language;
     Urls        = urls;
     PayeeInfo   = payeeInfo;
 }
Example #20
0
 /// <summary>
 /// Request details for creating a payment order.
 /// </summary>
 /// <param name="operation">Initial API operation to perform.</param>
 /// <param name="currency">The wanted currency for the payment.</param>
 /// <param name="amount">The amount to pay in the payment.</param>
 /// <param name="vatAmount">The amount to pay that is value added taxes.</param>
 /// <param name="description">Textual description of the payment order.</param>
 /// <param name="userAgent">The payers UserAgent string.</param>
 /// <param name="language">The payers prefered languae.</param>
 /// <param name="generateRecurrenceToken">Set if you want a recurrence token for recur payments.</param>
 /// <param name="urls">Object with URLs relevant for the payment.</param>
 /// <param name="payeeInfo">Object with information about the Merchant.</param>
 protected internal PaymentOrderRequestDetails(Operation operation,
                                               Currency currency,
                                               Amount amount,
                                               Amount vatAmount,
                                               string description,
                                               string userAgent,
                                               Language language,
                                               bool generateRecurrenceToken,
                                               IUrls urls,
                                               IPayeeInfo payeeInfo)
 {
     Operation               = operation ?? throw new ArgumentNullException(nameof(operation));
     Currency                = currency ?? throw new ArgumentNullException(nameof(currency));
     Amount                  = amount ?? throw new ArgumentNullException(nameof(amount));
     VatAmount               = vatAmount ?? throw new ArgumentNullException(nameof(vatAmount));
     Description             = description ?? throw new ArgumentNullException(nameof(description));
     UserAgent               = userAgent ?? throw new ArgumentNullException(nameof(userAgent));
     Language                = language ?? throw new ArgumentNullException(nameof(language));
     Urls                    = urls ?? throw new ArgumentNullException(nameof(urls));
     GenerateRecurrenceToken = generateRecurrenceToken;
     PayeeInfo               = payeeInfo;
 }
Example #21
0
        protected ResourceTestsBase()
        {
            this.connectionSettings = TestHelper.GetSwedbankPayConnectionSettings(Environment.CurrentDirectory);
            this.urls    = TestHelper.GetUrls(Environment.CurrentDirectory);
            this.payeeId = this.connectionSettings.PayeeId;
            var httpClient = new HttpClient {
                BaseAddress = this.connectionSettings.ApiBaseUrl
            };

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", this.connectionSettings.Token);

            this.Sut = new SwedbankPayClient(httpClient);


            var httpClientMobilePay = new HttpClient {
                BaseAddress = this.connectionSettings.ApiBaseUrl
            };

            httpClientMobilePay.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", this.connectionSettings.TokenMobilePay);

            this.SutMobilePay = new SwedbankPayClient(httpClientMobilePay);
        }
 /// <summary>
 /// Instantiates a new <see cref="CardPaymentRecurRequest"/> with the provided parameters.
 /// </summary>
 /// <param name="operation">The wanted <seealso cref="Operation"/> to perform.</param>
 /// <param name="intent">The current <seealso cref="PaymentIntent"/> for this payment.</param>
 /// <param name="recurrenceToken">A previously authorizied reucrrence token.</param>
 /// <param name="currency">The <seealso cref="Currency"/> the payment is being paid in.</param>
 /// <param name="amount">The amount the payer pays.</param>
 /// <param name="vatAmount">The <seealso cref="Amount"/> to be paid as Value Added Tax.</param>
 /// <param name="description">A textual description of the payment.</param>
 /// <param name="userAgent">The payers User Agent.</param>
 /// <param name="language">The prefered <seealso cref="Language"/> of the payer.</param>
 /// <param name="urls">All relevant <seealso cref="IUrls"/> for this payment.</param>
 /// <param name="payeeInfo">Your payee information.</param>
 public CardPaymentRecurRequest(Operation operation,
                                PaymentIntent intent,
                                string recurrenceToken,
                                Currency currency,
                                Amount amount,
                                Amount vatAmount,
                                string description,
                                string userAgent,
                                Language language,
                                IUrls urls,
                                IPayeeInfo payeeInfo)
 {
     Payment = new CardPaymentRecurDetails(operation,
                                           intent,
                                           recurrenceToken,
                                           currency,
                                           amount,
                                           vatAmount,
                                           description,
                                           userAgent,
                                           language,
                                           urls,
                                           payeeInfo);
 }
        /// <summary>
        /// Instantiates a new <see cref="TrustlyPaymentDetails"/> with the provided parameters.
        /// </summary>
        /// <param name="currency">The wanted currency of the payment.</param>
        /// <param name="prices">Prices object describing the payment price with different payment methods.</param>
        /// <param name="description">Textual descroption of the payment.</param>
        /// <param name="payerReference">A reference to the payer in the merchant system.</param>
        /// <param name="userAgent">The payers UserAgent string.</param>
        /// <param name="language">The payers prefered language.</param>
        /// <param name="urls">Object holding relevant URLs for this payment.</param>
        /// <param name="payeeInfo">Object with merchant information.</param>
        public TrustlyPaymentDetails(Currency currency,
                                                IEnumerable<IPrice> prices,
                                                string description,
                                                string payerReference,
                                                string userAgent,
                                                Language language,
                                                IUrls urls,
                                                IPayeeInfo payeeInfo)
        {
            Operation = Operation.Purchase;
            Intent = PaymentIntent.Sale;
            Currency = currency;
            Description = description;
            PayerReference = payerReference;
            UserAgent = userAgent;
            Language = language;
            Urls = urls;
            PayeeInfo = payeeInfo;

            foreach (var price in prices)
            {
                Prices.Add(price);
            }
        }
Example #24
0
 /// <summary>
 /// Instantiates a new <see cref="CardPaymentRecurDetails"/> with the provided parameters.
 /// </summary>
 /// <param name="operation">The initial <see cref="Sdk.Operation"/> of the payment.</param>
 /// <param name="intent">The initial intent of the payment.</param>
 /// <param name="recurrenceToken">A previosuly created recurrence token, from a verify request.</param>
 /// <param name="currency">The <see cref="Sdk.Currency"/> to be paid.</param>
 /// <param name="amount">The <seealso cref="Sdk.Amount"/> to be paid.</param>
 /// <param name="vatAmount">The <seealso cref="Sdk.Amount"/> to be paid in VAT.</param>
 /// <param name="description">A textual description of the recurring payment.</param>
 /// <param name="userAgent">The payers user agent.</param>
 /// <param name="language">The payers prefered <seealso cref="Sdk.Language"/>.</param>
 /// <param name="urls">Relevant URLs for the payment.</param>
 /// <param name="payeeInfo">Merchant payee information.</param>
 public CardPaymentRecurDetails(Operation operation,
                                PaymentIntent intent,
                                string recurrenceToken,
                                Currency currency,
                                Amount amount,
                                Amount vatAmount,
                                string description,
                                string userAgent,
                                Language language,
                                IUrls urls,
                                IPayeeInfo payeeInfo)
 {
     Operation       = operation;
     Intent          = intent;
     RecurrenceToken = recurrenceToken;
     Currency        = currency;
     Amount          = amount;
     VatAmount       = vatAmount;
     Description     = description;
     UserAgent       = userAgent;
     Language        = language;
     Urls            = urls;
     PayeeInfo       = payeeInfo;
 }
Example #25
0
 public void TearDown()
 {
     _target = null;
 }
Example #26
0
 public void Setup()
 {
     _target = new Urls();
 }
 public Connectors()
 {
     _urls        = new Urls();
     _credentials = new Credentials();
     InitializeInternal();
 }
Example #28
0
 public CmsUrlConstraint(IUrls urls)
 {
     _urls = urls;
 }
Example #29
0
 public SitemapController(IUrls urls)
 {
     _urls = urls;
 }
 public Connectors()
 {
     _urls = new Urls();
     _credentials = new Credentials();
     InitializeInternal();
 }