Search in sources :

Example 6 with Dispute

use of com.stripe.model.Dispute in project stripe-java by stripe.

the class DisputeTest method testCloseDispute.

@Test
public void testCloseDispute() throws StripeException, InterruptedException {
    int chargeValueCents = 100;
    Charge disputedCharge = createDisputedCharge(chargeValueCents, null);
    Dispute dispute = disputedCharge.getDisputeObject();
    assertEquals("needs_response", dispute.getStatus());
    Dispute closedDispute = dispute.close();
    assertEquals(dispute.getId(), closedDispute.getId());
    assertEquals("lost", closedDispute.getStatus());
}
Also used : Charge(com.stripe.model.Charge) Dispute(com.stripe.model.Dispute) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 7 with Dispute

use of com.stripe.model.Dispute in project stripe-java by stripe.

the class DisputeTest method testRetrieveDisputeWithExpand.

@Test
public void testRetrieveDisputeWithExpand() throws StripeException, InterruptedException {
    int chargeValueCents = 100;
    Charge disputedCharge = createDisputedCharge(chargeValueCents, null);
    Dispute dispute = disputedCharge.getDisputeObject();
    List<String> expandList = new LinkedList<String>();
    expandList.add("charge");
    Map<String, Object> retrieveParams = new HashMap<String, Object>();
    retrieveParams.put("expand", expandList);
    Dispute retrievedDispute = Dispute.retrieve(dispute.getId(), retrieveParams, null);
    assertEquals(dispute.getId(), retrievedDispute.getId());
    Charge expandedCharge = retrievedDispute.getChargeObject();
    assertNotNull(expandedCharge);
    assertEquals(disputedCharge.getId(), expandedCharge.getId());
    Card card = (Card) expandedCharge.getSource();
    assertEquals("0259", card.getLast4());
}
Also used : HashMap(java.util.HashMap) Charge(com.stripe.model.Charge) Dispute(com.stripe.model.Dispute) EvidenceSubObject(com.stripe.model.EvidenceSubObject) LinkedList(java.util.LinkedList) Card(com.stripe.model.Card) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Aggregations

BaseStripeFunctionalTest (com.stripe.BaseStripeFunctionalTest)7 Charge (com.stripe.model.Charge)7 Dispute (com.stripe.model.Dispute)7 Test (org.junit.Test)7 EvidenceSubObject (com.stripe.model.EvidenceSubObject)4 HashMap (java.util.HashMap)3 Card (com.stripe.model.Card)1 EvidenceDetails (com.stripe.model.EvidenceDetails)1 RequestOptions (com.stripe.net.RequestOptions)1 LinkedList (java.util.LinkedList)1