killbill-aplcache

profiles/killbill: Remove KillbillClient deprecated methods

10/6/2017 9:49:04 PM

Details

diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestInvoicePayment.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestInvoicePayment.java
index 661a1c6..e7c5755 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestInvoicePayment.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestInvoicePayment.java
@@ -66,7 +66,7 @@ public class TestInvoicePayment extends TestJaxrsBase {
     @Test(groups = "slow")
     public void testRetrievePayment() throws Exception {
         final InvoicePayment paymentJson = setupScenarioWithPayment();
-        final Payment retrievedPaymentJson = killBillClient.getPayment(paymentJson.getPaymentId(), false);
+        final Payment retrievedPaymentJson = killBillClient.getPayment(paymentJson.getPaymentId(), false, requestOptions);
         Assert.assertTrue(retrievedPaymentJson.equals((Payment) paymentJson));
     }
 
@@ -82,7 +82,7 @@ public class TestInvoicePayment extends TestJaxrsBase {
         final InvoicePaymentTransaction refund = new InvoicePaymentTransaction();
         refund.setPaymentId(invoicePaymentJson.getPaymentId());
         refund.setAmount(refundAmount);
-        final Payment paymentAfterRefundJson = killBillClient.createInvoicePaymentRefund(refund, createdBy, reason, comment);
+        final Payment paymentAfterRefundJson = killBillClient.createInvoicePaymentRefund(refund, requestOptions);
         verifyRefund(invoicePaymentJson, paymentAfterRefundJson, refundAmount);
 
         // Verify the invoice balance
@@ -101,7 +101,7 @@ public class TestInvoicePayment extends TestJaxrsBase {
         final InvoicePaymentTransaction refund = new InvoicePaymentTransaction();
         refund.setPaymentId(paymentJson.getPaymentId());
         refund.setAmount(refundAmount);
-        final Payment paymentAfterRefundJson = killBillClient.createInvoicePaymentRefund(refund, createdBy, reason, comment);
+        final Payment paymentAfterRefundJson = killBillClient.createInvoicePaymentRefund(refund, requestOptions);
         verifyRefund(paymentJson, paymentAfterRefundJson, refundAmount);
 
         // Verify the invoice balance
@@ -113,7 +113,7 @@ public class TestInvoicePayment extends TestJaxrsBase {
         final InvoicePayment paymentJson = setupScenarioWithPayment();
 
         // Get the individual items for the invoice
-        final Invoice invoice = killBillClient.getInvoice(paymentJson.getTargetInvoiceId(), true);
+        final Invoice invoice = killBillClient.getInvoice(paymentJson.getTargetInvoiceId(), true, false, requestOptions);
         final InvoiceItem itemToAdjust = invoice.getItems().get(0);
 
         // Issue a refund for the full amount
@@ -129,7 +129,7 @@ public class TestInvoicePayment extends TestJaxrsBase {
         adjustment.setInvoiceItemId(itemToAdjust.getInvoiceItemId());
         /* null amount means full adjustment for that item */
         refund.setAdjustments(ImmutableList.<InvoiceItem>of(adjustment));
-        final Payment paymentAfterRefundJson = killBillClient.createInvoicePaymentRefund(refund, createdBy, reason, comment);
+        final Payment paymentAfterRefundJson = killBillClient.createInvoicePaymentRefund(refund, requestOptions);
         verifyRefund(paymentJson, paymentAfterRefundJson, refundAmount);
 
         // Verify the invoice balance
@@ -141,7 +141,7 @@ public class TestInvoicePayment extends TestJaxrsBase {
         final InvoicePayment paymentJson = setupScenarioWithPayment();
 
         // Get the individual items for the invoice
-        final Invoice invoice = killBillClient.getInvoice(paymentJson.getTargetInvoiceId(), true);
+        final Invoice invoice = killBillClient.getInvoice(paymentJson.getTargetInvoiceId(), true, false, requestOptions);
         final InvoiceItem itemToAdjust = invoice.getItems().get(0);
 
         // Issue a refund for a fraction of the amount
@@ -156,7 +156,7 @@ public class TestInvoicePayment extends TestJaxrsBase {
         adjustment.setInvoiceItemId(itemToAdjust.getInvoiceItemId());
         adjustment.setAmount(refundAmount);
         refund.setAdjustments(ImmutableList.<InvoiceItem>of(adjustment));
-        final Payment paymentAfterRefundJson = killBillClient.createInvoicePaymentRefund(refund, createdBy, reason, comment);
+        final Payment paymentAfterRefundJson = killBillClient.createInvoicePaymentRefund(refund, requestOptions);
         verifyRefund(paymentJson, paymentAfterRefundJson, refundAmount);
 
         // Verify the invoice balance
@@ -202,23 +202,23 @@ public class TestInvoicePayment extends TestJaxrsBase {
             final InvoicePaymentTransaction refund = new InvoicePaymentTransaction();
             refund.setPaymentId(lastPayment.getPaymentId());
             refund.setAmount(lastPayment.getPurchasedAmount());
-            killBillClient.createInvoicePaymentRefund(refund, createdBy, reason, comment);
+            killBillClient.createInvoicePaymentRefund(refund, requestOptions);
 
             final InvoicePayment invoicePayment = new InvoicePayment();
             invoicePayment.setPurchasedAmount(lastPayment.getPurchasedAmount());
             invoicePayment.setAccountId(lastPayment.getAccountId());
             invoicePayment.setTargetInvoiceId(lastPayment.getTargetInvoiceId());
-            final InvoicePayment payment = killBillClient.createInvoicePayment(invoicePayment, false, createdBy, reason, comment);
+            final InvoicePayment payment = killBillClient.createInvoicePayment(invoicePayment, false, requestOptions);
             lastPayment = payment;
         }
 
-        final InvoicePayments allPayments = killBillClient.getInvoicePaymentsForAccount(lastPayment.getAccountId());
+        final InvoicePayments allPayments = killBillClient.getInvoicePaymentsForAccount(lastPayment.getAccountId(), requestOptions);
         Assert.assertEquals(allPayments.size(), 6);
 
         final List<PaymentTransaction> objRefundFromJson = getPaymentTransactions(allPayments, TransactionType.REFUND.toString());
         Assert.assertEquals(objRefundFromJson.size(), 5);
 
-        Payments paymentsPage = killBillClient.getPayments(0L, 1L);
+        Payments paymentsPage = killBillClient.getPayments(0L, 1L, requestOptions);
         for (int i = 0; i < 6; i++) {
             Assert.assertNotNull(paymentsPage);
             Assert.assertEquals(paymentsPage.size(), 1);
@@ -267,14 +267,14 @@ public class TestInvoicePayment extends TestJaxrsBase {
     private InvoicePayment setupScenarioWithPayment() throws Exception {
         final Account accountJson = createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice();
 
-        final List<InvoicePayment> paymentsForAccount = killBillClient.getInvoicePaymentsForAccount(accountJson.getAccountId());
+        final List<InvoicePayment> paymentsForAccount = killBillClient.getInvoicePaymentsForAccount(accountJson.getAccountId(), requestOptions);
         Assert.assertEquals(paymentsForAccount.size(), 1);
 
         final InvoicePayment paymentJson = paymentsForAccount.get(0);
 
         // Check the PaymentMethod from paymentMethodId returned in the Payment object
         final UUID paymentMethodId = paymentJson.getPaymentMethodId();
-        final PaymentMethod paymentMethodJson = killBillClient.getPaymentMethod(paymentMethodId, true);
+        final PaymentMethod paymentMethodJson = killBillClient.getPaymentMethod(paymentMethodId, true, requestOptions);
         Assert.assertEquals(paymentMethodJson.getPaymentMethodId(), paymentMethodId);
         Assert.assertEquals(paymentMethodJson.getAccountId(), accountJson.getAccountId());
 
@@ -299,7 +299,7 @@ public class TestInvoicePayment extends TestJaxrsBase {
         Assert.assertEquals(refund.getEffectiveDate().getDayOfMonth(), clock.getUTCNow().getDayOfMonth());
 
         // Verify the refund via the payment API
-        final Payment retrievedPaymentJson = killBillClient.getPayment(paymentJson.getPaymentId(), true);
+        final Payment retrievedPaymentJson = killBillClient.getPayment(paymentJson.getPaymentId(), true, requestOptions);
         Assert.assertEquals(retrievedPaymentJson.getPaymentId(), paymentJson.getPaymentId());
         Assert.assertEquals(retrievedPaymentJson.getPurchasedAmount().setScale(2, RoundingMode.HALF_UP), paymentJson.getPurchasedAmount().setScale(2, RoundingMode.HALF_UP));
         Assert.assertEquals(retrievedPaymentJson.getAccountId(), paymentJson.getAccountId());
@@ -308,7 +308,7 @@ public class TestInvoicePayment extends TestJaxrsBase {
     }
 
     private void verifyInvoice(final InvoicePayment paymentJson, final BigDecimal expectedInvoiceBalance) throws KillBillClientException {
-        final Invoice invoiceJson = killBillClient.getInvoice(paymentJson.getTargetInvoiceId());
+        final Invoice invoiceJson = killBillClient.getInvoice(paymentJson.getTargetInvoiceId(), requestOptions);
         Assert.assertEquals(invoiceJson.getBalance().setScale(2, BigDecimal.ROUND_HALF_UP),
                             expectedInvoiceBalance.setScale(2, BigDecimal.ROUND_HALF_UP));
     }