Details
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AccountResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AccountResource.java
index 1b34707..1e4f451 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AccountResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AccountResource.java
@@ -34,7 +34,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -110,7 +109,6 @@ import org.killbill.billing.payment.api.PluginProperty;
import org.killbill.billing.payment.api.TransactionStatus;
import org.killbill.billing.payment.api.TransactionType;
import org.killbill.billing.util.UUIDs;
-import org.killbill.billing.util.api.AuditLevel;
import org.killbill.billing.util.api.AuditUserApi;
import org.killbill.billing.util.api.CustomFieldApiException;
import org.killbill.billing.util.api.CustomFieldUserApi;
@@ -151,7 +149,7 @@ import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
@Singleton
@Path(JaxrsResource.ACCOUNTS_PATH)
-@Api(value = JaxrsResource.ACCOUNTS_PATH, description = "Operations on accounts", tags="Account")
+@Api(value = JaxrsResource.ACCOUNTS_PATH, description = "Operations on accounts", tags = "Account")
public class AccountResource extends JaxRsResourceBase {
private static final String ID_PARAM_NAME = "accountId";
@@ -295,24 +293,22 @@ public class AccountResource extends JaxRsResourceBase {
subscriptionApi.getSubscriptionBundlesForAccountIdAndExternalKey(accountId, externalKey, tenantContext) :
subscriptionApi.getSubscriptionBundlesForAccountId(accountId, tenantContext);
-
final AccountAuditLogs accountAuditLogs = auditUserApi.getAccountAuditLogs(account.getId(), auditMode.getLevel(), tenantContext);
-
boolean filter = (null != bundlesFilter && !bundlesFilter.isEmpty());
final Collection<BundleJson> result = Collections2.transform(
(filter) ? filterBundles(bundles, Arrays.asList(bundlesFilter.split(","))) : bundles, new Function<SubscriptionBundle, BundleJson>() {
- @Override
- public BundleJson apply(final SubscriptionBundle input) {
- try {
- return new BundleJson(input, account.getCurrency(), accountAuditLogs);
- } catch (final CatalogApiException e) {
- // Not the cleanest thing, but guava Api don't allow throw..
- throw new RuntimeException(e);
- }
- }
- });
+ @Override
+ public BundleJson apply(final SubscriptionBundle input) {
+ try {
+ return new BundleJson(input, account.getCurrency(), accountAuditLogs);
+ } catch (final CatalogApiException e) {
+ // Not the cleanest thing, but guava Api don't allow throw..
+ throw new RuntimeException(e);
+ }
+ }
+ });
return Response.status(Status.OK).entity(result).build();
}
@@ -331,7 +327,7 @@ public class AccountResource extends JaxRsResourceBase {
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve an account by external key", response = AccountJson.class)
@ApiResponses(value = {@ApiResponse(code = 404, message = "Account not found")})
- public Response getAccountByKey(@ApiParam(required=true) @QueryParam(QUERY_EXTERNAL_KEY) final String externalKey,
+ public Response getAccountByKey(@ApiParam(required = true) @QueryParam(QUERY_EXTERNAL_KEY) final String externalKey,
@QueryParam(QUERY_ACCOUNT_WITH_BALANCE) @DefaultValue("false") final Boolean accountWithBalance,
@QueryParam(QUERY_ACCOUNT_WITH_BALANCE_AND_CBA) @DefaultValue("false") final Boolean accountWithBalanceAndCBA,
@QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode,
@@ -362,7 +358,8 @@ public class AccountResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create account", response = AccountJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account data supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Account created successfully"),
+ @ApiResponse(code = 400, message = "Invalid account data supplied")})
public Response createAccount(final AccountJson json,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
@@ -376,7 +373,6 @@ public class AccountResource extends JaxRsResourceBase {
return uriBuilder.buildResponse(uriInfo, AccountResource.class, "getAccount", account.getId(), request);
}
-
@TimedResource
@PUT
@Consumes(APPLICATION_JSON)
@@ -402,7 +398,6 @@ public class AccountResource extends JaxRsResourceBase {
return Response.status(Status.OK).build();
}
-
@TimedResource
@DELETE
@Path("/{accountId:" + UUID_PATTERN + "}")
@@ -768,8 +763,8 @@ public class AccountResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Path("/{accountId:" + UUID_PATTERN + "}/" + INVOICE_PAYMENTS)
@ApiOperation(value = "Trigger a payment for all unpaid invoices")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id supplied"),
- @ApiResponse(code = 404, message = "Account not found")})
+ @ApiResponses(value = {/* @ApiResponse(code = 200, message = "Successful"), */
+ @ApiResponse(code = 404, message = "Invalid account id supplied")})
public Response payAllInvoices(@PathParam("accountId") final UUID accountId,
@QueryParam(QUERY_PAYMENT_EXTERNAL) @DefaultValue("false") final Boolean externalPayment,
@QueryParam(QUERY_PAYMENT_AMOUNT) final BigDecimal paymentAmount,
@@ -821,7 +816,8 @@ public class AccountResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add a payment method", response = PaymentMethodJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Payment method created"),
+ @ApiResponse(code = 400, message = "Invalid account id supplied"),
@ApiResponse(code = 404, message = "Account not found")})
public Response createPaymentMethod(@PathParam("accountId") final UUID accountId,
final PaymentMethodJson json,
@@ -849,7 +845,6 @@ public class AccountResource extends JaxRsResourceBase {
return Response.status(Status.BAD_REQUEST).build();
}
-
final PaymentOptions paymentOptions = createControlPluginApiPaymentOptions(paymentControlPluginNames);
final UUID paymentMethodId = paymentApi.addPaymentMethodWithPaymentControl(account, data.getExternalKey(), data.getPluginName(), isDefault, data.getPluginDetail(), pluginProperties, paymentOptions, callContext);
if (payAllUnpaidInvoices && unpaidInvoices.size() > 0) {
@@ -923,7 +918,8 @@ public class AccountResource extends JaxRsResourceBase {
@Produces(APPLICATION_JSON)
@Path("/{accountId:" + UUID_PATTERN + "}/" + PAYMENT_METHODS + "/{paymentMethodId:" + UUID_PATTERN + "}/" + PAYMENT_METHODS_DEFAULT_PATH_POSTFIX)
@ApiOperation(value = "Set the default payment method")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id or payment method id supplied"),
+ @ApiResponses(value = {/* @ApiResponse(code = 200, message = "Successful"),*/
+ @ApiResponse(code = 400, message = "Invalid account id or payment method id supplied"),
@ApiResponse(code = 404, message = "Account not found")})
public Response setDefaultPaymentMethod(@PathParam("accountId") final UUID accountId,
@PathParam("paymentMethodId") final UUID paymentMethodId,
@@ -976,8 +972,6 @@ public class AccountResource extends JaxRsResourceBase {
return Response.status(Response.Status.OK).entity(result).build();
}
-
-
@TimedResource(name = "processPayment")
@POST
@Path("/" + PAYMENTS)
@@ -993,7 +987,7 @@ public class AccountResource extends JaxRsResourceBase {
@ApiResponse(code = 503, message = "Payment in unknown status, failed to receive gateway response"),
@ApiResponse(code = 504, message = "Payment operation timeout")})
public Response processPaymentByExternalKey(@MetricTag(tag = "type", property = "transactionType") final PaymentTransactionJson json,
- @ApiParam(required=true) @QueryParam(QUERY_EXTERNAL_KEY) final String externalKey,
+ @ApiParam(required = true) @QueryParam(QUERY_EXTERNAL_KEY) final String externalKey,
@QueryParam(QUERY_PAYMENT_METHOD_ID) final UUID paymentMethodId,
@QueryParam(QUERY_PAYMENT_CONTROL_PLUGIN_NAME) final List<String> paymentControlPluginNames,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@@ -1063,9 +1057,9 @@ public class AccountResource extends JaxRsResourceBase {
if (paymentId != null) {
final Payment initialPayment = paymentApi.getPayment(paymentId, false, false, pluginProperties, callContext);
final PaymentTransaction pendingOrSuccessTransaction = lookupPendingOrSuccessTransaction(initialPayment,
- json != null ? json.getTransactionId() : null,
- json != null ? json.getTransactionExternalKey() : null,
- json != null ? json.getTransactionType() : null);
+ json != null ? json.getTransactionId() : null,
+ json != null ? json.getTransactionExternalKey() : null,
+ json != null ? json.getTransactionType() : null);
// If transaction was already completed, return early (See #626)
if (pendingOrSuccessTransaction.getTransactionStatus() == TransactionStatus.SUCCESS) {
return uriBuilder.buildResponse(uriInfo, PaymentResource.class, "getPayment", pendingOrSuccessTransaction.getPaymentId(), request);
@@ -1077,7 +1071,6 @@ public class AccountResource extends JaxRsResourceBase {
}
validatePaymentMethodForAccount(account.getId(), paymentMethodId, callContext);
-
final TransactionType transactionType = json.getTransactionType();
final PaymentOptions paymentOptions = createControlPluginApiPaymentOptions(paymentControlPluginNames);
final Payment result;
@@ -1158,8 +1151,9 @@ public class AccountResource extends JaxRsResourceBase {
@POST
@Path("/{accountId:" + UUID_PATTERN + "}/" + BLOCK)
@Consumes(APPLICATION_JSON)
- @ApiOperation(value = "Block an account")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id supplied"),
+ @ApiOperation(value = "Block an account", response = BlockingStateJson.class, responseContainer = "List")
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Blocking state created successfully"),
+ @ApiResponse(code = 400, message = "Invalid account id supplied"),
@ApiResponse(code = 404, message = "Account not found")})
public Response addAccountBlockingState(@PathParam(ID_PARAM_NAME) final UUID id,
final BlockingStateJson json,
@@ -1214,7 +1208,8 @@ public class AccountResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add custom fields to account", response = CustomField.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Custom field created successfully"),
+ @ApiResponse(code = 400, message = "Invalid account id supplied")})
public Response createAccountCustomFields(@PathParam(ID_PARAM_NAME) final UUID accountId,
final List<CustomFieldJson> customFields,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -1226,7 +1221,6 @@ public class AccountResource extends JaxRsResourceBase {
comment, request), uriInfo, request);
}
-
@TimedResource
@PUT
@Path("/{accountId:" + UUID_PATTERN + "}/" + CUSTOM_FIELDS)
@@ -1304,7 +1298,8 @@ public class AccountResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add tags to account", response = TagJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tag created successfully"),
+ @ApiResponse(code = 400, message = "Invalid account id supplied")})
public Response createAccountTags(@PathParam(ID_PARAM_NAME) final UUID accountId,
final List<UUID> tagList,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -1377,7 +1372,8 @@ public class AccountResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add account email", response = AccountEmailJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Email created successfully"),
+ @ApiResponse(code = 400, message = "Invalid account id supplied"),
@ApiResponse(code = 404, message = "Account not found")})
public Response addEmail(@PathParam(ID_PARAM_NAME) final UUID accountId,
final AccountEmailJson json,
@@ -1390,7 +1386,6 @@ public class AccountResource extends JaxRsResourceBase {
verifyNonNullOrEmpty(json.getEmail(), "AccountEmailJson email needs to be set");
final CallContext callContext = context.createCallContextWithAccountId(accountId, createdBy, reason, comment, request);
-
// Make sure the account exist or we will confuse the history and auditing code
accountUserApi.getAccountById(accountId, callContext);
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AdminResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AdminResource.java
index c0db07b..9a41251 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AdminResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AdminResource.java
@@ -261,7 +261,7 @@ public class AdminResource extends JaxRsResourceBase {
@Produces(APPLICATION_JSON)
@Path("/invoices")
@ApiOperation(value = "Trigger an invoice generation for all parked accounts")
- @ApiResponses(value = {})
+ /* @ApiResponses(value = {@ApiResponse(code = 200, message = "Successful")})*/
public Response triggerInvoiceGenerationForParkedAccounts(@QueryParam(QUERY_SEARCH_OFFSET) @DefaultValue("0") final Long offset,
@QueryParam(QUERY_SEARCH_LIMIT) @DefaultValue("100") final Long limit,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/BundleResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/BundleResource.java
index 103b78b..78ffb7a 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/BundleResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/BundleResource.java
@@ -276,8 +276,9 @@ public class BundleResource extends JaxRsResourceBase {
@POST
@Path("/{bundleId:" + UUID_PATTERN + "}/" + BLOCK)
@Consumes(APPLICATION_JSON)
- @ApiOperation(value = "Block a bundle")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid bundle id supplied"),
+ @ApiOperation(value = "Block a bundle", response = BlockingStateJson.class, responseContainer = "List")
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Blocking state created successfully"),
+ @ApiResponse(code = 400, message = "Invalid bundle id supplied"),
@ApiResponse(code = 404, message = "Bundle not found")})
public Response addBundleBlockingState(@PathParam(ID_PARAM_NAME) final UUID id,
final BlockingStateJson json,
@@ -313,7 +314,8 @@ public class BundleResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add custom fields to bundle", response = CustomField.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid bundle id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Custom field created successfully"),
+ @ApiResponse(code = 400, message = "Invalid bundle id supplied")})
public Response createBundleCustomFields(@PathParam(ID_PARAM_NAME) final UUID bundleId,
final List<CustomFieldJson> customFields,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -383,8 +385,9 @@ public class BundleResource extends JaxRsResourceBase {
@Path("/{bundleId:" + UUID_PATTERN + "}")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
- @ApiOperation(value = "Transfer a bundle to another account")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid bundle id, requested date or policy supplied"),
+ @ApiOperation(value = "Transfer a bundle to another account", response = BundleJson.class)
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Bundle transferred successfully"),
+ @ApiResponse(code = 400, message = "Invalid bundle id, requested date or policy supplied"),
@ApiResponse(code = 404, message = "Bundle not found")})
public Response transferBundle(@PathParam(ID_PARAM_NAME) final UUID bundleId,
final BundleJson json,
@@ -442,7 +445,8 @@ public class BundleResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add tags to bundle", response = TagJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid bundle id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tag created successfully"),
+ @ApiResponse(code = 400, message = "Invalid bundle id supplied")})
public Response createBundleTags(@PathParam(ID_PARAM_NAME) final UUID bundleId,
final List<UUID> tagList,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/CatalogResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/CatalogResource.java
index 0b030e1..23ebb79 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/CatalogResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/CatalogResource.java
@@ -81,6 +81,7 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
@@ -178,8 +179,8 @@ public class CatalogResource extends JaxRsResourceBase {
@POST
@Path("/xml")
@Consumes(TEXT_XML)
- @ApiOperation(value = "Upload the full catalog as XML")
- @ApiResponses(value = {})
+ @ApiOperation(value = "Upload the full catalog as XML", response = String.class)
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Catalog XML created successfully")})
public Response uploadCatalogXml(final String catalogXML,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
@@ -422,8 +423,8 @@ public class CatalogResource extends JaxRsResourceBase {
@Path("/simplePlan")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
- @ApiOperation(value = "Add a simple plan entry in the current version of the catalog")
- @ApiResponses(value = {})
+ @ApiOperation(value = "Add a simple plan entry in the current version of the catalog", response = String.class)
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created new plan successfully")})
public Response addSimplePlan(final SimplePlanJson simplePlan,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/CreditResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/CreditResource.java
index 98f306e..0d4b453 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/CreditResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/CreditResource.java
@@ -104,7 +104,8 @@ public class CreditResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create a credit", response = CreditJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created credit successfully"),
+ @ApiResponse(code = 400, message = "Invalid account id supplied"),
@ApiResponse(code = 404, message = "Account not found")})
public Response createCredit(final CreditJson json,
@QueryParam(QUERY_AUTO_COMMIT) @DefaultValue("false") final Boolean autoCommit,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceItemResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceItemResource.java
index 8eeb8a5..445a96b 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceItemResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceItemResource.java
@@ -95,7 +95,8 @@ public class InvoiceItemResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add custom fields to invoice item", response = CustomField.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid invoice item id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Custom field created successfully"),
+ @ApiResponse(code = 400, message = "Invalid invoice item id supplied")})
public Response createInvoiceItemCustomFields(@PathParam(ID_PARAM_NAME) final UUID id,
final List<CustomFieldJson> customFields,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -167,7 +168,8 @@ public class InvoiceItemResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add tags to invoice item", response = TagJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid invoice item id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tag created successfully"),
+ @ApiResponse(code = 400, message = "Invalid invoice item id supplied")})
public Response createInvoiceItemTags(@PathParam(ID_PARAM_NAME) final UUID id,
final List<UUID> tagList,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoicePaymentResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoicePaymentResource.java
index 3faf690..630c184 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoicePaymentResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoicePaymentResource.java
@@ -147,7 +147,8 @@ public class InvoicePaymentResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Refund a payment, and adjust the invoice if needed", response = InvoicePaymentJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid payment id supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created refund successfully"),
+ @ApiResponse(code = 400, message = "Invalid payment id supplied"),
@ApiResponse(code = 404, message = "Account or payment not found")})
public Response createRefundWithAdjustments(@PathParam("paymentId") final UUID paymentId,
final InvoicePaymentTransactionJson json,
@@ -210,7 +211,8 @@ public class InvoicePaymentResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Record a chargeback", response = InvoicePaymentJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid payment id supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created chargeback successfully"),
+ @ApiResponse(code = 400, message = "Invalid payment id supplied"),
@ApiResponse(code = 404, message = "Account or payment not found")})
public Response createChargeback(@PathParam("paymentId") final UUID paymentId,
final InvoicePaymentTransactionJson json,
@@ -238,7 +240,8 @@ public class InvoicePaymentResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Record a chargebackReversal", response = InvoicePaymentJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid payment id supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created chargeback reversal successfully"),
+ @ApiResponse(code = 400, message = "Invalid payment id supplied"),
@ApiResponse(code = 404, message = "Account or payment not found")})
public Response createChargebackReversal(@PathParam("paymentId") final UUID paymentId,
final InvoicePaymentTransactionJson json,
@@ -329,7 +332,8 @@ public class InvoicePaymentResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add custom fields to payment", response = CustomField.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid payment id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Custom field created successfully"),
+ @ApiResponse(code = 400, message = "Invalid payment id supplied")})
public Response createInvoicePaymentCustomFields(@PathParam(ID_PARAM_NAME) final UUID id,
final List<CustomFieldJson> customFields,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -401,7 +405,8 @@ public class InvoicePaymentResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add tags to payment", response = TagJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid payment id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tag created successfully"),
+ @ApiResponse(code = 400, message = "Invalid payment id supplied")})
public Response createInvoicePaymentTags(@PathParam(ID_PARAM_NAME) final UUID id,
final List<UUID> tagList,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceResource.java
index 67cad44..ef61369 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceResource.java
@@ -292,7 +292,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Trigger an invoice generation", response = InvoiceJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id or target datetime supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created invoice successfully"),
+ @ApiResponse(code = 400, message = "Invalid account id or target datetime supplied")})
public Response createFutureInvoice(@ApiParam(required=true) @QueryParam(QUERY_ACCOUNT_ID) final UUID accountId,
@QueryParam(QUERY_TARGET_DATE) final String targetDate,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -322,7 +323,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create a migration invoice", response = InvoiceJson.class, tags="Invoice")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id or target datetime supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created migration invoice successfully"),
+ @ApiResponse(code = 400, message = "Invalid account id or target datetime supplied")})
public Response createMigrationInvoice(@PathParam("accountId") final UUID accountId,
final List<InvoiceItemJson> items,
@Nullable @QueryParam(QUERY_TARGET_DATE) final String targetDate,
@@ -346,7 +348,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Generate a dryRun invoice", response = InvoiceJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id or target datetime supplied")})
+ @ApiResponses(value = {/* @ApiResponse(code = 200, message = "Successful"), */
+ @ApiResponse(code = 400, message = "Invalid account id or target datetime supplied")})
public Response generateDryRunInvoice(@Nullable final InvoiceDryRunJson dryRunSubscriptionSpec,
@ApiParam(required=true) @QueryParam(QUERY_ACCOUNT_ID) final UUID accountId,
@Nullable @QueryParam(QUERY_TARGET_DATE) final String targetDate,
@@ -433,7 +436,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Adjust an invoice item", response = InvoiceJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id, invoice id or invoice item id supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created adjustment Successfully"),
+ @ApiResponse(code = 400, message = "Invalid account id, invoice id or invoice item id supplied"),
@ApiResponse(code = 404, message = "Invoice not found")})
public Response adjustInvoiceItem(@PathParam("invoiceId") final UUID invoiceId,
final InvoiceItemJson json,
@@ -485,7 +489,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Path("/" + CHARGES + "/{accountId:" + UUID_PATTERN + "}")
@ApiOperation(value = "Create external charge(s)", response = InvoiceItemJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created external charge Successfully"),
+ @ApiResponse(code = 400, message = "Invalid account id supplied"),
@ApiResponse(code = 404, message = "Account not found")})
public Response createExternalCharges(@PathParam("accountId") final UUID accountId,
final List<InvoiceItemJson> externalChargesJson,
@@ -642,7 +647,9 @@ public class InvoiceResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Path("/{invoiceId:" + UUID_PATTERN + "}/" + PAYMENTS)
@ApiOperation(value = "Trigger a payment for invoice", response = InvoicePaymentJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid account id or invoice id supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Created payment Successfully"),
+ @ApiResponse(code = 204, message = "Nothing to pay for"),
+ @ApiResponse(code = 400, message = "Invalid account id or invoice id supplied"),
@ApiResponse(code = 404, message = "Account not found")})
public Response createInstantPayment(@PathParam("invoiceId") final UUID invoiceId,
final InvoicePaymentJson payment,
@@ -690,8 +697,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Produces(TEXT_PLAIN)
@Consumes(TEXT_PLAIN)
@Path("/" + INVOICE_TRANSLATION + "/{locale:" + ANYTHING_PATTERN + "}/")
- @ApiOperation(value = "Upload the invoice translation for the tenant")
- @ApiResponses(value = {})
+ @ApiOperation(value = "Upload the invoice translation for the tenant", response = String.class)
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Uploaded invoice translation Successfully")})
public Response uploadInvoiceTranslation(@PathParam("locale") final String localeStr,
final String invoiceTranslation,
@QueryParam(QUERY_DELETE_IF_EXISTS) @DefaultValue("false") final boolean deleteIfExists,
@@ -729,8 +736,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Produces(TEXT_PLAIN)
@Consumes(TEXT_PLAIN)
@Path("/" + INVOICE_CATALOG_TRANSLATION + "/{locale:" + ANYTHING_PATTERN + "}/")
- @ApiOperation(value = "Upload the catalog translation for the tenant")
- @ApiResponses(value = {})
+ @ApiOperation(value = "Upload the catalog translation for the tenant", response = String.class)
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Uploaded catalog translation Successfully")})
public Response uploadCatalogTranslation(@PathParam("locale") final String localeStr,
final String catalogTranslation,
@QueryParam(QUERY_DELETE_IF_EXISTS) @DefaultValue("false") final boolean deleteIfExists,
@@ -767,8 +774,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Produces(TEXT_HTML)
@Consumes(TEXT_HTML)
@Path("/" + INVOICE_TEMPLATE)
- @ApiOperation(value = "Upload the invoice template for the tenant")
- @ApiResponses(value = {})
+ @ApiOperation(value = "Upload the invoice template for the tenant", response = String.class)
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Uploaded invoice template Successfully")})
public Response uploadInvoiceTemplate(final String catalogTranslation,
@QueryParam(QUERY_DELETE_IF_EXISTS) @DefaultValue("false") final boolean deleteIfExists,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -804,8 +811,7 @@ public class InvoiceResource extends JaxRsResourceBase {
@Produces(TEXT_HTML)
@Consumes(TEXT_HTML)
@Path("/" + INVOICE_MP_TEMPLATE)
- @ApiOperation(value = "Upload the manualPay invoice template for the tenant")
- @ApiResponses(value = {})
+ @ApiOperation(value = "Upload the manualPay invoice template for the tenant", response = String.class)
public Response uploadInvoiceMPTemplate(final String catalogTranslation,
@QueryParam(QUERY_DELETE_IF_EXISTS) @DefaultValue("false") final boolean deleteIfExists,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -888,7 +894,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add custom fields to invoice", response = CustomField.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid invoice id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Custom field created successfully"),
+ @ApiResponse(code = 400, message = "Invalid invoice id supplied")})
public Response createInvoiceCustomFields(@PathParam(ID_PARAM_NAME) final UUID id,
final List<CustomFieldJson> customFields,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -957,7 +964,8 @@ public class InvoiceResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add tags to invoice", response = TagJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid invoice id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tag created successfully"),
+ @ApiResponse(code = 400, message = "Invalid invoice id supplied")})
public Response createInvoiceTags(@PathParam(ID_PARAM_NAME) final UUID id,
final List<UUID> tagList,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/KillBillApiDefinition.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/KillBillApiDefinition.java
index 881bc6e..2346827 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/KillBillApiDefinition.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/KillBillApiDefinition.java
@@ -120,9 +120,6 @@ public class KillBillApiDefinition implements ReaderListener {
qp.getName().equals(JaxrsResource.QUERY_START_DATE) ||
qp.getName().equals(JaxrsResource.QUERY_END_DATE) ||
qp.getName().equals(JaxrsResource.QUERY_TARGET_DATE)) {
-
-
-
qp.setType("string");
// Yack... See #922
if (op.getOperationId().equals("getCatalogJson") || op.getOperationId().equals("setTestClockTime")) {
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/NodesInfoResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/NodesInfoResource.java
index 69e0d40..a105cef 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/NodesInfoResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/NodesInfoResource.java
@@ -146,7 +146,8 @@ public class NodesInfoResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Trigger a node command")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid node command supplied")})
+ @ApiResponses(value = {/*@ApiResponse(code = 200, message = "Success"),*/
+ @ApiResponse(code = 400, message = "Invalid node command supplied")})
public Response triggerNodeCommand(final NodeCommandJson json,
@QueryParam(QUERY_LOCAL_NODE_ONLY) @DefaultValue("false") final Boolean localNodeOnly,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -173,7 +174,7 @@ public class NodesInfoResource extends JaxRsResourceBase {
};
killbillInfoApi.triggerNodeCommand(nodeCommand, localNodeOnly);
- return Response.status(Status.CREATED).build();
+ return Response.status(Status.OK).build();
}
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/OverdueResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/OverdueResource.java
index 576cd76..782c07a 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/OverdueResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/OverdueResource.java
@@ -54,6 +54,7 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
@@ -150,8 +151,9 @@ public class OverdueResource extends JaxRsResourceBase {
@POST
@Path("/xml")
@Consumes(TEXT_XML)
- @ApiOperation(value = "Upload the full overdue config as XML")
- @ApiResponses(value = {})
+ @ApiOperation(value = "Upload the full overdue config as XML", response = String.class)
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Successfully uploaded overdue config"),
+ @ApiResponse(code = 400, message = "Invalid node command supplied")})
public Response uploadOverdueConfigXml(final String overdueXML,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
@@ -167,7 +169,8 @@ public class OverdueResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Upload the full overdue config as JSON", response = OverdueJson.class)
- @ApiResponses(value = {})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Successfully uploaded overdue config"),
+ @ApiResponse(code = 400, message = "Invalid node command supplied")})
public Response uploadOverdueConfigJson(final OverdueJson overdueJson,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
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 9b2b795..db66455 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
@@ -92,7 +92,8 @@ public class PaymentGatewayResource extends ComboPaymentResource {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Combo API to generate form data to redirect the customer to the gateway", response = HostedPaymentPageFormDescriptorJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid data for Account or PaymentMethod")})
+ @ApiResponses(value = {/*@ApiResponse(code = 200, message = "Successful"),*/
+ @ApiResponse(code = 400, message = "Invalid data for Account or PaymentMethod")})
public Response buildComboFormDescriptor(final ComboHostedPaymentPageJson json,
@QueryParam(QUERY_PAYMENT_CONTROL_PLUGIN_NAME) final List<String> paymentControlPluginNames,
@QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@@ -127,7 +128,7 @@ public class PaymentGatewayResource extends ComboPaymentResource {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Generate form data to redirect the customer to the gateway", response = HostedPaymentPageFormDescriptorJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid accountId supplied"),
+ @ApiResponses(value = {/* @ApiResponse(code = 200, message = "Successful"),*/
@ApiResponse(code = 404, message = "Account not found")})
public Response buildFormDescriptor(@PathParam("accountId") final UUID accountId,
final HostedPaymentPageFieldsJson json,
@@ -161,7 +162,7 @@ public class PaymentGatewayResource extends ComboPaymentResource {
@Consumes(WILDCARD)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Process a gateway notification", notes = "The response is built by the appropriate plugin")
- @ApiResponses(value = {})
+ /*@ApiResponses(value = {@ApiResponse(code = 200, message = "Successful")})*/
public Response processNotification(@PathParam(PATH_PAYMENT_PLUGIN_NAME) final String pluginName,
final String body,
@QueryParam(QUERY_PAYMENT_CONTROL_PLUGIN_NAME) final List<String> paymentControlPluginNames,
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 78cd119..d0dd4da 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
@@ -299,7 +299,8 @@ public class PaymentMethodResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add custom fields to payment method", response = CustomField.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid payment method id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Custom field created successfully"),
+ @ApiResponse(code = 400, message = "Invalid payment method id supplied")})
public Response createPaymentMethodCustomFields(@PathParam("paymentMethodId") final UUID paymentMethodId,
final List<CustomFieldJson> customFields,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
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 e91d41f..f4de22e 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
@@ -800,7 +800,8 @@ public class PaymentResource extends ComboPaymentResource {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add custom fields to payment", response = CustomField.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid payment id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Custom field created successfully"),
+ @ApiResponse(code = 400, message = "Invalid payment id supplied")})
public Response createPaymentCustomFields(@PathParam(ID_PARAM_NAME) final UUID id,
final List<CustomFieldJson> customFields,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -868,7 +869,8 @@ public class PaymentResource extends ComboPaymentResource {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add tags to payment payment", response = TagJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid payment id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tag created successfully"),
+ @ApiResponse(code = 400, message = "Invalid payment id supplied")})
public Response createPaymentTags(@PathParam(ID_PARAM_NAME) final UUID paymentId,
final List<UUID> tagList,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SecurityResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SecurityResource.java
index 5c1132b..d5e8322 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SecurityResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SecurityResource.java
@@ -59,6 +59,7 @@ import com.google.common.collect.Iterables;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
@@ -115,7 +116,8 @@ public class SecurityResource extends JaxRsResourceBase {
@Path("/users")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
- @ApiOperation(value = "Add a new user with roles (to make api requests)")
+ @ApiOperation(value = "Add a new user with roles (to make api requests)", response = UserRolesJson.class)
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "User role created successfully")})
public Response addUserRoles(final UserRolesJson json,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
@@ -209,7 +211,8 @@ public class SecurityResource extends JaxRsResourceBase {
@Path("/roles")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
- @ApiOperation(value = "Add a new role definition)")
+ @ApiOperation(value = "Add a new role definition)", response = RoleDefinitionJson.class)
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Role definition created successfully")})
public Response addRoleDefinition(final RoleDefinitionJson json,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SubscriptionResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SubscriptionResource.java
index 69064fd..f0ebac5 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SubscriptionResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SubscriptionResource.java
@@ -168,7 +168,7 @@ public class SubscriptionResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create an subscription", response = SubscriptionJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid subscription supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Subscription created successfully")})
public Response createSubscription(final SubscriptionJson subscription,
@ApiParam(hidden = true) @QueryParam(QUERY_REQUESTED_DT) final String requestedDate, /* This is deprecated, only used for backward compatibility */
@QueryParam(QUERY_ENTITLEMENT_REQUESTED_DT) final String entitlementDate,
@@ -257,7 +257,7 @@ public class SubscriptionResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create an entitlement with addOn products", response = BundleJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid entitlement supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Subscriptions created successfully")})
public Response createSubscriptionWithAddOns(final List<SubscriptionJson> entitlements,
@ApiParam(hidden = true) @QueryParam(QUERY_REQUESTED_DT) final String requestedDate, /* This is deprecated, only used for backward compatibility */
@QueryParam(QUERY_ENTITLEMENT_REQUESTED_DT) final String entitlementDate,
@@ -282,7 +282,7 @@ public class SubscriptionResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create multiple entitlements with addOn products", response = BundleJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid entitlements supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Subscriptions created successfully")})
public Response createSubscriptionsWithAddOns(final List<BulkSubscriptionsBundleJson> entitlementsWithAddOns,
@ApiParam(hidden = true) @QueryParam(QUERY_REQUESTED_DT) final String requestedDate, /* This is deprecated, only used for backward compatibility */
@QueryParam(QUERY_ENTITLEMENT_REQUESTED_DT) final String entitlementDate,
@@ -625,8 +625,9 @@ public class SubscriptionResource extends JaxRsResourceBase {
@POST
@Path("/{subscriptionId:" + UUID_PATTERN + "}/" + BLOCK)
@Consumes(APPLICATION_JSON)
- @ApiOperation(value = "Block a subscription")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid subscription id supplied"),
+ @ApiOperation(value = "Block a subscription", response = BlockingStateJson.class, responseContainer = "List")
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Blocking state created successfully"),
+ @ApiResponse(code = 400, message = "Invalid subscription id supplied"),
@ApiResponse(code = 404, message = "Subscription not found")})
public Response addSubscriptionBlockingState(@PathParam(ID_PARAM_NAME) final UUID id,
final BlockingStateJson json,
@@ -875,7 +876,8 @@ public class SubscriptionResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add custom fields to subscription")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid subscription id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Custom field created successfully"),
+ @ApiResponse(code = 400, message = "Invalid subscription id supplied")})
public Response createSubscriptionCustomFields(@PathParam(ID_PARAM_NAME) final UUID id,
final List<CustomFieldJson> customFields,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -939,8 +941,8 @@ public class SubscriptionResource extends JaxRsResourceBase {
@Path("/{subscriptionId:" + UUID_PATTERN + "}/" + TAGS)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
- @ApiOperation(value = "Add tags to subscription", response = TagJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid subscription id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tag created successfully"),
+ @ApiResponse(code = 400, message = "Invalid subscription id supplied")})
public Response createSubscriptionTags(@PathParam(ID_PARAM_NAME) final UUID id,
final List<UUID> tagList,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TagDefinitionResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TagDefinitionResource.java
index 8998ecf..44b2efe 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TagDefinitionResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TagDefinitionResource.java
@@ -119,7 +119,8 @@ public class TagDefinitionResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create a tag definition", response = TagDefinitionJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid name or description supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tag definition created successfully"),
+ @ApiResponse(code = 400, message = "Invalid name or description supplied")})
public Response createTagDefinition(final TagDefinitionJson json,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TenantResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TenantResource.java
index 6872a58..be9a9cd 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TenantResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TenantResource.java
@@ -123,7 +123,8 @@ public class TenantResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create a tenant", response = TenantJson.class)
- @ApiResponses(value = {@ApiResponse(code = 500, message = "Tenant already exists")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tenant created successfully"),
+ @ApiResponse(code = 500, message = "Tenant already exists")})
public Response createTenant(final TenantJson json,
@QueryParam(QUERY_TENANT_USE_GLOBAL_DEFAULT) @DefaultValue("false") final Boolean useGlobalDefault,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -153,7 +154,8 @@ public class TenantResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create a push notification", response = TenantKeyValueJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid tenantId supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Push notification registered successfully"),
+ @ApiResponse(code = 400, message = "Invalid tenantId supplied")})
public Response registerPushNotificationCallback(@QueryParam(QUERY_NOTIFICATION_CALLBACK) final String notificationCallback,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
@@ -191,7 +193,8 @@ public class TenantResource extends JaxRsResourceBase {
@Consumes(TEXT_PLAIN)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add a per tenant configuration for a plugin", response = TenantKeyValueJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid tenantId supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Plugin configuration uploaded successfully"),
+ @ApiResponse(code = 400, message = "Invalid tenantId supplied")})
public Response uploadPluginConfiguration(@PathParam("pluginName") final String pluginName,
final String pluginConfig,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -254,7 +257,8 @@ public class TenantResource extends JaxRsResourceBase {
@Consumes(TEXT_PLAIN)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add a per tenant configuration (system properties)", response = TenantKeyValueJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid tenantId supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Per tenant configuration uploaded successfully"),
+ @ApiResponse(code = 400, message = "Invalid tenantId supplied")})
public Response uploadPerTenantConfiguration(final String perTenantConfig,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,
@@ -292,7 +296,8 @@ public class TenantResource extends JaxRsResourceBase {
@Consumes(TEXT_PLAIN)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add a per tenant payment state machine for a plugin", response = TenantKeyValueJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid tenantId supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Per tenant state machine uploaded successfully"),
+ @ApiResponse(code = 400, message = "Invalid tenantId supplied")})
public Response uploadPluginPaymentStateMachineConfig(@PathParam("pluginName") final String pluginName,
final String paymentStateMachineConfig,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -333,7 +338,8 @@ public class TenantResource extends JaxRsResourceBase {
@Consumes(TEXT_PLAIN)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add a per tenant user key/value", response = TenantKeyValueJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid tenantId supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Per tenant config uploaded successfully"),
+ @ApiResponse(code = 400, message = "Invalid tenantId supplied")})
public Response insertUserKeyValue(@PathParam("keyName") final String key,
final String value,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TestResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TestResource.java
index 8c73ca9..5a78b55 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TestResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TestResource.java
@@ -173,7 +173,8 @@ public class TestResource extends JaxRsResourceBase {
@Path("/clock")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Set the current time", response = ClockResource.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid time or timezone supplied")})
+ @ApiResponses(value = {/* @ApiResponse(code = 200, message = "Successful"), */
+ @ApiResponse(code = 400, message = "Invalid time or timezone supplied")})
public Response setTestClockTime(@QueryParam(QUERY_REQUESTED_DT) final String requestedClockDate,
@QueryParam("timeZone") final String timeZoneStr,
@QueryParam("timeoutSec") @DefaultValue("5") final Long timeoutSec,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TransactionResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TransactionResource.java
index 1483657..8a7e112 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TransactionResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/TransactionResource.java
@@ -117,7 +117,8 @@ public class TransactionResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Mark a pending payment transaction as succeeded or failed", response = PaymentJson.class)
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid paymentId supplied"),
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Successfully notifiy state change"),
+ @ApiResponse(code = 400, message = "Invalid paymentId supplied"),
@ApiResponse(code = 404, message = "Account or Payment not found")})
public Response notifyStateChanged(@PathParam("transactionId") final UUID transactionId,
final PaymentTransactionJson json,
@@ -163,7 +164,8 @@ public class TransactionResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add custom fields to payment transaction", response = CustomField.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid transaction id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Custom field created successfully"),
+ @ApiResponse(code = 400, message = "Invalid transaction id supplied")})
public Response createTransactionCustomFields(@PathParam(ID_PARAM_NAME) final UUID id,
final List<CustomFieldJson> customFields,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@@ -233,7 +235,8 @@ public class TransactionResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Add tags to payment transaction", response = TagJson.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid transaction id supplied")})
+ @ApiResponses(value = {@ApiResponse(code = 201, message = "Tag created successfully"),
+ @ApiResponse(code = 400, message = "Invalid transaction id supplied")})
public Response createTransactionTags(@PathParam(ID_PARAM_NAME) final UUID id,
final List<UUID> tagList,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/UsageResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/UsageResource.java
index 1e51050..b9f1c65 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/UsageResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/UsageResource.java
@@ -99,7 +99,8 @@ public class UsageResource extends JaxRsResourceBase {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Record usage for a subscription")
- @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid subscription (e.g. inactive)")})
+ @ApiResponses(value = {@ApiResponse(code = 200, message = "Successfully recorded usage data change"),
+ @ApiResponse(code = 400, message = "Invalid subscription (e.g. inactive)")})
public Response recordUsage(final SubscriptionUsageRecordJson json,
@HeaderParam(HDR_CREATED_BY) final String createdBy,
@HeaderParam(HDR_REASON) final String reason,