init
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
package constants
|
||||
|
||||
type PaymentMethodType string
|
||||
|
||||
const (
|
||||
PaymentMethodTypeCash PaymentMethodType = "cash"
|
||||
PaymentMethodTypeCard PaymentMethodType = "card"
|
||||
PaymentMethodTypeDigitalWallet PaymentMethodType = "digital_wallet"
|
||||
PaymentMethodTypeQR PaymentMethodType = "qr"
|
||||
PaymentMethodTypeEDC PaymentMethodType = "edc"
|
||||
)
|
||||
|
||||
type PaymentStatus string
|
||||
|
||||
const (
|
||||
PaymentStatusPending PaymentStatus = "pending"
|
||||
PaymentStatusCompleted PaymentStatus = "completed"
|
||||
PaymentStatusFailed PaymentStatus = "failed"
|
||||
PaymentStatusRefunded PaymentStatus = "refunded"
|
||||
)
|
||||
|
||||
type PaymentTransactionStatus string
|
||||
|
||||
const (
|
||||
PaymentTransactionStatusPending PaymentTransactionStatus = "pending"
|
||||
PaymentTransactionStatusCompleted PaymentTransactionStatus = "completed"
|
||||
PaymentTransactionStatusFailed PaymentTransactionStatus = "failed"
|
||||
PaymentTransactionStatusRefunded PaymentTransactionStatus = "refunded"
|
||||
)
|
||||
|
||||
func GetAllPaymentMethodTypes() []PaymentMethodType {
|
||||
return []PaymentMethodType{
|
||||
PaymentMethodTypeCash,
|
||||
PaymentMethodTypeCard,
|
||||
PaymentMethodTypeDigitalWallet,
|
||||
}
|
||||
}
|
||||
|
||||
func GetAllPaymentStatuses() []PaymentStatus {
|
||||
return []PaymentStatus{
|
||||
PaymentStatusPending,
|
||||
PaymentStatusCompleted,
|
||||
PaymentStatusFailed,
|
||||
PaymentStatusRefunded,
|
||||
}
|
||||
}
|
||||
|
||||
func GetAllPaymentTransactionStatuses() []PaymentTransactionStatus {
|
||||
return []PaymentTransactionStatus{
|
||||
PaymentTransactionStatusPending,
|
||||
PaymentTransactionStatusCompleted,
|
||||
PaymentTransactionStatusFailed,
|
||||
PaymentTransactionStatusRefunded,
|
||||
}
|
||||
}
|
||||
|
||||
func IsValidPaymentMethodType(methodType PaymentMethodType) bool {
|
||||
for _, validType := range GetAllPaymentMethodTypes() {
|
||||
if methodType == validType {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsValidPaymentStatus(status PaymentStatus) bool {
|
||||
for _, validStatus := range GetAllPaymentStatuses() {
|
||||
if status == validStatus {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsValidPaymentTransactionStatus(status PaymentTransactionStatus) bool {
|
||||
for _, validStatus := range GetAllPaymentTransactionStatuses() {
|
||||
if status == validStatus {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user