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.push.payment; 019 020import java.util.Map; 021 022import javax.xml.bind.annotation.XmlElement; 023 024import org.joda.time.DateTime; 025 026import com.ning.billing.recurly.model.AbstractTransaction; 027 028public class PushTransaction extends AbstractTransaction { 029 030 @XmlElement 031 private String id; 032 033 @XmlElement(name = "invoice_id") 034 private String invoiceId; 035 036 @XmlElement(name = "invoice_number") 037 private Integer invoiceNumber; 038 039 @XmlElement(name = "subscription_id") 040 private String subscriptionId; 041 042 @XmlElement 043 private DateTime date; 044 045 @XmlElement 046 private String message; 047 048 public String getId() { 049 return id; 050 } 051 052 public void setId(final Object id) { 053 this.id = stringOrNull(id); 054 } 055 056 public String getInvoiceId() { 057 return invoiceId; 058 } 059 060 public void setInvoiceId(final Object invoiceId) { 061 this.invoiceId = stringOrNull(invoiceId); 062 } 063 064 public Integer getInvoiceNumber() { 065 return invoiceNumber; 066 } 067 068 public void setInvoiceNumber(final Object invoiceNumber) { 069 this.invoiceNumber = integerOrNull(invoiceNumber); 070 } 071 072 public String getSubscriptionId() { 073 return subscriptionId; 074 } 075 076 public void setSubscriptionId(final Object subscriptionId) { 077 this.subscriptionId = stringOrNull(subscriptionId); 078 } 079 080 public DateTime getDate() { 081 return date; 082 } 083 084 public void setDate(final Object date) { 085 this.date = dateTimeOrNull(date); 086 } 087 088 public String getMessage() { 089 return message; 090 } 091 092 public void setMessage(final Object message) { 093 this.message = stringOrNull(message); 094 } 095 096 @Override 097 public boolean equals(final Object o) { 098 if (this == o) { 099 return true; 100 } 101 if (!(o instanceof PushTransaction)) { 102 return false; 103 } 104 if (!super.equals(o)) { 105 return false; 106 } 107 108 final PushTransaction that = (PushTransaction) o; 109 110 if (date != null ? !date.equals(that.date) : that.date != null) { 111 return false; 112 } 113 if (id != null ? !id.equals(that.id) : that.id != null) { 114 return false; 115 } 116 if (invoiceId != null ? !invoiceId.equals(that.invoiceId) : that.invoiceId != null) { 117 return false; 118 } 119 if (invoiceNumber != null ? !invoiceNumber.equals(that.invoiceNumber) : that.invoiceNumber != null) { 120 return false; 121 } 122 if (message != null ? !message.equals(that.message) : that.message != null) { 123 return false; 124 } 125 if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null) { 126 return false; 127 } 128 129 return true; 130 } 131 132 @Override 133 public int hashCode() { 134 int result = super.hashCode(); 135 result = 31 * result + (id != null ? id.hashCode() : 0); 136 result = 31 * result + (invoiceId != null ? invoiceId.hashCode() : 0); 137 result = 31 * result + (invoiceNumber != null ? invoiceNumber.hashCode() : 0); 138 result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0); 139 result = 31 * result + (date != null ? date.hashCode() : 0); 140 result = 31 * result + (message != null ? message.hashCode() : 0); 141 return result; 142 } 143}