killbill-uncached

analytics: don't fail a refresh if the plugin couldn't retrieve

4/23/2013 1:31:23 PM

Details

diff --git a/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/dao/factory/BusinessFactoryBase.java b/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/dao/factory/BusinessFactoryBase.java
index f49c9fc..dbf5a07 100644
--- a/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/dao/factory/BusinessFactoryBase.java
+++ b/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/dao/factory/BusinessFactoryBase.java
@@ -399,8 +399,17 @@ public abstract class BusinessFactoryBase {
         final PaymentApi paymentApi = getPaymentUserApi();
 
         try {
+            // Try to get the payment information, with plugin information
             return paymentApi.getPayment(paymentId, true, context);
         } catch (PaymentApiException e) {
+            logService.log(LogService.LOG_INFO, "Error retrieving payment with plugin info for id " + paymentId, e);
+        }
+
+        try {
+            // If we come here, it is possible that the plugin couldn't answer about the payment, maybe
+            // because it was deleted in the gateway. Try to return the Kill Bill specific info only
+            return paymentApi.getPayment(paymentId, false, context);
+        } catch (PaymentApiException e) {
             logService.log(LogService.LOG_WARNING, "Error retrieving payment for id " + paymentId, e);
             throw new AnalyticsRefreshException(e);
         }