congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Account.getCurrency
Code IndexAdd Tabnine to your IDE (free)

How to use
getCurrency
method
in
org.killbill.billing.account.api.Account

Best Java code snippets using org.killbill.billing.account.api.Account.getCurrency (Showing top 20 results out of 315)

origin: killbill/killbill

currentAccount.getCurrency() != null &&
!currentAccount.getCurrency().equals(currency)) {
throw new IllegalArgumentException(String.format("Killbill doesn't support updating the account currency yet: new=%s, current=%s",
                         currency, currentAccount.getCurrency()));
origin: killbill/killbill

public DefaultImmutableAccountData(final Account account) {
  this(account.getId(),
     account.getExternalKey(),
     account.getCurrency(),
     account.getTimeZone(),
     AccountDateTimeUtils.getFixedOffsetTimeZone(account),
     account.getReferenceTime());
}
origin: killbill/killbill

@Test(groups = "fast", description = "Test if Account constructor can accept null values")
public void testConstructorAcceptsNullValues() throws Exception {
  final AccountData accountData = getNullAccountData();
  final Account account = new DefaultAccount(UUID.randomUUID(), accountData);
  Assert.assertNull(account.getExternalKey());
  Assert.assertNull(account.getEmail());
  Assert.assertNull(account.getName());
  Assert.assertNull(account.getFirstNameLength());
  Assert.assertNull(account.getCurrency());
  Assert.assertEquals(account.getBillCycleDayLocal(), (Integer) 0);
  Assert.assertNull(account.getPaymentMethodId());
  Assert.assertNull(account.getTimeZone());
  Assert.assertNull(account.getLocale());
  Assert.assertNull(account.getAddress1());
  Assert.assertNull(account.getAddress2());
  Assert.assertNull(account.getCompanyName());
  Assert.assertNull(account.getCity());
  Assert.assertNull(account.getStateOrProvince());
  Assert.assertNull(account.getCountry());
  Assert.assertNull(account.getPostalCode());
  Assert.assertNull(account.getPhone());
  Assert.assertNull(account.isMigrated());
}
origin: killbill/killbill

@Test(groups = "slow", description = "Test Account update with null values")
public void testShouldBeAbleToPassNullForSomeFieldsToAvoidUpdate() throws Exception {
  final Account account = createAccount(new DefaultAccount(createTestAccount()));
  // Update the address and leave other fields null
  final MutableAccountData mutableAccountData = new DefaultMutableAccountData(null, null, null, 0, null, null, false, 0, null,
                                        clock.getUTCNow(), null, null, null, null, null, null,
                                        null, null, null, null, null, false);
  final String newAddress1 = UUID.randomUUID().toString();
  mutableAccountData.setAddress1(newAddress1);
  accountUserApi.updateAccount(account.getId(), mutableAccountData, callContext);
  final Account retrievedAccount = accountUserApi.getAccountById(account.getId(), callContext);
  Assert.assertEquals(retrievedAccount.getAddress1(), newAddress1);
  Assert.assertEquals(retrievedAccount.getAddress2(), account.getAddress2());
  Assert.assertEquals(retrievedAccount.getCurrency(), account.getCurrency());
  Assert.assertEquals(retrievedAccount.getExternalKey(), account.getExternalKey());
  Assert.assertEquals(retrievedAccount.getBillCycleDayLocal(), account.getBillCycleDayLocal());
}
origin: killbill/killbill

private void checkAccountEquals(final Account finalAccount, final Account delegateAccount) {
  Assert.assertEquals(finalAccount.getExternalKey(), delegateAccount.getExternalKey());
  Assert.assertEquals(finalAccount.getEmail(), delegateAccount.getEmail());
  Assert.assertEquals(finalAccount.getName(), delegateAccount.getName());
  Assert.assertEquals(finalAccount.getFirstNameLength(), delegateAccount.getFirstNameLength());
  Assert.assertEquals(finalAccount.getCurrency(), delegateAccount.getCurrency());
  Assert.assertEquals(finalAccount.getBillCycleDayLocal(), delegateAccount.getBillCycleDayLocal());
  Assert.assertEquals(finalAccount.getPaymentMethodId(), delegateAccount.getPaymentMethodId());
  Assert.assertEquals(finalAccount.getTimeZone(), delegateAccount.getTimeZone());
  Assert.assertEquals(finalAccount.getLocale(), delegateAccount.getLocale());
  Assert.assertEquals(finalAccount.getAddress1(), delegateAccount.getAddress1());
  Assert.assertEquals(finalAccount.getAddress2(), delegateAccount.getAddress2());
  Assert.assertEquals(finalAccount.getCompanyName(), delegateAccount.getCompanyName());
  Assert.assertEquals(finalAccount.getCity(), delegateAccount.getCity());
  Assert.assertEquals(finalAccount.getStateOrProvince(), delegateAccount.getStateOrProvince());
  Assert.assertEquals(finalAccount.getCountry(), delegateAccount.getCountry());
  Assert.assertEquals(finalAccount.getPostalCode(), delegateAccount.getPostalCode());
  Assert.assertEquals(finalAccount.getPhone(), delegateAccount.getPhone());
  Assert.assertEquals(finalAccount.getNotes(), delegateAccount.getNotes());
  Assert.assertEquals(finalAccount.isMigrated(), delegateAccount.isMigrated());
}
origin: killbill/killbill

final AccountData accountDataUpdates1 = getAccountData(account.getBillCycleDayLocal(), account.getCurrency(), account.getExternalKey());
final Account accountUpdates1 = new DefaultAccount(UUID.randomUUID(), accountDataUpdates1);
Assert.assertEquals(updatedAccount2.getFirstNameLength(), updatedAccount2.getFirstNameLength());
Assert.assertEquals(updatedAccount2.getExternalKey(), updatedAccount1.getExternalKey());
Assert.assertEquals(updatedAccount2.getCurrency(), updatedAccount1.getCurrency());
Assert.assertEquals(updatedAccount2.getBillCycleDayLocal(), updatedAccount1.getBillCycleDayLocal());
Assert.assertEquals(updatedAccount2.getPaymentMethodId(), updatedAccount1.getPaymentMethodId());
origin: killbill/killbill

Assert.assertEquals(retrievedAccount.getEmail(), account.getEmail());
Assert.assertEquals(retrievedAccount.getBillCycleDayLocal(), account.getBillCycleDayLocal());
Assert.assertEquals(retrievedAccount.getCurrency(), account.getCurrency());
Assert.assertEquals(retrievedAccount.getPaymentMethodId(), account.getPaymentMethodId());
Assert.assertEquals(retrievedAccount.getTimeZone(), account.getTimeZone());
origin: killbill/killbill

accountData.setCurrency(currentAccount.getCurrency());
origin: org.kill-bill.billing/killbill-jaxrs

  @Override
  public BundleJson apply(final SubscriptionBundle input) {
    try {
      return new BundleJson(input, account.getCurrency(), accountAuditLogs);
    } catch (final CatalogApiException e) {
      // Not the cleanest thing, but guava Api don't allow throw..
      throw new RuntimeException(e);
    }
  }
});
origin: org.kill-bill.billing/killbill-jaxrs

