コード例 #1
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);
            }
        }
コード例 #2
0
 public PaymentRequestBuilder WithMobilePayTestValues(string payeeId)
 {
     this.operation      = Operation.Purchase;
     this.intent         = PaymentIntent.Authorization;
     this.currency       = new Currency("SEK");
     this.description    = "Test Description";
     this.payerReference = "AB1234";
     this.userAgent      = "useragent";
     this.language       = new Language("sv-SE");
     SetUrls();
     this.payeeInfo = new PayeeInfo(payeeId, DateTime.Now.Ticks.ToString())
     {
         PayeeName       = "payeeName",
         ProductCategory = "productCategory"
     };
     this.prefillInfo = new PrefillInfo(new Msisdn("+46701234567"));
     this.amount      = new Amount(1600);
     this.vatAmount   = new Amount(0);
     this.metadata    = new Metadata {
         { "key1", "value1" }, { "key2", 2 }, { "key3", 3.1 }, { "key4", false }
     };
     this.shopslogoUrl = new Uri("https://example.com");
     this.prices       = new List <IPrice>
     {
         new Price(this.amount, PriceType.Visa, this.vatAmount)
     };
     return(this);
 }
コード例 #3
0
 public PrefillInfoDto(PrefillInfo prefillInfo)
 {
     if (prefillInfo == null)
     {
         return;
     }
     Msisdn = prefillInfo.Msisdn.ToString();
 }
コード例 #4
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);
        }
コード例 #5
0
 public PaymentRequestBuilder WithSwishTestValues(string payeeId)
 {
     this.operation      = Operation.Purchase;
     this.intent         = PaymentIntent.Sale;
     this.currency       = new Currency("SEK");
     this.description    = "Test Description";
     this.payerReference = "AB1234";
     this.userAgent      = "useragent";
     this.language       = new Language("sv-SE");
     SetUrls();
     this.payeeInfo            = new PayeeInfo(payeeId, DateTime.Now.Ticks.ToString());
     this.prefillInfo          = new PrefillInfo(new Msisdn("+46701234567"));
     this.generatePaymentToken = false;
     this.amount    = new Amount(1600);
     this.vatAmount = new Amount(0);
     this.metadata  = new Metadata {
         { "key1", "value1" }, { "key2", 2 }, { "key3", 3.1 }, { "key4", false }
     };
     this.prices = new List <IPrice>
     {
         new Price(this.amount, PriceType.Swish, this.vatAmount)
     };
     return(this);
 }