Updates
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
package com.test.payment.models;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* MTN MoMo's answer to an initiation. providerReference is the generated X-Reference-Id UUID.
|
||||
*
|
||||
* <p>One row per initiation. Independent of the other operators' response tables —
|
||||
* the lifecycle reads it through PaymentLifecycleStore's StoredResponse view.
|
||||
*/
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString(exclude = "Initiation")
|
||||
public class MtnPaymentResponse {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long Id;
|
||||
|
||||
/** The attempt this answers. Unique: one response per initiation. */
|
||||
@ManyToOne(targetEntity = PaymentInitiation.class, fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "Initiation", nullable = false, unique = true)
|
||||
private PaymentInitiation Initiation;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false, length = 20)
|
||||
private PaymentProviderType Provider;
|
||||
|
||||
/** Lookup key for callbacks and status checks. */
|
||||
@Column(unique = true, length = 100)
|
||||
private String ProviderReference;
|
||||
|
||||
@Column(length = 100)
|
||||
private String SecondaryReference;
|
||||
|
||||
@Column(length = 30)
|
||||
private String ResponseCode;
|
||||
|
||||
@Column(length = 255)
|
||||
private String ResponseDescription;
|
||||
|
||||
@Column(length = 255)
|
||||
private String CustomerMessage;
|
||||
|
||||
@Column(nullable = false)
|
||||
private LocalDateTime CreatedAt;
|
||||
|
||||
public Long initiationId() {
|
||||
return Initiation == null ? null : Initiation.getId();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user