com.chargebee.models.Export Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chargebee-java Show documentation
Show all versions of chargebee-java Show documentation
Java client library for ChargeBee API
package com.chargebee.models;
import com.chargebee.*;
import com.chargebee.internal.*;
import com.chargebee.filters.*;
import com.chargebee.filters.enums.SortOrder;
import com.chargebee.internal.HttpUtil.Method;
import com.chargebee.models.enums.*;
import org.json.*;
import java.io.*;
import java.sql.Timestamp;
import java.util.*;
public class Export extends Resource {
public enum MimeType {
PDF,
ZIP,
_UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a
java-client version incompatibility. We suggest you to upgrade to the latest version */
}
public enum Status {
IN_PROCESS,
COMPLETED,
FAILED,
_UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a
java-client version incompatibility. We suggest you to upgrade to the latest version */
}
public static class Download extends Resource {
public Download(JSONObject jsonObj) {
super(jsonObj);
}
public String downloadUrl() {
return reqString("download_url");
}
public Timestamp validTill() {
return reqTimestamp("valid_till");
}
public String mimeType() {
return optString("mime_type");
}
}
//Constructors
//============
public Export(String jsonStr) {
super(jsonStr);
}
public Export(JSONObject jsonObj) {
super(jsonObj);
}
// Fields
//=======
public String id() {
return reqString("id");
}
public String operationType() {
return reqString("operation_type");
}
public MimeType mimeType() {
return reqEnum("mime_type", MimeType.class);
}
public Status status() {
return reqEnum("status", Status.class);
}
public Timestamp createdAt() {
return reqTimestamp("created_at");
}
public Export.Download download() {
return optSubResource("download", Export.Download.class);
}
// Operations
//===========
public static Request retrieve(String id) {
String uri = uri("exports", nullCheck(id));
return new Request(Method.GET, uri);
}
public static RevenueRecognitionRequest revenueRecognition() {
String uri = uri("exports", "revenue_recognition");
return new RevenueRecognitionRequest(Method.POST, uri);
}
public static DeferredRevenueRequest deferredRevenue() {
String uri = uri("exports", "deferred_revenue");
return new DeferredRevenueRequest(Method.POST, uri);
}
public static PlansRequest plans() {
String uri = uri("exports", "plans");
return new PlansRequest(Method.POST, uri);
}
public static AddonsRequest addons() {
String uri = uri("exports", "addons");
return new AddonsRequest(Method.POST, uri);
}
public static CouponsRequest coupons() {
String uri = uri("exports", "coupons");
return new CouponsRequest(Method.POST, uri);
}
public static CustomersRequest customers() {
String uri = uri("exports", "customers");
return new CustomersRequest(Method.POST, uri);
}
public static SubscriptionsRequest subscriptions() {
String uri = uri("exports", "subscriptions");
return new SubscriptionsRequest(Method.POST, uri);
}
public static InvoicesRequest invoices() {
String uri = uri("exports", "invoices");
return new InvoicesRequest(Method.POST, uri);
}
public static CreditNotesRequest creditNotes() {
String uri = uri("exports", "credit_notes");
return new CreditNotesRequest(Method.POST, uri);
}
public static TransactionsRequest transactions() {
String uri = uri("exports", "transactions");
return new TransactionsRequest(Method.POST, uri);
}
public static OrdersRequest orders() {
String uri = uri("exports", "orders");
return new OrdersRequest(Method.POST, uri);
}
public static ItemFamiliesRequest itemFamilies() {
String uri = uri("exports", "item_families");
return new ItemFamiliesRequest(Method.POST, uri);
}
public static ItemsRequest items() {
String uri = uri("exports", "items");
return new ItemsRequest(Method.POST, uri);
}
public static ItemPricesRequest itemPrices() {
String uri = uri("exports", "item_prices");
return new ItemPricesRequest(Method.POST, uri);
}
public static AttachedItemsRequest attachedItems() {
String uri = uri("exports", "attached_items");
return new AttachedItemsRequest(Method.POST, uri);
}
public static DifferentialPricesRequest differentialPrices() {
String uri = uri("exports", "differential_prices");
return new DifferentialPricesRequest(Method.POST, uri);
}
public static PriceVariantsRequest priceVariants() {
String uri = uri("exports", "price_variants");
return new PriceVariantsRequest(Method.POST, uri);
}
public Export waitForExportCompletion()
throws Exception {
int count = 0;
int sleepTime = Integer.getInteger("cb.java.export.sleep.millis", 10000);
while(status() == Status.IN_PROCESS){
if(count++ > 50){
throw new RuntimeException("Export is taking too long");
}
Thread.sleep(sleepTime);
Request req = retrieve(id());
jsonObj = req.request().export().jsonObj;
}
return this;
}
// Operation Request Classes
//==========================
public static class RevenueRecognitionRequest extends Request {
private RevenueRecognitionRequest(Method httpMeth, String uri) {
super(httpMeth, uri);
}
public RevenueRecognitionRequest reportBy(com.chargebee.models.enums.ReportBy reportBy) {
params.add("report_by", reportBy);
return this;
}
public RevenueRecognitionRequest currencyCode(String currencyCode) {
params.addOpt("currency_code", currencyCode);
return this;
}
public RevenueRecognitionRequest reportFromMonth(Integer reportFromMonth) {
params.add("report_from_month", reportFromMonth);
return this;
}
public RevenueRecognitionRequest reportFromYear(Integer reportFromYear) {
params.add("report_from_year", reportFromYear);
return this;
}
public RevenueRecognitionRequest reportToMonth(Integer reportToMonth) {
params.add("report_to_month", reportToMonth);
return this;
}
public RevenueRecognitionRequest reportToYear(Integer reportToYear) {
params.add("report_to_year", reportToYear);
return this;
}
public RevenueRecognitionRequest includeDiscounts(Boolean includeDiscounts) {
params.addOpt("include_discounts", includeDiscounts);
return this;
}
public StringFilter paymentOwner() {
return new StringFilter("payment_owner",this).supportsMultiOperators(true);
}
public StringFilter itemId() {
return new StringFilter("item_id",this).supportsMultiOperators(true);
}
public StringFilter itemPriceId() {
return new StringFilter("item_price_id",this).supportsMultiOperators(true);
}
public StringFilter cancelReasonCode() {
return new StringFilter("cancel_reason_code",this).supportsMultiOperators(true);
}
public StringFilter businessEntityId() {
return new StringFilter("business_entity_id",this);
}
public StringFilter invoiceId() {
return new StringFilter("invoice[id]",this).supportsMultiOperators(true);
}
public BooleanFilter invoiceRecurring() {
return new BooleanFilter("invoice[recurring]",this);
}
public EnumFilter invoiceStatus() {
return new EnumFilter("invoice[status]",this);
}
public EnumFilter invoicePriceType() {
return new EnumFilter("invoice[price_type]",this);
}
public TimestampFilter invoiceDate() {
return new TimestampFilter("invoice[date]",this);
}
public TimestampFilter invoicePaidAt() {
return new TimestampFilter("invoice[paid_at]",this);
}
public NumberFilter invoiceTotal() {
return new NumberFilter("invoice[total]",this);
}
public NumberFilter invoiceAmountPaid() {
return new NumberFilter("invoice[amount_paid]",this);
}
public NumberFilter invoiceAmountAdjusted() {
return new NumberFilter("invoice[amount_adjusted]",this);
}
public NumberFilter invoiceCreditsApplied() {
return new NumberFilter("invoice[credits_applied]",this);
}
public NumberFilter invoiceAmountDue() {
return new NumberFilter("invoice[amount_due]",this);
}
public EnumFilter invoiceDunningStatus() {
return new EnumFilter("invoice[dunning_status]",this).supportsPresenceOperator(true);
}
public TimestampFilter invoiceUpdatedAt() {
return new TimestampFilter("invoice[updated_at]",this);
}
public EnumFilter invoiceChannel() {
return new EnumFilter("invoice[channel]",this);
}
public StringFilter subscriptionId() {
return new StringFilter("subscription[id]",this).supportsMultiOperators(true);
}
public StringFilter subscriptionCustomerId() {
return new StringFilter("subscription[customer_id]",this).supportsMultiOperators(true);
}
public StringFilter subscriptionPlanId() {
return new StringFilter("subscription[plan_id]",this).supportsMultiOperators(true);
}
public EnumFilter subscriptionStatus() {
return new EnumFilter("subscription[status]",this);
}
public EnumFilter subscriptionCancelReason() {
return new EnumFilter("subscription[cancel_reason]",this).supportsPresenceOperator(true);
}
public NumberFilter subscriptionRemainingBillingCycles() {
return new NumberFilter("subscription[remaining_billing_cycles]",this).supportsPresenceOperator(true);
}
public TimestampFilter subscriptionCreatedAt() {
return new TimestampFilter("subscription[created_at]",this);
}
public TimestampFilter subscriptionActivatedAt() {
return new TimestampFilter("subscription[activated_at]",this).supportsPresenceOperator(true);
}
public TimestampFilter subscriptionNextBillingAt() {
return new TimestampFilter("subscription[next_billing_at]",this);
}
public TimestampFilter subscriptionCancelledAt() {
return new TimestampFilter("subscription[cancelled_at]",this);
}
public BooleanFilter subscriptionHasScheduledChanges() {
return new BooleanFilter("subscription[has_scheduled_changes]",this);
}
public TimestampFilter subscriptionUpdatedAt() {
return new TimestampFilter("subscription[updated_at]",this);
}
public EnumFilter subscriptionOfflinePaymentMethod() {
return new EnumFilter("subscription[offline_payment_method]",this);
}
public BooleanFilter subscriptionAutoCloseInvoices() {
return new BooleanFilter("subscription[auto_close_invoices]",this);
}
public EnumFilter subscriptionChannel() {
return new EnumFilter("subscription[channel]",this);
}
public StringFilter customerId() {
return new StringFilter("customer[id]",this).supportsMultiOperators(true);
}
public StringFilter customerFirstName() {
return new StringFilter("customer[first_name]",this).supportsPresenceOperator(true);
}
public StringFilter customerLastName() {
return new StringFilter("customer[last_name]",this).supportsPresenceOperator(true);
}
public StringFilter customerEmail() {
return new StringFilter("customer[email]",this).supportsPresenceOperator(true);
}
public StringFilter customerCompany() {
return new StringFilter("customer[company]",this).supportsPresenceOperator(true);
}
public StringFilter customerPhone() {
return new StringFilter("customer[phone]",this).supportsPresenceOperator(true);
}
public EnumFilter customerAutoCollection() {
return new EnumFilter("customer[auto_collection]",this);
}
public EnumFilter customerTaxability() {
return new EnumFilter("customer[taxability]",this);
}
public TimestampFilter customerCreatedAt() {
return new TimestampFilter("customer[created_at]",this);
}
public TimestampFilter customerUpdatedAt() {
return new TimestampFilter("customer[updated_at]",this);
}
public StringFilter relationshipParentId() {
return new StringFilter("relationship[parent_id]",this);
}
public StringFilter relationshipPaymentOwnerId() {
return new StringFilter("relationship[payment_owner_id]",this);
}
public StringFilter relationshipInvoiceOwnerId() {
return new StringFilter("relationship[invoice_owner_id]",this);
}
public EnumFilter customerOfflinePaymentMethod() {
return new EnumFilter("customer[offline_payment_method]",this);
}
public BooleanFilter customerAutoCloseInvoices() {
return new BooleanFilter("customer[auto_close_invoices]",this);
}
public EnumFilter customerChannel() {
return new EnumFilter("customer[channel]",this);
}
@Override
public Params params() {
return params;
}
}
public static class DeferredRevenueRequest extends Request {
private DeferredRevenueRequest(Method httpMeth, String uri) {
super(httpMeth, uri);
}
public DeferredRevenueRequest reportBy(com.chargebee.models.enums.ReportBy reportBy) {
params.add("report_by", reportBy);
return this;
}
public DeferredRevenueRequest currencyCode(String currencyCode) {
params.addOpt("currency_code", currencyCode);
return this;
}
public DeferredRevenueRequest reportFromMonth(Integer reportFromMonth) {
params.add("report_from_month", reportFromMonth);
return this;
}
public DeferredRevenueRequest reportFromYear(Integer reportFromYear) {
params.add("report_from_year", reportFromYear);
return this;
}
public DeferredRevenueRequest reportToMonth(Integer reportToMonth) {
params.add("report_to_month", reportToMonth);
return this;
}
public DeferredRevenueRequest reportToYear(Integer reportToYear) {
params.add("report_to_year", reportToYear);
return this;
}
public DeferredRevenueRequest includeDiscounts(Boolean includeDiscounts) {
params.addOpt("include_discounts", includeDiscounts);
return this;
}
public StringFilter paymentOwner() {
return new StringFilter("payment_owner",this).supportsMultiOperators(true);
}
public StringFilter itemId() {
return new StringFilter("item_id",this).supportsMultiOperators(true);
}
public StringFilter itemPriceId() {
return new StringFilter("item_price_id",this).supportsMultiOperators(true);
}
public StringFilter cancelReasonCode() {
return new StringFilter("cancel_reason_code",this).supportsMultiOperators(true);
}
public StringFilter businessEntityId() {
return new StringFilter("business_entity_id",this);
}
public StringFilter invoiceId() {
return new StringFilter("invoice[id]",this).supportsMultiOperators(true);
}
public BooleanFilter invoiceRecurring() {
return new BooleanFilter("invoice[recurring]",this);
}
public EnumFilter invoiceStatus() {
return new EnumFilter("invoice[status]",this);
}
public EnumFilter invoicePriceType() {
return new EnumFilter("invoice[price_type]",this);
}
public TimestampFilter invoiceDate() {
return new TimestampFilter("invoice[date]",this);
}
public TimestampFilter invoicePaidAt() {
return new TimestampFilter("invoice[paid_at]",this);
}
public NumberFilter invoiceTotal() {
return new NumberFilter("invoice[total]",this);
}
public NumberFilter invoiceAmountPaid() {
return new NumberFilter("invoice[amount_paid]",this);
}
public NumberFilter invoiceAmountAdjusted() {
return new NumberFilter("invoice[amount_adjusted]",this);
}
public NumberFilter invoiceCreditsApplied() {
return new NumberFilter("invoice[credits_applied]",this);
}
public NumberFilter invoiceAmountDue() {
return new NumberFilter("invoice[amount_due]",this);
}
public EnumFilter invoiceDunningStatus() {
return new EnumFilter("invoice[dunning_status]",this).supportsPresenceOperator(true);
}
public TimestampFilter invoiceUpdatedAt() {
return new TimestampFilter("invoice[updated_at]",this);
}
public EnumFilter invoiceChannel() {
return new EnumFilter("invoice[channel]",this);
}
public StringFilter subscriptionId() {
return new StringFilter("subscription[id]",this).supportsMultiOperators(true);
}
public StringFilter subscriptionCustomerId() {
return new StringFilter("subscription[customer_id]",this).supportsMultiOperators(true);
}
public StringFilter subscriptionPlanId() {
return new StringFilter("subscription[plan_id]",this).supportsMultiOperators(true);
}
public EnumFilter subscriptionStatus() {
return new EnumFilter("subscription[status]",this);
}
public EnumFilter subscriptionCancelReason() {
return new EnumFilter("subscription[cancel_reason]",this).supportsPresenceOperator(true);
}
public NumberFilter subscriptionRemainingBillingCycles() {
return new NumberFilter("subscription[remaining_billing_cycles]",this).supportsPresenceOperator(true);
}
public TimestampFilter subscriptionCreatedAt() {
return new TimestampFilter("subscription[created_at]",this);
}
public TimestampFilter subscriptionActivatedAt() {
return new TimestampFilter("subscription[activated_at]",this).supportsPresenceOperator(true);
}
public TimestampFilter subscriptionNextBillingAt() {
return new TimestampFilter("subscription[next_billing_at]",this);
}
public TimestampFilter subscriptionCancelledAt() {
return new TimestampFilter("subscription[cancelled_at]",this);
}
public BooleanFilter subscriptionHasScheduledChanges() {
return new BooleanFilter("subscription[has_scheduled_changes]",this);
}
public TimestampFilter subscriptionUpdatedAt() {
return new TimestampFilter("subscription[updated_at]",this);
}
public EnumFilter subscriptionOfflinePaymentMethod() {
return new EnumFilter("subscription[offline_payment_method]",this);
}
public BooleanFilter subscriptionAutoCloseInvoices() {
return new BooleanFilter("subscription[auto_close_invoices]",this);
}
public EnumFilter subscriptionChannel() {
return new EnumFilter("subscription[channel]",this);
}
public StringFilter customerId() {
return new StringFilter("customer[id]",this).supportsMultiOperators(true);
}
public StringFilter customerFirstName() {
return new StringFilter("customer[first_name]",this).supportsPresenceOperator(true);
}
public StringFilter customerLastName() {
return new StringFilter("customer[last_name]",this).supportsPresenceOperator(true);
}
public StringFilter customerEmail() {
return new StringFilter("customer[email]",this).supportsPresenceOperator(true);
}
public StringFilter customerCompany() {
return new StringFilter("customer[company]",this).supportsPresenceOperator(true);
}
public StringFilter customerPhone() {
return new StringFilter("customer[phone]",this).supportsPresenceOperator(true);
}
public EnumFilter customerAutoCollection() {
return new EnumFilter("customer[auto_collection]",this);
}
public EnumFilter customerTaxability() {
return new EnumFilter("customer[taxability]",this);
}
public TimestampFilter customerCreatedAt() {
return new TimestampFilter("customer[created_at]",this);
}
public TimestampFilter customerUpdatedAt() {
return new TimestampFilter("customer[updated_at]",this);
}
public StringFilter relationshipParentId() {
return new StringFilter("relationship[parent_id]",this);
}
public StringFilter relationshipPaymentOwnerId() {
return new StringFilter("relationship[payment_owner_id]",this);
}
public StringFilter relationshipInvoiceOwnerId() {
return new StringFilter("relationship[invoice_owner_id]",this);
}
public EnumFilter customerOfflinePaymentMethod() {
return new EnumFilter("customer[offline_payment_method]",this);
}
public BooleanFilter customerAutoCloseInvoices() {
return new BooleanFilter("customer[auto_close_invoices]",this);
}
public EnumFilter customerChannel() {
return new EnumFilter("customer[channel]",this);
}
@Override
public Params params() {
return params;
}
}
public static class PlansRequest extends Request {
private PlansRequest(Method httpMeth, String uri) {
super(httpMeth, uri);
}
public StringFilter currencyCode() {
return new StringFilter("currency_code",this).supportsMultiOperators(true);
}
public StringFilter planId() {
return new StringFilter("plan[id]",this).supportsMultiOperators(true);
}
public StringFilter planName() {
return new StringFilter("plan[name]",this).supportsMultiOperators(true);
}
public NumberFilter planPrice() {
return new NumberFilter("plan[price]",this);
}
public NumberFilter planPeriod() {
return new NumberFilter("plan[period]",this);
}
public EnumFilter planPeriodUnit() {
return new EnumFilter("plan[period_unit]",this);
}
public NumberFilter planTrialPeriod() {
return new NumberFilter("plan[trial_period]",this).supportsPresenceOperator(true);
}
public EnumFilter planTrialPeriodUnit() {
return new EnumFilter("plan[trial_period_unit]",this);
}
public EnumFilter planAddonApplicability() {
return new EnumFilter("plan[addon_applicability]",this);
}
public BooleanFilter planGiftable() {
return new BooleanFilter("plan[giftable]",this);
}
public EnumFilter planStatus() {
return new EnumFilter("plan[status]",this);
}
public TimestampFilter planUpdatedAt() {
return new TimestampFilter("plan[updated_at]",this);
}
public EnumFilter planChannel() {
return new EnumFilter("plan[channel]",this);
}
@Override
public Params params() {
return params;
}
}
public static class AddonsRequest extends Request {
private AddonsRequest(Method httpMeth, String uri) {
super(httpMeth, uri);
}
public StringFilter currencyCode() {
return new StringFilter("currency_code",this).supportsMultiOperators(true);
}
public StringFilter addonId() {
return new StringFilter("addon[id]",this).supportsMultiOperators(true);
}
public StringFilter addonName() {
return new StringFilter("addon[name]",this).supportsMultiOperators(true);
}
public EnumFilter addonChargeType() {
return new EnumFilter("addon[charge_type]",this);
}
public NumberFilter addonPrice() {
return new NumberFilter("addon[price]",this);
}
public NumberFilter addonPeriod() {
return new NumberFilter("addon[period]",this);
}
public EnumFilter addonPeriodUnit() {
return new EnumFilter("addon[period_unit]",this);
}
public EnumFilter addonStatus() {
return new EnumFilter("addon[status]",this);
}
public TimestampFilter addonUpdatedAt() {
return new TimestampFilter("addon[updated_at]",this);
}
public EnumFilter addonChannel() {
return new EnumFilter