use of com.stripe.model.EvidenceSubObject in project stripe-java by stripe.
the class DisputeTest method testUpdateDispute.
@Test
public void testUpdateDispute() throws StripeException, InterruptedException {
int chargeValueCents = 100;
Charge disputedCharge = createDisputedCharge(chargeValueCents, null);
Dispute initialDispute = disputedCharge.getDisputeObject();
EvidenceSubObject emptyEvidence = new EvidenceSubObject();
assertEquals(emptyEvidence, initialDispute.getEvidenceSubObject());
assertEquals(new HashMap<String, String>(), initialDispute.getMetadata());
Map<String, Object> evidence = new HashMap<String, Object>();
evidence.put("product_description", "my productDescription");
evidence.put("customer_name", "my customerName");
evidence.put("uncategorized_text", "my uncategorizedText");
Map<String, String> metadata = new HashMap<String, String>();
metadata.put("some_info", "about the dispute");
metadata.put("a_little_more", "12345");
Map<String, Object> params = new HashMap<String, Object>();
params.put("evidence", evidence);
params.put("metadata", metadata);
Dispute updatedDispute = initialDispute.update(params);
assertNotNull(updatedDispute);
EvidenceSubObject evidenceSubObject = updatedDispute.getEvidenceSubObject();
assertEquals(evidence.get("product_description"), evidenceSubObject.getProductDescription());
assertEquals(evidence.get("customer_name"), evidenceSubObject.getCustomerName());
assertEquals(evidence.get("uncategorized_text"), evidenceSubObject.getUncategorizedText());
// Ensure this didn't get stored in the deprecated evidence field.
assertNull(updatedDispute.getEvidence());
Map<String, String> disputeMetadata = updatedDispute.getMetadata();
assertNotNull(disputeMetadata);
assertEquals(metadata, disputeMetadata);
}
use of com.stripe.model.EvidenceSubObject 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());
}
Aggregations