use of com.stripe.model.Customer in project stripe-java by stripe.
the class CardTest method testCardMetadata.
@Test
public void testCardMetadata() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams);
Map<String, Object> creationParams = new HashMap<String, Object>();
creationParams.put("source", "tok_visa");
testMetadata(customer.createCard(creationParams));
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class CouponTest method testCustomerCreateWithCoupon.
@Test
public void testCustomerCreateWithCoupon() throws StripeException {
Coupon coupon = Coupon.create(getUniqueCouponParams());
Map<String, Object> customerWithCouponParams = new HashMap<String, Object>();
customerWithCouponParams.put("coupon", coupon.getId());
Customer customer = Customer.create(customerWithCouponParams);
assertEquals(customer.getDiscount().getCoupon().getId(), coupon.getId());
customer.deleteDiscount();
assertNull(Customer.retrieve(customer.getId()).getDiscount());
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class CustomerTest method testCustomerCreateWithPlanPerCallAPIKey.
@Test
public void testCustomerCreateWithPlanPerCallAPIKey() throws StripeException {
Plan plan = Plan.create(getUniquePlanParams(), Stripe.apiKey);
Customer customer = createDefaultCustomerWithPlan(plan);
assertEquals(customer.getSubscriptions().getData().get(0).getPlan().getId(), plan.getId());
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class CustomerTest method testCustomerCreatePerCallAPIKey.
@Test
public void testCustomerCreatePerCallAPIKey() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams, supportedRequestOptions);
assertEquals(customer.getDescription(), "J Bindings Customer");
List<ExternalAccount> customerSources = customer.getSources().getData();
assertEquals(1, customerSources.size());
assertThat(customerSources.get(0), instanceOf(Card.class));
assertEquals("4242", ((Card) customerSources.get(0)).getLast4());
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class CustomerTest method testCustomerRetrieve.
@Test
public void testCustomerRetrieve() throws StripeException {
Customer createdCustomer = Customer.create(defaultCustomerParams);
Customer retrievedCustomer = Customer.retrieve(createdCustomer.getId());
assertEquals(createdCustomer.getCreated(), retrievedCustomer.getCreated());
assertEquals(createdCustomer.getId(), retrievedCustomer.getId());
}
Aggregations