payment-poc/domain/providers/viva/viva.go

58 lines
1.6 KiB
Go
Raw Normal View History

package viva
2024-04-01 18:29:24 +00:00
import (
"payment-poc/domain/database"
)
2023-07-27 20:46:37 +00:00
type OrderRequest struct {
Amount int64 `json:"amount"`
Description string `json:"customerTrns"`
MerchantDescription string `json:"merchantTrns"`
PreAuth bool `json:"preauth"`
AllowRecurring bool `json:"allowRecurring"`
Source string `json:"sourceCode"`
}
2023-07-27 20:46:37 +00:00
type OrderResponse struct {
OrderId database.OrderId `json:"orderCode"`
}
2023-07-27 20:46:37 +00:00
type OAuthResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
}
2023-07-27 20:46:37 +00:00
type TransactionCompleteRequest struct {
Amount int64 `json:"amount"`
CustomerDescription string `json:"customerTrns"`
}
2023-07-27 20:46:37 +00:00
type TransactionResponse struct {
2024-04-01 18:29:24 +00:00
Amount int64 `json:"Amount"`
StatusId string `json:"StatusId"`
ErrorCode int64 `json:"ErrorCode"`
ErrorText string `json:"ErrorText"`
EventId int64 `json:"EventId"`
Success bool `json:"Success"`
}
2023-07-31 07:21:54 +00:00
type TransactionStatus string
const (
2024-04-01 18:29:24 +00:00
PaymentSuccessful TransactionStatus = "C"
2023-07-31 07:21:54 +00:00
PaymentPending TransactionStatus = "A"
2024-04-01 18:29:24 +00:00
PaymentPreauthorized TransactionStatus = "F"
2023-07-31 07:21:54 +00:00
PaymentUnsuccessful TransactionStatus = "E"
PaymentRefunded TransactionStatus = "R"
PaymentVoided TransactionStatus = "X"
)
type TransactionStatusResponse struct {
Email string `json:"email"`
2024-04-01 18:29:24 +00:00
Amount float64 `json:"amount"`
2023-07-31 07:21:54 +00:00
OrderCode database.OrderId `json:"orderCode"`
StatusId TransactionStatus `json:"statusId"`
FullName string `json:"fullName"`
CardNumber string `json:"cardNumber"`
}