/** * Update a charge. */ @Override public Charge update(Map<String, Object> params) throws StripeException { return update(params, (RequestOptions) null); }
/** * Mark the charge as safe. */ public Charge markSafe(RequestOptions options) throws StripeException { Map<String, Object> params = Collections.<String, Object>singletonMap( FRAUD_DETAILS, Collections.singletonMap(FraudDetails.USER_REPORT, "safe")); return this.update(params, options); } // </editor-fold>
/** * Mark the charge as fraudulent. */ public Charge markFraudulent(RequestOptions options) throws StripeException { Map<String, Object> params = Collections.<String, Object>singletonMap( FRAUD_DETAILS, Collections.singletonMap(FraudDetails.USER_REPORT, "fraudulent")); return this.update(params, options); } // </editor-fold>
@Test public void testUpdate() throws StripeException { final Charge charge = getChargeFixture(); final Map<String, Object> metadata = new HashMap<>(); metadata.put("foo", "bar"); final Map<String, Object> params = new HashMap<>(); params.put("metadata", metadata); final Charge updatedCharge = charge.update(params); assertNotNull(updatedCharge); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/charges/%s", charge.getId()), params ); }