示例#1
0
        public void TestChargeWithCustomer()
        {
            // Arrange
            ICustomerEntity customer = CreateMockCustomer();
            IChargeEntity   charge   = CreateMockCharge();

            StripeToken token = CreateTestToken(customer);

            StripeManager.CreateCustomer(customer, token.Id);

            // Act - charge customer
            string chargeId = StripeManager.Charge(customer, charge);

            Assert.IsNotNull(chargeId);

            chargeId = StripeManager.Charge(customer, 12.34f, "Test charge with customer");
            Assert.IsNotNull(chargeId);
        }
示例#2
0
 /// <summary>
 /// Charges the given user for the given product
 /// </summary>
 /// <param name="user"></param>
 /// <param name="product"></param>
 /// <returns></returns>
 public static string Charge(ICustomerEntity user, IChargeEntity product)
 {
     return(Charge(user, product.Price, product.Title));
 }