Yimaru-BackEnd/internal/domain/payment.go

73 lines
1.7 KiB
Go

package domain
import "time"
type PaymentStatus string
const (
PaymentStatusPending PaymentStatus = "PENDING"
PaymentStatusProcessing PaymentStatus = "PROCESSING"
PaymentStatusSuccess PaymentStatus = "SUCCESS"
PaymentStatusFailed PaymentStatus = "FAILED"
PaymentStatusCancelled PaymentStatus = "CANCELLED"
PaymentStatusExpired PaymentStatus = "EXPIRED"
)
type Payment struct {
ID int64
UserID int64
PlanID *int64
SubscriptionID *int64
SessionID *string
TransactionID *string
Nonce string
Amount float64
Currency string
PaymentMethod *string
Status string
PaymentURL *string
PaidAt *time.Time
ExpiresAt *time.Time
CreatedAt time.Time
UpdatedAt *time.Time
PlanName *string
}
type CreatePaymentInput struct {
UserID int64
PlanID *int64
Amount float64
Currency string
PaymentMethod *string
Nonce string
ExpiresAt *time.Time
}
type InitiateSubscriptionPaymentRequest struct {
PlanID int64 `json:"plan_id" validate:"required"`
Phone string `json:"phone" validate:"required"`
Email string `json:"email" validate:"required,email"`
}
type InitiateSubscriptionPaymentResponse struct {
PaymentID int64 `json:"payment_id"`
SessionID string `json:"session_id"`
PaymentURL string `json:"payment_url"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
ExpiresAt string `json:"expires_at"`
}
type VerifyPaymentRequest struct {
SessionID string `json:"session_id"`
}
type PaymentWebhookData struct {
SessionID string
TransactionID string
Nonce string
TransactionStatus string
PaymentMethod string
TotalAmount float64
}