Paypal.java 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. public class Paypal implements Payment {
  2. private long id;
  3. private String payerName;
  4. private String email;
  5. public Paypal(){
  6. }
  7. public Paypal(long id, String payerName, String email){
  8. this.id = id;
  9. this.payerName = payerName;
  10. this.email= email;
  11. }
  12. public long getId() {
  13. return id;
  14. }
  15. public String getPayerName() {
  16. return payerName;
  17. }
  18. public String getShortDescription() {
  19. return "Paypal " + getPayerName() + " " + getEmail();
  20. }
  21. public void setId(long id) {
  22. this.id = id;
  23. }
  24. public void setPayerName(String payerName) {
  25. this.payerName = payerName;
  26. }
  27. public String getEmail() {
  28. return email;
  29. }
  30. public void setEmail(String email) {
  31. this.email = email;
  32. }
  33. public int compareTo(Payment o) {
  34. if (this.getShortDescription().compareTo(o.getShortDescription()) > 0) return 1;
  35. else if (this.getShortDescription().compareTo(o.getShortDescription()) < 0)return -1;
  36. else return 0;
  37. }
  38. }