|
|
|
@@ -0,0 +1,61 @@
|
|
|
|
|
package ru.soune.nocopy.entity.payment;
|
|
|
|
|
|
|
|
|
|
import jakarta.persistence.*;
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
import lombok.Getter;
|
|
|
|
|
import lombok.NoArgsConstructor;
|
|
|
|
|
import lombok.Setter;
|
|
|
|
|
import org.springframework.data.annotation.CreatedDate;
|
|
|
|
|
import org.springframework.data.annotation.LastModifiedDate;
|
|
|
|
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|
|
|
|
import ru.soune.nocopy.entity.tarif.Tariff;
|
|
|
|
|
import ru.soune.nocopy.entity.user.User;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
|
|
|
|
@Entity
|
|
|
|
|
@Table(name = "payment")
|
|
|
|
|
@AllArgsConstructor
|
|
|
|
|
@NoArgsConstructor
|
|
|
|
|
@Getter
|
|
|
|
|
@Setter
|
|
|
|
|
@EntityListeners(AuditingEntityListener.class)
|
|
|
|
|
public class Payment {
|
|
|
|
|
|
|
|
|
|
@Id
|
|
|
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
|
|
private Long id;
|
|
|
|
|
|
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
|
|
|
@Column(name = "status", nullable = false)
|
|
|
|
|
private PaymentStatus status;
|
|
|
|
|
|
|
|
|
|
@Column(name = "payment_uuid", unique = true)
|
|
|
|
|
private String paymentUuid;
|
|
|
|
|
|
|
|
|
|
@Column(name = "amount")
|
|
|
|
|
private Double amount;
|
|
|
|
|
|
|
|
|
|
@CreatedDate
|
|
|
|
|
@Column(name = "created_at", updatable = false, nullable = false)
|
|
|
|
|
private LocalDateTime createdAt;
|
|
|
|
|
|
|
|
|
|
@LastModifiedDate
|
|
|
|
|
@Column(name = "updated_at")
|
|
|
|
|
private LocalDateTime updatedAt;
|
|
|
|
|
|
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
|
|
|
@Column(name = "operation_type", nullable = false)
|
|
|
|
|
private PaymentOperationType operationType;
|
|
|
|
|
|
|
|
|
|
@Column(name = "cancellation_reason")
|
|
|
|
|
private String cancellationReason;
|
|
|
|
|
|
|
|
|
|
@ManyToOne
|
|
|
|
|
@JoinColumn(name = "user_id", nullable = false)
|
|
|
|
|
private User user;
|
|
|
|
|
|
|
|
|
|
@ManyToOne
|
|
|
|
|
@JoinColumn(name = "tariff_id")
|
|
|
|
|
private Tariff tariff;
|
|
|
|
|
}
|