posnet

package
v0.0.0-...-d846d7a Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Currencies = map[string]string{
	"TRY": "TL",
	"YTL": "TL",
	"TRL": "TL",
	"TL":  "TL",
	"USD": "US",
	"US":  "US",
	"EUR": "EU",
	"EU":  "EU",
}
View Source
var EndPoints = map[string]string{
	"PROD":   "https://posnet.yapikredi.com.tr/PosnetWebService/XML",
	"PROD3D": "https://posnet.yapikredi.com.tr/3DSWebService/YKBPaymentService",

	"TEST":   "https://setmpos.ykb.com/PosnetWebService/XML",
	"TEST3D": "https://setmpos.ykb.com/3DSWebService/YKBPaymentService",
}

Functions

func Amount

func Amount(amount string) string

func Api

func Api(merchant, terminal string) (*API, *Request)

func B64

func B64(data string) (hash string)

func Currency

func Currency(currency string) string

func D64

func D64(data string) []byte

func Expiry

func Expiry(month, year string) string

func Installment

func Installment(installment string) string

func MAC

func MAC(xid, amount, currency, mid, key, tid, extra string) (mac string)

func QueryString

func QueryString(v interface{}) (url.Values, error)

func SHA256

func SHA256(data string) (hash string)

func String

func String(v reflect.Value) string

func XID

func XID(n int) string

Types

type API

type API struct {
	Mode string
	Key  string
	Pid  string
}

func (*API) Transaction

func (api *API) Transaction(ctx context.Context, req *Request) (res Response, err error)

func (*API) Transaction3D

func (api *API) Transaction3D(ctx context.Context, req *Form) (res string, err error)

type Auth

type Auth struct {
	Card        *Card  `xml:"cardInfo,omitempty"`
	CardNumber  string `xml:"ccno,omitempty"`
	CardExpiry  string `xml:"expDate,omitempty"`
	CardCode    string `xml:"cvc,omitempty"`
	Amount      string `xml:"amount,omitempty"`
	Currency    string `xml:"currencyCode,omitempty"`
	Installment string `xml:"installment,omitempty"`
	OrderId     string `xml:"orderID,omitempty"`
	Mailorder   string `xml:"mailorderflag,omitempty"`
}

type Cancel

type Cancel struct {
	Transaction string `xml:"transaction,omitempty"`
	HostLogKey  string `xml:"hostlogkey,omitempty"`
}

type Card

type Card struct {
	InquiryValue string `xml:"inquiryValue,omitempty"`
	CardNoFirst  string `xml:"cardNoFirst,omitempty"`
	CardNoLast   string `xml:"cardNoLast,omitempty"`
}

type Form

type Form struct {
	MerchantID string `form:"mid,omitempty"`
	PosnetID   string `form:"posnetID,omitempty"`
	Data1      string `form:"posnetData,omitempty"`
	Data2      string `form:"posnetData2,omitempty"`
	Sign       string `form:"digest,omitempty"`
	VftCode    string `form:"vftCode,omitempty"`
	ReturnUrl  string `form:"merchantReturnURL,omitempty"`
	Url        string `form:"url,omitempty"`
	NewWindow  string `form:"openANewWindow,omitempty"`
	Lang       string `form:"lang,omitempty"`
}

type OOS

type OOS struct {
	PosnetID    string `xml:"posnetid,omitempty"`
	XID         string `xml:"XID,omitempty"`
	TranType    string `xml:"tranType,omitempty"`
	CardHolder  string `xml:"cardHolderName,omitempty"`
	CardNumber  string `xml:"ccno,omitempty"`
	CardExpiry  string `xml:"expDate,omitempty"`
	CardCode    string `xml:"cvc,omitempty"`
	Amount      string `xml:"amount,omitempty"`
	Currency    string `xml:"currencyCode,omitempty"`
	Installment string `xml:"installment,omitempty"`
}

type OOSMerchant

