Search in sources :

Example 1 with Account

use of org.killbill.billing.client.model.Account in project killbill by killbill.

the class KillbillClient method createAccountNoPMBundleAndSubscriptionAndWaitForFirstInvoice.

protected Account createAccountNoPMBundleAndSubscriptionAndWaitForFirstInvoice() throws Exception {
    // Create an account with no payment method
    final Account accountJson = createAccount();
    assertNotNull(accountJson);
    // Add a bundle, subscription and move the clock to get the first invoice
    final Subscription subscriptionJson = createEntitlement(accountJson.getAccountId(), UUID.randomUUID().toString(), "Shotgun", ProductCategory.BASE, BillingPeriod.MONTHLY, true);
    assertNotNull(subscriptionJson);
    clock.addMonths(1);
    crappyWaitForLackOfProperSynchonization();
    return accountJson;
}
Also used : Account(org.killbill.billing.client.model.Account) Subscription(org.killbill.billing.client.model.Subscription)

Example 2 with Account

use of org.killbill.billing.client.model.Account in project killbill by killbill.

the class KillbillClient method createAccountWithExternalPaymentMethod.

protected Account createAccountWithExternalPaymentMethod() throws Exception {
    final Account input = createAccount();
    final PaymentMethodPluginDetail info = new PaymentMethodPluginDetail();
    final PaymentMethod paymentMethodJson = new PaymentMethod(null, UUIDs.randomUUID().toString(), input.getAccountId(), true, ExternalPaymentProviderPlugin.PLUGIN_NAME, info);
    killBillClient.createPaymentMethod(paymentMethodJson, requestOptions);
    return killBillClient.getAccount(input.getExternalKey(), requestOptions);
}
Also used : Account(org.killbill.billing.client.model.Account) PaymentMethodPluginDetail(org.killbill.billing.client.model.PaymentMethodPluginDetail) PaymentMethod(org.killbill.billing.client.model.PaymentMethod)

Example 3 with Account

use of org.killbill.billing.client.model.Account in project killbill by killbill.

the class KillbillClient method createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice.

protected Account createAccountWithPMBundleAndSubscriptionAndWaitForFirstInvoice() throws Exception {
    final Account accountJson = createAccountWithDefaultPaymentMethod();
    assertNotNull(accountJson);
    // Add a bundle, subscription and move the clock to get the first invoice
    final Subscription subscriptionJson = createEntitlement(accountJson.getAccountId(), UUID.randomUUID().toString(), "Shotgun", ProductCategory.BASE, BillingPeriod.MONTHLY, true);
    assertNotNull(subscriptionJson);
    clock.addDays(32);
    crappyWaitForLackOfProperSynchonization();
    return accountJson;
}
Also used : Account(org.killbill.billing.client.model.Account) Subscription(org.killbill.billing.client.model.Subscription)

Example 4 with Account

use of org.killbill.billing.client.model.Account in project killbill by killbill.

the class KillbillClient method createAccountWithExternalPMBundleAndSubscriptionAndManualPayTagAndWaitForFirstInvoice.

protected Account createAccountWithExternalPMBundleAndSubscriptionAndManualPayTagAndWaitForFirstInvoice() throws Exception {
    final Account accountJson = createAccountWithExternalPaymentMethod();
    assertNotNull(accountJson);
    final Tags accountTag = killBillClient.createAccountTag(accountJson.getAccountId(), ControlTagType.MANUAL_PAY.getId(), requestOptions);
    assertNotNull(accountTag);
    assertEquals(accountTag.get(0).getTagDefinitionId(), ControlTagType.MANUAL_PAY.getId());
    // Add a bundle, subscription and move the clock to get the first invoice
    final Subscription subscriptionJson = createEntitlement(accountJson.getAccountId(), UUID.randomUUID().toString(), "Shotgun", ProductCategory.BASE, BillingPeriod.MONTHLY, true);
    assertNotNull(subscriptionJson);
    clock.addDays(32);
    crappyWaitForLackOfProperSynchonization();
    return accountJson;
}
Also used : Account(org.killbill.billing.client.model.Account) Subscription(org.killbill.billing.client.model.Subscription) Tags(org.killbill.billing.client.model.Tags)

Example 5 with Account

use of org.killbill.billing.client.model.Account in project killbill by killbill.

the class TestAccount method testAccountWithBalance.

@Test(groups = "slow", description = "Can retrieve the account balance")
public void testAccountWithBalance() throws Exception {
    final Account accountJson = createAccountNoPMBundleAndSubscriptionAndWaitForFirstInvoice();
    final Account accountWithBalance = killBillClient.getAccount(accountJson.getAccountId(), true, false, requestOptions);
    final BigDecimal accountBalance = accountWithBalance.getAccountBalance();
    Assert.assertTrue(accountBalance.compareTo(BigDecimal.ZERO) > 0);
}
Also used : Account(org.killbill.billing.client.model.Account) BigDecimal(java.math.BigDecimal) Test(org.testng.annotations.Test)

Aggregations

Account (org.killbill.billing.client.model.Account)123 Test (org.testng.annotations.Test)109 UUID (java.util.UUID)32 DateTime (org.joda.time.DateTime)32 Invoice (org.killbill.billing.client.model.Invoice)30 BigDecimal (java.math.BigDecimal)27 Payment (org.killbill.billing.client.model.Payment)24 Subscription (org.killbill.billing.client.model.Subscription)24 ComboPaymentTransaction (org.killbill.billing.client.model.ComboPaymentTransaction)17 InvoiceItem (org.killbill.billing.client.model.InvoiceItem)16 PaymentTransaction (org.killbill.billing.client.model.PaymentTransaction)16 KillBillClientException (org.killbill.billing.client.KillBillClientException)14 InvoicePayment (org.killbill.billing.client.model.InvoicePayment)14 InvoicePayments (org.killbill.billing.client.model.InvoicePayments)13 PaymentMethod (org.killbill.billing.client.model.PaymentMethod)13 InvoicePaymentTransaction (org.killbill.billing.client.model.InvoicePaymentTransaction)10 Payments (org.killbill.billing.client.model.Payments)10 Tags (org.killbill.billing.client.model.Tags)10 Invoices (org.killbill.billing.client.model.Invoices)9 PaymentMethodPluginDetail (org.killbill.billing.client.model.PaymentMethodPluginDetail)9