All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stripe.model.CustomerBalanceTransaction Maven / Gradle / Ivy

There is a newer version: 28.2.0
Show newest version
// Generated by delombok at Wed Aug 05 16:28:33 PDT 2020
package com.stripe.model;

import com.google.gson.annotations.SerializedName;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;
import com.stripe.param.CustomerBalanceTransactionUpdateParams;
import java.util.Map;

public class CustomerBalanceTransaction extends ApiResource implements HasId, MetadataStore {
  /**
   * The amount of the transaction. A negative value is a credit for the customer's balance, and a
   * positive value is a debit to the customer's {@code balance}.
   */
  @SerializedName("amount")
  Long amount;
  /**
   * Time at which the object was created. Measured in seconds since the Unix epoch.
   */
  @SerializedName("created")
  Long created;
  /**
   * The ID of the credit note (if any) related to the transaction.
   */
  @SerializedName("credit_note")
  ExpandableField creditNote;
  /**
   * Three-letter ISO currency code,
   * in lowercase. Must be a supported currency.
   */
  @SerializedName("currency")
  String currency;
  /**
   * The ID of the customer the transaction belongs to.
   */
  @SerializedName("customer")
  ExpandableField customer;
  /**
   * An arbitrary string attached to the object. Often useful for displaying to users.
   */
  @SerializedName("description")
  String description;
  /**
   * The customer's {@code balance} after the transaction was applied. A negative value decreases
   * the amount due on the customer's next invoice. A positive value increases the amount due on the
   * customer's next invoice.
   */
  @SerializedName("ending_balance")
  Long endingBalance;
  /**
   * Unique identifier for the object.
   */
  @SerializedName("id")
  String id;
  /**
   * The ID of the invoice (if any) related to the transaction.
   */
  @SerializedName("invoice")
  ExpandableField invoice;
  /**
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
   * object exists in test mode.
   */
  @SerializedName("livemode")
  Boolean livemode;
  /**
   * Set of key-value pairs that you can attach
   * to an object. This can be useful for storing additional information about the object in a
   * structured format.
   */
  @SerializedName("metadata")
  Map metadata;
  /**
   * String representing the object's type. Objects of the same type share the same value.
   *
   * 

Equal to {@code customer_balance_transaction}. */ @SerializedName("object") String object; /** * Transaction type: {@code adjustment}, {@code applied_to_invoice}, {@code credit_note}, {@code * initial}, {@code invoice_too_large}, {@code invoice_too_small}, {@code * unspent_receiver_credit}, or {@code unapplied_from_invoice}. See the Customer Balance page to * learn more about transaction types. * *

One of {@code adjustment}, {@code applied_to_invoice}, {@code credit_note}, {@code initial}, * {@code invoice_too_large}, {@code invoice_too_small}, {@code migration}, {@code * unapplied_from_invoice}, or {@code unspent_receiver_credit}. */ @SerializedName("type") String type; /** * Get ID of expandable {@code creditNote} object. */ public String getCreditNote() { return (this.creditNote != null) ? this.creditNote.getId() : null; } public void setCreditNote(String id) { this.creditNote = ApiResource.setExpandableFieldId(id, this.creditNote); } /** * Get expanded {@code creditNote}. */ public CreditNote getCreditNoteObject() { return (this.creditNote != null) ? this.creditNote.getExpanded() : null; } public void setCreditNoteObject(CreditNote expandableObject) { this.creditNote = new ExpandableField(expandableObject.getId(), expandableObject); } /** * Get ID of expandable {@code customer} object. */ public String getCustomer() { return (this.customer != null) ? this.customer.getId() : null; } public void setCustomer(String id) { this.customer = ApiResource.setExpandableFieldId(id, this.customer); } /** * Get expanded {@code customer}. */ public Customer getCustomerObject() { return (this.customer != null) ? this.customer.getExpanded() : null; } public void setCustomerObject(Customer expandableObject) { this.customer = new ExpandableField(expandableObject.getId(), expandableObject); } /** * Get ID of expandable {@code invoice} object. */ public String getInvoice() { return (this.invoice != null) ? this.invoice.getId() : null; } public void setInvoice(String id) { this.invoice = ApiResource.setExpandableFieldId(id, this.invoice); } /** * Get expanded {@code invoice}. */ public Invoice getInvoiceObject() { return (this.invoice != null) ? this.invoice.getExpanded() : null; } public void setInvoiceObject(Invoice expandableObject) { this.invoice = new ExpandableField(expandableObject.getId(), expandableObject); } /** * Most customer balance transaction fields are immutable, but you may update its * description and metadata. */ @Override public CustomerBalanceTransaction update(Map params) throws StripeException { return update(params, (RequestOptions) null); } /** * Most customer balance transaction fields are immutable, but you may update its * description and metadata. */ @Override public CustomerBalanceTransaction update(Map params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), String.format("/v1/customers/%s/balance_transactions/%s", ApiResource.urlEncodeId(this.getCustomer()), ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, CustomerBalanceTransaction.class, options); } /** * Most customer balance transaction fields are immutable, but you may update its * description and metadata. */ public CustomerBalanceTransaction update(CustomerBalanceTransactionUpdateParams params) throws StripeException { return update(params, (RequestOptions) null); } /** * Most customer balance transaction fields are immutable, but you may update its * description and metadata. */ public CustomerBalanceTransaction update(CustomerBalanceTransactionUpdateParams params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), String.format("/v1/customers/%s/balance_transactions/%s", ApiResource.urlEncodeId(this.getCustomer()), ApiResource.urlEncodeId(this.getId()))); return ApiResource.request(ApiResource.RequestMethod.POST, url, params, CustomerBalanceTransaction.class, options); } /** * The amount of the transaction. A negative value is a credit for the customer's balance, and a * positive value is a debit to the customer's {@code balance}. */ @java.lang.SuppressWarnings("all") @lombok.Generated public Long getAmount() { return this.amount; } /** * Time at which the object was created. Measured in seconds since the Unix epoch. */ @java.lang.SuppressWarnings("all") @lombok.Generated public Long getCreated() { return this.created; } /** * Three-letter ISO currency code, * in lowercase. Must be a supported currency. */ @java.lang.SuppressWarnings("all") @lombok.Generated public String getCurrency() { return this.currency; } /** * An arbitrary string attached to the object. Often useful for displaying to users. */ @java.lang.SuppressWarnings("all") @lombok.Generated public String getDescription() { return this.description; } /** * The customer's {@code balance} after the transaction was applied. A negative value decreases * the amount due on the customer's next invoice. A positive value increases the amount due on the * customer's next invoice. */ @java.lang.SuppressWarnings("all") @lombok.Generated public Long getEndingBalance() { return this.endingBalance; } /** * Has the value {@code true} if the object exists in live mode or the value {@code false} if the * object exists in test mode. */ @java.lang.SuppressWarnings("all") @lombok.Generated public Boolean getLivemode() { return this.livemode; } /** * String representing the object's type. Objects of the same type share the same value. * *

Equal to {@code customer_balance_transaction}. */ @java.lang.SuppressWarnings("all") @lombok.Generated public String getObject() { return this.object; } /** * Transaction type: {@code adjustment}, {@code applied_to_invoice}, {@code credit_note}, {@code * initial}, {@code invoice_too_large}, {@code invoice_too_small}, {@code * unspent_receiver_credit}, or {@code unapplied_from_invoice}. See the Customer Balance page to * learn more about transaction types. * *

One of {@code adjustment}, {@code applied_to_invoice}, {@code credit_note}, {@code initial}, * {@code invoice_too_large}, {@code invoice_too_small}, {@code migration}, {@code * unapplied_from_invoice}, or {@code unspent_receiver_credit}. */ @java.lang.SuppressWarnings("all") @lombok.Generated public String getType() { return this.type; } /** * The amount of the transaction. A negative value is a credit for the customer's balance, and a * positive value is a debit to the customer's {@code balance}. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setAmount(final Long amount) { this.amount = amount; } /** * Time at which the object was created. Measured in seconds since the Unix epoch. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setCreated(final Long created) { this.created = created; } /** * Three-letter ISO currency code, * in lowercase. Must be a supported currency. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setCurrency(final String currency) { this.currency = currency; } /** * An arbitrary string attached to the object. Often useful for displaying to users. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setDescription(final String description) { this.description = description; } /** * The customer's {@code balance} after the transaction was applied. A negative value decreases * the amount due on the customer's next invoice. A positive value increases the amount due on the * customer's next invoice. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setEndingBalance(final Long endingBalance) { this.endingBalance = endingBalance; } /** * Unique identifier for the object. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setId(final String id) { this.id = id; } /** * Has the value {@code true} if the object exists in live mode or the value {@code false} if the * object exists in test mode. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setLivemode(final Boolean livemode) { this.livemode = livemode; } /** * Set of key-value pairs that you can attach * to an object. This can be useful for storing additional information about the object in a * structured format. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setMetadata(final Map metadata) { this.metadata = metadata; } /** * String representing the object's type. Objects of the same type share the same value. * *

Equal to {@code customer_balance_transaction}. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setObject(final String object) { this.object = object; } /** * Transaction type: {@code adjustment}, {@code applied_to_invoice}, {@code credit_note}, {@code * initial}, {@code invoice_too_large}, {@code invoice_too_small}, {@code * unspent_receiver_credit}, or {@code unapplied_from_invoice}. See the Customer Balance page to * learn more about transaction types. * *

One of {@code adjustment}, {@code applied_to_invoice}, {@code credit_note}, {@code initial}, * {@code invoice_too_large}, {@code invoice_too_small}, {@code migration}, {@code * unapplied_from_invoice}, or {@code unspent_receiver_credit}. */ @java.lang.SuppressWarnings("all") @lombok.Generated public void setType(final String type) { this.type = type; } @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof CustomerBalanceTransaction)) return false; final CustomerBalanceTransaction other = (CustomerBalanceTransaction) o; if (!other.canEqual((java.lang.Object) this)) return false; final java.lang.Object this$amount = this.getAmount(); final java.lang.Object other$amount = other.getAmount(); if (this$amount == null ? other$amount != null : !this$amount.equals(other$amount)) return false; final java.lang.Object this$created = this.getCreated(); final java.lang.Object other$created = other.getCreated(); if (this$created == null ? other$created != null : !this$created.equals(other$created)) return false; final java.lang.Object this$creditNote = this.getCreditNote(); final java.lang.Object other$creditNote = other.getCreditNote(); if (this$creditNote == null ? other$creditNote != null : !this$creditNote.equals(other$creditNote)) return false; final java.lang.Object this$currency = this.getCurrency(); final java.lang.Object other$currency = other.getCurrency(); if (this$currency == null ? other$currency != null : !this$currency.equals(other$currency)) return false; final java.lang.Object this$customer = this.getCustomer(); final java.lang.Object other$customer = other.getCustomer(); if (this$customer == null ? other$customer != null : !this$customer.equals(other$customer)) return false; final java.lang.Object this$description = this.getDescription(); final java.lang.Object other$description = other.getDescription(); if (this$description == null ? other$description != null : !this$description.equals(other$description)) return false; final java.lang.Object this$endingBalance = this.getEndingBalance(); final java.lang.Object other$endingBalance = other.getEndingBalance(); if (this$endingBalance == null ? other$endingBalance != null : !this$endingBalance.equals(other$endingBalance)) return false; final java.lang.Object this$id = this.getId(); final java.lang.Object other$id = other.getId(); if (this$id == null ? other$id != null : !this$id.equals(other$id)) return false; final java.lang.Object this$invoice = this.getInvoice(); final java.lang.Object other$invoice = other.getInvoice(); if (this$invoice == null ? other$invoice != null : !this$invoice.equals(other$invoice)) return false; final java.lang.Object this$livemode = this.getLivemode(); final java.lang.Object other$livemode = other.getLivemode(); if (this$livemode == null ? other$livemode != null : !this$livemode.equals(other$livemode)) return false; final java.lang.Object this$metadata = this.getMetadata(); final java.lang.Object other$metadata = other.getMetadata(); if (this$metadata == null ? other$metadata != null : !this$metadata.equals(other$metadata)) return false; final java.lang.Object this$object = this.getObject(); final java.lang.Object other$object = other.getObject(); if (this$object == null ? other$object != null : !this$object.equals(other$object)) return false; final java.lang.Object this$type = this.getType(); final java.lang.Object other$type = other.getType(); if (this$type == null ? other$type != null : !this$type.equals(other$type)) return false; return true; } @java.lang.SuppressWarnings("all") @lombok.Generated protected boolean canEqual(final java.lang.Object other) { return other instanceof CustomerBalanceTransaction; } @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $amount = this.getAmount(); result = result * PRIME + ($amount == null ? 43 : $amount.hashCode()); final java.lang.Object $created = this.getCreated(); result = result * PRIME + ($created == null ? 43 : $created.hashCode()); final java.lang.Object $creditNote = this.getCreditNote(); result = result * PRIME + ($creditNote == null ? 43 : $creditNote.hashCode()); final java.lang.Object $currency = this.getCurrency(); result = result * PRIME + ($currency == null ? 43 : $currency.hashCode()); final java.lang.Object $customer = this.getCustomer(); result = result * PRIME + ($customer == null ? 43 : $customer.hashCode()); final java.lang.Object $description = this.getDescription(); result = result * PRIME + ($description == null ? 43 : $description.hashCode()); final java.lang.Object $endingBalance = this.getEndingBalance(); result = result * PRIME + ($endingBalance == null ? 43 : $endingBalance.hashCode()); final java.lang.Object $id = this.getId(); result = result * PRIME + ($id == null ? 43 : $id.hashCode()); final java.lang.Object $invoice = this.getInvoice(); result = result * PRIME + ($invoice == null ? 43 : $invoice.hashCode()); final java.lang.Object $livemode = this.getLivemode(); result = result * PRIME + ($livemode == null ? 43 : $livemode.hashCode()); final java.lang.Object $metadata = this.getMetadata(); result = result * PRIME + ($metadata == null ? 43 : $metadata.hashCode()); final java.lang.Object $object = this.getObject(); result = result * PRIME + ($object == null ? 43 : $object.hashCode()); final java.lang.Object $type = this.getType(); result = result * PRIME + ($type == null ? 43 : $type.hashCode()); return result; } /** * Unique identifier for the object. */ @Override @java.lang.SuppressWarnings("all") @lombok.Generated public String getId() { return this.id; } /** * Set of key-value pairs that you can attach * to an object. This can be useful for storing additional information about the object in a * structured format. */ @Override @java.lang.SuppressWarnings("all") @lombok.Generated public Map getMetadata() { return this.metadata; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy