use of com.stripe.model.PlanTransformUsage in project stripe-java by stripe.
the class PlanTest method testPlanCreateWithTransformUsage.
@Test
public void testPlanCreateWithTransformUsage() throws StripeException {
Map<String, Object> productParams = new HashMap<String, Object>();
productParams.put("name", "Bar");
Map<String, Object> params = getUniquePlanParams();
params.remove("name");
params.put("nickname", "Foo");
params.put("product", productParams);
Map<String, Object> transformUsage = new HashMap<>();
transformUsage.put("divide_by", 1000);
transformUsage.put("round", "up");
params.put("transform_usage", transformUsage);
Plan plan = Plan.create(params);
assertEquals(new Long(100), plan.getAmount());
PlanTransformUsage planTransformUsage = plan.getTransformUsage();
assertEquals(new Long(1000), planTransformUsage.getDivideBy());
assertEquals("up", planTransformUsage.getRound());
}
Aggregations