Esempio n. 1
0
        public void ConvertsToPaymentMethodData()
        {
            var msPaymentMethodData = new MicrosoftPayMethodData();

            var convertedPaymentMethodData = msPaymentMethodData.ToPaymentMethodData();

            Assert.NotNull(convertedPaymentMethodData);
            Assert.IsType <PaymentMethodData>(convertedPaymentMethodData);
            var supportMethods = convertedPaymentMethodData.SupportedMethods;

            Assert.IsType <List <string> >(supportMethods);
            Assert.True(supportMethods.Contains("https://pay.microsoft.com/microsoftpay"));
            Assert.Equal(msPaymentMethodData, convertedPaymentMethodData.Data);
        }
Esempio n. 2
0
 private static PaymentRequest BuildPaymentRequest(string cartId, CatalogItem item, MicrosoftPayMethodData methodData)
 {
     return(new PaymentRequest
     {
         Id = cartId,
         Expires = TimeSpan.FromDays(1).ToString(),
         MethodData = new List <PaymentMethodData>
         {
             methodData.ToPaymentMethodData()
         },
         Details = new PaymentDetails
         {
             Total = new PaymentItem
             {
                 Label = Resources.Wallet_Label_Total,
                 Amount = new PaymentCurrencyAmount
                 {
                     Currency = item.Currency,
                     Value = Convert.ToString(item.Price, CultureInfo.InvariantCulture)
                 },
                 Pending = true
             },
             DisplayItems = new List <PaymentItem>
             {
                 new PaymentItem
                 {
                     Label = item.Title,
                     Amount = new PaymentCurrencyAmount
                     {
                         Currency = item.Currency,
                         Value = item.Price.ToString(CultureInfo.InvariantCulture)
                     }
                 },
                 new PaymentItem
                 {
                     Label = Resources.Wallet_Label_Shipping,
                     Amount = new PaymentCurrencyAmount
                     {
                         Currency = item.Currency,
                         Value = "0.00"
                     },
                     Pending = true
                 },
                 new PaymentItem
                 {
                     Label = Resources.Wallet_Label_Tax,
                     Amount = new PaymentCurrencyAmount
                     {
                         Currency = item.Currency,
                         Value = "0.00"
                     },
                     Pending = true
                 }
             }
         },
         Options = new PaymentOptions
         {
             RequestShipping = true,
             RequestPayerEmail = true,
             RequestPayerName = true,
             RequestPayerPhone = true,
             ShippingType = PaymentShippingTypes.Shipping
         }
     });
 }