use of com.stripe.model.Charge in project stripe-java by stripe.
the class RefundTest method testChargeRefundCreate.
@Test
public void testChargeRefundCreate() throws StripeException {
Charge ch = Charge.create(defaultChargeParams);
Map<String, Object> params = new HashMap<String, Object>();
params.put("amount", 10);
ChargeRefundCollection refunds = ch.getRefunds();
Refund created = refunds.create(params);
Refund retrieved = ch.getRefunds().retrieve(created.getId());
assertEquals(created.getId(), retrieved.getId());
}
use of com.stripe.model.Charge in project stripe-java by stripe.
the class RefundTest method testChargeRefundListAndRetrieve.
@Test
public void testChargeRefundListAndRetrieve() throws StripeException {
Charge ch = Charge.create(defaultChargeParams);
ch = ch.refund();
Map<String, Object> listParams = new HashMap<String, Object>();
listParams.put("count", 1);
Refund created = ch.getRefunds().all(listParams).getData().get(0);
Refund retrieved = ch.getRefunds().retrieve(created.getId());
assertEquals(created.getId(), retrieved.getId());
}
use of com.stripe.model.Charge in project stripe-java by stripe.
the class ChargeTest method testInvalidAddressLine1Test.
@Test
public void testInvalidAddressLine1Test() throws StripeException {
Map<String, Object> invalidChargeParams = new HashMap<String, Object>();
invalidChargeParams.putAll(defaultChargeParams);
invalidChargeParams.put("source", "tok_avsLine1Fail");
Charge charge = Charge.create(invalidChargeParams, supportedRequestOptions);
assertEquals(charge.getPaid(), true);
assertThat(charge.getSource(), instanceOf(Card.class));
Card card = (Card) charge.getSource();
assertEquals(card.getAddressLine1Check(), "fail");
}
use of com.stripe.model.Charge in project stripe-java by stripe.
the class ChargeTest method testChargeCreate.
@Test
public void testChargeCreate() throws StripeException {
Charge createdCharge = Charge.create(defaultChargeParams);
assertFalse(createdCharge.getRefunded());
}
use of com.stripe.model.Charge in project stripe-java by stripe.
the class ChargeTest method testChargeCreateWithStatementDescriptor.
@Test
public void testChargeCreateWithStatementDescriptor() throws StripeException {
Map<String, Object> chargeWithStatementDescriptorParams = new HashMap<String, Object>();
chargeWithStatementDescriptorParams.putAll(defaultChargeParams);
chargeWithStatementDescriptorParams.put("description", "hahaha1234");
chargeWithStatementDescriptorParams.put("statement_descriptor", "Stripe");
chargeWithStatementDescriptorParams.put("alternate_statement_descriptors[kana]", "ストライプ");
chargeWithStatementDescriptorParams.put("alternate_statement_descriptors[kanji]", "ストライプジャパン株式会社");
Charge createdCharge = Charge.create(chargeWithStatementDescriptorParams);
assertEquals("Stripe", createdCharge.getStatementDescriptor());
assertEquals("ストライプ", createdCharge.getAlternateStatementDescriptors().getKana());
assertEquals("ストライプジャパン株式会社", createdCharge.getAlternateStatementDescriptors().getKanji());
}
Aggregations