| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package com.zipcoder.payment;
-
- public class CreditCard implements Payment {
- Long id;
- String payerName;
- String number;
- int expiredMonth;
- int expiredYear;
-
- public CreditCard(){
-
- }
- public CreditCard(String name, String number, int expiredMonth, int expiredYear){
- this.payerName = name;
- this.number = number;
- this.expiredMonth = expiredMonth;
- this.expiredYear = expiredYear;
- }
-
- public int getExpiredYear() {
- return expiredYear;
- }
-
- public void setExpiredYear(int expiredYear) {
- this.expiredYear = expiredYear;
- }
-
- public int getExpiredMonth() {
- return expiredMonth;
- }
-
- public void setExpiredMonth(int expiredMonth) {
- this.expiredMonth = expiredMonth;
- }
-
- public String getNumber() {
- return number;
- }
-
- public void setNumber(String number) {
- this.number = number;
- }
-
-
- public Long getId(){
- return id;
- }
-
- public void setId(Long id){
- this.id = id;
- }
-
- public String getPayerName(){
- return payerName;
- }
-
- public void setPayerName(String payerName) {
- this.payerName = payerName;
- }
-
- public String getShortDescription(){
- String result = "CC " + getPayerName() + " " + lastFour(getNumber()) + " " + getExpiredMonth() + "/" + getExpiredYear();
- return result;
- }
-
- public String lastFour(String number){
- return number.substring(number.length()-4);
- }
-
- public int compareTo(Payment o) {
- return this.getShortDescription().compareTo(o.getShortDescription());
- }
- }
|