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.google.common.base.Objects; 021 022import javax.xml.bind.annotation.XmlElement; 023import javax.xml.bind.annotation.XmlRootElement; 024 025@XmlRootElement(name = "transaction_error") 026public class TransactionError extends RecurlyObject { 027 028 @XmlElement(name = "error_code") 029 private String errorCode; 030 031 @XmlElement(name = "error_category") 032 private String errorCategory; 033 034 @XmlElement(name = "merchant_message") 035 private String merchantMessage; 036 037 @XmlElement(name = "customer_message") 038 private String customerMessage; 039 040 @XmlElement(name = "gateway_error_code") 041 private String gatewayErrorCode; 042 043 @XmlElement(name = "three_d_secure_action_token_id") 044 private String threeDSecureActionTokenId; 045 046 public String getErrorCode() { 047 return errorCode; 048 } 049 050 public void setErrorCode(final Object errorCode) { 051 this.errorCode = stringOrNull(errorCode); 052 } 053 054 public String getErrorCategory() { 055 return errorCategory; 056 } 057 058 public void setErrorCategory(final Object errorCategory) { 059 this.errorCategory = stringOrNull(errorCategory); 060 } 061 062 public String getMerchantMessage() { 063 return merchantMessage; 064 } 065 066 public void setMerchantMessage(final Object merchantMessage) { 067 this.merchantMessage = stringOrNull(merchantMessage); 068 } 069 070 public String getCustomerMessage() { 071 return customerMessage; 072 } 073 074 public void setCustomerMessage(final Object customerMessage) { 075 this.customerMessage = stringOrNull(customerMessage); 076 } 077 078 public String getGatewayErrorCode() { 079 return gatewayErrorCode; 080 } 081 082 public void setGatewayErrorCode(final Object gatewayErrorCode) { 083 this.gatewayErrorCode = stringOrNull(gatewayErrorCode); 084 } 085 086 public String getThreeDSecureActionTokenId() { 087 return threeDSecureActionTokenId; 088 } 089 090 public void setThreeDSecureActionTokenId(final Object threeDSecureActionTokenId) { 091 this.threeDSecureActionTokenId = stringOrNull(threeDSecureActionTokenId); 092 } 093 094 @Override 095 public boolean equals(Object o) { 096 if (this == o) return true; 097 if (o == null || getClass() != o.getClass()) return false; 098 if (!super.equals(o)) return false; 099 100 TransactionError that = (TransactionError) o; 101 102 if (errorCode != null ? !errorCode.equals(that.errorCode) : that.errorCode != null) return false; 103 if (errorCategory != null ? !errorCategory.equals(that.errorCategory) : that.errorCategory != null) 104 return false; 105 if (merchantMessage != null ? !merchantMessage.equals(that.merchantMessage) : that.merchantMessage != null) 106 return false; 107 if (customerMessage != null ? !customerMessage.equals(that.customerMessage) : that.customerMessage != null) 108 return false; 109 if (threeDSecureActionTokenId != null ? !threeDSecureActionTokenId.equals(that.threeDSecureActionTokenId) : that.threeDSecureActionTokenId != null) 110 return false; 111 return gatewayErrorCode != null ? gatewayErrorCode.equals(that.gatewayErrorCode) : that.gatewayErrorCode == null; 112 } 113 114 @Override 115 public int hashCode() { 116 return Objects.hashCode(errorCode, errorCategory, merchantMessage, customerMessage, gatewayErrorCode, threeDSecureActionTokenId); 117 } 118 119 @Override 120 public String toString() { 121 return "TransactionError{" + 122 "errorCode='" + errorCode + '\'' + 123 ", errorCategory='" + errorCategory + '\'' + 124 ", merchantMessage='" + merchantMessage + '\'' + 125 ", customerMessage='" + customerMessage + '\'' + 126 ", gatewayErrorCode='" + gatewayErrorCode + '\'' + 127 ", threeDSecureActionTokenId='" + threeDSecureActionTokenId + '\'' + 128 '}'; 129 } 130 131}