2023-07-27 20:46:37 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/google/uuid"
|
2024-04-01 18:29:24 +00:00
|
|
|
"payment-poc/domain/state"
|
2023-07-27 20:46:37 +00:00
|
|
|
"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
|
2024-04-01 18:29:24 +00:00
|
|
|
WsPayOrderId string `db:"ws_pay_order_id"`
|
2023-07-30 10:14:05 +00:00
|
|
|
ShoppingCardID *string `db:"shopping_card_id"`
|
2023-07-27 20:46:37 +00:00
|
|
|
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
|
|
|
|
}
|