Details
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentGatewayResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentGatewayResource.java
index dd84e46..fc8ce6a 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentGatewayResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentGatewayResource.java
@@ -59,6 +59,9 @@ import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+import com.wordnik.swagger.annotations.ApiResponse;
+import com.wordnik.swagger.annotations.ApiResponses;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static javax.ws.rs.core.MediaType.WILDCARD;
@@ -88,7 +91,9 @@ public class PaymentGatewayResource extends JaxRsResourceBase {
@Path("/" + HOSTED + "/" + FORM + "/{" + QUERY_ACCOUNT_ID + ":" + UUID_PATTERN + "}")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
- // Generate form data to redirect the customer to the gateway
+ @ApiOperation(value = "Generate form data to redirect the customer to the gateway", response = HostedPaymentPageFormDescriptorJson.class)
+ @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid accountId supplied"),
+ @ApiResponse(code = 404, message = "Account not found")})
public Response buildFormDescriptor(final HostedPaymentPageFieldsJson json,
@PathParam(QUERY_ACCOUNT_ID) final String accountIdString,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@@ -126,6 +131,8 @@ public class PaymentGatewayResource extends JaxRsResourceBase {
@Path("/" + NOTIFICATION + "/{" + QUERY_PAYMENT_PLUGIN_NAME + ":" + ANYTHING_PATTERN + "}")
@Consumes(WILDCARD)
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Process a gateway notification", notes = "The response is built by the appropriate plugin")
+ @ApiResponses(value = {})
public Response processNotification(final String body,
@PathParam(QUERY_PAYMENT_PLUGIN_NAME) final String pluginName,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentMethodResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentMethodResource.java
index 752b80c..002622a 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentMethodResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentMethodResource.java
@@ -64,6 +64,9 @@ import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+import com.wordnik.swagger.annotations.ApiResponse;
+import com.wordnik.swagger.annotations.ApiResponses;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
@@ -88,6 +91,9 @@ public class PaymentMethodResource extends JaxRsResourceBase {
@GET
@Path("/{paymentMethodId:" + UUID_PATTERN + "}")
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Retrieve a payment method by id", response = PaymentMethodJson.class)
+ @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid paymentMethodId supplied"),
+ @ApiResponse(code = 404, message = "Account or payment method not found")})
public Response getPaymentMethod(@PathParam("paymentMethodId") final String paymentMethodId,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode,
@@ -107,6 +113,8 @@ public class PaymentMethodResource extends JaxRsResourceBase {
@Timed
@GET
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Retrieve a payment method by external key", response = PaymentMethodJson.class)
+ @ApiResponses(value = {@ApiResponse(code = 404, message = "Account or payment method not found")})
public Response getPaymentMethodByKey(@QueryParam(QUERY_EXTERNAL_KEY) final String externalKey,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode,
@@ -126,6 +134,8 @@ public class PaymentMethodResource extends JaxRsResourceBase {
@GET
@Path("/" + PAGINATION)
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "List payment methods", response = PaymentMethodJson.class, responseContainer = "List")
+ @ApiResponses(value = {})
public Response getPaymentMethods(@QueryParam(QUERY_SEARCH_OFFSET) @DefaultValue("0") final Long offset,
@QueryParam(QUERY_SEARCH_LIMIT) @DefaultValue("100") final Long limit,
@QueryParam(QUERY_PAYMENT_METHOD_PLUGIN_NAME) final String pluginName,
@@ -180,6 +190,8 @@ public class PaymentMethodResource extends JaxRsResourceBase {
@GET
@Path("/" + SEARCH + "/{searchKey:" + ANYTHING_PATTERN + "}")
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Search payment methods", response = PaymentMethodJson.class, responseContainer = "List")
+ @ApiResponses(value = {})
public Response searchPaymentMethods(@PathParam("searchKey") final String searchKey,
@QueryParam(QUERY_SEARCH_OFFSET) @DefaultValue("0") final Long offset,
@QueryParam(QUERY_SEARCH_LIMIT) @DefaultValue("100") final Long limit,
@@ -237,6 +249,9 @@ public class PaymentMethodResource extends JaxRsResourceBase {
@DELETE
@Produces(APPLICATION_JSON)
@Path("/{paymentMethodId:" + UUID_PATTERN + "}")
+ @ApiOperation(value = "Delete a payment method")
+ @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid paymentMethodId supplied"),
+ @ApiResponse(code = 404, message = "Account or payment method not found")})
public Response deletePaymentMethod(@PathParam("paymentMethodId") final String paymentMethodId,
@QueryParam(QUERY_DELETE_DEFAULT_PM_WITH_AUTO_PAY_OFF) @DefaultValue("false") final Boolean deleteDefaultPaymentMethodWithAutoPayOff,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentResource.java
index f9ad929..cb8b4b5 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/PaymentResource.java
@@ -66,6 +66,9 @@ import com.google.common.base.Function;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+import com.wordnik.swagger.annotations.ApiResponse;
+import com.wordnik.swagger.annotations.ApiResponses;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
@@ -89,6 +92,9 @@ public class PaymentResource extends JaxRsResourceBase {
@GET
@Path("/{paymentId:" + UUID_PATTERN + "}/")
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Retrieve a payment by id", response = PaymentJson.class)
+ @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid paymentId supplied"),
+ @ApiResponse(code = 404, message = "Payment not found")})
public Response getPayment(@PathParam("paymentId") final String paymentIdStr,
@QueryParam(QUERY_WITH_PLUGIN_INFO) @DefaultValue("false") final Boolean withPluginInfo,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@@ -108,6 +114,8 @@ public class PaymentResource extends JaxRsResourceBase {
@GET
@Path("/" + PAGINATION)
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Get payments", response = PaymentJson.class, responseContainer = "List")
+ @ApiResponses(value = {})
public Response getPayments(@QueryParam(QUERY_SEARCH_OFFSET) @DefaultValue("0") final Long offset,
@QueryParam(QUERY_SEARCH_LIMIT) @DefaultValue("100") final Long limit,
@QueryParam(QUERY_PAYMENT_PLUGIN_NAME) final String pluginName,
@@ -149,6 +157,8 @@ public class PaymentResource extends JaxRsResourceBase {
@GET
@Path("/" + SEARCH + "/{searchKey:" + ANYTHING_PATTERN + "}")
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Search payments", response = PaymentJson.class, responseContainer = "List")
+ @ApiResponses(value = {})
public Response searchPayments(@PathParam("searchKey") final String searchKey,
@QueryParam(QUERY_SEARCH_OFFSET) @DefaultValue("0") final Long offset,
@QueryParam(QUERY_SEARCH_LIMIT) @DefaultValue("100") final Long limit,
@@ -194,6 +204,9 @@ public class PaymentResource extends JaxRsResourceBase {
@Path("/{paymentId:" + UUID_PATTERN + "}/")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Capture an existing authorization")
+ @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid paymentId supplied"),
+ @ApiResponse(code = 404, message = "Account or payment not found")})
public Response captureAuthorization(final PaymentTransactionJson json,
@PathParam("paymentId") final String paymentIdStr,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@@ -220,6 +233,9 @@ public class PaymentResource extends JaxRsResourceBase {
@Path("/{paymentId:" + UUID_PATTERN + "}/" + REFUNDS)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Refund an existing payment")
+ @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid paymentId supplied"),
+ @ApiResponse(code = 404, message = "Account or payment not found")})
public Response refundPayment(final PaymentTransactionJson json,
@PathParam("paymentId") final String paymentIdStr,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@@ -246,6 +262,9 @@ public class PaymentResource extends JaxRsResourceBase {
@Path("/{paymentId:" + UUID_PATTERN + "}/")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Void an existing payment")
+ @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid paymentId supplied"),
+ @ApiResponse(code = 404, message = "Account or payment not found")})
public Response voidPayment(final PaymentTransactionJson json,
@PathParam("paymentId") final String paymentIdStr,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@@ -271,6 +290,9 @@ public class PaymentResource extends JaxRsResourceBase {
@Path("/{paymentId:" + UUID_PATTERN + "}/" + CHARGEBACKS)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
+ @ApiOperation(value = "Record a chargeback")
+ @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid paymentId supplied"),
+ @ApiResponse(code = 404, message = "Account not found")})
public Response chargebackPayment(final PaymentTransactionJson json,
@PathParam("paymentId") final String paymentIdStr,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,