File History: src/main/java/com/paymentlink/model/entity/PaymentLink.java

← View file content

File Content at Commit 690c1f6

1 package com.paymentlink.model.entity;
2
3 import com.fasterxml.jackson.annotation.JsonManagedReference;
4 import jakarta.persistence.*;
5 import lombok.AllArgsConstructor;
6 import lombok.Builder;
7 import lombok.Data;
8 import lombok.NoArgsConstructor;
9 import org.hibernate.annotations.CreationTimestamp;
10 import org.hibernate.annotations.UpdateTimestamp;
11
12 import java.time.LocalDateTime;
13 import java.util.ArrayList;
14 import java.util.List;
15
16 @Entity
17 @Table(name = "payment_links")
18 @Data
19 @NoArgsConstructor
20 @AllArgsConstructor
21 @Builder
22 public class PaymentLink {
23
24 @Id
25 @GeneratedValue(strategy = GenerationType.IDENTITY)
26 private Long id;
27
28 @Column(name = "link_id", unique = true, nullable = false)
29 private String linkId; // Hex format
30
31 @OneToMany(mappedBy = "paymentLink", cascade = CascadeType.ALL, orphanRemoval = true)
32 @Builder.Default
33 @JsonManagedReference
34 private List<PaymentLinkItem> items = new ArrayList<>();
35
36 @Column(nullable = false)
37 private Long amount; // Total amount in cents
38
39 @Column(nullable = false)
40 private Long subtotal; // Subtotal in cents
41
42 @Column(name = "shipping_cost")
43 private Long shippingCost; // In cents
44
45 @Column(name = "tax_amount")
46 private Long taxAmount; // In cents
47
48 @Column(nullable = false, length = 3)
49 private String currency;
50
51 @Column(nullable = false)
52 private String status; // pending, paid, expired, failed
53
54 @Column(name = "order_id")
55 private String orderId;
56
57 @Column(name = "stripe_payment_intent_id")
58 private String stripePaymentIntentId;
59
60 @Column(name = "customer_email")
61 private String customerEmail;
62
63 @Column(name = "customer_name")
64 private String customerName;
65
66 @Column(name = "customer_phone")
67 private String customerPhone;
68
69 @Column(name = "shipping_address")
70 private String shippingAddress;
71
72 @Column(name = "shipping_city")
73 private String shippingCity;
74
75 @Column(name = "shipping_state")
76 private String shippingState;
77
78 @Column(name = "shipping_zip")
79 private String shippingZip;
80
81 @Column(name = "shipping_country")
82 private String shippingCountry;
83
84 @Column(name = "shipping_method")
85 private String shippingMethod;
86
87 @Column(name = "node_id")
88 private String nodeId;
89
90 @CreationTimestamp
91 @Column(name = "created_at", updatable = false)
92 private LocalDateTime createdAt;
93
94 @UpdateTimestamp
95 @Column(name = "updated_at")
96 private LocalDateTime updatedAt;
97
98 // Helper method to add item
99 public void addItem(PaymentLinkItem item) {
100 items.add(item);
101 item.setPaymentLink(this);
102 }
103 }
104
105

Commits

Commit Author Date Message File SHA Actions
f0438c2 <f69e50@finnacloud.com> 1766443042 +0300 12/22/2025, 10:37:22 PM increment once more fdbd88e View
188fc92 <f69e50@finnacloud.com> 1766442998 +0300 12/22/2025, 10:36:38 PM increment fdbd88e View
4617f76 <f69e50@finnacloud.com> 1766442953 +0300 12/22/2025, 10:35:53 PM rename branch from main to master oops fdbd88e View
e6d1548 <f69e50@finnacloud.com> 1766442769 +0300 12/22/2025, 10:32:49 PM add initial test workflow file fdbd88e View
9c24ca4 <f69e50@finnacloud.com> 1766442705 +0300 12/22/2025, 10:31:45 PM add CI configuration and test script for Jenkins build fdbd88e View
690c1f6 <f69e50@finnacloud.com> 1766368110 +0300 12/22/2025, 1:48:30 AM initialize backend structure with controllers, DTOs, and configuration files fdbd88e Hide