Details
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/KillbillClient.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/KillbillClient.java
index 8672065..25517ab 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/KillbillClient.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/KillbillClient.java
@@ -145,7 +145,7 @@ public abstract class KillbillClient extends GuicyKillbillTestSuiteWithEmbeddedD
input.setBillingPeriod(billingPeriod);
input.setPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
- return killBillClient.createSubscription(input, null, waitCompletion ? DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC : -1, basicRequestOptions());
+ return killBillClient.createSubscription(input, null, waitCompletion ? DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC : -1, requestOptions);
}
protected Account createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice() throws Exception {
@@ -257,14 +257,4 @@ public abstract class KillbillClient extends GuicyKillbillTestSuiteWithEmbeddedD
Thread.sleep(sleepValueMSec);
}
- /**
- * Return a RequestOptions instance with the createdBy, reason and comment fields populated
- * @return an instance of RequestOptions
- */
- protected RequestOptions basicRequestOptions() {
- return RequestOptions.builder()
- .withCreatedBy(createdBy)
- .withReason(reason)
- .withComment(comment).build();
- }
}
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestAccount.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestAccount.java
index d714352..b306e85 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestAccount.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestAccount.java
@@ -78,7 +78,7 @@ public class TestAccount extends TestJaxrsBase {
public void testEmptyAccount() throws Exception {
final Account emptyAccount = new Account();
- final Account account = killBillClient.createAccount(emptyAccount, createdBy, reason, comment);
+ final Account account = killBillClient.createAccount(emptyAccount, requestOptions);
Assert.assertNotNull(account.getExternalKey());
Assert.assertNull(account.getName());
Assert.assertNull(account.getEmail());
@@ -90,12 +90,12 @@ public class TestAccount extends TestJaxrsBase {
final Account inputWithNoExternalKey = getAccount(UUID.randomUUID().toString(), null, UUID.randomUUID().toString());
Assert.assertNull(inputWithNoExternalKey.getExternalKey());
- final Account account = killBillClient.createAccount(inputWithNoExternalKey, createdBy, reason, comment);
+ final Account account = killBillClient.createAccount(inputWithNoExternalKey, requestOptions);
Assert.assertNotNull(account.getExternalKey());
final Account inputWithSameExternalKey = getAccount(UUID.randomUUID().toString(), account.getExternalKey(), UUID.randomUUID().toString());
try {
- killBillClient.createAccount(inputWithSameExternalKey, createdBy, reason, comment);
+ killBillClient.createAccount(inputWithSameExternalKey, requestOptions);
Assert.fail();
} catch (final KillBillClientException e) {
Assert.assertEquals(e.getBillingException().getCode(), (Integer) ErrorCode.ACCOUNT_ALREADY_EXISTS.getCode());
@@ -107,7 +107,7 @@ public class TestAccount extends TestJaxrsBase {
final Account input = createAccount();
// Retrieves by external key
- final Account retrievedAccount = killBillClient.getAccount(input.getExternalKey());
+ final Account retrievedAccount = killBillClient.getAccount(input.getExternalKey(), requestOptions);
Assert.assertTrue(retrievedAccount.equals(input));
// Try search endpoint
@@ -119,7 +119,7 @@ public class TestAccount extends TestJaxrsBase {
"USD", null, false, null, "UTC",
"bl1", "bh2", "", "", "ca", "San Francisco", "usa", "en", "415-255-2991",
"notes", false, false, null, null);
- final Account updatedAccount = killBillClient.updateAccount(newInput, createdBy, reason, comment);
+ final Account updatedAccount = killBillClient.updateAccount(newInput, requestOptions);
Assert.assertTrue(updatedAccount.equals(newInput));
// Try search endpoint
@@ -130,7 +130,7 @@ public class TestAccount extends TestJaxrsBase {
public void testAccountWithBalance() throws Exception {
final Account accountJson = createAccountNoPMBundleAndSubscriptionAndWaitForFirstInvoice();
- final Account accountWithBalance = killBillClient.getAccount(accountJson.getAccountId(), true, false);
+ final Account accountWithBalance = killBillClient.getAccount(accountJson.getAccountId(), true, false, requestOptions);
final BigDecimal accountBalance = accountWithBalance.getAccountBalance();
Assert.assertTrue(accountBalance.compareTo(BigDecimal.ZERO) > 0);
}
@@ -139,13 +139,13 @@ public class TestAccount extends TestJaxrsBase {
public void testUpdateNonExistentAccount() throws Exception {
final Account input = getAccount();
- Assert.assertNull(killBillClient.updateAccount(input, createdBy, reason, comment));
+ Assert.assertNull(killBillClient.updateAccount(input, requestOptions));
}
@Test(groups = "slow", description = "Cannot retrieve non-existent account")
public void testAccountNonExistent() throws Exception {
- Assert.assertNull(killBillClient.getAccount(UUID.randomUUID()));
- Assert.assertNull(killBillClient.getAccount(UUID.randomUUID().toString()));
+ Assert.assertNull(killBillClient.getAccount(UUID.randomUUID(), requestOptions));
+ Assert.assertNull(killBillClient.getAccount(UUID.randomUUID().toString(), requestOptions));
}
@Test(groups = "slow", description = "Can CRUD payment methods")
@@ -156,7 +156,7 @@ public class TestAccount extends TestJaxrsBase {
final PaymentMethodPluginDetail info = new PaymentMethodPluginDetail();
info.setProperties(getPaymentMethodCCProperties());
PaymentMethod paymentMethodJson = new PaymentMethod(null, UUID.randomUUID().toString(), accountJson.getAccountId(), true, PLUGIN_NAME, info);
- final PaymentMethod paymentMethodCC = killBillClient.createPaymentMethod(paymentMethodJson, createdBy, reason, comment);
+ final PaymentMethod paymentMethodCC = killBillClient.createPaymentMethod(paymentMethodJson, requestOptions);
assertTrue(paymentMethodCC.getIsDefault());
//
@@ -165,40 +165,40 @@ public class TestAccount extends TestJaxrsBase {
final PaymentMethodPluginDetail info2 = new PaymentMethodPluginDetail();
info2.setProperties(getPaymentMethodPaypalProperties());
paymentMethodJson = new PaymentMethod(null, UUID.randomUUID().toString(), accountJson.getAccountId(), false, PLUGIN_NAME, info2);
- final PaymentMethod paymentMethodPP = killBillClient.createPaymentMethod(paymentMethodJson, createdBy, reason, comment);
+ final PaymentMethod paymentMethodPP = killBillClient.createPaymentMethod(paymentMethodJson, requestOptions);
assertFalse(paymentMethodPP.getIsDefault());
//
// FETCH ALL PAYMENT METHODS
//
- List<PaymentMethod> paymentMethods = killBillClient.getPaymentMethodsForAccount(accountJson.getAccountId());
+ List<PaymentMethod> paymentMethods = killBillClient.getPaymentMethodsForAccount(accountJson.getAccountId(), requestOptions);
assertEquals(paymentMethods.size(), 2);
//
// CHANGE DEFAULT
//
- assertTrue(killBillClient.getPaymentMethod(paymentMethodCC.getPaymentMethodId()).getIsDefault());
- assertFalse(killBillClient.getPaymentMethod(paymentMethodPP.getPaymentMethodId()).getIsDefault());
- killBillClient.updateDefaultPaymentMethod(accountJson.getAccountId(), paymentMethodPP.getPaymentMethodId(), createdBy, reason, comment);
- assertTrue(killBillClient.getPaymentMethod(paymentMethodPP.getPaymentMethodId()).getIsDefault());
- assertFalse(killBillClient.getPaymentMethod(paymentMethodCC.getPaymentMethodId()).getIsDefault());
+ assertTrue(killBillClient.getPaymentMethod(paymentMethodCC.getPaymentMethodId(), requestOptions).getIsDefault());
+ assertFalse(killBillClient.getPaymentMethod(paymentMethodPP.getPaymentMethodId(), requestOptions).getIsDefault());
+ killBillClient.updateDefaultPaymentMethod(accountJson.getAccountId(), paymentMethodPP.getPaymentMethodId(), requestOptions);
+ assertTrue(killBillClient.getPaymentMethod(paymentMethodPP.getPaymentMethodId(), requestOptions).getIsDefault());
+ assertFalse(killBillClient.getPaymentMethod(paymentMethodCC.getPaymentMethodId(), requestOptions).getIsDefault());
//
// DELETE NON DEFAULT PM
//
- killBillClient.deletePaymentMethod(paymentMethodCC.getPaymentMethodId(), false, false, createdBy, reason, comment);
+ killBillClient.deletePaymentMethod(paymentMethodCC.getPaymentMethodId(), false, false, requestOptions);
//
// FETCH ALL PAYMENT METHODS
//
- paymentMethods = killBillClient.getPaymentMethodsForAccount(accountJson.getAccountId());
+ paymentMethods = killBillClient.getPaymentMethodsForAccount(accountJson.getAccountId(), requestOptions);
assertEquals(paymentMethods.size(), 1);
//
// DELETE DEFAULT PAYMENT METHOD (without special flag first)
//
try {
- killBillClient.deletePaymentMethod(paymentMethodPP.getPaymentMethodId(), false, false, createdBy, reason, comment);
+ killBillClient.deletePaymentMethod(paymentMethodPP.getPaymentMethodId(), false, false, requestOptions);
fail();
} catch (final KillBillClientException e) {
}
@@ -206,17 +206,17 @@ public class TestAccount extends TestJaxrsBase {
//
// RETRY TO DELETE DEFAULT PAYMENT METHOD (with special flag this time)
//
- killBillClient.deletePaymentMethod(paymentMethodPP.getPaymentMethodId(), true, false, createdBy, reason, comment);
+ killBillClient.deletePaymentMethod(paymentMethodPP.getPaymentMethodId(), true, false, requestOptions);
// CHECK ACCOUNT IS NOW AUTO_PAY_OFF
- final List<Tag> tagsJson = killBillClient.getAccountTags(accountJson.getAccountId());
+ final List<Tag> tagsJson = killBillClient.getAccountTags(accountJson.getAccountId(), requestOptions);
Assert.assertEquals(tagsJson.size(), 1);
final Tag tagJson = tagsJson.get(0);
Assert.assertEquals(tagJson.getTagDefinitionName(), "AUTO_PAY_OFF");
Assert.assertEquals(tagJson.getTagDefinitionId(), new UUID(0, 1));
// FETCH ACCOUNT AGAIN AND CHECK THERE IS NO DEFAULT PAYMENT METHOD SET
- final Account updatedAccount = killBillClient.getAccount(accountJson.getAccountId());
+ final Account updatedAccount = killBillClient.getAccount(accountJson.getAccountId(), requestOptions);
Assert.assertEquals(updatedAccount.getAccountId(), accountJson.getAccountId());
Assert.assertNull(updatedAccount.getPaymentMethodId());
@@ -224,7 +224,7 @@ public class TestAccount extends TestJaxrsBase {
// FINALLY TRY TO REMOVE AUTO_PAY_OFF WITH NO DEFAULT PAYMENT METHOD ON ACCOUNT
//
try {
- killBillClient.deleteAccountTag(accountJson.getAccountId(), new UUID(0, 1), createdBy, reason, comment);
+ killBillClient.deleteAccountTag(accountJson.getAccountId(), new UUID(0, 1), requestOptions);
} catch (final KillBillClientException e) {
}
}
@@ -234,7 +234,7 @@ public class TestAccount extends TestJaxrsBase {
final Account accountJson = createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice();
// Verify payments
- final InvoicePayments objFromJson = killBillClient.getInvoicePaymentsForAccount(accountJson.getAccountId());
+ final InvoicePayments objFromJson = killBillClient.getInvoicePaymentsForAccount(accountJson.getAccountId(), requestOptions);
Assert.assertEquals(objFromJson.size(), 1);
}
@@ -245,19 +245,19 @@ public class TestAccount extends TestJaxrsBase {
final UUID autoPayOffId = new UUID(0, 1);
// Add a tag
- killBillClient.createAccountTag(input.getAccountId(), autoPayOffId, createdBy, reason, comment);
+ killBillClient.createAccountTag(input.getAccountId(), autoPayOffId, requestOptions);
// Retrieves all tags
- final List<Tag> tags1 = killBillClient.getAccountTags(input.getAccountId(), AuditLevel.FULL);
+ final List<Tag> tags1 = killBillClient.getAccountTags(input.getAccountId(), AuditLevel.FULL, requestOptions);
Assert.assertEquals(tags1.size(), 1);
Assert.assertEquals(tags1.get(0).getTagDefinitionId(), autoPayOffId);
// Verify adding the same tag a second time doesn't do anything
- killBillClient.createAccountTag(input.getAccountId(), autoPayOffId, createdBy, reason, comment);
+ killBillClient.createAccountTag(input.getAccountId(), autoPayOffId, requestOptions);
// Retrieves all tags again
- killBillClient.createAccountTag(input.getAccountId(), autoPayOffId, createdBy, reason, comment);
- final List<Tag> tags2 = killBillClient.getAccountTags(input.getAccountId(), AuditLevel.FULL);
+ killBillClient.createAccountTag(input.getAccountId(), autoPayOffId, requestOptions);
+ final List<Tag> tags2 = killBillClient.getAccountTags(input.getAccountId(), AuditLevel.FULL, requestOptions);
Assert.assertEquals(tags2, tags1);
// Verify audit logs
@@ -281,46 +281,46 @@ public class TestAccount extends TestJaxrsBase {
customFields.add(new CustomField(null, accountJson.getAccountId(), ObjectType.ACCOUNT, "2", "value2", null));
customFields.add(new CustomField(null, accountJson.getAccountId(), ObjectType.ACCOUNT, "3", "value3", null));
- killBillClient.createAccountCustomFields(accountJson.getAccountId(), customFields, createdBy, reason, comment);
+ killBillClient.createAccountCustomFields(accountJson.getAccountId(), customFields, requestOptions);
- final List<CustomField> accountCustomFields = killBillClient.getAccountCustomFields(accountJson.getAccountId());
+ final List<CustomField> accountCustomFields = killBillClient.getAccountCustomFields(accountJson.getAccountId(), requestOptions);
assertEquals(accountCustomFields.size(), 3);
// Delete all custom fields for account
- killBillClient.deleteAccountCustomFields(accountJson.getAccountId(), createdBy, reason, comment);
+ killBillClient.deleteAccountCustomFields(accountJson.getAccountId(), requestOptions);
- final List<CustomField> remainingCustomFields = killBillClient.getAccountCustomFields(accountJson.getAccountId());
+ final List<CustomField> remainingCustomFields = killBillClient.getAccountCustomFields(accountJson.getAccountId(), requestOptions);
assertEquals(remainingCustomFields.size(), 0);
}
@Test(groups = "slow", description = "refresh payment methods")
public void testRefreshPaymentMethods() throws Exception {
- Account account = createAccountWithDefaultPaymentMethod("someExternalKey");
+ final Account account = createAccountWithDefaultPaymentMethod("someExternalKey");
- final PaymentMethods paymentMethodsBeforeRefreshing = killBillClient.getPaymentMethodsForAccount(account.getAccountId());
+ final PaymentMethods paymentMethodsBeforeRefreshing = killBillClient.getPaymentMethodsForAccount(account.getAccountId(), requestOptions);
assertEquals(paymentMethodsBeforeRefreshing.size(), 1);
assertEquals(paymentMethodsBeforeRefreshing.get(0).getExternalKey(), "someExternalKey");
// WITH NAME OF AN EXISTING PLUGIN
- killBillClient.refreshPaymentMethods(account.getAccountId(), PLUGIN_NAME, ImmutableMap.<String, String>of(), createdBy, reason, comment);
+ killBillClient.refreshPaymentMethods(account.getAccountId(), PLUGIN_NAME, ImmutableMap.<String, String>of(), requestOptions);
- final PaymentMethods paymentMethodsAfterExistingPluginCall = killBillClient.getPaymentMethodsForAccount(account.getAccountId());
+ final PaymentMethods paymentMethodsAfterExistingPluginCall = killBillClient.getPaymentMethodsForAccount(account.getAccountId(), requestOptions);
assertEquals(paymentMethodsAfterExistingPluginCall.size(), 1);
assertEquals(paymentMethodsAfterExistingPluginCall.get(0).getExternalKey(), "someExternalKey");
// WITHOUT PLUGIN NAME
- killBillClient.refreshPaymentMethods(account.getAccountId(), ImmutableMap.<String, String>of(), createdBy, reason, comment);
+ killBillClient.refreshPaymentMethods(account.getAccountId(), ImmutableMap.<String, String>of(), requestOptions);
- final PaymentMethods paymentMethodsAfterNoPluginNameCall = killBillClient.getPaymentMethodsForAccount(account.getAccountId());
+ final PaymentMethods paymentMethodsAfterNoPluginNameCall = killBillClient.getPaymentMethodsForAccount(account.getAccountId(), requestOptions);
assertEquals(paymentMethodsAfterNoPluginNameCall.size(), 1);
assertEquals(paymentMethodsAfterNoPluginNameCall.get(0).getExternalKey(), "someExternalKey");
// WITH WRONG PLUGIN NAME
try {
- killBillClient.refreshPaymentMethods(account.getAccountId(), "GreatestPluginEver", ImmutableMap.<String, String>of(), createdBy, reason, comment);
+ killBillClient.refreshPaymentMethods(account.getAccountId(), "GreatestPluginEver", ImmutableMap.<String, String>of(), requestOptions);
Assert.fail();
- } catch (KillBillClientException e) {
+ } catch (final KillBillClientException e) {
Assert.assertEquals(e.getBillingException().getCode(), (Integer) ErrorCode.PAYMENT_NO_SUCH_PAYMENT_PLUGIN.getCode());
}
}
@@ -331,10 +331,10 @@ public class TestAccount extends TestJaxrsBase {
createAccount();
}
- final Accounts allAccounts = killBillClient.getAccounts();
+ final Accounts allAccounts = killBillClient.getAccounts(requestOptions);
Assert.assertEquals(allAccounts.size(), 5);
- Accounts page = killBillClient.getAccounts(0L, 1L);
+ Accounts page = killBillClient.getAccounts(0L, 1L, requestOptions);
for (int i = 0; i < 5; i++) {
Assert.assertNotNull(page);
Assert.assertEquals(page.size(), 1);
@@ -361,14 +361,14 @@ public class TestAccount extends TestJaxrsBase {
// Search by external key.
// Note: we will always find a match since we don't update it
- final List<Account> accountsByExternalKey = killBillClient.searchAccounts(input.getExternalKey());
+ final List<Account> accountsByExternalKey = killBillClient.searchAccounts(input.getExternalKey(), requestOptions);
Assert.assertEquals(accountsByExternalKey.size(), 1);
Assert.assertEquals(accountsByExternalKey.get(0).getAccountId(), input.getAccountId());
Assert.assertEquals(accountsByExternalKey.get(0).getExternalKey(), input.getExternalKey());
}
private void doSearchAccount(final String key, @Nullable final Account output) throws Exception {
- final List<Account> accountsByKey = killBillClient.searchAccounts(key);
+ final List<Account> accountsByKey = killBillClient.searchAccounts(key, requestOptions);
if (output == null) {
Assert.assertEquals(accountsByKey.size(), 0);
} else {
@@ -385,10 +385,10 @@ public class TestAccount extends TestJaxrsBase {
final Account childInput = getAccount();
childInput.setParentAccountId(parentAccount.getAccountId());
childInput.setIsPaymentDelegatedToParent(true);
- final Account childAccount = killBillClient.createAccount(childInput, createdBy, reason, comment);
+ final Account childAccount = killBillClient.createAccount(childInput, requestOptions);
// Retrieves child account by external key
- final Account retrievedAccount = killBillClient.getAccount(childAccount.getExternalKey());
+ final Account retrievedAccount = killBillClient.getAccount(childAccount.getExternalKey(), requestOptions);
Assert.assertTrue(retrievedAccount.equals(childAccount));
Assert.assertEquals(retrievedAccount.getParentAccountId(), parentAccount.getAccountId());
Assert.assertTrue(retrievedAccount.getIsPaymentDelegatedToParent());
@@ -402,14 +402,14 @@ public class TestAccount extends TestJaxrsBase {
final Account childInput = getAccount();
childInput.setParentAccountId(parentAccount.getAccountId());
childInput.setIsPaymentDelegatedToParent(true);
- Account childAccount = killBillClient.createAccount(childInput, createdBy, reason, comment);
- childAccount = killBillClient.getAccount(childAccount.getAccountId(), true, true, basicRequestOptions());
+ Account childAccount = killBillClient.createAccount(childInput, requestOptions);
+ childAccount = killBillClient.getAccount(childAccount.getAccountId(), true, true, requestOptions);
final Account childInput2 = getAccount();
childInput2.setParentAccountId(parentAccount.getAccountId());
childInput2.setIsPaymentDelegatedToParent(true);
- Account childAccount2 = killBillClient.createAccount(childInput2, createdBy, reason, comment);
- childAccount2 = killBillClient.getAccount(childAccount2.getAccountId(), true, true, basicRequestOptions());
+ Account childAccount2 = killBillClient.createAccount(childInput2, requestOptions);
+ childAccount2 = killBillClient.getAccount(childAccount2.getAccountId(), true, true, requestOptions);
// Retrieves children accounts by parent account id
final Accounts childrenAccounts = killBillClient.getChildrenAccounts(parentAccount.getAccountId(), true, true, requestOptions);
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestAdmin.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestAdmin.java
index 4377c5a..4a28ea3 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestAdmin.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestAdmin.java
@@ -68,7 +68,7 @@ public class TestAdmin extends TestJaxrsBase {
authTransaction.setPaymentExternalKey(paymentExternalKey);
authTransaction.setTransactionExternalKey(authTransactionExternalKey);
authTransaction.setTransactionType("AUTHORIZE");
- final Payment authPayment = killBillClient.createPayment(account.getAccountId(), account.getPaymentMethodId(), authTransaction, basicRequestOptions());
+ final Payment authPayment = killBillClient.createPayment(account.getAccountId(), account.getPaymentMethodId(), authTransaction, requestOptions);
// First fix transactionStatus and paymentSstate (but not lastSuccessPaymentState
// Note that state is not consistent between TransactionStatus and lastSuccessPaymentState but we don't care.
@@ -176,7 +176,7 @@ public class TestAdmin extends TestJaxrsBase {
captureTransaction.setPaymentExternalKey(payment.getPaymentExternalKey());
captureTransaction.setTransactionExternalKey(capture1TransactionExternalKey);
try {
- killBillClient.captureAuthorization(captureTransaction, basicRequestOptions());
+ killBillClient.captureAuthorization(captureTransaction, requestOptions);
if (expectException) {
Assert.fail("Capture should not succeed, after auth was moved to a PAYMENT_FAILURE");
}
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestBundle.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestBundle.java
index 4c158af..4323f25 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestBundle.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestBundle.java
@@ -180,13 +180,13 @@ public class TestBundle extends TestJaxrsBase {
final Subscription subscription2 = killBillClient.getSubscription(entitlement.getSubscriptionId());
assertEquals(subscription2.getState(), EntitlementState.ACTIVE);
- final BlockingStates blockingStates = killBillClient.getBlockingStates(accountJson.getAccountId(), null, ImmutableList.<String>of("service"), AuditLevel.FULL, basicRequestOptions());
+ final BlockingStates blockingStates = killBillClient.getBlockingStates(accountJson.getAccountId(), null, ImmutableList.<String>of("service"), AuditLevel.FULL, requestOptions);
Assert.assertEquals(blockingStates.size(), 2);
- final BlockingStates blockingStates2 = killBillClient.getBlockingStates(accountJson.getAccountId(), ImmutableList.<BlockingStateType>of(BlockingStateType.SUBSCRIPTION_BUNDLE), null, AuditLevel.FULL, basicRequestOptions());
+ final BlockingStates blockingStates2 = killBillClient.getBlockingStates(accountJson.getAccountId(), ImmutableList.<BlockingStateType>of(BlockingStateType.SUBSCRIPTION_BUNDLE), null, AuditLevel.FULL, requestOptions);
Assert.assertEquals(blockingStates2.size(), 2);
- final BlockingStates blockingStates3 = killBillClient.getBlockingStates(accountJson.getAccountId(), null, null, AuditLevel.FULL, basicRequestOptions());
+ final BlockingStates blockingStates3 = killBillClient.getBlockingStates(accountJson.getAccountId(), null, null, AuditLevel.FULL, requestOptions);
Assert.assertEquals(blockingStates3.size(), 3);
}
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestEntitlement.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestEntitlement.java
index da4a391..6460849 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestEntitlement.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestEntitlement.java
@@ -291,7 +291,7 @@ public class TestEntitlement extends TestJaxrsBase {
final Subscription newInput = new Subscription();
newInput.setSubscriptionId(subscription2.getSubscriptionId());
newInput.setPlanName("pistol-monthly");
- final Subscription subscription3 = killBillClient.updateSubscription(newInput, null, BillingActionPolicy.IMMEDIATE, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, basicRequestOptions());
+ final Subscription subscription3 = killBillClient.updateSubscription(newInput, null, BillingActionPolicy.IMMEDIATE, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, requestOptions);
Assert.assertEquals(subscription3.getEvents().size(), 4);
Assert.assertEquals(subscription3.getEvents().get(0).getEventType(), SubscriptionEventType.START_ENTITLEMENT.name());
@@ -515,7 +515,7 @@ public class TestEntitlement extends TestJaxrsBase {
final Subscription updatedSubscription = new Subscription();
updatedSubscription.setSubscriptionId(entitlementJson.getSubscriptionId());
updatedSubscription.setBillCycleDayLocal(9);
- killBillClient.updateSubscriptionBCD(updatedSubscription, null, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, basicRequestOptions());
+ killBillClient.updateSubscriptionBCD(updatedSubscription, null, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, requestOptions);
final Subscription result = killBillClient.getSubscription(entitlementJson.getSubscriptionId());
@@ -545,7 +545,7 @@ public class TestEntitlement extends TestJaxrsBase {
input.setExternalKey("somethingSpecial");
input.setPlanName("shotgun-monthly");
- final Subscription entitlementJson = killBillClient.createSubscription(input, null, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, basicRequestOptions());
+ final Subscription entitlementJson = killBillClient.createSubscription(input, null, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, requestOptions);
Assert.assertEquals(entitlementJson.getProductName(), "Shotgun");
Assert.assertEquals(entitlementJson.getBillingPeriod(), BillingPeriod.MONTHLY);
Assert.assertEquals(entitlementJson.getPriceList(), DefaultPriceListSet.DEFAULT_PRICELIST_NAME);
@@ -556,7 +556,7 @@ public class TestEntitlement extends TestJaxrsBase {
newInput.setAccountId(entitlementJson.getAccountId());
newInput.setSubscriptionId(entitlementJson.getSubscriptionId());
newInput.setPlanName("pistol-monthly");
- final Subscription newEntitlementJson = killBillClient.updateSubscription(newInput, null, null, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, basicRequestOptions());
+ final Subscription newEntitlementJson = killBillClient.updateSubscription(newInput, null, null, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, requestOptions);
Assert.assertEquals(newEntitlementJson.getProductName(), "Pistol");
Assert.assertEquals(newEntitlementJson.getBillingPeriod(), BillingPeriod.MONTHLY);
Assert.assertEquals(newEntitlementJson.getPriceList(), DefaultPriceListSet.DEFAULT_PRICELIST_NAME);
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestInvoice.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestInvoice.java
index dfd8d8c..d70c150 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestInvoice.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestInvoice.java
@@ -751,7 +751,7 @@ public class TestInvoice extends TestJaxrsBase {
final Account accountWithBalance = killBillClient.getAccount(accountJson.getAccountId(), true, true);
- final Invoice migrationInvoice = killBillClient.createMigrationInvoice(accountJson.getAccountId(), null, ImmutableList.<InvoiceItem>of(externalCharge), basicRequestOptions());
+ final Invoice migrationInvoice = killBillClient.createMigrationInvoice(accountJson.getAccountId(), null, ImmutableList.<InvoiceItem>of(externalCharge), requestOptions);
assertEquals(migrationInvoice.getBalance(), BigDecimal.ZERO);
assertEquals(migrationInvoice.getItems().size(), 1);
assertEquals(migrationInvoice.getItems().get(0).getAmount().compareTo(chargeAmount), 0);
@@ -786,7 +786,7 @@ public class TestInvoice extends TestJaxrsBase {
Assert.assertEquals(parentInvoices.size(), 0);
// transfer credit to parent account
- killBillClient.transferChildCreditToParent(childAccount.getAccountId(), basicRequestOptions());
+ killBillClient.transferChildCreditToParent(childAccount.getAccountId(), requestOptions);
childInvoices = killBillClient.getInvoicesForAccount(childAccount.getAccountId(), true, false);
Assert.assertEquals(childInvoices.size(), 2);
@@ -803,7 +803,7 @@ public class TestInvoice extends TestJaxrsBase {
final Account account = createAccount();
// transfer credit to parent account
- killBillClient.transferChildCreditToParent(account.getAccountId(), basicRequestOptions());
+ killBillClient.transferChildCreditToParent(account.getAccountId(), requestOptions);
}
@@ -814,7 +814,7 @@ public class TestInvoice extends TestJaxrsBase {
final Account childAccount = createAccount(parentAccount.getAccountId());
// transfer credit to parent account
- killBillClient.transferChildCreditToParent(childAccount.getAccountId(), basicRequestOptions());
+ killBillClient.transferChildCreditToParent(childAccount.getAccountId(), requestOptions);
}
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 de45ad7..661a1c6 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
@@ -238,22 +238,22 @@ public class TestInvoicePayment extends TestJaxrsBase {
final Account accountJson = createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice();
- InvoicePayments invoicePayments = killBillClient.getInvoicePaymentsForAccount(accountJson.getAccountId(), basicRequestOptions());
+ InvoicePayments invoicePayments = killBillClient.getInvoicePaymentsForAccount(accountJson.getAccountId(), requestOptions);
assertEquals(invoicePayments.size(), 1);
final InvoicePayment invoicePayment = invoicePayments.get(0);
// Verify targetInvoiceId is not Null. See #593
assertNotNull(invoicePayment.getTargetInvoiceId());
- final Invoices invoices = killBillClient.getInvoicesForAccount(accountJson.getAccountId(), basicRequestOptions());
+ final Invoices invoices = killBillClient.getInvoicesForAccount(accountJson.getAccountId(), requestOptions);
assertEquals(invoices.size(), 2);
final Invoice invoice = invoices.get(1);
// Verify this is the correct value
assertEquals(invoicePayment.getTargetInvoiceId(), invoice.getInvoiceId());
// Make a payment and verify both invoice payment point to the same targetInvoiceId
- killBillClient.payAllInvoices(accountJson.getAccountId(), false, null, basicRequestOptions());
- invoicePayments = killBillClient.getInvoicePaymentsForAccount(accountJson.getAccountId(), basicRequestOptions());
+ killBillClient.payAllInvoices(accountJson.getAccountId(), false, null, requestOptions);
+ invoicePayments = killBillClient.getInvoicePaymentsForAccount(accountJson.getAccountId(), requestOptions);
assertEquals(invoicePayments.size(), 2);
for (final InvoicePayment cur : invoicePayments) {
assertEquals(cur.getTargetInvoiceId(), invoice.getInvoiceId());
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPayment.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPayment.java
index 88cb7ea..6a2e8f6 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPayment.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPayment.java
@@ -114,7 +114,7 @@ public class TestPayment extends TestJaxrsBase {
authTransaction.setTransactionType(TransactionType.AUTHORIZE.name());
final Payment payment = killBillClient.createPayment(account.getAccountId(), account.getPaymentMethodId(), authTransaction,
- ImmutableMap.<String, String>of(), basicRequestOptions());
+ ImmutableMap.<String, String>of(), requestOptions);
final PaymentTransaction paymentTransaction = payment.getTransactions().get(0);
assertEquals(paymentTransaction.getStatus(), TransactionStatus.PAYMENT_FAILURE.toString());
assertEquals(paymentTransaction.getGatewayErrorCode(), MockPaymentProviderPlugin.GATEWAY_ERROR_CODE);
@@ -131,7 +131,7 @@ public class TestPayment extends TestJaxrsBase {
authTransaction.setAmount(BigDecimal.ONE);
authTransaction.setCurrency(account.getCurrency());
authTransaction.setTransactionType(TransactionType.AUTHORIZE.name());
- final Payment payment = killBillClient.createPayment(account.getAccountId(), account.getPaymentMethodId(), authTransaction, ImmutableMap.<String, String>of(), basicRequestOptions());
+ final Payment payment = killBillClient.createPayment(account.getAccountId(), account.getPaymentMethodId(), authTransaction, ImmutableMap.<String, String>of(), requestOptions);
final PaymentTransaction paymentTransaction = payment.getTransactions().get(0);
assertEquals(paymentTransaction.getStatus(), TransactionStatus.PLUGIN_FAILURE.toString());
}
@@ -147,7 +147,7 @@ public class TestPayment extends TestJaxrsBase {
authTransaction.setCurrency(account.getCurrency());
authTransaction.setTransactionType(TransactionType.AUTHORIZE.name());
try {
- killBillClient.createPayment(account.getAccountId(), account.getPaymentMethodId(), authTransaction, ImmutableMap.<String, String>of(), basicRequestOptions());
+ killBillClient.createPayment(account.getAccountId(), account.getPaymentMethodId(), authTransaction, ImmutableMap.<String, String>of(), requestOptions);
fail();
} catch (KillBillClientException e) {
assertEquals(504, e.getResponse().getStatusCode());
@@ -313,27 +313,27 @@ public class TestPayment extends TestJaxrsBase {
// Complete operation: first, only specify the payment id
final PaymentTransaction completeTransactionByPaymentId = new PaymentTransaction();
completeTransactionByPaymentId.setPaymentId(initialPayment.getPaymentId());
- final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentId, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentId, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, completedPaymentByPaymentId, paymentExternalKey, authTransactionExternalKey, transactionType.toString(), pending, amount, authAmount, BigDecimal.ZERO, BigDecimal.ZERO, 1, paymentNb);
// Second, only specify the payment external key
final PaymentTransaction completeTransactionByPaymentExternalKey = new PaymentTransaction();
completeTransactionByPaymentExternalKey.setPaymentExternalKey(initialPayment.getPaymentExternalKey());
- final Payment completedPaymentByExternalKey = killBillClient.completePayment(completeTransactionByPaymentExternalKey, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByExternalKey = killBillClient.completePayment(completeTransactionByPaymentExternalKey, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, completedPaymentByExternalKey, paymentExternalKey, authTransactionExternalKey, transactionType.toString(), pending, amount, authAmount, BigDecimal.ZERO, BigDecimal.ZERO, 1, paymentNb);
// Third, specify the payment id and transaction external key
final PaymentTransaction completeTransactionWithTypeAndKey = new PaymentTransaction();
completeTransactionWithTypeAndKey.setPaymentId(initialPayment.getPaymentId());
completeTransactionWithTypeAndKey.setTransactionExternalKey(authPaymentTransaction.getTransactionExternalKey());
- final Payment completedPaymentByTypeAndKey = killBillClient.completePayment(completeTransactionWithTypeAndKey, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByTypeAndKey = killBillClient.completePayment(completeTransactionWithTypeAndKey, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, completedPaymentByTypeAndKey, paymentExternalKey, authTransactionExternalKey, transactionType.toString(), pending, amount, authAmount, BigDecimal.ZERO, BigDecimal.ZERO, 1, paymentNb);
// Finally, specify the payment id and transaction id
final PaymentTransaction completeTransactionWithTypeAndId = new PaymentTransaction();
completeTransactionWithTypeAndId.setPaymentId(initialPayment.getPaymentId());
completeTransactionWithTypeAndId.setTransactionId(authPaymentTransaction.getTransactionId());
- final Payment completedPaymentByTypeAndId = killBillClient.completePayment(completeTransactionWithTypeAndId, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByTypeAndId = killBillClient.completePayment(completeTransactionWithTypeAndId, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, completedPaymentByTypeAndId, paymentExternalKey, authTransactionExternalKey, transactionType.toString(), pending, amount, authAmount, BigDecimal.ZERO, BigDecimal.ZERO, 1, paymentNb);
}
}
@@ -358,7 +358,7 @@ public class TestPayment extends TestJaxrsBase {
// Complete operation: first, only specify the payment id
final PaymentTransaction completeTransactionByPaymentId = new PaymentTransaction();
completeTransactionByPaymentId.setPaymentId(initialPayment.getPaymentId());
- final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentId, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentId, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, completedPaymentByPaymentId, paymentExternalKey, authTransactionExternalKey, transactionType.toString(), TransactionStatus.SUCCESS.name(), amount, amount, BigDecimal.ZERO, BigDecimal.ZERO, 1, 1);
}
@@ -385,7 +385,7 @@ public class TestPayment extends TestJaxrsBase {
completeTransactionByPaymentIdAndInvalidTransactionId.setPaymentId(initialPayment.getPaymentId());
completeTransactionByPaymentIdAndInvalidTransactionId.setTransactionId(UUID.randomUUID());
try {
- killBillClient.completePayment(completeTransactionByPaymentIdAndInvalidTransactionId, pluginProperties, basicRequestOptions());
+ killBillClient.completePayment(completeTransactionByPaymentIdAndInvalidTransactionId, pluginProperties, requestOptions);
fail("Payment completion should fail when invalid transaction id has been provided" );
} catch (final KillBillClientException expected) {
}
@@ -393,7 +393,7 @@ public class TestPayment extends TestJaxrsBase {
final PaymentTransaction completeTransactionByPaymentIdAndTransactionId = new PaymentTransaction();
completeTransactionByPaymentIdAndTransactionId.setPaymentId(initialPayment.getPaymentId());
completeTransactionByPaymentIdAndTransactionId.setTransactionId(initialPayment.getTransactions().get(0).getTransactionId());
- final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentIdAndTransactionId, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentIdAndTransactionId, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, completedPaymentByPaymentId, paymentExternalKey, authTransactionExternalKey, transactionType.toString(), TransactionStatus.SUCCESS.name(), amount, amount, BigDecimal.ZERO, BigDecimal.ZERO, 1, 1);
}
@@ -418,7 +418,7 @@ public class TestPayment extends TestJaxrsBase {
completeTransactionByPaymentIdAndInvalidTransactionExternalKey.setPaymentId(initialPayment.getPaymentId());
completeTransactionByPaymentIdAndInvalidTransactionExternalKey.setTransactionExternalKey("bozo");
try {
- killBillClient.completePayment(completeTransactionByPaymentIdAndInvalidTransactionExternalKey, pluginProperties, basicRequestOptions());
+ killBillClient.completePayment(completeTransactionByPaymentIdAndInvalidTransactionExternalKey, pluginProperties, requestOptions);
fail("Payment completion should fail when invalid transaction externalKey has been provided" );
} catch (final KillBillClientException expected) {
}
@@ -426,7 +426,7 @@ public class TestPayment extends TestJaxrsBase {
final PaymentTransaction completeTransactionByPaymentIdAndTransactionExternalKey = new PaymentTransaction();
completeTransactionByPaymentIdAndTransactionExternalKey.setPaymentId(initialPayment.getPaymentId());
completeTransactionByPaymentIdAndTransactionExternalKey.setTransactionExternalKey(authTransactionExternalKey);
- final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentIdAndTransactionExternalKey, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentIdAndTransactionExternalKey, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, completedPaymentByPaymentId, paymentExternalKey, authTransactionExternalKey, transactionType.toString(), TransactionStatus.SUCCESS.name(), amount, amount, BigDecimal.ZERO, BigDecimal.ZERO, 1, 1);
}
@@ -453,7 +453,7 @@ public class TestPayment extends TestJaxrsBase {
completeTransactionByPaymentIdAndInvalidTransactionType.setPaymentId(initialPayment.getPaymentId());
completeTransactionByPaymentIdAndInvalidTransactionType.setTransactionType(TransactionType.CAPTURE.name());
try {
- killBillClient.completePayment(completeTransactionByPaymentIdAndInvalidTransactionType, pluginProperties, basicRequestOptions());
+ killBillClient.completePayment(completeTransactionByPaymentIdAndInvalidTransactionType, pluginProperties, requestOptions);
fail("Payment completion should fail when invalid transaction type has been provided" );
} catch (final KillBillClientException expected) {
}
@@ -461,7 +461,7 @@ public class TestPayment extends TestJaxrsBase {
final PaymentTransaction completeTransactionByPaymentIdAndTransactionType = new PaymentTransaction();
completeTransactionByPaymentIdAndTransactionType.setPaymentId(initialPayment.getPaymentId());
completeTransactionByPaymentIdAndTransactionType.setTransactionType(transactionType.name());
- final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentIdAndTransactionType, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionByPaymentIdAndTransactionType, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, completedPaymentByPaymentId, paymentExternalKey, authTransactionExternalKey, transactionType.toString(), TransactionStatus.SUCCESS.name(), amount, amount, BigDecimal.ZERO, BigDecimal.ZERO, 1, 1);
}
@@ -486,7 +486,7 @@ public class TestPayment extends TestJaxrsBase {
final PaymentTransaction completeTransactionWithTypeAndKey = new PaymentTransaction();
completeTransactionWithTypeAndKey.setPaymentId(initialPayment.getPaymentId());
completeTransactionWithTypeAndKey.setTransactionExternalKey(authTransactionExternalKey);
- final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionWithTypeAndKey, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByPaymentId = killBillClient.completePayment(completeTransactionWithTypeAndKey, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, completedPaymentByPaymentId, paymentExternalKey, authTransactionExternalKey, transactionType.toString(), TransactionStatus.SUCCESS.name(), amount, amount, BigDecimal.ZERO, BigDecimal.ZERO, 1, 1);
}
@@ -508,7 +508,7 @@ public class TestPayment extends TestJaxrsBase {
// The payment was already completed, it should succeed (no-op)
final PaymentTransaction completeTransactionByPaymentId = new PaymentTransaction();
completeTransactionByPaymentId.setPaymentId(initialPayment.getPaymentId());
- killBillClient.completePayment(completeTransactionByPaymentId, pluginProperties, basicRequestOptions());
+ killBillClient.completePayment(completeTransactionByPaymentId, pluginProperties, requestOptions);
}
@@ -534,21 +534,21 @@ public class TestPayment extends TestJaxrsBase {
refundTransaction.setTransactionExternalKey(refundTransactionExternalKey);
refundTransaction.setAmount(purchaseAmount);
refundTransaction.setCurrency(authPayment.getCurrency());
- final Payment refundPayment = killBillClient.refundPayment(refundTransaction, null, pluginProperties, basicRequestOptions());
+ final Payment refundPayment = killBillClient.refundPayment(refundTransaction, null, pluginProperties, requestOptions);
verifyPaymentWithPendingRefund(account, paymentMethodId, paymentExternalKey, purchaseTransactionExternalKey, purchaseAmount, refundTransactionExternalKey, refundPayment);
final PaymentTransaction completeTransactionWithTypeAndKey = new PaymentTransaction();
completeTransactionWithTypeAndKey.setPaymentId(refundPayment.getPaymentId());
completeTransactionWithTypeAndKey.setTransactionExternalKey(refundTransactionExternalKey);
- final Payment completedPaymentByTypeAndKey = killBillClient.completePayment(completeTransactionWithTypeAndKey, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByTypeAndKey = killBillClient.completePayment(completeTransactionWithTypeAndKey, pluginProperties, requestOptions);
verifyPaymentWithPendingRefund(account, paymentMethodId, paymentExternalKey, purchaseTransactionExternalKey, purchaseAmount, refundTransactionExternalKey, completedPaymentByTypeAndKey);
// Also, it should work if we specify the payment id and transaction id
final PaymentTransaction completeTransactionWithTypeAndId = new PaymentTransaction();
completeTransactionWithTypeAndId.setPaymentId(refundPayment.getPaymentId());
completeTransactionWithTypeAndId.setTransactionId(refundPayment.getTransactions().get(1).getTransactionId());
- final Payment completedPaymentByTypeAndId = killBillClient.completePayment(completeTransactionWithTypeAndId, pluginProperties, basicRequestOptions());
+ final Payment completedPaymentByTypeAndId = killBillClient.completePayment(completeTransactionWithTypeAndId, pluginProperties, requestOptions);
verifyPaymentWithPendingRefund(account, paymentMethodId, paymentExternalKey, purchaseTransactionExternalKey, purchaseAmount, refundTransactionExternalKey, completedPaymentByTypeAndId);
}
@@ -560,12 +560,12 @@ public class TestPayment extends TestJaxrsBase {
final ComboPaymentTransaction comboPaymentTransaction = createComboPaymentTransaction(accountJson, paymentExternalKey);
- final Payment payment = killBillClient.createPayment(comboPaymentTransaction, ImmutableMap.<String, String>of(), basicRequestOptions());
+ final Payment payment = killBillClient.createPayment(comboPaymentTransaction, ImmutableMap.<String, String>of(), requestOptions);
verifyComboPayment(payment, paymentExternalKey, BigDecimal.TEN, BigDecimal.ZERO, BigDecimal.ZERO, 1, 1);
// Void payment using externalKey
final String voidTransactionExternalKey = UUID.randomUUID().toString();
- final Payment voidPayment = killBillClient.voidPayment(null, paymentExternalKey, voidTransactionExternalKey, null, ImmutableMap.<String, String>of(), basicRequestOptions());
+ final Payment voidPayment = killBillClient.voidPayment(null, paymentExternalKey, voidTransactionExternalKey, null, ImmutableMap.<String, String>of(), requestOptions);
verifyPaymentTransaction(accountJson, voidPayment.getPaymentId(), paymentExternalKey, voidPayment.getTransactions().get(1),
voidTransactionExternalKey, null, "VOID", "SUCCESS");
}
@@ -579,7 +579,7 @@ public class TestPayment extends TestJaxrsBase {
mockPaymentControlProviderPlugin.setAborted(true);
try {
- killBillClient.createPayment(comboPaymentTransaction, Arrays.asList(MockPaymentControlProviderPlugin.PLUGIN_NAME), ImmutableMap.<String, String>of(), basicRequestOptions());
+ killBillClient.createPayment(comboPaymentTransaction, Arrays.asList(MockPaymentControlProviderPlugin.PLUGIN_NAME), ImmutableMap.<String, String>of(), requestOptions);
fail();
} catch (KillBillClientException e) {
assertEquals(e.getResponse().getStatusCode(), 422);
@@ -597,7 +597,7 @@ public class TestPayment extends TestJaxrsBase {
mockPaymentControlProviderPlugin.throwsException(new IllegalStateException());
try {
- killBillClient.createPayment(comboPaymentTransaction, Arrays.asList(MockPaymentControlProviderPlugin.PLUGIN_NAME), ImmutableMap.<String, String>of(), basicRequestOptions());
+ killBillClient.createPayment(comboPaymentTransaction, Arrays.asList(MockPaymentControlProviderPlugin.PLUGIN_NAME), ImmutableMap.<String, String>of(), requestOptions);
fail();
} catch (KillBillClientException e) {
assertEquals(e.getResponse().getStatusCode(), 500);
@@ -635,7 +635,7 @@ public class TestPayment extends TestJaxrsBase {
final ComboPaymentTransaction comboPaymentTransaction = new ComboPaymentTransaction(accountJson, paymentMethodJson, null, ImmutableList.<PluginProperty>of(), ImmutableList.<PluginProperty>of());
- final Payment payment = killBillClient.createPayment(comboPaymentTransaction, ImmutableMap.<String, String>of(), basicRequestOptions());
+ final Payment payment = killBillClient.createPayment(comboPaymentTransaction, ImmutableMap.<String, String>of(), requestOptions);
// Client returns null in case of a 404
Assert.assertNull(payment);
}
@@ -700,7 +700,7 @@ public class TestPayment extends TestJaxrsBase {
captureTransaction.setPaymentExternalKey(paymentExternalKey);
captureTransaction.setTransactionExternalKey(capture1TransactionExternalKey);
// captureAuthorization is using paymentId
- final Payment capturedPayment1 = killBillClient.captureAuthorization(captureTransaction, basicRequestOptions());
+ final Payment capturedPayment1 = killBillClient.captureAuthorization(captureTransaction, requestOptions);
verifyPayment(account, paymentMethodId, capturedPayment1, paymentExternalKey, authTransactionExternalKey, "AUTHORIZE", "SUCCESS",
BigDecimal.TEN, BigDecimal.TEN, BigDecimal.ONE, BigDecimal.ZERO, 2, paymentNb);
verifyPaymentTransaction(account, authPayment.getPaymentId(), paymentExternalKey, capturedPayment1.getTransactions().get(1),
@@ -711,7 +711,7 @@ public class TestPayment extends TestJaxrsBase {
captureTransaction.setTransactionExternalKey(capture2TransactionExternalKey);
// captureAuthorization is using externalKey
captureTransaction.setPaymentId(null);
- final Payment capturedPayment2 = killBillClient.captureAuthorization(captureTransaction, basicRequestOptions());
+ final Payment capturedPayment2 = killBillClient.captureAuthorization(captureTransaction, requestOptions);
verifyPayment(account, paymentMethodId, capturedPayment2, paymentExternalKey, authTransactionExternalKey, "AUTHORIZE", "SUCCESS",
BigDecimal.TEN, BigDecimal.TEN, new BigDecimal("2"), BigDecimal.ZERO, 3, paymentNb);
verifyPaymentTransaction(account, authPayment.getPaymentId(), paymentExternalKey, capturedPayment2.getTransactions().get(2),
@@ -725,7 +725,7 @@ public class TestPayment extends TestJaxrsBase {
refundTransaction.setCurrency(account.getCurrency());
refundTransaction.setPaymentExternalKey(paymentExternalKey);
refundTransaction.setTransactionExternalKey(refundTransactionExternalKey);
- final Payment refundPayment = killBillClient.refundPayment(refundTransaction, basicRequestOptions());
+ final Payment refundPayment = killBillClient.refundPayment(refundTransaction, requestOptions);
verifyPayment(account, paymentMethodId, refundPayment, paymentExternalKey, authTransactionExternalKey, "AUTHORIZE", "SUCCESS",
BigDecimal.TEN, BigDecimal.TEN, new BigDecimal("2"), new BigDecimal("2"), 4, paymentNb);
verifyPaymentTransaction(account, authPayment.getPaymentId(), paymentExternalKey, refundPayment.getTransactions().get(3),
@@ -750,7 +750,7 @@ public class TestPayment extends TestJaxrsBase {
authTransaction.setPaymentExternalKey(paymentExternalKey);
authTransaction.setTransactionExternalKey(transactionExternalKey);
authTransaction.setTransactionType(transactionType.toString());
- final Payment payment = killBillClient.createPayment(account.getAccountId(), paymentMethodId, authTransaction, pluginProperties, basicRequestOptions());
+ final Payment payment = killBillClient.createPayment(account.getAccountId(), paymentMethodId, authTransaction, pluginProperties, requestOptions);
verifyPayment(account, paymentMethodId, payment, paymentExternalKey, transactionExternalKey, transactionType.toString(), transactionStatus, transactionAmount, authAmount, BigDecimal.ZERO, BigDecimal.ZERO, 1, paymentNb);
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPaymentGateway.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPaymentGateway.java
index 6ae89fb..5c87db5 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPaymentGateway.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPaymentGateway.java
@@ -42,7 +42,7 @@ public class TestPaymentGateway extends TestJaxrsBase {
final HostedPaymentPageFields hppFields = new HostedPaymentPageFields();
- final HostedPaymentPageFormDescriptor hostedPaymentPageFormDescriptor = killBillClient.buildFormDescriptor(hppFields, account.getAccountId(), null, ImmutableMap.<String, String>of(), basicRequestOptions());
+ final HostedPaymentPageFormDescriptor hostedPaymentPageFormDescriptor = killBillClient.buildFormDescriptor(hppFields, account.getAccountId(), null, ImmutableMap.<String, String>of(), requestOptions);
Assert.assertEquals(hostedPaymentPageFormDescriptor.getKbAccountId(), account.getAccountId());
}
@@ -58,7 +58,7 @@ public class TestPaymentGateway extends TestJaxrsBase {
final ComboHostedPaymentPage comboHostedPaymentPage = new ComboHostedPaymentPage(account, paymentMethod, ImmutableList.<PluginProperty>of(), hppFields);
- final HostedPaymentPageFormDescriptor hostedPaymentPageFormDescriptor = killBillClient.buildFormDescriptor(comboHostedPaymentPage, ImmutableMap.<String, String>of(), basicRequestOptions());
+ final HostedPaymentPageFormDescriptor hostedPaymentPageFormDescriptor = killBillClient.buildFormDescriptor(comboHostedPaymentPage, ImmutableMap.<String, String>of(), requestOptions);
Assert.assertNotNull(hostedPaymentPageFormDescriptor.getKbAccountId());
}
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPaymentPluginProperties.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPaymentPluginProperties.java
index e24c9a9..f31858f 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPaymentPluginProperties.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPaymentPluginProperties.java
@@ -222,7 +222,7 @@ public class TestPaymentPluginProperties extends TestJaxrsBase {
completeTransactionByPaymentId.setPaymentId(initialPayment.getPaymentId());
completeTransactionByPaymentId.setProperties(bodyProperties);
- final RequestOptions basicRequestOptions = basicRequestOptions();
+ final RequestOptions basicRequestOptions = requestOptions;
final Multimap<String, String> params = LinkedListMultimap.create(basicRequestOptions.getQueryParams());
params.putAll(KillBillHttpClient.CONTROL_PLUGIN_NAME, ImmutableList.<String>of(PluginPropertiesVerificator.PLUGIN_NAME));
@@ -245,7 +245,7 @@ public class TestPaymentPluginProperties extends TestJaxrsBase {
authTransaction.setPaymentExternalKey(paymentExternalKey);
authTransaction.setTransactionExternalKey(transactionExternalKey);
authTransaction.setTransactionType(transactionType.toString());
- final Payment payment = killBillClient.createPayment(account.getAccountId(), paymentMethodId, authTransaction, pluginProperties, basicRequestOptions());
+ final Payment payment = killBillClient.createPayment(account.getAccountId(), paymentMethodId, authTransaction, pluginProperties, requestOptions);
return payment;
}
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPerTenantConfig.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPerTenantConfig.java
index a180f70..ea4ab18 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPerTenantConfig.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestPerTenantConfig.java
@@ -77,7 +77,7 @@ public class TestPerTenantConfig extends TestJaxrsBase {
perTenantProperties.put("org.killbill.payment.retry.days", "1,1,1");
final String perTenantConfig = mapper.writeValueAsString(perTenantProperties);
- final TenantKey tenantKey = killBillClient.postConfigurationPropertiesForTenant(perTenantConfig, basicRequestOptions());
+ final TenantKey tenantKey = killBillClient.postConfigurationPropertiesForTenant(perTenantConfig, requestOptions);
final Account accountJson = createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice();
@@ -92,7 +92,7 @@ public class TestPerTenantConfig extends TestJaxrsBase {
//
// Now unregister special per tenant config and we the first retry occurs one day after (and still fails), it now sets a retry date of 8 days
//
- killBillClient.unregisterConfigurationForTenant(basicRequestOptions());
+ killBillClient.unregisterConfigurationForTenant(requestOptions);
// org.killbill.tenant.broadcast.rate has been set to 1s
crappyWaitForLackOfProperSynchonization(2000);