Charge ch = Charge.retrieve(trnID); Refund re = ch.getRefunds().create(params);
Charge ch = Charge.retrieve(chargeId); ch.capture();
/** * Retrieve a charge. */ public static Charge retrieve(String id, RequestOptions options) throws StripeException { return retrieve(id, null, options); }
/** * Retrieve a charge. */ public static Charge retrieve(String id) throws StripeException { return retrieve(id, (RequestOptions) null); }
private Charge getChargeFixture() throws StripeException { final Charge charge = Charge.retrieve(CHARGE_ID); resetNetworkSpy(); return charge; }
@Test public void testRetrieve() throws StripeException { final Charge charge = Charge.retrieve(CHARGE_ID); assertNotNull(charge); verifyRequest( ApiResource.RequestMethod.GET, String.format("/v1/charges/%s", CHARGE_ID) ); }
@Override public CaptureResult capture(AuthorizationResult authorizationResult) { String id = authorizationResult.getProviderUniqueId(); try { authorizationResult.getProviderUniqueId(); Charge ch = Charge.retrieve(id, options); ch.capture(options); return new CaptureResult( providerId, TransactionResult.CommunicationResult.SUCCESS, null, null, null, id ); } catch(StripeException e) { ConvertedError converted = convertError(e); return new CaptureResult( providerId, converted.communicationResult, converted.providerErrorCode, converted.errorCode, converted.providerErrorMessage, id ); } }