Tabnine Logo
RecurlyAPIError
Code IndexAdd Tabnine to your IDE (free)

How to use
RecurlyAPIError
in
com.ning.billing.recurly.model

Best Java code snippets using com.ning.billing.recurly.model.RecurlyAPIError (Showing top 11 results out of 315)

origin: killbilling/recurly-java-library

public static RecurlyAPIError buildFromResponse(final Response response) {
  final RecurlyAPIError recurlyAPIError = new RecurlyAPIError();
  recurlyAPIError.setResponse(response);
  return recurlyAPIError;
}
origin: killbilling/recurly-java-library

protected void setResponse(final Response response) {
  this.setHttpStatusCode(response.getStatusCode());
  this.setResponseMetadata(new ResponseMetadata(response));
}
origin: killbilling/recurly-java-library

log.warn("Recurly error whilst calling: {}\n{}", response.getUri(), payload);
log.warn("Error status code: {}\n", response.getStatusCode());
RecurlyAPIError recurlyError = RecurlyAPIError.buildFromResponse(response);
  recurlyError.setSymbol("unauthorized");
  recurlyError.setDescription("We could not authenticate your request. Either your subdomain and private key are not set or incorrect");
    recurlyError = RecurlyAPIError.buildFromXml(xmlMapper, payload, response);
  } catch (Exception e) {
    log.debug("Unable to extract error", e);
origin: com.ning.billing/recurly-java-library

@Test(groups = "integration")
public void testUnauthorizedException() throws Exception {
  final String subdomain = System.getProperty(KILLBILL_PAYMENT_RECURLY_SUBDOMAIN);
  RecurlyClient unauthorizedRecurlyClient = new RecurlyClient("invalid-api-key", subdomain);
  unauthorizedRecurlyClient.open();
  try {
    unauthorizedRecurlyClient.getAccounts();
    Assert.fail("getAccounts call should not succeed with invalid credentials.");
  } catch (RecurlyAPIException expected) {
    Assert.assertEquals(expected.getRecurlyError().getSymbol(), "unauthorized");
  }
}
origin: com.ning.billing/recurly-java-library

  Assert.fail("Failed to delete the Adjustment");
} catch (final RecurlyAPIException e) {
  Assert.assertEquals(e.getRecurlyError().getHttpStatusCode(), 404);
origin: killbilling/recurly-java-library

public static RecurlyAPIError buildFromXml(final XmlMapper xmlMapper, final String payload, final Response response) throws IOException {
  final RecurlyAPIError recurlyAPIError = xmlMapper.readValue(payload, RecurlyAPIError.class);
  recurlyAPIError.setResponse(response);
  return recurlyAPIError;
}
origin: killbilling/recurly-java-library

private InputStream callRecurlySafeGetPdf(String url) {
  final Response response;
  final InputStream pdfInputStream;
  try {
    response = clientRequestBuilderCommon(client.prepareGet(url))
        .addHeader("Accept", "application/pdf")
        .addHeader("Content-Type", "application/pdf")
        .execute()
        .get();
    pdfInputStream = response.getResponseBodyAsStream();
  } catch (InterruptedException e) {
    log.error("Interrupted while calling recurly", e);
    return null;
  } catch (ExecutionException e) {
    log.error("Execution error", e);
    return null;
  } catch (IOException e) {
    log.error("Error retrieving response body", e);
    return null;
  }
  if (response.getStatusCode() != 200) {
    final RecurlyAPIError recurlyAPIError = RecurlyAPIError.buildFromResponse(response);
    throw new RecurlyAPIException(recurlyAPIError);
  }
  return pdfInputStream;
}
origin: killbilling/recurly-java-library

@Test(groups = "integration")
public void testUnauthorizedException() throws Exception {
  final String subdomain = System.getProperty(KILLBILL_PAYMENT_RECURLY_SUBDOMAIN);
  RecurlyClient unauthorizedRecurlyClient = new RecurlyClient("invalid-api-key", subdomain);
  unauthorizedRecurlyClient.open();
  try {
    unauthorizedRecurlyClient.getAccounts();
    Assert.fail("getAccounts call should not succeed with invalid credentials.");
  } catch (RecurlyAPIException expected) {
    Assert.assertEquals(expected.getRecurlyError().getSymbol(), "unauthorized");
  }
}
origin: killbilling/recurly-java-library

  Assert.fail("Failed to delete the Adjustment");
} catch (final RecurlyAPIException e) {
  Assert.assertEquals(e.getRecurlyError().getHttpStatusCode(), 404);
origin: killbilling/recurly-java-library

} catch (RecurlyAPIException ex) {
  final RecurlyAPIError err = ex.getRecurlyError();
  Assert.assertEquals(err.getSymbol(), "not_found");
} catch (Exception ex) {
  Assert.fail("Fetching deleted shipping address should have failed with 404 and instead failed because: " + ex.getMessage());
origin: com.ning.billing/recurly-java-library

} catch (RecurlyAPIException ex) {
  final RecurlyAPIError err = ex.getRecurlyError();
  Assert.assertEquals(err.getSymbol(), "not_found");
} catch (Exception ex) {
  Assert.fail("Fetching deleted shipping address should have failed with 404 and instead failed because: " + ex.getMessage());
com.ning.billing.recurly.modelRecurlyAPIError

Most used methods

  • <init>
  • buildFromResponse
  • buildFromXml
  • getHttpStatusCode
  • getSymbol
  • setDescription
  • setHttpStatusCode
  • setResponse
  • setResponseMetadata
  • setSymbol
  • toString
  • toString

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • findViewById (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now