@TimedResource
@GET
@Path("/{bundleId:" + UUID_PATTERN + "}")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve a bundle by id", response = BundleJson.class)
@ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid bundle id supplied"),
            @ApiResponse(code = 404, message = "Bundle not found")})
public Response getBundle(@PathParam("bundleId") final UUID bundleId,
             @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode,
             @javax.ws.rs.core.Context final HttpServletRequest request) throws SubscriptionApiException, AccountApiException, CatalogApiException {
  final TenantContext tenantContext = this.context.createTenantContextNoAccountId(request);
  final SubscriptionBundle bundle = subscriptionApi.getSubscriptionBundle(bundleId, tenantContext);
  final Account account = accountUserApi.getAccountById(bundle.getAccountId(), tenantContext);
  final AccountAuditLogs accountAuditLogs = auditUserApi.getAccountAuditLogs(bundle.getAccountId(), auditMode.getLevel(), tenantContext);
  final BundleJson json = new BundleJson(bundle, account.getCurrency(), accountAuditLogs);
  return Response.status(Status.OK).entity(json).build();
}
origin: org.kill-bill.billing/killbill-jaxrs

@TimedResource
@GET
@Path("/{subscriptionId:" + UUID_PATTERN + "}")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve a subscription by id", response = SubscriptionJson.class)
@ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid subscription id supplied"),
            @ApiResponse(code = 404, message = "Subscription not found")})
