本文整理汇总了Java中org.killbill.billing.catalog.api.Plan类的典型用法代码示例。如果您正苦于以下问题:Java Plan类的具体用法?Java Plan怎么用?Java Plan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Plan类属于org.killbill.billing.catalog.api包,在下文中一共展示了Plan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: productNameForInvoiceItem
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
private String productNameForInvoiceItem(final InvoiceItem invoiceItem,
final Map<String, String> planToProductCache, final UUID kbTenantId) {
final String planName = invoiceItem.getPlanName();
if (planName == null) {
return null;
}
return planToProductCache.computeIfAbsent(planName, k -> {
try {
StaticCatalog catalog = killbillApi.getCatalogUserApi().getCurrentCatalog(null,
new EasyTaxTenantContext(kbTenantId, invoiceItem.getAccountId()));
Plan plan = catalog.findCurrentPlan(planName);
return (plan != null && plan.getProduct() != null ? plan.getProduct().getName()
: null);
} catch (CatalogApiException e) {
return null;
}
});
}
示例2: getMaxPaymentAmount
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
private long getMaxPaymentAmount(@Nullable final Plan plan) throws CatalogApiException {
if (plan == null) {
return 0;
}
BigDecimal maxPaymentAmount = BigDecimal.ZERO;
for (PlanPhase ph : plan.getAllPhases()) {
BigDecimal phaseAmount = ph.getRecurringPrice() != null ? ph.getRecurringPrice().getPrice(Currency.BTC) : BigDecimal.ZERO;
if (maxPaymentAmount.compareTo(phaseAmount) < 0) {
maxPaymentAmount = phaseAmount;
}
}
return maxPaymentAmount.longValue() * BTC_TO_SATOSHIS;
}
示例3: getPlanFromInvoiceItem
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
protected Plan getPlanFromInvoiceItem(final InvoiceItem invoiceItem, final LocalDate subscriptionStartDate, final TenantContext context) throws AnalyticsRefreshException {
try {
final Catalog catalog = getCatalog(context);
return catalog.findPlan(invoiceItem.getPlanName(), invoiceItem.getStartDate().toDateTimeAtStartOfDay(), subscriptionStartDate.toDateTimeAtStartOfDay());
} catch (CatalogApiException e) {
logger.warn("Unable to retrieve plan for invoice item " + invoiceItem.getId(), e);
return null;
}
}
示例4: BusinessInvoiceAdjustmentModelDao
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
public BusinessInvoiceAdjustmentModelDao(final Account account,
final Long accountRecordId,
final Invoice invoice,
final InvoiceItem invoiceItem,
@Nullable final ItemSource itemSource,
final Long invoiceItemRecordId,
final Long secondInvoiceItemRecordId,
@Nullable final SubscriptionBundle bundle,
@Nullable final Plan plan,
@Nullable final PlanPhase planPhase,
final CurrencyConverter currencyConverter,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
super(account,
accountRecordId,
invoice,
invoiceItem,
itemSource,
invoiceItemRecordId,
secondInvoiceItemRecordId,
bundle,
plan,
planPhase,
currencyConverter,
creationAuditLog,
tenantRecordId,
reportGroup);
}
示例5: BusinessInvoiceItemCreditModelDao
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
public BusinessInvoiceItemCreditModelDao(final Account account,
final Long accountRecordId,
final Invoice invoice,
final InvoiceItem invoiceItem,
@Nullable final ItemSource itemSource,
final Long invoiceItemRecordId,
final Long secondInvoiceItemRecordId,
@Nullable final SubscriptionBundle bundle,
@Nullable final Plan plan,
@Nullable final PlanPhase planPhase,
final CurrencyConverter currencyConverter,
@Nullable final AuditLog creationAuditLogs,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
super(account,
accountRecordId,
invoice,
invoiceItem,
itemSource,
invoiceItemRecordId,
secondInvoiceItemRecordId,
bundle,
plan,
planPhase,
currencyConverter,
creationAuditLogs,
tenantRecordId,
reportGroup);
}
示例6: BusinessInvoiceItemModelDao
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
public BusinessInvoiceItemModelDao(final Account account,
final Long accountRecordId,
final Invoice invoice,
final InvoiceItem invoiceItem,
@Nullable final ItemSource itemSource,
final Long invoiceItemRecordId,
final Long secondInvoiceItemRecordId,
@Nullable final SubscriptionBundle bundle,
@Nullable final Plan plan,
@Nullable final PlanPhase planPhase,
final CurrencyConverter currencyConverter,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
super(account,
accountRecordId,
invoice,
invoiceItem,
itemSource,
invoiceItemRecordId,
secondInvoiceItemRecordId,
bundle,
plan,
planPhase,
currencyConverter,
creationAuditLog,
tenantRecordId,
reportGroup);
}
示例7: BusinessInvoiceItemAdjustmentModelDao
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
public BusinessInvoiceItemAdjustmentModelDao(final Account account,
final Long accountRecordId,
final Invoice invoice,
final InvoiceItem invoiceItem,
@Nullable final ItemSource itemSource,
final Long invoiceItemRecordId,
final Long secondInvoiceItemRecordId,
@Nullable final SubscriptionBundle bundle,
@Nullable final Plan plan,
@Nullable final PlanPhase planPhase,
final CurrencyConverter currencyConverter,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
super(account,
accountRecordId,
invoice,
invoiceItem,
itemSource,
invoiceItemRecordId,
secondInvoiceItemRecordId,
bundle,
plan,
planPhase,
currencyConverter,
creationAuditLog,
tenantRecordId,
reportGroup);
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:30,代码来源:BusinessInvoiceItemAdjustmentModelDao.java
示例8: getTypeFromSubscription
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
private static ProductCategory getTypeFromSubscription(@Nullable final Plan plan) {
if (plan != null && plan.getProduct() != null) {
final Product product = plan.getProduct();
if (product.getCatalogName() != null && product.getCategory() != null) {
return product.getCategory();
}
}
return null;
}
示例9: createBst
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
private BusinessSubscriptionTransitionModelDao createBst(final UUID bundleId, final UUID subscriptionId, final String eventString, final LocalDate startDate) {
final SubscriptionBundle bundle = Mockito.mock(SubscriptionBundle.class);
Mockito.when(bundle.getId()).thenReturn(bundleId);
final BusinessSubscriptionEvent event = BusinessSubscriptionEvent.valueOf(eventString);
final BusinessSubscription previousSubscription = null; // We don't look at it
final Product product = Mockito.mock(Product.class);
Mockito.when(product.getCategory()).thenReturn(event.getCategory());
final Plan plan = Mockito.mock(Plan.class);
Mockito.when(plan.getProduct()).thenReturn(product);
final BusinessSubscription nextSubscription = new BusinessSubscription(plan,
null,
null,
Currency.GBP,
startDate,
serviceName,
stateName,
currencyConverter);
Mockito.when(subscriptionTransition.getEntitlementId()).thenReturn(subscriptionId);
return new BusinessSubscriptionTransitionModelDao(account,
accountRecordId,
bundle,
subscriptionTransition,
subscriptionEventRecordId,
event,
previousSubscription,
nextSubscription,
currencyConverter,
auditLog,
tenantRecordId,
reportGroup);
}
示例10: setup
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
@BeforeMethod
public void setup() throws Exception {
clock = Mockito.mock(Clock.class);
now = new DateTime(DateTimeZone.UTC);
tenantId = UUID.randomUUID();
account1 = TestUtils.buildAccount(Currency.NZD, "NZ");
account2 = TestUtils.buildAccount(Currency.EUR, "DE");
newInvoice1 = TestUtils.buildInvoice(account1);
newInvoice2 = TestUtils.buildInvoice(account2);
dao = Mockito.mock(EasyTaxDao.class);
osgiKillbillApi = TestUtils.buildOSGIKillbillAPI(account1);
osgiKillbillLogService = TestUtils.buildLogService();
when(clock.getUTCNow()).thenReturn(now);
// no custom fields provided for tests
CustomFieldUserApi fieldApi = Mockito.mock(CustomFieldUserApi.class);
when(osgiKillbillApi.getCustomFieldUserApi()).thenReturn(fieldApi);
when(fieldApi.getCustomFieldsForObject(any(), eq(ObjectType.ACCOUNT), any()))
.thenReturn(Collections.emptyList());
EasyTaxTaxCode taxCode = new EasyTaxTaxCode();
taxCode.setKbTenantId(tenantId);
taxCode.setTaxZone("NZ");
taxCode.setProductName(TEST_PRODUCT_NAME);
taxCode.setTaxCode(GST);
taxCode.setTaxRate(GST_RATE);
taxCode.setValidFromDate(new DateTime().year().roundFloorCopy());
nzGst = taxCode;
taxCode = new EasyTaxTaxCode();
taxCode.setKbTenantId(tenantId);
taxCode.setTaxZone("NZ");
taxCode.setProductName(TEST_PRODUCT_NAME);
taxCode.setTaxCode(XST);
taxCode.setTaxRate(XST_RATE);
taxCode.setValidFromDate(new DateTime().year().roundFloorCopy());
xst = taxCode;
// add catalog support with test product and test plan
currCatalog = Mockito.mock(StaticCatalog.class);
testProduct = Mockito.mock(Product.class);
given(testProduct.getName()).willReturn(TEST_PRODUCT_NAME);
Plan plan = Mockito.mock(Plan.class);
given(plan.getProduct()).willReturn(testProduct);
given(currCatalog.findCurrentPlan(TEST_PLAN_NAME)).willReturn(plan);
CatalogUtils.setupCatalogApi(osgiKillbillApi, CatalogUtils.createCatalogApi(currCatalog));
}
示例11: createSubscription
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
private UUID createSubscription(final Account account, final Plan plan, final String externalKey, final String priceList, final PhaseType phaseType, final DateTime now, final CallContext callContext) throws EntitlementApiException, TagApiException, CustomFieldApiException {
final PlanPhaseSpecifier spec = new PlanPhaseSpecifier(plan.getProduct().getName(), plan.getProduct().getCategory(), plan.getBillingPeriod(), priceList, phaseType);
final Entitlement entitlement = killbillAPI.getEntitlementApi().createBaseEntitlement(account.getId(), spec, externalKey, now.toLocalDate(), callContext);
return entitlement.getId();
}
示例12: createBusinessInvoiceItem
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
@VisibleForTesting
BusinessInvoiceItemBaseModelDao createBusinessInvoiceItem(final BusinessContextFactory businessContextFactory,
final Account account,
final Invoice invoice,
final InvoiceItem invoiceItem,
final Collection<InvoiceItem> otherInvoiceItems,
final Map<UUID, SubscriptionBundle> bundles,
final CurrencyConverter currencyConverter,
final AuditLog creationAuditLog,
final Long accountRecordId,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) throws AnalyticsRefreshException {
// For convenience, populate empty columns using the linked item
final InvoiceItem linkedInvoiceItem = Iterables.find(otherInvoiceItems, new Predicate<InvoiceItem>() {
@Override
public boolean apply(final InvoiceItem input) {
return invoiceItem.getLinkedItemId() != null && invoiceItem.getLinkedItemId().equals(input.getId());
}
}, null);
SubscriptionBundle bundle = null;
// Subscription and bundle could be null for e.g. credits or adjustments
if (invoiceItem.getBundleId() != null) {
bundle = bundles.get(invoiceItem.getBundleId());
}
if (bundle == null && linkedInvoiceItem != null && linkedInvoiceItem.getBundleId() != null) {
bundle = bundles.get(linkedInvoiceItem.getBundleId());
}
final LocalDate subscriptionStartDate = bundle != null ? getSubscriptionStartDate(invoiceItem, bundle) : null;
Plan plan = null;
if (Strings.emptyToNull(invoiceItem.getPlanName()) != null) {
if (subscriptionStartDate != null) {
plan = businessContextFactory.getPlanFromInvoiceItem(invoiceItem, subscriptionStartDate);
}
}
if (plan == null && linkedInvoiceItem != null && Strings.emptyToNull(linkedInvoiceItem.getPlanName()) != null) {
if (subscriptionStartDate != null) {
plan = businessContextFactory.getPlanFromInvoiceItem(linkedInvoiceItem, subscriptionStartDate);
}
}
PlanPhase planPhase = null;
if (invoiceItem.getSubscriptionId() != null && Strings.emptyToNull(invoiceItem.getPhaseName()) != null && bundle != null) {
if (subscriptionStartDate != null) {
planPhase = businessContextFactory.getPlanPhaseFromInvoiceItem(invoiceItem, subscriptionStartDate);
}
}
if (planPhase == null && linkedInvoiceItem != null && linkedInvoiceItem.getSubscriptionId() != null && Strings.emptyToNull(linkedInvoiceItem.getPhaseName()) != null && bundle != null) {
if (subscriptionStartDate != null) {
planPhase = businessContextFactory.getPlanPhaseFromInvoiceItem(linkedInvoiceItem, subscriptionStartDate);
}
}
final Long invoiceItemRecordId = invoiceItem.getId() != null ? businessContextFactory.getInvoiceItemRecordId(invoiceItem.getId()) : null;
return createBusinessInvoiceItem(account,
invoice,
invoiceItem,
otherInvoiceItems,
bundle,
plan,
planPhase,
invoiceItemRecordId,
currencyConverter,
creationAuditLog,
accountRecordId,
tenantRecordId,
reportGroup);
}
示例13: getPlanFromInvoiceItem
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
public Plan getPlanFromInvoiceItem(final InvoiceItem invoiceItem, final LocalDate subscriptionStartDate) throws AnalyticsRefreshException {
return getPlanFromInvoiceItem(invoiceItem, subscriptionStartDate, callContext);
}
示例14: create
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
public static BusinessInvoiceItemBaseModelDao create(final Account account,
final Long accountRecordId,
final Invoice invoice,
final InvoiceItem invoiceItem,
@Nullable final ItemSource itemSource,
final BusinessInvoiceItemType businessInvoiceItemType,
final Long invoiceItemRecordId,
final Long secondInvoiceItemRecordId,
@Nullable final SubscriptionBundle bundle,
@Nullable final Plan plan,
@Nullable final PlanPhase planPhase,
final CurrencyConverter currencyConverter,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
if (BusinessInvoiceItemType.INVOICE_ADJUSTMENT.equals(businessInvoiceItemType)) {
return new BusinessInvoiceAdjustmentModelDao(account,
accountRecordId,
invoice,
invoiceItem,
itemSource,
invoiceItemRecordId,
secondInvoiceItemRecordId,
bundle,
plan,
planPhase,
currencyConverter,
creationAuditLog,
tenantRecordId,
reportGroup);
} else if (BusinessInvoiceItemType.CHARGE.equals(businessInvoiceItemType)) {
return new BusinessInvoiceItemModelDao(account,
accountRecordId,
invoice,
invoiceItem,
itemSource,
invoiceItemRecordId,
secondInvoiceItemRecordId,
bundle,
plan,
planPhase,
currencyConverter,
creationAuditLog,
tenantRecordId,
reportGroup);
} else if (BusinessInvoiceItemType.INVOICE_ITEM_ADJUSTMENT.equals(businessInvoiceItemType)) {
return new BusinessInvoiceItemAdjustmentModelDao(account,
accountRecordId,
invoice,
invoiceItem,
itemSource,
invoiceItemRecordId,
secondInvoiceItemRecordId,
bundle,
plan,
planPhase,
currencyConverter,
creationAuditLog,
tenantRecordId,
reportGroup);
} else if (BusinessInvoiceItemType.ACCOUNT_CREDIT.equals(businessInvoiceItemType)) {
return new BusinessInvoiceItemCreditModelDao(account,
accountRecordId,
invoice,
invoiceItem,
itemSource,
invoiceItemRecordId,
secondInvoiceItemRecordId,
bundle,
plan,
planPhase,
currencyConverter,
creationAuditLog,
tenantRecordId,
reportGroup);
} else {
// We don't care
return null;
}
}
示例15: BusinessInvoiceItemBaseModelDao
import org.killbill.billing.catalog.api.Plan; //导入依赖的package包/类
public BusinessInvoiceItemBaseModelDao(final Account account,
final Long accountRecordId,
final Invoice invoice,
final InvoiceItem invoiceItem,
@Nullable final ItemSource itemSource,
final Long invoiceItemRecordId,
final Long secondInvoiceItemRecordId,
@Nullable final SubscriptionBundle bundle,
@Nullable final Plan plan,
@Nullable final PlanPhase planPhase,
final CurrencyConverter currencyConverter,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
this(invoiceItemRecordId,
secondInvoiceItemRecordId,
invoiceItem.getId(),
invoice.getId(),
invoice.getInvoiceNumber(),
invoice.getCreatedDate(),
invoice.getInvoiceDate(),
invoice.getTargetDate(),
invoice.getCurrency() == null ? null : invoice.getCurrency().toString(),
invoice.getBalance(),
currencyConverter.getConvertedValue(invoice.getBalance(), invoice),
invoice.getPaidAmount(),
currencyConverter.getConvertedValue(invoice.getPaidAmount(), invoice),
invoice.getChargedAmount(),
currencyConverter.getConvertedValue(invoice.getChargedAmount(), invoice),
invoice.getOriginalChargedAmount(),
currencyConverter.getConvertedValue(invoice.getOriginalChargedAmount(), invoice),
invoice.getCreditedAmount(),
currencyConverter.getConvertedValue(invoice.getCreditedAmount(), invoice),
invoice.getRefundedAmount(),
currencyConverter.getConvertedValue(invoice.getRefundedAmount(), invoice),
invoiceItem.getInvoiceItemType().toString(),
itemSource,
bundle == null ? null : bundle.getId(),
bundle == null ? null : bundle.getExternalKey(),
(plan != null && plan.getProduct() != null) ? plan.getProduct().getName() : null,
(plan != null && plan.getProduct() != null) ? plan.getProduct().getCatalogName() : null,
(plan != null && plan.getProduct().getCategory() != null) ? plan.getProduct().getCategory().toString() : null,
planPhase != null ? planPhase.getName() : null,
invoiceItem.getUsageName(),
(planPhase != null && planPhase.getPhaseType() != null) ? planPhase.getPhaseType().toString() : null,
(planPhase != null && planPhase.getRecurring() != null && planPhase.getRecurring().getBillingPeriod() != null) ? planPhase.getRecurring().getBillingPeriod().toString() : null,
invoiceItem.getStartDate(),
/* Populate end date for fixed items for convenience (null in invoice_items table) */
BusinessInvoiceItemUtils.computeServicePeriodEndDate(invoiceItem, planPhase, bundle),
invoiceItem.getAmount(),
currencyConverter.getConvertedValue(invoiceItem, invoice),
invoiceItem.getCurrency() == null ? null : invoiceItem.getCurrency().toString(),
invoiceItem.getLinkedItemId(),
currencyConverter.getConvertedCurrency(),
invoiceItem.getCreatedDate(),
creationAuditLog != null ? creationAuditLog.getUserName() : null,
creationAuditLog != null ? creationAuditLog.getReasonCode() : null,
creationAuditLog != null ? creationAuditLog.getComment() : null,
account.getId(),
account.getName(),
account.getExternalKey(),
accountRecordId,
tenantRecordId,
reportGroup);
}