1 | package com.example.skychasemk.model;
|
---|
2 |
|
---|
3 | import jakarta.persistence.*;
|
---|
4 | import lombok.Getter;
|
---|
5 | import lombok.Setter;
|
---|
6 |
|
---|
7 | import java.math.BigDecimal;
|
---|
8 | import java.time.LocalDate;
|
---|
9 |
|
---|
10 | @Getter
|
---|
11 | @Entity
|
---|
12 | @Table(name="Payment")
|
---|
13 | public class Payment {
|
---|
14 |
|
---|
15 | @Id
|
---|
16 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
17 | @Column(name = "PaymentID")
|
---|
18 |
|
---|
19 | private Integer paymentID;
|
---|
20 |
|
---|
21 | @Column(name = "bookingid")
|
---|
22 |
|
---|
23 | private Integer bookingID;
|
---|
24 | @Column(name = "UserID")
|
---|
25 |
|
---|
26 | private Integer userID;
|
---|
27 | @Setter
|
---|
28 | @Column(name = "payment_method")
|
---|
29 |
|
---|
30 | @Enumerated(EnumType.STRING)
|
---|
31 | private PaymentMethod method;
|
---|
32 | @Setter
|
---|
33 | @Column(name = "Amount")
|
---|
34 |
|
---|
35 | private BigDecimal amount;
|
---|
36 | @Setter
|
---|
37 | @Getter
|
---|
38 | @Column(name = "transaction_date")
|
---|
39 |
|
---|
40 | private LocalDate transactionDate;
|
---|
41 | @Column(name = "payment_status")
|
---|
42 |
|
---|
43 | @Enumerated(EnumType.STRING)
|
---|
44 | private PaymentStatus status;
|
---|
45 |
|
---|
46 | public enum PaymentStatus {
|
---|
47 | PENDING,
|
---|
48 | COMPLETED,
|
---|
49 | CANCELLED
|
---|
50 | }
|
---|
51 |
|
---|
52 | public enum PaymentMethod {
|
---|
53 | PAYPAL,
|
---|
54 | DEBIT,
|
---|
55 | CREDIT
|
---|
56 | }
|
---|
57 |
|
---|
58 | public Integer getPaymentID() {
|
---|
59 | return paymentID;
|
---|
60 | }
|
---|
61 |
|
---|
62 | public Integer getBookingID() {
|
---|
63 | return bookingID;
|
---|
64 | }
|
---|
65 |
|
---|
66 | public Integer getUserID() {
|
---|
67 | return userID;
|
---|
68 | }
|
---|
69 |
|
---|
70 | public void setUserID(Integer userID) {
|
---|
71 | this.userID = userID;
|
---|
72 | }
|
---|
73 |
|
---|
74 | public PaymentMethod getMethod() {
|
---|
75 | return method;
|
---|
76 | }
|
---|
77 |
|
---|
78 | public void setMethod(PaymentMethod method) {
|
---|
79 | this.method = method;
|
---|
80 | }
|
---|
81 |
|
---|
82 | public BigDecimal getAmount() {
|
---|
83 | return amount;
|
---|
84 | }
|
---|
85 |
|
---|
86 | public void setPaymentID(Integer paymentID) {
|
---|
87 | this.paymentID = paymentID;
|
---|
88 | }
|
---|
89 |
|
---|
90 | public void setBookingID(Integer bookingID) {
|
---|
91 | this.bookingID = bookingID;
|
---|
92 | }
|
---|
93 |
|
---|
94 | public void setAmount(BigDecimal amount) {
|
---|
95 | this.amount = amount;
|
---|
96 | }
|
---|
97 |
|
---|
98 | public LocalDate getTransactionDate() {
|
---|
99 | return transactionDate;
|
---|
100 | }
|
---|
101 |
|
---|
102 | public void setTransactionDate(LocalDate transactionDate) {
|
---|
103 | this.transactionDate = transactionDate;
|
---|
104 | }
|
---|
105 |
|
---|
106 | public PaymentStatus getStatus() {
|
---|
107 | return status;
|
---|
108 | }
|
---|
109 |
|
---|
110 | public void setStatus(PaymentStatus status) {
|
---|
111 | this.status = status;
|
---|
112 | }
|
---|
113 |
|
---|
114 | public void setUserID(Long userID) {
|
---|
115 | this.userID = Math.toIntExact(userID);
|
---|
116 | }
|
---|
117 |
|
---|
118 | }
|
---|
119 |
|
---|