Class JaxRsResourceBase
- java.lang.Object
-
- org.killbill.billing.jaxrs.resources.JaxRsResourceBase
-
- All Implemented Interfaces:
JaxrsResource
- Direct Known Subclasses:
AccountResource,AdminResource,BundleResource,CatalogResource,ComboPaymentResource,CreditResource,CustomFieldResource,ExportResource,InvoiceItemResource,InvoicePaymentResource,InvoiceResource,NodesInfoResource,OverdueResource,PaymentMethodResource,PluginInfoResource,PluginResource,SecurityResource,SubscriptionResource,TagDefinitionResource,TagResource,TenantResource,TestResource,TransactionResource,UsageResource
public abstract class JaxRsResourceBase extends Object implements JaxrsResource
-
-
Field Summary
Fields Modifier and Type Field Description protected AccountUserApiaccountUserApiprotected org.killbill.billing.util.api.AuditUserApiauditUserApiprotected static StringcatalogNameprotected org.killbill.clock.Clockclockprotected Contextcontextprotected org.killbill.billing.util.api.CustomFieldUserApicustomFieldUserApiprotected org.joda.time.format.DateTimeFormatterDATE_TIME_FORMATTERprotected InvoicePaymentApiinvoicePaymentApiprotected org.joda.time.format.DateTimeFormatterLOCAL_DATE_FORMATTERprotected static ObjectMappermapperprotected PaymentApipaymentApiprotected SubscriptionApisubscriptionApiprotected org.killbill.billing.util.api.TagUserApitagUserApiprotected JaxrsUriBuilderuriBuilder-
Fields inherited from interface org.killbill.billing.jaxrs.resources.JaxrsResource
ACCOUNTS, ACCOUNTS_PATH, ADMIN, ADMIN_PATH, ALL_CUSTOM_FIELDS, ALL_TAGS, ANALYTICS, ANALYTICS_PATH, ANYTHING_PATTERN, API_POSTFIX, API_PREFIX, API_VERSION, ATTEMPTS, AUDIT_LOG, AUDIT_LOG_WITH_HISTORY, AUTHORIZATION, BCD, BLOCK, BUNDLES, BUNDLES_PATH, CACHE, CANCEL_SCHEDULED_PAYMENT_TRANSACTION, CAPTURE, CATALOG, CATALOG_PATH, CBA_REBALANCING, CHARGEBACK_REVERSALS, CHARGEBACK_REVERSALS_PATH, CHARGEBACKS, CHARGEBACKS_PATH, CHARGES, CHARGES_PATH, CHILDREN, COMBO, COMMIT_INVOICE, CREDITS, CREDITS_PATH, CUSTOM_FIELDS, CUSTOM_FIELDS_PATH, DRY_RUN, EMAIL_NOTIFICATIONS, EMAILS, ENTITLEMENTS, ENTITLEMENTS_PATH, EVENTS, EXPORT, EXPORT_PATH, FORM, GROUP, HDR_API_KEY, HDR_API_SECRET, HDR_COMMENT, HDR_CREATED_BY, HDR_PAGINATION_CURRENT_OFFSET, HDR_PAGINATION_MAX_NB_RECORDS, HDR_PAGINATION_NEXT_OFFSET, HDR_PAGINATION_NEXT_PAGE_URI, HDR_PAGINATION_TOTAL_NB_RECORDS, HDR_REASON, HEALTHCHECK, HOSTED, INVOICE_CATALOG_TRANSLATION, INVOICE_ITEMS, INVOICE_MP_TEMPLATE, INVOICE_PAYMENTS, INVOICE_PAYMENTS_PATH, INVOICE_TEMPLATE, INVOICE_TRANSLATION, INVOICES, INVOICES_ITEMS_PATH, INVOICES_PATH, MIGRATION, NODES_INFO, NODES_INFO_PATH, NOTIFICATION, NUMBER_PATTERN, OVERDUE, OVERDUE_PATH, PAGINATION, PATH_PAYMENT_PLUGIN_NAME, PAUSE, PAYMENT_GATEWAYS, PAYMENT_GATEWAYS_PATH, PAYMENT_METHODS, PAYMENT_METHODS_DEFAULT_PATH_POSTFIX, PAYMENT_METHODS_PATH, PAYMENT_TRANSACTIONS, PAYMENT_TRANSACTIONS_PATH, PAYMENTS, PAYMENTS_PATH, PLUGINS, PLUGINS_INFO, PLUGINS_INFO_PATH, PLUGINS_PATH, PREFIX, QUANTITY, QUERY_ACCOUNT_ID, QUERY_ACCOUNT_TREAT_NULL_AS_RESET, QUERY_ACCOUNT_WITH_BALANCE, QUERY_ACCOUNT_WITH_BALANCE_AND_CBA, QUERY_API_KEY, QUERY_AUDIT, QUERY_AUTO_COMMIT, QUERY_BCD_TRANSFER, QUERY_BILLING_POLICY, QUERY_BILLING_REQUESTED_DT, QUERY_BLOCKING_STATE_SVCS, QUERY_BLOCKING_STATE_TYPES, QUERY_BUNDLES_FILTER, QUERY_BUNDLES_RENAME_KEY_IF_EXIST_UNUSED, QUERY_CALL_COMPLETION, QUERY_CALL_TIMEOUT, QUERY_CANCEL_ALL_SUBSCRIPTIONS, QUERY_CUSTOM_FIELD, QUERY_DELETE_DEFAULT_PM_WITH_AUTO_PAY_OFF, QUERY_DELETE_IF_EXISTS, QUERY_END_DATE, QUERY_ENTITLEMENT_EFFECTIVE_FROM_DT, QUERY_ENTITLEMENT_POLICY, QUERY_ENTITLEMENT_REQUESTED_DT, QUERY_EXTERNAL_KEY, QUERY_FORCE_DEFAULT_PM_DELETION, QUERY_FORCE_NEW_BCD_WITH_PAST_EFFECTIVE_DATE, QUERY_FORCE_NEW_QUANTITY_WITH_PAST_EFFECTIVE_DATE, QUERY_INCLUDE_INVOICE_COMPONENTS, QUERY_INCLUDE_VOIDED_INVOICES, QUERY_INCLUDED_DELETED, QUERY_INVOICE_WITH_CHILDREN_ITEMS, QUERY_INVOICES_FILTER, QUERY_ITEM_ADJUST_UNPAID_INVOICES, QUERY_LOCAL_NODE_ONLY, QUERY_MIGRATED, QUERY_NOTIFICATION_CALLBACK, QUERY_OBJECT_TYPE, QUERY_PARALLEL, QUERY_PAY_ALL_UNPAID_INVOICES, QUERY_PAY_INVOICE, QUERY_PAYMENT_AMOUNT, QUERY_PAYMENT_CONTROL_PLUGIN_NAME, QUERY_PAYMENT_EXTERNAL, QUERY_PAYMENT_EXTERNAL_KEY, QUERY_PAYMENT_METHOD_ID, QUERY_PAYMENT_METHOD_IS_DEFAULT, QUERY_PAYMENT_METHOD_PLUGIN_NAME, QUERY_PAYMENT_PLUGIN_NAME, QUERY_PAYMENT_WITH_REFUNDS_AND_CHARGEBACKS, QUERY_PLUGIN_PROPERTY, QUERY_REMOVE_FUTURE_NOTIFICATIONS, QUERY_REQUESTED_DT, QUERY_SEARCH_LIMIT, QUERY_SEARCH_OFFSET, QUERY_SKIP_RESPONSE, QUERY_START_DATE, QUERY_TAG, QUERY_TAGS_INCLUDED_DELETED, QUERY_TARGET_DATE, QUERY_TENANT_USE_GLOBAL_DEFAULT, QUERY_TRANSACTION_EXTERNAL_KEY, QUERY_UNPAID_INVOICES_ONLY, QUERY_USE_REQUESTED_DATE_FOR_BILLING, QUERY_WITH_ATTEMPTS, QUERY_WITH_MIGRATION_INVOICES, QUERY_WITH_PLUGIN_INFO, QUERY_WRITE_OFF_UNPAID_INVOICES, REFUNDS, REGISTER_NOTIFICATION_CALLBACK, RENAME_KEY, RESUME, SEARCH, SECURITY, SECURITY_PATH, STRING_PATTERN, SUBSCRIPTIONS, SUBSCRIPTIONS_PATH, TAG_DEFINITIONS, TAG_DEFINITIONS_PATH, TAGS, TAGS_PATH, TAXES, TENANTS, TENANTS_PATH, TEST, TEST_PATH, TIMELINE, TRANSFER_CREDIT, UNDO_CANCEL, UNDO_CHANGE_PLAN, UPLOAD_PER_TENANT_CONFIG, UPLOAD_PLUGIN_CONFIG, UPLOAD_PLUGIN_PAYMENT_STATE_MACHINE_CONFIG, USAGES, USAGES_PATH, USER_KEY_VALUE, UUID_PATTERN, VOID_INVOICE
-
-
Constructor Summary
Constructors Constructor Description JaxRsResourceBase(JaxrsUriBuilder uriBuilder, org.killbill.billing.util.api.TagUserApi tagUserApi, org.killbill.billing.util.api.CustomFieldUserApi customFieldUserApi, org.killbill.billing.util.api.AuditUserApi auditUserApi, AccountUserApi accountUserApi, PaymentApi paymentApi, InvoicePaymentApi invoicePaymentApi, SubscriptionApi subscriptionApi, org.killbill.clock.Clock clock, Context context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.ws.rs.core.ResponseaddBlockingState(BlockingStateJson json, UUID accountId, UUID blockableId, BlockingStateType type, String requestedDate, List<String> pluginPropertiesString, String createdBy, String reason, String comment, javax.servlet.http.HttpServletRequest request, javax.ws.rs.core.UriInfo uriInfo)protected <E extends Entity,J extends JsonBase>
javax.ws.rs.core.ResponsebuildStreamingPaginationResponse(Pagination<E> entities, Function<E,J> toJson, URI nextPageUri)protected voidcompleteTransactionInternal(PaymentTransactionJson json, Payment initialPayment, List<String> paymentControlPluginNames, Iterable<PluginProperty> pluginProperties, TenantContext contextNoAccountId, String createdBy, String reason, String comment, javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest request)protected PaymentOptionscreateControlPluginApiPaymentOptions(boolean isExternalPayment, List<String> paymentControlPluginNames)protected PaymentOptionscreateControlPluginApiPaymentOptions(List<String> paymentControlPluginNames)protected javax.ws.rs.core.ResponsecreateCustomFieldResponse(Iterable<CustomField> fields, AuditMode auditMode, TenantContext context)protected javax.ws.rs.core.ResponsecreateCustomFields(UUID id, List<CustomFieldJson> customFields, CallContext context, javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest request)protected PaymentOptionscreateInvoicePaymentControlPluginApiPaymentOptions(boolean isExternalPayment)protected javax.ws.rs.core.ResponsecreatePaymentResponse(javax.ws.rs.core.UriInfo uriInfo, Payment payment, TransactionType transactionType, String transactionExternalKey, javax.servlet.http.HttpServletRequest request)protected InvoicePaymentcreatePurchaseForInvoice(Account account, UUID invoiceId, BigDecimal amountToPay, UUID paymentMethodId, Boolean externalPayment, String paymentExternalKey, String transactionExternalKey, Iterable<PluginProperty> pluginProperties, CallContext callContext)protected InvoicePaymentcreatePurchaseForInvoice(Account account, UUID invoiceId, BigDecimal amountToPay, UUID paymentMethodId, String paymentExternalKey, String transactionExternalKey, Iterable<PluginProperty> pluginProperties, PaymentOptions paymentOptions, CallContext callContext)protected javax.ws.rs.core.ResponsecreateTagResponse(UUID accountId, List<Tag> tags, AuditMode auditMode, TenantContext context)protected javax.ws.rs.core.ResponsecreateTags(UUID id, List<UUID> tagList, javax.ws.rs.core.UriInfo uriInfo, CallContext context, javax.servlet.http.HttpServletRequest request)protected javax.ws.rs.core.ResponsedeleteCustomFields(UUID id, List<UUID> customFieldList, CallContext context)protected javax.ws.rs.core.ResponsedeleteTags(UUID id, List<UUID> tagList, CallContext context)protected Iterable<PluginProperty>extractPluginProperties(Iterable<String> pluginProperties, PluginProperty... additionalProperties)protected Iterable<PluginProperty>extractPluginProperties(Iterable<PluginPropertyJson> pluginProperties)protected List<AuditLogJson>getAuditLogsWithHistory(List<AuditLogWithHistory> auditLogWithHistory)protected javax.ws.rs.core.ResponsegetCustomFields(UUID id, AuditMode auditMode, TenantContext context)static UUIDgetInvoiceId(List<InvoicePayment> invoicePayments, Payment payment)protected org.killbill.billing.ObjectTypegetObjectType()protected PaymentgetPaymentByIdOrKey(UUID paymentId, String externalKey, Iterable<PluginProperty> pluginProperties, TenantContext tenantContext)static Iterable<PaymentTransaction>getPaymentTransactions(List<Payment> payments, TransactionType transactionType)protected Collection<UUID>getTagDefinitionUUIDs(List<String> tagList)protected javax.ws.rs.core.ResponsegetTags(UUID accountId, UUID taggedObjectId, AuditMode auditMode, boolean includeDeleted, TenantContext context)protected booleanisDateTime(String inputDate)protected PaymentTransactionlookupPendingOrSuccessTransaction(Payment initialPayment, UUID transactionId, String transactionExternalKey, TransactionType transactionType)protected javax.ws.rs.core.ResponsemodifyCustomFields(UUID id, List<CustomFieldJson> customFields, CallContext context)protected org.joda.time.DateTimetoDateTime(String inputDate)protected org.joda.time.LocalDatetoLocalDate(String inputDate)protected org.joda.time.LocalDatetoLocalDateDefaultToday(UUID accountId, String inputDate, TenantContext context)protected org.joda.time.LocalDatetoLocalDateDefaultToday(Account account, String inputDate, TenantContext context)protected voidvalidatePaymentMethodForAccount(UUID accountId, UUID paymentMethodId, CallContext callContext)protected Iterable<InvoiceItem>validateSanitizeAndTranformInputItems(Currency accountCurrency, Iterable<InvoiceItemJson> inputItems)protected voidverifyNonNull(Object... elements)protected voidverifyNonNullOrEmpty(Object... elements)
-
-
-
Field Detail
-
catalogName
protected static final String catalogName
- See Also:
- Constant Field Values
-
mapper
protected static final ObjectMapper mapper
-
uriBuilder
protected final JaxrsUriBuilder uriBuilder
-
tagUserApi
protected final org.killbill.billing.util.api.TagUserApi tagUserApi
-
customFieldUserApi
protected final org.killbill.billing.util.api.CustomFieldUserApi customFieldUserApi
-
auditUserApi
protected final org.killbill.billing.util.api.AuditUserApi auditUserApi
-
accountUserApi
protected final AccountUserApi accountUserApi
-
paymentApi
protected final PaymentApi paymentApi
-
invoicePaymentApi
protected final InvoicePaymentApi invoicePaymentApi
-
subscriptionApi
protected final SubscriptionApi subscriptionApi
-
context
protected final Context context
-
clock
protected final org.killbill.clock.Clock clock
-
DATE_TIME_FORMATTER
protected final org.joda.time.format.DateTimeFormatter DATE_TIME_FORMATTER
-
LOCAL_DATE_FORMATTER
protected final org.joda.time.format.DateTimeFormatter LOCAL_DATE_FORMATTER
-
-
Constructor Detail
-
JaxRsResourceBase
public JaxRsResourceBase(JaxrsUriBuilder uriBuilder, org.killbill.billing.util.api.TagUserApi tagUserApi, org.killbill.billing.util.api.CustomFieldUserApi customFieldUserApi, org.killbill.billing.util.api.AuditUserApi auditUserApi, AccountUserApi accountUserApi, PaymentApi paymentApi, InvoicePaymentApi invoicePaymentApi, SubscriptionApi subscriptionApi, org.killbill.clock.Clock clock, Context context)
-
-
Method Detail
-
getObjectType
protected org.killbill.billing.ObjectType getObjectType()
-
addBlockingState
protected javax.ws.rs.core.Response addBlockingState(BlockingStateJson json, UUID accountId, UUID blockableId, BlockingStateType type, String requestedDate, List<String> pluginPropertiesString, String createdBy, String reason, String comment, javax.servlet.http.HttpServletRequest request, @Nullable javax.ws.rs.core.UriInfo uriInfo) throws SubscriptionApiException, EntitlementApiException, AccountApiException
-
getTags
protected javax.ws.rs.core.Response getTags(@Nullable UUID accountId, UUID taggedObjectId, AuditMode auditMode, boolean includeDeleted, TenantContext context) throws org.killbill.billing.util.api.TagDefinitionApiException- Throws:
org.killbill.billing.util.api.TagDefinitionApiException
-
createTagResponse
protected javax.ws.rs.core.Response createTagResponse(@Nullable UUID accountId, List<Tag> tags, AuditMode auditMode, TenantContext context) throws org.killbill.billing.util.api.TagDefinitionApiException- Throws:
org.killbill.billing.util.api.TagDefinitionApiException
-
createTags
protected javax.ws.rs.core.Response createTags(UUID id, List<UUID> tagList, javax.ws.rs.core.UriInfo uriInfo, CallContext context, javax.servlet.http.HttpServletRequest request) throws org.killbill.billing.util.api.TagApiException
- Throws:
org.killbill.billing.util.api.TagApiException
-
getTagDefinitionUUIDs
protected Collection<UUID> getTagDefinitionUUIDs(List<String> tagList)
-
deleteTags
protected javax.ws.rs.core.Response deleteTags(UUID id, List<UUID> tagList, CallContext context) throws org.killbill.billing.util.api.TagApiException
- Throws:
org.killbill.billing.util.api.TagApiException
-
getCustomFields
protected javax.ws.rs.core.Response getCustomFields(UUID id, AuditMode auditMode, TenantContext context)
-
createCustomFieldResponse
protected javax.ws.rs.core.Response createCustomFieldResponse(Iterable<CustomField> fields, AuditMode auditMode, TenantContext context)
-
createCustomFields
protected javax.ws.rs.core.Response createCustomFields(UUID id, List<CustomFieldJson> customFields, CallContext context, javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest request) throws org.killbill.billing.util.api.CustomFieldApiException
- Throws:
org.killbill.billing.util.api.CustomFieldApiException
-
modifyCustomFields
protected javax.ws.rs.core.Response modifyCustomFields(UUID id, List<CustomFieldJson> customFields, CallContext context) throws org.killbill.billing.util.api.CustomFieldApiException
- Throws:
org.killbill.billing.util.api.CustomFieldApiException
-
deleteCustomFields
protected javax.ws.rs.core.Response deleteCustomFields(UUID id, List<UUID> customFieldList, CallContext context) throws org.killbill.billing.util.api.CustomFieldApiException
- Parameters:
id- the if of the object for which the custom fields applycustomFieldList- a comma separated list of custom field ids or null if they should all be removedcontext- the context- Returns:
- Throws:
org.killbill.billing.util.api.CustomFieldApiException
-
buildStreamingPaginationResponse
protected <E extends Entity,J extends JsonBase> javax.ws.rs.core.Response buildStreamingPaginationResponse(Pagination<E> entities, Function<E,J> toJson, URI nextPageUri)
-
validatePaymentMethodForAccount
protected void validatePaymentMethodForAccount(UUID accountId, UUID paymentMethodId, CallContext callContext) throws PaymentApiException
- Throws:
PaymentApiException
-
getPaymentByIdOrKey
protected Payment getPaymentByIdOrKey(@Nullable UUID paymentId, @Nullable String externalKey, Iterable<PluginProperty> pluginProperties, TenantContext tenantContext) throws PaymentApiException
- Throws:
PaymentApiException
-
completeTransactionInternal
protected void completeTransactionInternal(PaymentTransactionJson json, Payment initialPayment, List<String> paymentControlPluginNames, Iterable<PluginProperty> pluginProperties, TenantContext contextNoAccountId, String createdBy, String reason, String comment, javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest request) throws PaymentApiException, AccountApiException
-
lookupPendingOrSuccessTransaction
protected PaymentTransaction lookupPendingOrSuccessTransaction(Payment initialPayment, @Nullable UUID transactionId, @Nullable String transactionExternalKey, @Nullable TransactionType transactionType) throws PaymentApiException
- Throws:
PaymentApiException
-
toLocalDateDefaultToday
protected org.joda.time.LocalDate toLocalDateDefaultToday(UUID accountId, @Nullable String inputDate, TenantContext context) throws AccountApiException
- Throws:
AccountApiException
-
toLocalDateDefaultToday
protected org.joda.time.LocalDate toLocalDateDefaultToday(Account account, @Nullable String inputDate, TenantContext context)
-
toLocalDate
protected org.joda.time.LocalDate toLocalDate(@Nullable String inputDate)
-
toDateTime
protected org.joda.time.DateTime toDateTime(@Nullable String inputDate)
-
isDateTime
protected boolean isDateTime(@Nullable String inputDate)
-
extractPluginProperties
protected Iterable<PluginProperty> extractPluginProperties(@Nullable Iterable<PluginPropertyJson> pluginProperties)
-
extractPluginProperties
protected Iterable<PluginProperty> extractPluginProperties(@Nullable Iterable<String> pluginProperties, PluginProperty... additionalProperties)
-
createPurchaseForInvoice
protected InvoicePayment createPurchaseForInvoice(Account account, UUID invoiceId, BigDecimal amountToPay, UUID paymentMethodId, Boolean externalPayment, String paymentExternalKey, String transactionExternalKey, Iterable<PluginProperty> pluginProperties, CallContext callContext) throws PaymentApiException
- Throws:
PaymentApiException
-
createPurchaseForInvoice
protected InvoicePayment createPurchaseForInvoice(Account account, UUID invoiceId, BigDecimal amountToPay, UUID paymentMethodId, String paymentExternalKey, String transactionExternalKey, Iterable<PluginProperty> pluginProperties, PaymentOptions paymentOptions, CallContext callContext) throws PaymentApiException
- Throws:
PaymentApiException
-
createInvoicePaymentControlPluginApiPaymentOptions
protected PaymentOptions createInvoicePaymentControlPluginApiPaymentOptions(boolean isExternalPayment)
-
createControlPluginApiPaymentOptions
protected PaymentOptions createControlPluginApiPaymentOptions(@Nullable List<String> paymentControlPluginNames)
-
createControlPluginApiPaymentOptions
protected PaymentOptions createControlPluginApiPaymentOptions(boolean isExternalPayment, List<String> paymentControlPluginNames)
-
validateSanitizeAndTranformInputItems
protected Iterable<InvoiceItem> validateSanitizeAndTranformInputItems(Currency accountCurrency, Iterable<InvoiceItemJson> inputItems) throws InvoiceApiException
- Throws:
InvoiceApiException
-
getPaymentTransactions
public static Iterable<PaymentTransaction> getPaymentTransactions(List<Payment> payments, TransactionType transactionType)
-
getInvoiceId
public static UUID getInvoiceId(List<InvoicePayment> invoicePayments, Payment payment)
-
verifyNonNullOrEmpty
protected void verifyNonNullOrEmpty(Object... elements)
-
verifyNonNull
protected void verifyNonNull(Object... elements)
-
createPaymentResponse
protected javax.ws.rs.core.Response createPaymentResponse(javax.ws.rs.core.UriInfo uriInfo, Payment payment, TransactionType transactionType, @Nullable String transactionExternalKey, javax.servlet.http.HttpServletRequest request)
-
getAuditLogsWithHistory
protected List<AuditLogJson> getAuditLogsWithHistory(List<AuditLogWithHistory> auditLogWithHistory)
-
-