public Response getSubscription(@PathParam("subscriptionId") final UUID subscriptionId,
                @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode,
                @javax.ws.rs.core.Context final HttpServletRequest request) throws SubscriptionApiException, AccountApiException, CatalogApiException {
  final TenantContext context = this.context.createTenantContextNoAccountId(request);
  final Subscription subscription = subscriptionApi.getSubscriptionForEntitlementId(subscriptionId, context);
  final Account account = accountUserApi.getAccountById(subscription.getAccountId(), context);
  final AccountAuditLogs accountAuditLogs = auditUserApi.getAccountAuditLogs(subscription.getAccountId(), auditMode.getLevel(), context);
  final SubscriptionJson json = new SubscriptionJson(subscription, account.getCurrency(), accountAuditLogs);
  return Response.status(Status.OK).entity(json).build();
}
origin: org.kill-bill.billing.plugin.java/killbill-base-plugin

public static Invoice buildInvoice(final Account account) {
  final Invoice invoice = Mockito.mock(Invoice.class);
  Mockito.when(invoice.getId()).thenReturn(UUID.randomUUID());
  // To work-around org.mockito.exceptions.misusing.UnfinishedStubbingException
  final UUID accountId = account.getId();
  final Currency currency = account.getCurrency();
  Mockito.when(invoice.getAccountId()).thenReturn(accountId);
  Mockito.when(invoice.getInvoiceDate()).thenReturn(new LocalDate());
  Mockito.when(invoice.getCurrency()).thenReturn(currency);
  Mockito.when(invoice.getInvoiceItems()).thenReturn(new LinkedList<InvoiceItem>());
  return invoice;
}
origin: org.kill-bill.billing/killbill-payment

@Test(groups = "slow")
public void testSimpleAuthCaptureWithInvalidPaymentId() throws Exception {
  final BigDecimal requestedAmount = new BigDecimal("80.0091");
  final Payment initialPayment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(), null,
                                 UUID.randomUUID().toString(), UUID.randomUUID().toString(), ImmutableList.<PluginProperty>of(), callContext);
  try {
    paymentApi.createCapture(account, UUID.randomUUID(), requestedAmount, account.getCurrency(), null, UUID.randomUUID().toString(), ImmutableList.<PluginProperty>of(), callContext);
    Assert.fail("Expected capture to fail...");
  } catch (final PaymentApiException e) {
    Assert.assertEquals(e.getCode(), ErrorCode.PAYMENT_NO_SUCH_PAYMENT.getCode());
    final Payment latestPayment = paymentApi.getPayment(initialPayment.getId(), true, false, ImmutableList.<PluginProperty>of(), callContext);
    assertEquals(latestPayment, initialPayment);
  }
}
origin: org.kill-bill.billing/killbill-account

public DefaultImmutableAccountData(final Account account) {
  this(account.getId(),
     account.getExternalKey(),
     account.getCurrency(),
     account.getTimeZone(),
     AccountDateTimeUtils.getFixedOffsetTimeZone(account),
     account.getReferenceTime());
}
origin: org.kill-bill.billing/killbill-payment

