94 lines
2.7 KiB
Go
94 lines
2.7 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type PaymentStatus string
|
|
|
|
const (
|
|
PaymentStatusPending PaymentStatus = "pending"
|
|
PaymentStatusCompleted PaymentStatus = "completed"
|
|
PaymentStatusFailed PaymentStatus = "failed"
|
|
)
|
|
|
|
type ChapaDepositRequest struct {
|
|
Amount Currency `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
Email string `json:"email"`
|
|
FirstName string `json:"first_name"`
|
|
LastName string `json:"last_name"`
|
|
TxRef string `json:"tx_ref"`
|
|
CallbackURL string `json:"callback_url"`
|
|
ReturnURL string `json:"return_url"`
|
|
}
|
|
|
|
type ChapaDepositRequestPayload struct {
|
|
Amount float64 `json:"amount" validate:"required,gt=0"`
|
|
}
|
|
|
|
type ChapaWebhookPayload struct {
|
|
TxRef string `json:"tx_ref"`
|
|
Amount Currency `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
Status PaymentStatus `json:"status"`
|
|
}
|
|
|
|
// PaymentResponse contains the response from payment initialization
|
|
type ChapaDepositResponse struct {
|
|
CheckoutURL string
|
|
Reference string
|
|
}
|
|
|
|
// PaymentVerification contains payment verification details
|
|
type ChapaDepositVerification struct {
|
|
Status PaymentStatus
|
|
Amount Currency
|
|
Currency string
|
|
}
|
|
|
|
type ChapaVerificationResponse struct {
|
|
Status string `json:"status"`
|
|
Amount float64 `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
TxRef string `json:"tx_ref"`
|
|
}
|
|
|
|
type Bank struct {
|
|
ID int `json:"id"`
|
|
Slug string `json:"slug"`
|
|
Swift string `json:"swift"`
|
|
Name string `json:"name"`
|
|
AcctLength int `json:"acct_length"`
|
|
CountryID int `json:"country_id"`
|
|
IsMobileMoney int `json:"is_mobilemoney"` // nullable
|
|
IsActive int `json:"is_active"`
|
|
IsRTGS int `json:"is_rtgs"`
|
|
Active int `json:"active"`
|
|
Is24Hrs int `json:"is_24hrs"` // nullable
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Currency string `json:"currency"`
|
|
}
|
|
|
|
type BankResponse struct {
|
|
Message string `json:"message"`
|
|
Status string `json:"status"`
|
|
Data []BankData `json:"data"`
|
|
}
|
|
|
|
type BankData struct {
|
|
ID int `json:"id"`
|
|
Slug string `json:"slug"`
|
|
Swift string `json:"swift"`
|
|
Name string `json:"name"`
|
|
AcctLength int `json:"acct_length"`
|
|
CountryID int `json:"country_id"`
|
|
IsMobileMoney int `json:"is_mobilemoney"` // nullable
|
|
IsActive int `json:"is_active"`
|
|
IsRTGS int `json:"is_rtgs"`
|
|
Active int `json:"active"`
|
|
Is24Hrs int `json:"is_24hrs"` // nullable
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Currency string `json:"currency"`
|
|
}
|