Copyright (c) 2012 CloudMine LLC, http://cloudmine.me
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software")...
If you think the Android project cloudmine-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.cloudmine.api;
//www.java2s.comimport com.cloudmine.api.db.BaseLocallySavableCMObject;
import com.cloudmine.api.rest.JsonUtilities;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* <br>Copyright CloudMine LLC. All rights reserved
* <br> See LICENSE file included with SDK for details.
*/publicclass CMCreditCard extends BaseLocallySavableCMObject {
private String nameOnCard;
private String token;
private String expirationDate;
private String last4Digits;
private String type;
public CMCreditCard() {}
public CMCreditCard(String nameOnCard, String token, String expirationDate, String last4Digits, String type) {
this.nameOnCard = nameOnCard;
this.token = token;
this.expirationDate = expirationDate;
this.last4Digits = last4Digits;
this.type = type;
}
public String getNameOnCard() {
return nameOnCard;
}
publicvoid setNameOnCard(String nameOnCard) {
this.nameOnCard = nameOnCard;
}
public String getToken() {
return token;
}
publicvoid setToken(String token) {
this.token = token;
}
public String getExpirationDate() {
return expirationDate;
}
/**
* Format: "0214" month/year
* @param expirationDate
*/publicvoid setExpirationDate(String expirationDate) {
this.expirationDate = expirationDate;
}
public String getLast4Digits() {
return last4Digits;
}
publicvoid setLast4Digits(String last4Digits) {
this.last4Digits = last4Digits;
}
public String getType() {
return type;
}
publicvoid setType(String type) {
this.type = type;
}
@JsonIgnore
public String getPaymentTransportRepresentation() {
return JsonUtilities.objectToJson(this);
}
@Override
publicboolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CMCreditCard that = (CMCreditCard) o;
if (expirationDate != null ? !expirationDate.equals(that.expirationDate) : that.expirationDate != null)
return false;
if (last4Digits != null ? !last4Digits.equals(that.last4Digits) : that.last4Digits != null) return false;
if (nameOnCard != null ? !nameOnCard.equals(that.nameOnCard) : that.nameOnCard != null) return false;
if (token != null ? !token.equals(that.token) : that.token != null) return false;
if (type != null ? !type.equals(that.type) : that.type != null) return false;
return true;
}
@Override
publicint hashCode() {
int result = nameOnCard != null ? nameOnCard.hashCode() : 0;
result = 31 * result + (token != null ? token.hashCode() : 0);
result = 31 * result + (expirationDate != null ? expirationDate.hashCode() : 0);
result = 31 * result + (last4Digits != null ? last4Digits.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
return result;
}
}