Line | |
---|
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 | @Setter
|
---|
16 | @Id
|
---|
17 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
18 | @Column(name = "PaymentID")
|
---|
19 |
|
---|
20 | private Integer paymentID;
|
---|
21 |
|
---|
22 | //@Column(name = "bookingId")
|
---|
23 | @Setter
|
---|
24 | @Column(name="bookingid")
|
---|
25 | private Integer bookingId;
|
---|
26 | @Getter
|
---|
27 | @Column(name = "userid")
|
---|
28 |
|
---|
29 | private Integer userId;
|
---|
30 | @Setter
|
---|
31 | @Column(name = "payment_method")
|
---|
32 |
|
---|
33 | @Enumerated(EnumType.STRING)
|
---|
34 | private PaymentMethod method;
|
---|
35 | @Setter
|
---|
36 | @Column(name = "Amount")
|
---|
37 |
|
---|
38 | private BigDecimal amount;
|
---|
39 | @Setter
|
---|
40 | @Getter
|
---|
41 | @Column(name = "transaction_date")
|
---|
42 |
|
---|
43 | private LocalDate transactionDate;
|
---|
44 | @Setter
|
---|
45 | @Getter
|
---|
46 | @Column(name = "payment_status")
|
---|
47 |
|
---|
48 | @Enumerated(EnumType.STRING)
|
---|
49 | private PaymentStatus status;
|
---|
50 |
|
---|
51 |
|
---|
52 | public enum PaymentStatus {
|
---|
53 | PENDING,
|
---|
54 | COMPLETED,
|
---|
55 | CANCELLED
|
---|
56 | }
|
---|
57 |
|
---|
58 | public enum PaymentMethod {
|
---|
59 | PAYPAL,
|
---|
60 | DEBIT,
|
---|
61 | CREDIT
|
---|
62 | }
|
---|
63 |
|
---|
64 | public Integer getBookingID() {
|
---|
65 | return bookingId;
|
---|
66 | }
|
---|
67 |
|
---|
68 | public void setUserID(Integer userId) {
|
---|
69 | this.userId = userId;
|
---|
70 | }
|
---|
71 |
|
---|
72 | public void setUserId(Long userId) {
|
---|
73 | this.userId = Math.toIntExact(userId);
|
---|
74 | }
|
---|
75 |
|
---|
76 | }
|
---|
77 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.