示例#1
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());
  }
示例#2
0
 public void deleteDiscount()
     throws AuthenticationException, InvalidRequestException, APIConnectionException,
         CardException, APIException {
   deleteDiscount(null);
 }