use of com.stripe.model.StripeObject in project stripe-java by stripe.
the class LiveStripeResponseGetter method staticRequest.
private static <T> T staticRequest(APIResource.RequestMethod method, String url, Map<String, Object> params, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException {
StripeResponse response = rawRequest(method, url, params, type, options);
int responseCode = response.code();
String responseBody = response.body();
String requestId = response.requestId();
if (responseCode < 200 || responseCode >= 300) {
handleAPIError(responseBody, responseCode, requestId);
}
T resource = APIResource.GSON.fromJson(responseBody, clazz);
if (resource instanceof StripeObject) {
StripeObject obj = (StripeObject) resource;
obj.setLastResponse(response);
}
return resource;
}
Aggregations