001/* 002 * Copyright 2010-2013 Ning, Inc. 003 * 004 * Ning licenses this file to you under the Apache License, version 2.0 005 * (the "License"); you may not use this file except in compliance with the 006 * License. You may obtain a copy of the License at: 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations 014 * under the License. 015 */ 016 017package com.ning.billing.recurly.model; 018 019import javax.xml.bind.annotation.XmlElement; 020import javax.xml.bind.annotation.XmlRootElement; 021 022@XmlRootElement(name = "transaction") 023public class AbstractTransaction extends RecurlyObject { 024 025 @XmlElement(name = "action") 026 protected String action; 027 028 @XmlElement(name = "amount_in_cents") 029 protected Integer amountInCents; 030 031 @XmlElement(name = "status") 032 protected String status; 033 034 @XmlElement(name = "reference") 035 protected String reference; 036 037 @XmlElement(name = "test") 038 protected Boolean test; 039 040 @XmlElement(name = "voidable") 041 protected Boolean voidable; 042 043 @XmlElement(name = "refundable") 044 protected Boolean refundable; 045 046 @XmlElement(name = "transaction_error") 047 private TransactionError transactionError; 048 049 public String getAction() { 050 return action; 051 } 052 053 public void setAction(final Object action) { 054 this.action = stringOrNull(action); 055 } 056 057 public Integer getAmountInCents() { 058 return amountInCents; 059 } 060 061 public void setAmountInCents(final Object amountInCents) { 062 this.amountInCents = integerOrNull(amountInCents); 063 } 064 065 public String getStatus() { 066 return status; 067 } 068 069 public void setStatus(final Object status) { 070 this.status = stringOrNull(status); 071 } 072 073 public String getReference() { 074 return reference; 075 } 076 077 public void setReference(final Object reference) { 078 this.reference = stringOrNull(reference); 079 } 080 081 public Boolean getTest() { 082 return test; 083 } 084 085 public void setTest(final Object test) { 086 this.test = booleanOrNull(test); 087 } 088 089 public Boolean getVoidable() { 090 return voidable; 091 } 092 093 public void setVoidable(final Object voidable) { 094 this.voidable = booleanOrNull(voidable); 095 } 096 097 public Boolean getRefundable() { 098 return refundable; 099 } 100 101 public void setRefundable(final Object refundable) { 102 this.refundable = booleanOrNull(refundable); 103 } 104 105 public TransactionError getTransactionError() { 106 return transactionError; 107 } 108 109 public void setTransactionError(final TransactionError transactionError) { 110 this.transactionError = transactionError; 111 } 112 113 @Override 114 public boolean equals(final Object o) { 115 if (this == o) { 116 return true; 117 } 118 if (o == null || getClass() != o.getClass()) { 119 return false; 120 } 121 122 final AbstractTransaction that = (AbstractTransaction) o; 123 124 if (action != null ? !action.equals(that.action) : that.action != null) { 125 return false; 126 } 127 if (amountInCents != null ? !amountInCents.equals(that.amountInCents) : that.amountInCents != null) { 128 return false; 129 } 130 if (reference != null ? !reference.equals(that.reference) : that.reference != null) { 131 return false; 132 } 133 if (refundable != null ? !refundable.equals(that.refundable) : that.refundable != null) { 134 return false; 135 } 136 if (status != null ? !status.equals(that.status) : that.status != null) { 137 return false; 138 } 139 if (test != null ? !test.equals(that.test) : that.test != null) { 140 return false; 141 } 142 if (transactionError != null ? !transactionError.equals(that.transactionError) : that.transactionError != null) { 143 return false; 144 } 145 if (voidable != null ? !voidable.equals(that.voidable) : that.voidable != null) { 146 return false; 147 } 148 149 return true; 150 } 151 152 @Override 153 public int hashCode() { 154 int result = action != null ? action.hashCode() : 0; 155 result = 31 * result + (amountInCents != null ? amountInCents.hashCode() : 0); 156 result = 31 * result + (status != null ? status.hashCode() : 0); 157 result = 31 * result + (reference != null ? reference.hashCode() : 0); 158 result = 31 * result + (test != null ? test.hashCode() : 0); 159 result = 31 * result + (voidable != null ? voidable.hashCode() : 0); 160 result = 31 * result + (refundable != null ? refundable.hashCode() : 0); 161 result = 31 * result + (transactionError != null ? transactionError.hashCode() : 0); 162 return result; 163 } 164}