Exemplo n.º 1
0
 @Test
 public void testCouponDeletePerCallAPIKey() throws StripeException {
   Coupon createdCoupon = Coupon.create(getUniqueCouponParams(), Stripe.apiKey);
   DeletedCoupon deletedCoupon = createdCoupon.delete(Stripe.apiKey);
   assertTrue(deletedCoupon.getDeleted());
   assertEquals(deletedCoupon.getId(), createdCoupon.getId());
 }
Exemplo n.º 2
0
  @Test
  public void testCustomerCreateWithCouponPerCallAPIKey() throws StripeException {
    Coupon coupon = Coupon.create(getUniqueCouponParams(), Stripe.apiKey);
    Map<String, Object> customerWithCouponParams = new HashMap<String, Object>();
    customerWithCouponParams.put("coupon", coupon.getId());
    Customer customer = Customer.create(customerWithCouponParams, Stripe.apiKey);
    assertEquals(customer.getDiscount().getCoupon().getId(), coupon.getId());

    customer.deleteDiscount();
    assertNull(Customer.retrieve(customer.getId()).getDiscount());
  }
Exemplo n.º 3
0
 @Test
 public void testCouponListPerCallAPIKey() throws StripeException {
   Map<String, Object> listParams = new HashMap<String, Object>();
   listParams.put("count", 1);
   List<Coupon> Coupons = Coupon.all(listParams, Stripe.apiKey).getData();
   assertEquals(Coupons.size(), 1);
 }
Exemplo n.º 4
0
 @Test
 public void testCouponRetrievePerCallAPIKey() throws StripeException {
   Coupon createdCoupon = Coupon.create(getUniqueCouponParams(), Stripe.apiKey);
   Coupon retrievedCoupon = Coupon.retrieve(createdCoupon.getId(), Stripe.apiKey);
   assertEquals(createdCoupon.getId(), retrievedCoupon.getId());
 }
Exemplo n.º 5
0
 @Test
 public void testCouponCreatePerCallAPIKey() throws StripeException {
   Coupon coupon = Coupon.create(getUniqueCouponParams(), Stripe.apiKey);
   assertEquals(coupon.getDuration(), "once");
 }