mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 08:58:48 +00:00
añadidos ficheros a falta de modificar el servicio y el controlador redsys
This commit is contained in:
164
src/main/java/com/imprimelibros/erp/payments/model/Payment.java
Normal file
164
src/main/java/com/imprimelibros/erp/payments/model/Payment.java
Normal file
@ -0,0 +1,164 @@
|
||||
package com.imprimelibros.erp.payments.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "payments")
|
||||
public class Payment {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "order_id", nullable = false)
|
||||
private Long orderId;
|
||||
|
||||
@Column(name = "user_id")
|
||||
private Long userId;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "payment_method_id")
|
||||
private PaymentMethod paymentMethod;
|
||||
|
||||
@Column(nullable = false, length = 3)
|
||||
private String currency;
|
||||
|
||||
@Column(name = "amount_total_cents", nullable = false)
|
||||
private Long amountTotalCents;
|
||||
|
||||
@Column(name = "amount_captured_cents", nullable = false)
|
||||
private Long amountCapturedCents = 0L;
|
||||
|
||||
@Column(name = "amount_refunded_cents", nullable = false)
|
||||
private Long amountRefundedCents = 0L;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false, length = 32)
|
||||
private PaymentStatus status = PaymentStatus.REQUIRES_PAYMENT_METHOD;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "capture_method", nullable = false, length = 16)
|
||||
private CaptureMethod captureMethod = CaptureMethod.AUTOMATIC;
|
||||
|
||||
@Column(nullable = false, length = 32)
|
||||
private String gateway;
|
||||
|
||||
@Column(name = "gateway_payment_id", length = 128)
|
||||
private String gatewayPaymentId;
|
||||
|
||||
@Column(name = "gateway_order_id", length = 12)
|
||||
private String gatewayOrderId;
|
||||
|
||||
@Column(name = "authorization_code", length = 32)
|
||||
private String authorizationCode;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "three_ds_status", nullable = false, length = 32)
|
||||
private ThreeDSStatus threeDsStatus = ThreeDSStatus.NOT_APPLICABLE;
|
||||
|
||||
@Column(length = 22)
|
||||
private String descriptor;
|
||||
|
||||
@Lob
|
||||
@Column(name = "client_ip", columnDefinition = "varbinary(16)")
|
||||
private byte[] clientIp;
|
||||
|
||||
@Column(name = "authorized_at")
|
||||
private LocalDateTime authorizedAt;
|
||||
|
||||
@Column(name = "captured_at")
|
||||
private LocalDateTime capturedAt;
|
||||
|
||||
@Column(name = "canceled_at")
|
||||
private LocalDateTime canceledAt;
|
||||
|
||||
@Column(name = "failed_at")
|
||||
private LocalDateTime failedAt;
|
||||
|
||||
@Column(columnDefinition = "json")
|
||||
private String metadata;
|
||||
|
||||
@Column(name = "created_at", nullable = false,
|
||||
columnDefinition = "datetime default current_timestamp")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "updated_at", nullable = false,
|
||||
columnDefinition = "datetime default current_timestamp on update current_timestamp")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
public Payment() {}
|
||||
|
||||
// Getters y setters ↓ (los típicos)
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
|
||||
public Long getOrderId() { return orderId; }
|
||||
public void setOrderId(Long orderId) { this.orderId = orderId; }
|
||||
|
||||
public Long getUserId() { return userId; }
|
||||
public void setUserId(Long userId) { this.userId = userId; }
|
||||
|
||||
public PaymentMethod getPaymentMethod() { return paymentMethod; }
|
||||
public void setPaymentMethod(PaymentMethod paymentMethod) { this.paymentMethod = paymentMethod; }
|
||||
|
||||
public String getCurrency() { return currency; }
|
||||
public void setCurrency(String currency) { this.currency = currency; }
|
||||
|
||||
public Long getAmountTotalCents() { return amountTotalCents; }
|
||||
public void setAmountTotalCents(Long amountTotalCents) { this.amountTotalCents = amountTotalCents; }
|
||||
|
||||
public Long getAmountCapturedCents() { return amountCapturedCents; }
|
||||
public void setAmountCapturedCents(Long amountCapturedCents) { this.amountCapturedCents = amountCapturedCents; }
|
||||
|
||||
public Long getAmountRefundedCents() { return amountRefundedCents; }
|
||||
public void setAmountRefundedCents(Long amountRefundedCents) { this.amountRefundedCents = amountRefundedCents; }
|
||||
|
||||
public PaymentStatus getStatus() { return status; }
|
||||
public void setStatus(PaymentStatus status) { this.status = status; }
|
||||
|
||||
public CaptureMethod getCaptureMethod() { return captureMethod; }
|
||||
public void setCaptureMethod(CaptureMethod captureMethod) { this.captureMethod = captureMethod; }
|
||||
|
||||
public String getGateway() { return gateway; }
|
||||
public void setGateway(String gateway) { this.gateway = gateway; }
|
||||
|
||||
public String getGatewayPaymentId() { return gatewayPaymentId; }
|
||||
public void setGatewayPaymentId(String gatewayPaymentId) { this.gatewayPaymentId = gatewayPaymentId; }
|
||||
|
||||
public String getGatewayOrderId() { return gatewayOrderId; }
|
||||
public void setGatewayOrderId(String gatewayOrderId) { this.gatewayOrderId = gatewayOrderId; }
|
||||
|
||||
public String getAuthorizationCode() { return authorizationCode; }
|
||||
public void setAuthorizationCode(String authorizationCode) { this.authorizationCode = authorizationCode; }
|
||||
|
||||
public ThreeDSStatus getThreeDsStatus() { return threeDsStatus; }
|
||||
public void setThreeDsStatus(ThreeDSStatus threeDsStatus) { this.threeDsStatus = threeDsStatus; }
|
||||
|
||||
public String getDescriptor() { return descriptor; }
|
||||
public void setDescriptor(String descriptor) { this.descriptor = descriptor; }
|
||||
|
||||
public byte[] getClientIp() { return clientIp; }
|
||||
public void setClientIp(byte[] clientIp) { this.clientIp = clientIp; }
|
||||
|
||||
public LocalDateTime getAuthorizedAt() { return authorizedAt; }
|
||||
public void setAuthorizedAt(LocalDateTime authorizedAt) { this.authorizedAt = authorizedAt; }
|
||||
|
||||
public LocalDateTime getCapturedAt() { return capturedAt; }
|
||||
public void setCapturedAt(LocalDateTime capturedAt) { this.capturedAt = capturedAt; }
|
||||
|
||||
public LocalDateTime getCanceledAt() { return canceledAt; }
|
||||
public void setCanceledAt(LocalDateTime canceledAt) { this.canceledAt = canceledAt; }
|
||||
|
||||
public LocalDateTime getFailedAt() { return failedAt; }
|
||||
public void setFailedAt(LocalDateTime failedAt) { this.failedAt = failedAt; }
|
||||
|
||||
public String getMetadata() { return metadata; }
|
||||
public void setMetadata(String metadata) { this.metadata = metadata; }
|
||||
|
||||
public LocalDateTime getCreatedAt() { return createdAt; }
|
||||
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
||||
|
||||
public LocalDateTime getUpdatedAt() { return updatedAt; }
|
||||
public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
|
||||
}
|
||||
Reference in New Issue
Block a user