@Test(groups = "slow")
public void testSimpleAuthCaptureWithInvalidCurrency() throws Exception {
  final BigDecimal requestedAmount = new BigDecimal("80.0091");
  final Payment initialPayment = paymentApi.createAuthorization(account, account.getPaymentMethodId(), null, requestedAmount, account.getCurrency(), null,
                                 UUID.randomUUID().toString(), UUID.randomUUID().toString(), ImmutableList.<PluginProperty>of(), callContext);
  try {
    paymentApi.createCapture(account, initialPayment.getId(), requestedAmount, Currency.AMD, null, UUID.randomUUID().toString(), ImmutableList.<PluginProperty>of(), callContext);
    Assert.fail("Expected capture to fail...");
  } catch (final PaymentApiException e) {
    Assert.assertEquals(e.getCode(), ErrorCode.PAYMENT_INVALID_PARAMETER.getCode());
    final Payment latestPayment = paymentApi.getPayment(initialPayment.getId(), true, false, ImmutableList.<PluginProperty>of(), callContext);
    assertEquals(latestPayment, initialPayment);
  }
}
origin: org.kill-bill.billing/killbill-payment

private void verifyRefund(final Payment refund, final String paymentExternalKey, final String paymentTransactionExternalKey, final String refundTransactionExternalKey, final BigDecimal requestedAmount, final BigDecimal refundAmount, final TransactionStatus transactionStatus) {
  Assert.assertEquals(refund.getExternalKey(), paymentExternalKey);
  Assert.assertEquals(refund.getTransactions().size(), 2);
  Assert.assertEquals(refund.getTransactions().get(0).getAmount().compareTo(requestedAmount), 0);
  Assert.assertEquals(refund.getTransactions().get(0).getProcessedAmount().compareTo(requestedAmount), 0);
  Assert.assertEquals(refund.getTransactions().get(0).getCurrency(), account.getCurrency());
  Assert.assertEquals(refund.getTransactions().get(0).getExternalKey(), paymentTransactionExternalKey);
  Assert.assertEquals(refund.getTransactions().get(0).getTransactionStatus(), TransactionStatus.SUCCESS);
  Assert.assertEquals(refund.getTransactions().get(1).getAmount().compareTo(requestedAmount), 0);
  Assert.assertEquals(refund.getTransactions().get(1).getProcessedAmount().compareTo(refundAmount), 0);
  Assert.assertEquals(refund.getTransactions().get(1).getCurrency(), account.getCurrency());
  Assert.assertEquals(refund.getTransactions().get(1).getExternalKey(), refundTransactionExternalKey);
  Assert.assertEquals(refund.getTransactions().get(1).getTransactionStatus(), transactionStatus);
}
origin: org.kill-bill.billing/killbill-invoice

@Test(groups = "slow")
public void testCreateParentInvoice() throws InvoiceApiException {
  final UUID parentAccountId = UUID.randomUUID();
  final UUID childAccountId = UUID.randomUUID();
  final DateTime today = clock.getNow(account.getTimeZone());
  InvoiceModelDao parentInvoice = new InvoiceModelDao(parentAccountId, today.toLocalDate(), account.getCurrency(), InvoiceStatus.DRAFT, true);
  InvoiceItem parentInvoiceItem = new ParentInvoiceItem(UUID.randomUUID(), today, parentInvoice.getId(), parentAccountId, childAccountId, BigDecimal.TEN, account.getCurrency(), "");
  parentInvoice.addInvoiceItem(new InvoiceItemModelDao(parentInvoiceItem));
  invoiceDao.createInvoices(ImmutableList.<InvoiceModelDao>of(parentInvoice), ImmutableSet.of(), context);
  final InvoiceModelDao parentDraftInvoice = invoiceDao.getParentDraftInvoice(parentAccountId, context);
  assertNotNull(parentDraftInvoice);
  assertEquals(parentDraftInvoice.getStatus(), InvoiceStatus.DRAFT);
  assertEquals(parentDraftInvoice.getInvoiceItems().size(), 1);
}
origin: org.kill-bill.billing.plugin.java/killbill-base-plugin

