001/*
002 * Copyright 2010-2014 Ning, Inc.
003 * Copyright 2014-2015 The Billing Project, LLC
004 *
005 * The Billing Project licenses this file to you under the Apache License, version 2.0
006 * (the "License"); you may not use this file except in compliance with the
007 * License.  You may obtain a copy of the License at:
008 *
009 *    http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
014 * License for the specific language governing permissions and limitations
015 * under the License.
016 */
017
018package com.ning.billing.recurly.model;
019
020import com.fasterxml.jackson.annotation.JsonIgnore;
021import com.google.common.base.Objects;
022import org.joda.time.DateTime;
023
024import javax.xml.bind.annotation.XmlElement;
025import javax.xml.bind.annotation.XmlElementWrapper;
026import javax.xml.bind.annotation.XmlRootElement;
027import java.math.BigDecimal;
028import java.util.ArrayList;
029import java.util.List;
030
031@XmlRootElement(name = "subscription")
032public class Subscription extends AbstractSubscription {
033
034    @XmlElement(name = "account")
035    private Account account;
036
037    @XmlElement(name = "invoice")
038    private Invoice invoice;
039
040    @XmlElement(name = "plan")
041    private Plan plan;
042
043    @XmlElement(name = "uuid")
044    private String uuid;
045
046    @XmlElement(name = "state", required = false)
047    private String state;
048
049    @XmlElement(name = "tax_in_cents")
050    private Integer taxInCents;
051
052    @XmlElement(name = "tax_region")
053    private String taxRegion;
054
055    @XmlElement(name = "tax_type")
056    private String taxType;
057
058    @XmlElement(name = "tax_rate")
059    private BigDecimal taxRate;
060
061    @XmlElement(name = "currency")
062    private String currency;
063
064    @XmlElement(name = "activated_at")
065    private DateTime activatedAt;
066
067    @XmlElement(name = "canceled_at")
068    private DateTime canceledAt;
069
070    @XmlElement(name = "expires_at")
071    private DateTime expiresAt;
072
073    @XmlElement(name = "remaining_billing_cycles")
074    private Integer remainingBillingCycles;
075
076    @XmlElement(name = "current_period_started_at")
077    private DateTime currentPeriodStartedAt;
078
079    @XmlElement(name = "current_period_ends_at")
080    private DateTime currentPeriodEndsAt;
081
082    @XmlElement(name = "trial_started_at")
083    private DateTime trialStartedAt;
084
085    @XmlElement(name = "trial_ends_at")
086    private DateTime trialEndsAt;
087
088    @XmlElement(name = "pending_subscription")
089    private Subscription pendingSubscription;
090
091    @XmlElement(name = "starts_at")
092    private DateTime startsAt;
093
094    @XmlElement(name = "updated_at")
095    private DateTime updatedAt;
096
097    @XmlElement(name = "collection_method")
098    private String collectionMethod;
099
100    @XmlElement(name = "net_terms")
101    private Integer netTerms;
102
103    @JsonIgnore
104    private String couponCode;
105
106    @XmlElementWrapper(name = "coupon_codes")
107    @XmlElement(name = "coupon_code")
108    private List<String> couponCodes;
109
110    //Purchase Order Number
111    @XmlElement(name = "po_number")
112    private String poNumber;
113    
114    @XmlElement(name = "terms_and_conditions")
115    private String termsAndConditions;
116    
117    @XmlElement(name = "customer_notes")
118    private String customerNotes;
119
120    @XmlElement(name = "first_renewal_date")
121    private DateTime firstRenewalDate;
122    
123    @XmlElement(name = "bulk")
124    private Boolean bulk;
125
126    @XmlElement(name = "revenue_schedule_type")
127    private RevenueScheduleType revenueScheduleType;
128
129    @XmlElement(name = "gift_card")
130    private GiftCard giftCard;
131
132    @XmlElement(name = "started_with_gift")
133    private Boolean startedWithGift;
134
135    @XmlElement(name = "converted_at")
136    private DateTime convertedAt;
137
138    @XmlElement(name = "shipping_address")
139    private ShippingAddress shippingAddress;
140
141    @XmlElement(name = "shipping_address_id")
142    private Long shippingAddressId;
143
144    @XmlElement(name = "shipping_method_code")
145    private String shippingMethodCode;
146
147    @XmlElement(name = "shipping_amount_in_cents")
148    private Integer shippingAmountInCents;
149
150    @XmlElement(name = "billing_info_uuid")
151    private String billingInfoUuid;
152
153    @XmlElement(name = "no_billing_info_reason")
154    private String noBillingInfoReason;
155
156    @XmlElement(name = "imported_trial")
157    private Boolean importedTrial;
158
159    @XmlElement(name = "credit_customer_notes")
160    private String creditCustomerNotes;
161
162    @XmlElement(name = "invoice_collection")
163    private InvoiceCollection invoiceCollection;
164
165    @XmlElement(name = "remaining_pause_cycles")
166    private Integer remainingPauseCycles;
167
168    @XmlElement(name = "paused_at")
169    private DateTime pausedAt;
170
171    @XmlElement(name = "auto_renew")
172    private Boolean autoRenew;
173
174    @XmlElement(name = "renewal_billing_cycles")
175    private Integer renewalBillingCycles;
176
177    @XmlElement(name = "first_bill_date")
178    private DateTime firstBillDate;
179
180    @XmlElement(name = "next_bill_date")
181    private DateTime nextBillDate;
182
183    @XmlElement(name = "current_term_started_at")
184    private DateTime currentTermStartedAt;
185
186    @XmlElement(name = "current_term_ends_at")
187    private DateTime currentTermEndsAt;
188
189    @XmlElement(name = "transaction_type")
190    private String transactionType;
191
192    public Account getAccount() {
193        if (account != null && account.getHref() != null && !account.getHref().isEmpty()) {
194            account = fetch(account, Account.class);
195        }
196        return account;
197    }
198
199    public void setAccount(final Account account) {
200        this.account = account;
201    }
202
203    public Invoice getInvoice() {
204        if (invoice != null && invoice.getHref() != null && !invoice.getHref().isEmpty()) {
205            invoice = fetch(invoice, Invoice.class);
206        }
207        return invoice;
208    }
209
210    public Plan getPlan() {
211        return plan;
212    }
213
214    public void setPlan(final Plan plan) {
215        this.plan = plan;
216    }
217
218    public String getUuid() {
219        return uuid;
220    }
221
222    public void setUuid(final Object uuid) {
223        this.uuid = stringOrNull(uuid);
224    }
225
226    public String getState() {
227        return state;
228    }
229
230    public void setState(final Object state) {
231        this.state = stringOrNull(state);
232    }
233
234    public String getCurrency() {
235        return currency;
236    }
237
238    public void setCurrency(final Object currency) {
239        this.currency = stringOrNull(currency);
240    }
241
242    public Integer getTaxInCents() {
243        return taxInCents;
244    }
245
246    public void setTaxInCents(final Object taxInCents) {
247        this.taxInCents = integerOrNull(taxInCents);
248    }
249
250    public void setTaxRegion(final Object taxRegion) {
251        this.taxRegion = stringOrNull(taxRegion);
252    }
253
254    public String getTaxRegion() {
255        return taxRegion;
256    }
257
258    public void setTaxRate(final Object taxRate) {
259        this.taxRate = bigDecimalOrNull(taxRate);
260    }
261
262    public BigDecimal getTaxRate() {
263        return taxRate;
264    }
265
266    public void setTaxType(final Object taxType) {
267        this.taxType = stringOrNull(taxType);
268    }
269
270    public String getTaxType() {
271        return taxType;
272    }
273
274    public DateTime getActivatedAt() {
275        return activatedAt;
276    }
277
278    public void setActivatedAt(final Object activatedAt) {
279        this.activatedAt = dateTimeOrNull(activatedAt);
280    }
281
282    public DateTime getCanceledAt() {
283        return canceledAt;
284    }
285
286    public void setCanceledAt(final Object canceledAt) {
287        this.canceledAt = dateTimeOrNull(canceledAt);
288    }
289
290    public DateTime getExpiresAt() {
291        return expiresAt;
292    }
293
294    public void setExpiresAt(final Object expiresAt) {
295        this.expiresAt = dateTimeOrNull(expiresAt);
296    }
297
298    public DateTime getCurrentPeriodStartedAt() {
299        return currentPeriodStartedAt;
300    }
301
302    public Integer getRemainingBillingCycles() {
303        return remainingBillingCycles;
304    }
305
306    public void setRemainingBillingCycles(final Object remainingBillingCycles) {
307        this.remainingBillingCycles = integerOrNull(remainingBillingCycles);
308    }
309
310    public void setCurrentPeriodStartedAt(final Object currentPeriodStartedAt) {
311        this.currentPeriodStartedAt = dateTimeOrNull(currentPeriodStartedAt);
312    }
313
314    public DateTime getCurrentPeriodEndsAt() {
315        return currentPeriodEndsAt;
316    }
317
318    public void setCurrentPeriodEndsAt(final Object currentPeriodEndsAt) {
319        this.currentPeriodEndsAt = dateTimeOrNull(currentPeriodEndsAt);
320    }
321
322    public DateTime getTrialStartedAt() {
323        return trialStartedAt;
324    }
325
326    public void setTrialStartedAt(final Object trialStartedAt) {
327        this.trialStartedAt = dateTimeOrNull(trialStartedAt);
328    }
329
330    public DateTime getTrialEndsAt() {
331        return trialEndsAt;
332    }
333
334    public void setTrialEndsAt(final Object trialEndsAt) {
335        this.trialEndsAt = dateTimeOrNull(trialEndsAt);
336    }
337
338    public Subscription getPendingSubscription() {
339        return pendingSubscription;
340    }
341
342    public void setPendingSubscription(final Subscription pendingSubscription) {
343        this.pendingSubscription = pendingSubscription;
344    }
345
346    public DateTime getStartsAt() {
347        return startsAt;
348    }
349
350    public void setStartsAt(final Object startsAt) {
351        this.startsAt = dateTimeOrNull(startsAt);
352    }
353
354    public String getCollectionMethod() {
355        return collectionMethod;
356    }
357
358    public void setCollectionMethod(Object collectionMethod) {
359        this.collectionMethod = stringOrNull(collectionMethod);
360    }
361
362    public Integer getNetTerms() {
363        return netTerms;
364    }
365
366    public void setNetTerms(final Object netTerms) {
367        this.netTerms = integerOrNull(netTerms);
368    }
369
370    public String getPoNumber() {
371        return poNumber;
372    }
373
374    public void setPoNumber(Object poNumber) {
375        this.poNumber = stringOrNull(poNumber);
376    }
377
378    public DateTime getFirstRenewalDate() {
379        return firstRenewalDate;
380    }
381
382    public String getCustomerNotes() {
383        return customerNotes;
384    }
385
386    public void setCustomerNotes(Object customerNotes) {
387        this.customerNotes = stringOrNull(customerNotes);
388    }
389
390    public String getTermsAndConditions() {
391        return termsAndConditions;
392    }
393
394    public void setTermsAndConditions(Object termsAndConditions) {
395        this.termsAndConditions = stringOrNull(termsAndConditions);
396    }
397
398    public void setFirstRenewalDate(final Object firstRenewalDate) {
399        this.firstRenewalDate = dateTimeOrNull(firstRenewalDate);
400    }
401
402    public String getCouponCode() {
403        return couponCode;
404    }
405
406    public void setCouponCode(final String couponCode) {
407        this.couponCode = couponCode;
408        if (this.couponCodes == null) this.couponCodes = new ArrayList<String>();
409        this.couponCodes.add(couponCode);
410    }
411
412    public void setCouponCodes(final List<String> couponCodes) {
413        this.couponCodes = couponCodes;
414    }
415
416    public List<String> getCouponCodes() {
417        return this.couponCodes;
418    }
419
420    public void setBulk(final Object bulk) {
421        this.bulk = booleanOrNull(bulk);
422    }
423
424    public RevenueScheduleType getRevenueScheduleType() {
425        return revenueScheduleType;
426    }
427
428    public void setRevenueScheduleType(final Object revenueScheduleType) {
429        this.revenueScheduleType = enumOrNull(RevenueScheduleType.class, revenueScheduleType, true);
430    }
431
432    public GiftCard getGiftCard() {
433        return giftCard;
434    }
435
436    public void setGiftCard(final GiftCard giftCard) {
437        this.giftCard = giftCard;
438    }
439
440    public void setShippingAddress(final ShippingAddress shippingAddress) {
441        this.shippingAddress = shippingAddress;
442    }
443
444    public ShippingAddress getShippingAddress() {
445        return shippingAddress;
446    }
447
448    public void setShippingAddressId(final Object shippingAddressId) {
449        this.shippingAddressId = longOrNull(shippingAddressId);
450    }
451
452    public String getShippingMethodCode() {
453        return shippingMethodCode;
454    }
455
456    public void setShippingMethodCode(final Object shippingMethodCode) {
457        this.shippingMethodCode = stringOrNull(shippingMethodCode);
458    }
459
460    public Integer getShippingAmountInCents() {
461        return shippingAmountInCents;
462    }
463
464    public void setShippingAmountInCents(final Object shippingAmountInCents) {
465        this.shippingAmountInCents = integerOrNull(shippingAmountInCents);
466    }
467
468    public String getBillingInfoUuid() {
469      return billingInfoUuid;
470    }
471
472    public void setBillingInfoUuid(final Object billingInfoUuid) {
473        this.billingInfoUuid = stringOrNull(billingInfoUuid);
474    }
475
476    public DateTime getUpdatedAt() {
477        return updatedAt;
478    }
479
480    public void setUpdatedAt(final Object updatedAt) {
481        this.updatedAt = dateTimeOrNull(updatedAt);
482    }
483
484    public Boolean getStartedWithGift() {
485        return this.startedWithGift;
486    }
487
488    public void setStartedWithGift(final Object startedWithGift) {
489        this.startedWithGift = booleanOrNull(startedWithGift);
490    }
491
492    public DateTime getConvertedAt() {
493        return this.convertedAt;
494    }
495
496    public void setConvertedAt(final Object convertedAt) {
497        this.convertedAt = dateTimeOrNull(convertedAt);
498    }
499
500    public String getNoBillingInfoReason() {
501        return this.noBillingInfoReason;
502    }
503
504    public void setNoBillingInfoReason(final Object noBillingInfoReason) {
505        this.noBillingInfoReason = stringOrNull(noBillingInfoReason);
506    }
507
508    public Boolean getImportedTrial() {
509        return this.importedTrial;
510    }
511
512    public void setImportedTrial(final Object importedTrial) {
513        this.importedTrial = booleanOrNull(importedTrial);
514    }
515
516
517    public String getCreditCustomerNotes() {
518        return creditCustomerNotes;
519    }
520
521    public void setCreditCustomerNotes(final Object creditCustomerNotes) {
522        this.creditCustomerNotes = stringOrNull(creditCustomerNotes);
523    }
524
525    public InvoiceCollection getInvoiceCollection() {
526        return invoiceCollection;
527    }
528
529    public void setInvoiceCollection(final InvoiceCollection invoiceCollection) {
530        this.invoiceCollection = invoiceCollection;
531    }
532
533    public Integer getRemainingPauseCycles() {
534        return remainingPauseCycles;
535    }
536
537    public void setRemainingPauseCycles(final Object remainingPauseCycles) {
538        this.remainingPauseCycles = integerOrNull(remainingPauseCycles);
539    }
540
541    public DateTime getPausedAt() {
542        return this.pausedAt;
543    }
544
545    public void setPausedAt(final Object pausedAt) {
546        this.pausedAt = dateTimeOrNull(pausedAt);
547    }
548
549    public Boolean getAutoRenew() {
550        return this.autoRenew;
551    }
552
553    public void setAutoRenew(final Object autoRenew) {
554        this.autoRenew = booleanOrNull(autoRenew);
555    }
556
557    public Integer getRenewalBillingCycles() {
558        return renewalBillingCycles;
559    }
560
561    public void setRenewalBillingCycles(final Object renewalBillingCycles) {
562        this.renewalBillingCycles = integerOrNull(renewalBillingCycles);
563    }
564
565    public DateTime getFirstBillDate() {
566        return firstBillDate;
567    }
568
569    protected void setFirstBillDate(final Object firstBillDate) {
570        this.firstBillDate = dateTimeOrNull(firstBillDate);
571    }
572
573    public DateTime getNextBillDate() {
574        return nextBillDate;
575    }
576
577    protected void setNextBillDate(final Object nextBillDate) {
578        this.nextBillDate = dateTimeOrNull(nextBillDate);
579    }
580
581    public DateTime getCurrentTermStartedAt() {
582        return currentTermStartedAt;
583    }
584
585    protected void setCurrentTermStartedAt(final Object currentTermStartedAt) {
586        this.currentTermStartedAt = dateTimeOrNull(currentTermStartedAt);
587    }
588
589    public DateTime getCurrentTermEndsAt() {
590        return currentTermEndsAt;
591    }
592
593    protected void setCurrentTermEndsAt(final Object currentTermEndsAt) {
594        this.currentTermEndsAt = dateTimeOrNull(currentTermEndsAt);
595    }
596
597    public String getTransactionType() {
598        return transactionType;
599    }
600
601    public void setTransactionType(final Object transactionType) {
602        this.transactionType = stringOrNull(transactionType);
603    }
604
605    @Override
606    public String toString() {
607        final StringBuilder sb = new StringBuilder();
608        sb.append("Subscription");
609        sb.append("{account=").append(account);
610        sb.append(", plan=").append(plan);
611        sb.append(", uuid='").append(uuid).append('\'');
612        sb.append(", state='").append(state).append('\'');
613        sb.append(", unitAmountInCents=").append(unitAmountInCents);
614        sb.append(", currency='").append(currency).append('\'');
615        sb.append(", quantity=").append(quantity);
616        sb.append(", couponCode=").append(couponCode);
617        sb.append(", couponCodes=").append(couponCodes);
618        sb.append(", activatedAt=").append(activatedAt);
619        sb.append(", updatedAt=").append(updatedAt);
620        sb.append(", canceledAt=").append(canceledAt);
621        sb.append(", expiresAt=").append(expiresAt);
622        sb.append(", remainingBillingCycles=").append(remainingBillingCycles);
623        sb.append(", currentPeriodStartedAt=").append(currentPeriodStartedAt);
624        sb.append(", currentPeriodEndsAt=").append(currentPeriodEndsAt);
625        sb.append(", trialStartedAt=").append(trialStartedAt);
626        sb.append(", trialEndsAt=").append(trialEndsAt);
627        sb.append(", startsAt=").append(startsAt);
628        sb.append(", addOns=").append(addOns);
629        sb.append(", pendingSubscription=").append(pendingSubscription);
630        sb.append(", firstRenewalDate=").append(firstRenewalDate);
631        sb.append(", bulk=").append(bulk);
632        sb.append(", revenueScheduleType=").append(revenueScheduleType);
633        sb.append(", giftCard=").append(giftCard);
634        sb.append(", taxInCents=").append(taxInCents);
635        sb.append(", taxRegion=").append(taxRegion);
636        sb.append(", taxType=").append(taxType);
637        sb.append(", taxRate=").append(taxRate);
638        sb.append(", shippingAddress=").append(shippingAddress);
639        sb.append(", shippingAddressId=").append(shippingAddressId);
640        sb.append(", shippingMethodCode=").append(shippingMethodCode);
641        sb.append(", shippingAmountInCents=").append(shippingAmountInCents);
642        sb.append(", billingInfoUuid='").append(billingInfoUuid).append('\'');
643        sb.append(", startedWithGift=").append(startedWithGift);
644        sb.append(", convertedAt=").append(convertedAt);
645        sb.append(", noBillingInfoReason=").append(noBillingInfoReason);
646        sb.append(", importedTrial=").append(importedTrial);
647        sb.append(", creditCustomerNotes=").append(creditCustomerNotes);
648        sb.append(", invoiceCollection=").append(invoiceCollection);
649        sb.append(", customFields=").append(customFields);
650        sb.append(", remainingPauseCycles=").append(remainingPauseCycles);
651        sb.append(", pausedAt=").append(pausedAt);
652        sb.append(", autoRenew=").append(autoRenew);
653        sb.append(", renewalBillingCycles=").append(renewalBillingCycles);
654        sb.append(", firstBillDate=").append(firstBillDate);
655        sb.append(", nextBillDate=").append(nextBillDate);
656        sb.append(", currentPeriodStartedAt=").append(currentPeriodStartedAt);
657        sb.append(", currentPeriodEndsAt=").append(currentPeriodEndsAt);
658        sb.append(", transactionType='").append(transactionType).append('\'');
659        sb.append('}');
660        return sb.toString();
661    }
662
663    @Override
664    public boolean equals(final Object o) {
665        if (this == o) return true;
666        if (o == null || getClass() != o.getClass()) return false;
667
668        final Subscription that = (Subscription) o;
669
670        if (account != null ? !account.equals(that.account) : that.account != null) {
671            return false;
672        }
673        if (activatedAt != null ? activatedAt.compareTo(that.activatedAt) != 0 : that.activatedAt != null) {
674            return false;
675        }
676        if (addOns != null ? !addOns.equals(that.addOns) : that.addOns != null) {
677            return false;
678        }
679        if (canceledAt != null ? canceledAt.compareTo(that.canceledAt) != 0 : that.canceledAt != null) {
680            return false;
681        }
682        if (convertedAt != null ? convertedAt.compareTo(that.convertedAt) != 0 : that.convertedAt != null) {
683            return false;
684        }
685        if (currency != null ? !currency.equals(that.currency) : that.currency != null) {
686            return false;
687        }
688        if (updatedAt != null ? updatedAt.compareTo(that.updatedAt) != 0 : that.updatedAt != null) {
689            return false;
690        }
691        if (currentPeriodEndsAt != null ? currentPeriodEndsAt.compareTo(that.currentPeriodEndsAt) != 0 : that.currentPeriodEndsAt != null) {
692            return false;
693        }
694        if (currentPeriodStartedAt != null ? currentPeriodStartedAt.compareTo(that.currentPeriodStartedAt) != 0 : that.currentPeriodStartedAt != null) {
695            return false;
696        }
697        if (expiresAt != null ? expiresAt.compareTo(that.expiresAt) != 0 : that.expiresAt != null) {
698            return false;
699        }
700        if (importedTrial != null ? !importedTrial.equals(that.importedTrial) : that.importedTrial != null) {
701            return false;
702        }
703        if (remainingBillingCycles != null ? !remainingBillingCycles.equals(that.remainingBillingCycles) : that.remainingBillingCycles != null) {
704            return false;
705        }
706        if (remainingPauseCycles != null ? !remainingPauseCycles.equals(that.remainingPauseCycles) : that.remainingPauseCycles != null) {
707            return false;
708        }
709        if (plan != null ? !plan.equals(that.plan) : that.plan != null) {
710            return false;
711        }
712        if (quantity != null ? !quantity.equals(that.quantity) : that.quantity != null) {
713            return false;
714        }
715        if (startedWithGift != null ? !startedWithGift.equals(that.startedWithGift) : that.startedWithGift != null) {
716            return false;
717        }
718        if (state != null ? !state.equals(that.state) : that.state != null) {
719            return false;
720        }
721        if (trialEndsAt != null ? trialEndsAt.compareTo(that.trialEndsAt) != 0 : that.trialEndsAt != null) {
722            return false;
723        }
724        if (trialStartedAt != null ? trialStartedAt.compareTo(that.trialStartedAt) != 0 : that.trialStartedAt != null) {
725            return false;
726        }
727        if (unitAmountInCents != null ? !unitAmountInCents.equals(that.unitAmountInCents) : that.unitAmountInCents != null) {
728            return false;
729        }
730        if (uuid != null ? !uuid.equals(that.uuid) : that.uuid != null) {
731            return false;
732        }
733        if (startsAt != null ? startsAt.compareTo(that.startsAt) != 0 : that.startsAt != null) {
734            return false;
735        }
736        if (pendingSubscription != null ? !pendingSubscription.equals(that.pendingSubscription) : that.pendingSubscription != null) {
737            return false;
738        }
739        if (collectionMethod != null ? !collectionMethod.equals(that.collectionMethod) : that.collectionMethod != null) {
740            return false;
741        }
742        if (netTerms != null ? !netTerms.equals(that.netTerms) : that.netTerms != null) {
743            return false;
744        }
745        if (pausedAt != null ? pausedAt.compareTo(that.pausedAt) != 0 : that.pausedAt != null) {
746            return false;
747        }
748        if (poNumber != null ? !poNumber.equals(that.poNumber) : that.poNumber != null) {
749            return false;
750        }
751        if (firstRenewalDate != null ? firstRenewalDate.compareTo(that.firstRenewalDate) != 0 : that.firstRenewalDate != null) {
752            return false;
753        }
754        if (bulk != null ? !bulk.equals(that.bulk) : that.bulk != null) {
755            return false;
756        }
757        if (revenueScheduleType != null ? !revenueScheduleType.equals(that.revenueScheduleType) : that.revenueScheduleType != null) {
758            return false;
759        }
760        if (giftCard != null ? !giftCard.equals(that.giftCard) : that.giftCard != null) {
761            return false;
762        }
763        if (taxInCents != null ? !taxInCents.equals(that.taxInCents) : that.taxInCents != null) {
764            return false;
765        }
766        if (taxRegion != null ? !taxRegion.equals(that.taxRegion) : that.taxRegion != null) {
767            return false;
768        }
769        if (taxType != null ? !taxType.equals(that.taxType) : that.taxType != null) {
770            return false;
771        }
772        if (taxRate != null ? !taxRate.equals(that.taxRate) : that.taxRate != null) {
773            return false;
774        }
775        if (shippingAddress != null ? !shippingAddress.equals(that.shippingAddress) : that.shippingAddress != null) {
776            return false;
777        }
778        if (shippingAddressId != null ? !shippingAddressId.equals(that.shippingAddressId) : that.shippingAddressId != null) {
779            return false;
780        }
781        if (shippingMethodCode != null ? !shippingMethodCode.equals(that.shippingMethodCode) : that.shippingMethodCode != null) {
782            return false;
783        }
784        if (shippingAmountInCents != null ? !shippingAmountInCents.equals(that.shippingAmountInCents) : that.shippingAmountInCents != null) {
785            return false;
786        }
787        if (billingInfoUuid != null ? !billingInfoUuid.equals(that.billingInfoUuid) : that.billingInfoUuid != null) {
788            return false;
789        }
790        if (noBillingInfoReason != null ? !noBillingInfoReason.equals(that.noBillingInfoReason) : that.noBillingInfoReason != null) {
791            return false;
792        }
793        if (creditCustomerNotes != null ? !creditCustomerNotes.equals(that.creditCustomerNotes) : that.creditCustomerNotes != null) {
794            return false;
795        }
796        if (invoiceCollection != null ? !invoiceCollection.equals(that.invoiceCollection) : that.invoiceCollection != null) {
797            return false;
798        }
799        if (customFields != null ? !customFields.equals(that.customFields) : that.customFields != null) {
800            return false;
801        }
802        if (renewalBillingCycles != null ? !renewalBillingCycles.equals(that.renewalBillingCycles) : that.renewalBillingCycles != null) {
803            return false;
804        }
805        if (autoRenew != null ? !autoRenew.equals(that.autoRenew) : that.autoRenew != null) {
806            return false;
807        }
808        if (firstBillDate != null ? firstBillDate.compareTo(that.firstBillDate) != 0 : that.firstBillDate != null) {
809            return false;
810        }
811        if (nextBillDate != null ? nextBillDate.compareTo(that.nextBillDate) != 0 : that.nextBillDate != null) {
812            return false;
813        }
814        if (currentPeriodStartedAt != null ? currentPeriodStartedAt.compareTo(that.currentPeriodStartedAt) != 0 : that.currentPeriodStartedAt != null) {
815            return false;
816        }
817        if (currentPeriodEndsAt != null ? currentPeriodEndsAt.compareTo(that.currentPeriodEndsAt) != 0 : that.currentPeriodEndsAt != null) {
818            return false;
819        }
820        if (transactionType != null ? !transactionType.equals(that.transactionType) : that.transactionType != null) {
821            return false;
822        }
823
824        return true;
825    }
826
827    @Override
828    public int hashCode() {
829        return Objects.hashCode(
830                account,
831                plan,
832                uuid,
833                state,
834                unitAmountInCents,
835                currency,
836                quantity,
837                activatedAt,
838                updatedAt,
839                canceledAt,
840                expiresAt,
841                remainingBillingCycles,
842                currentPeriodStartedAt,
843                currentPeriodEndsAt,
844                trialStartedAt,
845                trialEndsAt,
846                addOns,
847                pendingSubscription,
848                startsAt,
849                collectionMethod,
850                netTerms,
851                poNumber,
852                revenueScheduleType,
853                giftCard,
854                taxInCents,
855                taxRegion,
856                taxType,
857                taxRate,
858                shippingAddress,
859                shippingAddressId,
860                shippingMethodCode,
861                shippingAmountInCents,
862                billingInfoUuid,
863                couponCode,
864                couponCodes,
865                convertedAt,
866                startedWithGift,
867                noBillingInfoReason,
868                importedTrial,
869                invoiceCollection,
870                customFields,
871                remainingPauseCycles,
872                pausedAt,
873                autoRenew,
874                renewalBillingCycles,
875                firstBillDate,
876                nextBillDate,
877                currentPeriodStartedAt,
878                currentPeriodEndsAt,
879                transactionType
880        );
881    }
882
883}