PayPal.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package com.zipcoder.payment;
  2. public class PayPal implements Payment {
  3. Long id;
  4. String payerName;
  5. String email;
  6. public PayPal(Long id, String payerName, String email) {
  7. this.id = id;
  8. this.payerName = payerName;
  9. this.email = email;
  10. }
  11. public PayPal() {
  12. id = 0L;
  13. payerName = "";
  14. email = "";
  15. }
  16. public void setId(Long id) {
  17. this.id = id;
  18. }
  19. //on Payment interface
  20. public Long getId() {
  21. return id;
  22. }
  23. public void setPayerName(String payerName) {
  24. this.payerName = payerName;
  25. }
  26. //on Payment interface
  27. public String getPayerName() {
  28. return payerName;
  29. }
  30. public void setEmail(String email) {
  31. this.email = email;
  32. }
  33. public String getEmail() {
  34. return email;
  35. }
  36. //on Payment interface
  37. public String getShortDescription() {
  38. return "Paypal " + payerName +" "+email;
  39. }
  40. public int compareTo(Payment o) {
  41. return this.getShortDescription().compareTo(o.getShortDescription());
  42. }
  43. }