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

com.payu.sdk.api.ApiEndpoints Maven / Gradle / Ivy

The newest version!
package com.payu.sdk.api;

import retrofit.Endpoint;
import retrofit.Endpoints;

public enum ApiEndpoints {

  PAYMENTS_PRODUCTION("payments_production", "https://api.payulatam.com/payments-api"),
  PAYMENTS_TESTING("payments_testing", "https://stg.api.payulatam.com/payments-api"),
  REPORTS_PRODUCTION("reports_production", "https://api.payulatam.com/reports-api"),
  REPORTS_TESTING("reports_testing", "https://stg.api.payulatam.com/reports-api"),
  CUSTOM("custom", null);

  public final String name;
  public final String url;

  ApiEndpoints(String name, String url) {
    this.name = name;
    this.url = url;
  }

  public static ApiEndpoints from(String endpoint) {
    for (ApiEndpoints value : values()) {
      if (value.url != null && value.url.equals(endpoint)) {
        return value;
      }
    }
    return CUSTOM;
  }

  public Endpoint endpoint() {
    return Endpoints.newFixedEndpoint(this.url, this.name);
  }

  @Override public String toString() {
    return name;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy