killbill-memoizeit

jaxrs: add support for InvoicePaymentInfoInternalEvent

4/18/2017 11:27:45 AM

Details

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 8cefa75..47f1153 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
@@ -1,7 +1,7 @@
 /*
  * Copyright 2010-2013 Ning, Inc.
- * Copyright 2014-2015 Groupon, Inc
- * Copyright 2014-2015 The Billing Project, LLC
+ * Copyright 2014-2017 Groupon, Inc
+ * Copyright 2014-2017 The Billing Project, LLC
  *
  * The Billing Project licenses this file to you under the Apache License, version 2.0
  * (the "License"); you may not use this file except in compliance with the
@@ -71,6 +71,7 @@ import org.killbill.billing.events.BlockingTransitionInternalEvent;
 import org.killbill.billing.events.EffectiveSubscriptionInternalEvent;
 import org.killbill.billing.events.InvoiceCreationInternalEvent;
 import org.killbill.billing.events.InvoicePaymentErrorInternalEvent;
+import org.killbill.billing.events.InvoicePaymentInfoInternalEvent;
 import org.killbill.billing.events.NullInvoiceInternalEvent;
 import org.killbill.billing.events.PaymentErrorInternalEvent;
 import org.killbill.billing.events.PaymentInfoInternalEvent;
@@ -785,6 +786,12 @@ public class SubscriptionResource extends JaxRsResourceBase {
         }
 
         @Override
+        public void onInvoicePaymentInfo(final InvoicePaymentInfoInternalEvent event) {
+            log.info("Got event InvoicePaymentInfo token='{}'", event.getUserToken());
+            notifyForCompletion();
+        }
+
+        @Override
         public void onInvoicePaymentError(final InvoicePaymentErrorInternalEvent event) {
             log.info("Got event InvoicePaymentError token='{}'", event.getUserToken());
             notifyForCompletion();
diff --git a/util/src/main/java/org/killbill/billing/util/userrequest/CompletionUserRequestBase.java b/util/src/main/java/org/killbill/billing/util/userrequest/CompletionUserRequestBase.java
index f48a2e8..81d6575 100644
--- a/util/src/main/java/org/killbill/billing/util/userrequest/CompletionUserRequestBase.java
+++ b/util/src/main/java/org/killbill/billing/util/userrequest/CompletionUserRequestBase.java
@@ -1,7 +1,7 @@
 /*
- * Copyright 2010-2011 Ning, Inc.
- * Copyright 2014 Groupon, Inc
- * Copyright 2014 The Billing Project, LLC
+ * Copyright 2010-2013 Ning, Inc.
+ * Copyright 2014-2017 Groupon, Inc
+ * Copyright 2014-2017 The Billing Project, LLC
  *
  * The Billing Project licenses this file to you under the Apache License, version 2.0
  * (the "License"); you may not use this file except in compliance with the
@@ -30,6 +30,7 @@ import org.killbill.billing.events.BusInternalEvent;
 import org.killbill.billing.events.EffectiveSubscriptionInternalEvent;
 import org.killbill.billing.events.InvoiceCreationInternalEvent;
 import org.killbill.billing.events.InvoicePaymentErrorInternalEvent;
+import org.killbill.billing.events.InvoicePaymentInfoInternalEvent;
 import org.killbill.billing.events.NullInvoiceInternalEvent;
 import org.killbill.billing.events.PaymentErrorInternalEvent;
 import org.killbill.billing.events.PaymentInfoInternalEvent;
@@ -132,6 +133,9 @@ public class CompletionUserRequestBase implements CompletionUserRequest {
             case PAYMENT_PLUGIN_ERROR:
                 onPaymentPluginError((PaymentPluginErrorInternalEvent) curEvent);
                 break;
+            case INVOICE_PAYMENT_INFO:
+                onInvoicePaymentInfo((InvoicePaymentInfoInternalEvent) curEvent);
+                break;
             case INVOICE_PAYMENT_ERROR:
                 onInvoicePaymentError((InvoicePaymentErrorInternalEvent) curEvent);
                 break;
@@ -178,6 +182,10 @@ public class CompletionUserRequestBase implements CompletionUserRequest {
     }
 
     @Override
+    public void onInvoicePaymentInfo(final InvoicePaymentInfoInternalEvent curEvent) {
+    }
+
+    @Override
     public void onInvoicePaymentError(final InvoicePaymentErrorInternalEvent curEvent) {
     }
 }
diff --git a/util/src/main/java/org/killbill/billing/util/userrequest/CompletionUserRequestWaiter.java b/util/src/main/java/org/killbill/billing/util/userrequest/CompletionUserRequestWaiter.java
index 6876550..827d2ef 100644
--- a/util/src/main/java/org/killbill/billing/util/userrequest/CompletionUserRequestWaiter.java
+++ b/util/src/main/java/org/killbill/billing/util/userrequest/CompletionUserRequestWaiter.java
@@ -1,7 +1,9 @@
 /*
- * Copyright 2010-2011 Ning, Inc.
+ * Copyright 2010-2013 Ning, Inc.
+ * Copyright 2014-2017 Groupon, Inc
+ * Copyright 2014-2017 The Billing Project, LLC
  *
- * Ning licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
  * (the "License"); you may not use this file except in compliance with the
  * License.  You may obtain a copy of the License at:
  *
@@ -26,6 +28,7 @@ import org.killbill.billing.events.BusInternalEvent;
 import org.killbill.billing.events.EffectiveSubscriptionInternalEvent;
 import org.killbill.billing.events.InvoiceCreationInternalEvent;
 import org.killbill.billing.events.InvoicePaymentErrorInternalEvent;
+import org.killbill.billing.events.InvoicePaymentInfoInternalEvent;
 import org.killbill.billing.events.NullInvoiceInternalEvent;
 import org.killbill.billing.events.PaymentErrorInternalEvent;
 import org.killbill.billing.events.PaymentInfoInternalEvent;
@@ -53,5 +56,7 @@ public interface CompletionUserRequestWaiter {
 
     public void onPaymentPluginError(final PaymentPluginErrorInternalEvent curEvent);
 
+    public void onInvoicePaymentInfo(final InvoicePaymentInfoInternalEvent curEvent);
+
     public void onInvoicePaymentError(final InvoicePaymentErrorInternalEvent curEvent);
 }