All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stripe.net.StripeResponse Maven / Gradle / Ivy

There is a newer version: 26.13.0-beta.1
Show newest version
package com.stripe.net;

import java.util.List;
import java.util.Map;

public class StripeResponse {

  int code;
  String body;
  StripeHeaders headers;

  /** Constructs a Stripe response with the specified status code and body. */
  public StripeResponse(int code, String body) {
    this.code = code;
    this.body = body;
    this.headers = null;
  }

  /** Constructs a Stripe response with the specified status code, body and headers. */
  public StripeResponse(int code, String body, Map> headers) {
    this.code = code;
    this.body = body;
    this.headers = new StripeHeaders(headers);
  }

  public int code() {
    return this.code;
  }

  public String body() {
    return this.body;
  }

  public StripeHeaders headers() {
    return headers;
  }

  public String idempotencyKey() {
    return (headers != null) ? headers.get("Idempotency-Key") : null;
  }

  public String requestId() {
    return (headers != null) ? headers.get("Request-Id") : null;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy