Search in sources :

Example 1 with EvidenceDetails

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

the class DisputeTest method testSubmitEvidence.

@Test
public void testSubmitEvidence() throws StripeException, InterruptedException {
    int chargeValueCents = 100;
    Charge disputedCharge = createDisputedCharge(chargeValueCents, null);
    Dispute initialDispute = disputedCharge.getDisputeObject();
    assertNull(initialDispute.getEvidence());
    EvidenceSubObject emptyEvidence = new EvidenceSubObject();
    assertEquals(emptyEvidence, initialDispute.getEvidenceSubObject());
    assertEquals(0, initialDispute.getEvidenceDetails().getSubmissionCount().intValue());
    Map<String, Object> evidenceHashParams = new HashMap<String, Object>();
    // TODO: assert on all param types
    evidenceHashParams.put("product_description", "my productDescription");
    evidenceHashParams.put("customer_name", "my customerName");
    evidenceHashParams.put("uncategorized_text", "my uncategorizedText");
    Map<String, Object> providedEvidenceParams = ImmutableMap.<String, Object>of("evidence", evidenceHashParams);
    Dispute updatedDispute = disputedCharge.updateDispute(providedEvidenceParams);
    assertNotNull(updatedDispute);
    EvidenceSubObject evidenceSubObject = updatedDispute.getEvidenceSubObject();
    assertNotSame(emptyEvidence, evidenceSubObject);
    assertEquals(1, updatedDispute.getEvidenceDetails().getSubmissionCount().intValue());
    assertNull(updatedDispute.getEvidence());
    assertEquals("my productDescription", evidenceSubObject.getProductDescription());
    assertEquals("my customerName", evidenceSubObject.getCustomerName());
    assertEquals("my uncategorizedText", evidenceSubObject.getUncategorizedText());
    EvidenceDetails evidenceDetails = updatedDispute.getEvidenceDetails();
    assertNotNull(evidenceDetails);
    assertEquals(1, evidenceDetails.getSubmissionCount().intValue());
}
Also used : EvidenceSubObject(com.stripe.model.EvidenceSubObject) EvidenceDetails(com.stripe.model.EvidenceDetails) HashMap(java.util.HashMap) Charge(com.stripe.model.Charge) Dispute(com.stripe.model.Dispute) EvidenceSubObject(com.stripe.model.EvidenceSubObject) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Aggregations

BaseStripeFunctionalTest (com.stripe.BaseStripeFunctionalTest)1 Charge (com.stripe.model.Charge)1 Dispute (com.stripe.model.Dispute)1 EvidenceDetails (com.stripe.model.EvidenceDetails)1 EvidenceSubObject (com.stripe.model.EvidenceSubObject)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1