55 lines
1.1 KiB
Go
55 lines
1.1 KiB
Go
|
package database
|
||
|
|
||
|
import (
|
||
|
"github.com/google/uuid"
|
||
|
"payment-poc/state"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type PaymentEntry struct {
|
||
|
Id uuid.UUID `db:"id"`
|
||
|
|
||
|
Created time.Time `db:"created"`
|
||
|
Modified *time.Time `db:"modified"`
|
||
|
|
||
|
Gateway state.PaymentGateway `db:"gateway"`
|
||
|
State state.PaymentState `db:"state"`
|
||
|
|
||
|
Lang *string `db:"lang"`
|
||
|
|
||
|
Error *string `db:"error"`
|
||
|
|
||
|
// paid amount
|
||
|
Amount *int64 `db:"amount"`
|
||
|
// preauthorized amount
|
||
|
TotalAmount int64 `db:"total_amount"`
|
||
|
|
||
|
// used for wspay and viva
|
||
|
ECI *string `db:"eci"`
|
||
|
|
||
|
// stripe field
|
||
|
PaymentIntentId *string `db:"payment_intent_id"`
|
||
|
|
||
|
// wspay field
|
||
|
ShoppingCardID *string `db:"shopping_card_it"`
|
||
|
STAN *string `db:"stan"`
|
||
|
Success *int `db:"success"`
|
||
|
ApprovalCode *string `db:"approval_code"`
|
||
|
|
||
|
// viva field
|
||
|
OrderId *OrderId `db:"order_id"`
|
||
|
TransactionId *uuid.UUID `db:"transaction_id"`
|
||
|
EventId *string `db:"event_id"`
|
||
|
}
|
||
|
|
||
|
type OrderId string
|
||
|
|
||
|
func (o OrderId) MarshalJSON() ([]byte, error) {
|
||
|
return []byte(o), nil
|
||
|
}
|
||
|
|
||
|
func (o *OrderId) UnmarshalJSON(value []byte) error {
|
||
|
*o = OrderId(value)
|
||
|
return nil
|
||
|
}
|