Details
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 f8fd726..14428ca 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
@@ -173,12 +173,15 @@ public class TransactionResource extends JaxRsResourceBase {
@ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid transaction id supplied"),
@ApiResponse(code = 404, message = "Invoice not found")})
public Response getTags(@PathParam(ID_PARAM_NAME) final String id,
+ @QueryParam(QUERY_WITH_PLUGIN_INFO) @DefaultValue("false") final Boolean withPluginInfo,
+ @QueryParam(QUERY_WITH_ATTEMPTS) @DefaultValue("false") final Boolean withAttempts,
+ @QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString,
@QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode,
@QueryParam(QUERY_TAGS_INCLUDED_DELETED) @DefaultValue("false") final Boolean includedDeleted,
@javax.ws.rs.core.Context final HttpServletRequest request) throws TagDefinitionApiException, PaymentApiException {
final TenantContext tenantContext = context.createContext(request);
- final PaymentTransaction paymentTransaction = paymentApi.getPaymentTransactionById(UUID.fromString(id), tenantContext);
- final Payment payment = paymentApi.getPayment(paymentTransaction.getPaymentId(), false, false, ImmutableList.<PluginProperty>of(), tenantContext);
+ final Iterable<PluginProperty> pluginProperties = extractPluginProperties(pluginPropertiesString);
+ final Payment payment = paymentApi.getPaymentByTransactionId(UUID.fromString(id), withPluginInfo, withAttempts, pluginProperties, tenantContext);
return super.getTags(payment.getAccountId(), UUID.fromString(id), auditMode, includedDeleted, tenantContext);
}
diff --git a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java
index f57bea6..273f4cc 100644
--- a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java
+++ b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentApi.java
@@ -912,8 +912,12 @@ public class DefaultPaymentApi extends DefaultApiBase implements PaymentApi {
}
@Override
- public PaymentTransaction getPaymentTransactionById(final UUID paymentTransactionId, final TenantContext context) throws PaymentApiException {
- return paymentProcessor.getPaymentTransactionById(paymentTransactionId, internalCallContextFactory.createInternalTenantContextWithoutAccountRecordId(context));
+ public Payment getPaymentByTransactionId(final UUID transactionId, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentApiException {
+ final Payment payment = paymentProcessor.getPaymentByTransactionId(transactionId, withPluginInfo, withAttempts, properties, context, internalCallContextFactory.createInternalTenantContext(transactionId, ObjectType.PAYMENT, context));
+ if (payment == null) {
+ throw new PaymentApiException(ErrorCode.PAYMENT_NO_SUCH_PAYMENT, transactionId);
+ }
+ return payment;
}
private PaymentTransaction findPaymentTransaction(final Payment payment, @Nullable final String paymentTransactionExternalKey) {
diff --git a/payment/src/main/java/org/killbill/billing/payment/core/PaymentProcessor.java b/payment/src/main/java/org/killbill/billing/payment/core/PaymentProcessor.java
index 0b29de1..ce07214 100644
--- a/payment/src/main/java/org/killbill/billing/payment/core/PaymentProcessor.java
+++ b/payment/src/main/java/org/killbill/billing/payment/core/PaymentProcessor.java
@@ -389,26 +389,13 @@ public class PaymentProcessor extends ProcessorBase {
}
}
- public PaymentTransaction getPaymentTransactionById(final UUID transactionId,
- final InternalTenantContext internalTenantContext) throws PaymentApiException {
+ public Payment getPaymentByTransactionId(final UUID transactionId, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext tenantContext, final InternalTenantContext internalTenantContext) throws PaymentApiException {
final PaymentTransactionModelDao paymentTransactionDao = paymentDao.getPaymentTransaction(transactionId, internalTenantContext);
- return new DefaultPaymentTransaction(
- paymentTransactionDao.getId(),
- paymentTransactionDao.getAttemptId(),
- paymentTransactionDao.getTransactionExternalKey(),
- paymentTransactionDao.getCreatedDate(),
- paymentTransactionDao.getUpdatedDate(),
- paymentTransactionDao.getPaymentId(),
- paymentTransactionDao.getTransactionType(),
- paymentTransactionDao.getEffectiveDate(),
- paymentTransactionDao.getTransactionStatus(),
- paymentTransactionDao.getAmount(),
- paymentTransactionDao.getCurrency(),
- paymentTransactionDao.getProcessedAmount(),
- paymentTransactionDao.getProcessedCurrency(),
- paymentTransactionDao.getGatewayErrorCode(),
- paymentTransactionDao.getGatewayErrorMsg(),
- null);
+ if (null != paymentTransactionDao) {
+ PaymentModelDao paymentModelDao = paymentDao.getPayment(paymentTransactionDao.getPaymentId(), internalTenantContext);
+ return toPayment(paymentModelDao, withPluginInfo, withAttempts, properties, tenantContext, internalTenantContext);
+ }
+ return null;
}
private Payment performOperation(final boolean isApiPayment,