type OOSMerchant struct {
	BankData     string `xml:"bankData,omitempty"`
	MerchantData string `xml:"merchantData,omitempty"`
	SIGN         string `xml:"sign,omitempty"`
	MAC          string `xml:"mac,omitempty"`
}

type OOSTran

type OOSTran struct {
	BankData string `xml:"bankData,omitempty"`
	WpAmount string `xml:"wpAmount,omitempty"`
	MAC      string `xml:"mac,omitempty"`
}

type PostAuth

type PostAuth struct {
	Amount      string `xml:"amount,omitempty"`
	Currency    string `xml:"currencyCode,omitempty"`
	Installment string `xml:"installment,omitempty"`
	HostLogKey  string `xml:"hostlogkey,omitempty"`
}

type PreAuth

type PreAuth struct {
	Card        *Card  `xml:"cardInfo,omitempty"`
	CardNumber  string `xml:"ccno,omitempty"`
	CardExpiry  string `xml:"expDate,omitempty"`
	CardCode    string `xml:"cvc,omitempty"`
	Amount      string `xml:"amount,omitempty"`
	Currency    string `xml:"currencyCode,omitempty"`
	Installment string `xml:"installment,omitempty"`
	OrderId     string `xml:"orderID,omitempty"`
}

type Refund

type Refund struct {
	Amount      string `xml:"amount,omitempty"`
	Currency    string `xml:"currencyCode,omitempty"`
	Transaction string `xml:"transaction,omitempty"`
	HostLogKey  string `xml:"hostlogkey,omitempty"`
}

type Request

type Request struct {
	XMLName     xml.Name     `xml:"posnetRequest,omitempty"`
	MerchantID  string       `xml:"mid,omitempty"`
	TerminalID  string       `xml:"tid,omitempty"`
	TranDate    string       `xml:"tranDateRequired,omitempty"`
	OOS         *OOS         `xml:"oosRequestData,omitempty"`
	OOSMerchant *OOSMerchant `xml:"oosResolveMerchantData,omitempty"`
	OOSTran     *OOSTran     `xml:"oosTranData,omitempty"`
	PreAuth     *PreAuth     `xml:"auth,omitempty"`
	Auth        *Auth        `xml:"sale,omitempty"`
	PostAuth    *PostAuth    `xml:"capt,omitempty"`
	Refund      *Refund      `xml:"return,omitempty"`
	Cancel      *Cancel      `xml:"reverse,omitempty"`
}

type Response

type Response struct {
	XMLName    xml.Name `xml:"posnetResponse,omitempty"`
	Approved   string   `xml:"approved,omitempty"`
	HostLogKey string   `xml:"hostlogkey,omitempty"`
	AuthCode   string   `xml:"authCode,omitempty"`
	ErrorCode  string   `xml:"respCode,omitempty"`
	ErrorText  string   `xml:"respText,omitempty"`
	TranDate   string   `xml:"tranDate,omitempty"`
	YourIP     string   `xml:"yourIP,omitempty"`
	MAC        string   `xml:"mac,omitempty"`
	OOS        struct {
		Data1 string `xml:"data1,omitempty"`
		Data2 string `xml:"data2,omitempty"`
		Sign  string `xml:"sign,omitempty"`
	} `xml:"oosRequestDataResponse,omitempty"`
	OOSMerchant struct {
		XID         string `xml:"XID,omitempty"`
		Amount      string `xml:"amount,omitempty"`
		Currency    string `xml:"currency,omitempty"`
		Installment string `xml:"installment,omitempty"`
		TxStatus    string `xml:"txStatus,omitempty"`
		MdStatus    string `xml:"mdStatus,omitempty"`
		MdError     string `xml:"mdErrorMessage,omitempty"`
		MAC         string `xml:"mac,omitempty"`
	} `xml:"oosResolveMerchantDataResponse,omitempty"`
}

Jump to

Keyboard shortcuts

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