@Override
@BeforeClass(groups = "slow")
public void setUpBeforeClass() throws Exception {
  super.setUpBeforeClass();
  this.dao = new TestPluginPaymentDao(embeddedDB.getDataSource());
  final Clock clock = new DefaultClock();
  final UUID tenantId = UUID.randomUUID();
  context = Mockito.mock(CallContext.class);
  Mockito.when(context.getTenantId()).thenReturn(tenantId);
  account = TestUtils.buildAccount(Currency.JPY, "JP");
  final OSGIKillbillAPI killbillApi = TestUtils.buildOSGIKillbillAPI(account);
  final Payment payment = TestUtils.buildPayment(account.getId(), account.getPaymentMethodId(), account.getCurrency(), killbillApi);
  final OSGIKillbillLogService logService = TestUtils.buildLogService();
  final OSGIConfigPropertiesService configPropertiesService = Mockito.mock(OSGIConfigPropertiesService.class);
  api = new TestPaymentPluginApi(killbillApi, configPropertiesService, logService, clock, dao);
  TestUtils.updateOSGIKillbillAPI(killbillApi, api);
}
origin: org.kill-bill.billing/killbill-beatrix

@Test(groups = "slow")
public void testCreatWithFixedPriceOverride() throws Exception {
  // We take april as it has 30 days (easier to play with BCD)
  // Set clock to the initial start date - we implicitly assume here that the account timezone is UTC
  clock.setDay(new LocalDate(2012, 4, 1));
  final AccountData accountData = getAccountData(1);
  final Account account = createAccountWithNonOsgiPaymentMethod(accountData);
  accountChecker.checkAccount(account.getId(), accountData, callContext);
  final List<PlanPhasePriceOverride> overrides = new ArrayList<PlanPhasePriceOverride>();
  overrides.add(new DefaultPlanPhasePriceOverride("shotgun-monthly-trial", account.getCurrency(), BigDecimal.ONE, null, null));
  final DefaultEntitlement bpSubscription = createBaseEntitlementWithPriceOverrideAndCheckForCompletion(account.getId(), "bundleKey", "Shotgun", ProductCategory.BASE, BillingPeriod.MONTHLY, overrides, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE, NextEvent.PAYMENT, NextEvent.INVOICE_PAYMENT);
  // Check bundle after BP got created otherwise we get an error from auditApi.
  subscriptionChecker.checkSubscriptionCreated(bpSubscription.getId(), internalCallContext);
  invoiceChecker.checkInvoice(account.getId(), 1, callContext, new ExpectedInvoiceItemCheck(clock.getUTCToday(), null, InvoiceItemType.FIXED, new BigDecimal("1")));
}
origin: org.kill-bill.billing/killbill-beatrix

private void insertInvoiceItemAdjustmentToChildInvoice(final Account childAccount, final Invoice childInvoice, BigDecimal amount) throws InvoiceApiException {
  busHandler.pushExpectedEvents(NextEvent.INVOICE_ADJUSTMENT, NextEvent.INVOICE_ADJUSTMENT);
  invoiceUserApi.insertInvoiceItemAdjustment(childAccount.getId(), childInvoice.getId(),
                        childInvoice.getInvoiceItems().get(0).getId(),
                        clock.getToday(childAccount.getTimeZone()), amount,
                        childAccount.getCurrency(), "test adjustment", null, null, callContext);
  assertListenerStatus();
}
org.killbill.billing.account.apiAccountgetCurrency

Popular methods of Account

  • getId
  • getExternalKey
  • getTimeZone
  • getEmail
  • getName
  • getFirstNameLength
  • getPhone
  • getReferenceTime
  • getBillCycleDayLocal
  • getLocale
  • getParentAccountId
  • getPaymentMethodId
  • getParentAccountId,
  • getPaymentMethodId,
  • isPaymentDelegatedToParent,
  • getAddress1,
  • getAddress2,
  • getCity,
  • getCompanyName,
  • getCountry,
  • getPostalCode

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (Timer)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getExternalFilesDir (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JLabel (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now