pass

package
v1.2.30-alpha1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderInqueryStatusPaid      string = "paid"
	OrderInqueryStatusPending   string = "pending"
	OrderInqueryStatusCancelled string = "cancelled"
	OrderInqueryStatusVoided    string = "voided"
)
View Source
const (
	WebhookOperationPayment string = "payment"
	WebhookOperationVoid    string = "void"
)

Variables

View Source
var (
	PassCreateOrder = utils.API{
		Url:    "/create_order",
		Method: http.MethodPost,
	}
	PassInqueryOrder = utils.API{
		Url:    "/order_inquiry",
		Method: http.MethodPost,
	}
	PassNotifyOrder = utils.API{
		Url:    "/order_notify",
		Method: http.MethodPost,
	}
	PassCancelOrder = utils.API{
		Url:    "/cancel_order",
		Method: http.MethodPost,
	}
	PassVoidOrder = utils.API{
		Url:    "/void",
		Method: http.MethodPost,
	}
)

Functions

This section is empty.

Types

type BaseError

type BaseError struct {
	Code  string `json:"code"`
	Level string `json:"level"`
	Body  string `json:"body"`
}

type CreateOrderInput

type CreateOrderInput struct {
	EcommerceToken string `json:"ecommerce_token"`
	Amount         int64  `json:"amount"`
	CallbackURL    string `json:"callback_url"`
}

type CreateOrderResponse

type CreateOrderResponse struct {
	StatusCode string          `json:"status_code"`
	Ret        *RetCreateOrder `json:"ret,omitempty"`
	Msg        *BaseError      `json:"msg,omitempty"`
}

type CustomerData

type CustomerData struct {
	UserID   string `json:"user_id"`
	UniqueID string `json:"unique_id"`
}

type Datum

type Datum struct {
	Success   bool   `json:"success"`
	MessageID string `json:"message_id"`
}

type OrderCancelInput

type OrderCancelInput struct {
	EcommerceToken string `json:"ecommerce_token"`
	OrderID        string `json:"order_id"`
}

type OrderCancelResponse

type OrderCancelResponse struct {
	StatusCode string          `json:"status_code"`
	Ret        *RetOrderCancel `json:"ret,omitempty"`
	Msg        *BaseError      `json:"msg,omitempty"`
}

type OrderInqueryInput

type OrderInqueryInput struct {
	EcommerceToken string `json:"ecommerce_token"`
	OrderID        string `json:"order_id"`
}

type OrderInqueryResponse

type OrderInqueryResponse struct {
	StatusCode string           `json:"status_code"`
	Ret        *RetInqueryOrder `json:"ret,omitempty"`
	Msg        *BaseError       `json:"msg,omitempty"`
}

type OrderNotifyInput

type OrderNotifyInput struct {
	EcommerceToken string `json:"ecommerce_token"`
	OrderID        string `json:"order_id"`
	Phone          string `json:"phone"`
}

type OrderNotifyResponse

type OrderNotifyResponse struct {
	StatusCode string          `json:"status_code"`
	Ret        *RetNotifyOrder `json:"ret,omitempty"`
	Msg        *BaseError      `json:"msg,omitempty"`
}

type OrderVoidInput

type OrderVoidInput struct {
	EcommerceToken string `json:"ecommerce_token"`
	OrderID        string `json:"order_id"`
}

type OrderVoidResponse

type OrderVoidResponse struct {
	StatusCode string        `json:"status_code"`
	Ret        *RetOrderVoid `json:"ret,omitempty"`
	Msg        *BaseError    `json:"msg,omitempty"`
}

type Pass

type Pass interface {
	CreateOrder(amount int64, callbackParams map[string]string) (CreateOrderResponse, error)
	InqueryOrder(orderID string) (OrderInqueryResponse, error)
	NotifyOrder(orderID, phone string) (OrderNotifyResponse, error)
	CancelOrder(orderID string) (OrderCancelResponse, error)
	VoidOrder(orderID string) (OrderVoidResponse, error)
}

func New

func New(endpoint, ecommerceToken, callback string) Pass

type RetCreateOrder

type RetCreateOrder struct {
	Shop     string `json:"shop"`
	Amount   string `json:"amount"`
	OrderID  string `json:"order_id"`
	OrderTTL int64  `json:"order_ttl"`
	DBRefNo  string `json:"db_ref_no"`
}

type RetInqueryOrder

type RetInqueryOrder struct {
	RespCode     string            `json:"resp_code"`
	RespMsg      string            `json:"resp_msg"`
	Status       string            `json:"status"`
	Amount       string            `json:"amount"`
	CustomerData *CustomerData     `json:"customer_data,omitempty"`
	LoyaltyData  interface{}       `json:"loyalty_data,omitempty"`
	DBRefNo      string            `json:"db_ref_no"`
	ExtraData    map[string]string `json:"extra_data,omitempty"`
	StatusText   string            `json:"status_text"`
}

type RetNotifyOrder

type RetNotifyOrder struct {
	RespCode string  `json:"resp_code"`
	RespMsg  string  `json:"resp_msg"`
	Success  int64   `json:"success"`
	Data     []Datum `json:"data"`
}

type RetOrderCancel

type RetOrderCancel struct {
	RespCode    string      `json:"resp_code"`
	RespMsg     string      `json:"resp_msg"`
	Status      string      `json:"status"`
	Amount      string      `json:"amount"`
	LoyaltyData interface{} `json:"loyalty_data"`
	DBRefNo     string      `json:"db_ref_no"`
}

type RetOrderVoid

type RetOrderVoid struct {
	RespCode    string      `json:"resp_code"`
	RespMsg     string      `json:"resp_msg"`
	Status      string      `json:"status"`
	Amount      string      `json:"amount"`
	LoyaltyData interface{} `json:"loyalty_data"`
	DBRefNo     string      `json:"db_ref_no"`
	ServiceName string      `json:"service_name"`
	DateTime    string      `json:"date_time"`
	TraceNo     string      `json:"trace_no"`
	Rrn         string      `json:"rrn"`
	TerminalID  string      `json:"terminal_id"`
	MerchantID  string      `json:"merchant_id"`
}

type WebhookCallbackResponse

type WebhookCallbackResponse struct {
	OrderID          string            `json:"order_id"`
	PaymentRequestID string            `json:"payment_request_id"`
	PosID            string            `json:"pos_id"`
	Operation        string            `json:"operation"`
	IsSuccess        bool              `json:"is_success"`
	Amount           string            `json:"amount"`
	CreatedTime      string            `json:"created_time"`
	CustomerData     *CustomerData     `json:"customer_data,omitempty"`
	ExtraData        map[string]string `json:"extra_data,omitempty"`
	DBRefNo          string            `json:"db_ref_no"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL