58 lines
1.6 KiB
Go
58 lines
1.6 KiB
Go
package viva
|
|
|
|
import (
|
|
"payment-poc/domain/database"
|
|
)
|
|
|
|
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"`
|
|
}
|
|
|
|
type OrderResponse struct {
|
|
OrderId database.OrderId `json:"orderCode"`
|
|
}
|
|
|
|
type OAuthResponse struct {
|
|
AccessToken string `json:"access_token"`
|
|
ExpiresIn int `json:"expires_in"`
|
|
}
|
|
|
|
type TransactionCompleteRequest struct {
|
|
Amount int64 `json:"amount"`
|
|
CustomerDescription string `json:"customerTrns"`
|
|
}
|
|
|
|
type TransactionResponse struct {
|
|
Amount int64 `json:"Amount"`
|
|
StatusId string `json:"StatusId"`
|
|
ErrorCode int64 `json:"ErrorCode"`
|
|
ErrorText string `json:"ErrorText"`
|
|
EventId int64 `json:"EventId"`
|
|
Success bool `json:"Success"`
|
|
}
|
|
|
|
type TransactionStatus string
|
|
|
|
const (
|
|
PaymentSuccessful TransactionStatus = "C"
|
|
PaymentPending TransactionStatus = "A"
|
|
PaymentPreauthorized TransactionStatus = "F"
|
|
PaymentUnsuccessful TransactionStatus = "E"
|
|
PaymentRefunded TransactionStatus = "R"
|
|
PaymentVoided TransactionStatus = "X"
|
|
)
|
|
|
|
type TransactionStatusResponse struct {
|
|
Email string `json:"email"`
|
|
Amount float64 `json:"amount"`
|
|
OrderCode database.OrderId `json:"orderCode"`
|
|
StatusId TransactionStatus `json:"statusId"`
|
|
FullName string `json:"fullName"`
|
|
CardNumber string `json:"cardNumber"`
|
|
}
|