payture

package
v0.0.0-...-2aa44d1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SESSION_PAY   string = "Pay"
	SESSION_ADD   string = "Add"
	SESSION_BLOCK string = "Block"
)
View Source
const (
	API     string = "api"
	INPAY   string = "apim"
	EWALLET string = "vwapi"
)
View Source
const (
	APPLE      string = "apple"
	MASTERPASS string = "mspass"
	ANDROID    string = "android"
)
View Source
const (
	ORDERID     string = "OrderId"
	PASSWORD    string = "Password"
	KEY         string = "Key"
	AMOUNT      string = "Amount"
	VWID        string = "VWID"
	DATAUP      string = "DATA"
	DATA        string = "Data"
	SESSIONID   string = "SessionId"
	CARDID      string = "CardId"
	IP          string = "IP"
	CONFIRMCODE string = "ConfirmCode"
	CUSTFIELD   string = "CustomField"
	CUSTFIELDS  string = "CustomFields"
	SECURECODE  string = "SecureCode"
	TEMPTAG     string = "TemplateTag"
	LANG        string = "Language"
	SESSIONTYPE string = "SessionType"
	URL         string = "Url"
	PAYINFO     string = "PayInfo"
	CUSTKEY     string = "CustomerKey"
	PAN         string = "PAN"
	EMONTH      string = "EMonth"
	EYEAR       string = "EYear"
	CARDHOLDER  string = "CardHolder"
	MD          string = "MD"
	PARES       string = "PaRes"
	PAYTOKEN    string = "PayToken"
	METHOD      string = "Method"
	TOKEN       string = "Token"
	CVC2        string = "CVC2"
)
View Source
const (
	PAY          string = "Pay"
	BLOCK        string = "Block"
	UNBLOCK      string = "Unblock"
	CHARGE       string = "Charge"
	REFUND       string = "Refund"
	GETSTATE     string = "GetState"
	PAYSTATUS    string = "PayStatus"
	REGISTER     string = "Register"
	UPDATE       string = "Update"
	DELETE       string = "Delete"
	CHECK        string = "Check"
	ADD          string = "Add"
	ACTIVATE     string = "Activate"
	REMOVE       string = "Remove"
	GETLIST      string = "GetList"
	INIT         string = "Init"
	SENDCODE     string = "SendCode"
	APPLEPAY     string = "ApplePay"
	APPLEBLOCK   string = "AppleBlock"
	MPPAY        string = "MPPay"
	MPBLOCK      string = "MPBlock"
	PAY3DS       string = "Pay3DS"
	BLOCK3DS     string = "Block3DS"
	PAYSUBMIT3DS string = "PaySubmit3DS"
)

Variables

This section is empty.

Functions

func BodyByte

func BodyByte(resp *http.Response) (body []byte, err error)

func MapHttpRespToResp

func MapHttpRespToResp(ret Unwrapper, httpResp *http.Response) error

func Parse

func Parse(resp *http.Response) (responseText string, err error)

func ParseByteBody

func ParseByteBody(body []byte) (responseText string)

Types

type APIManager

type APIManager struct {
	OrderManager
}

APIManager type provide the access for calling API Service in Payture system.

func APIService

func APIService(merch Merchant) (api APIManager)

APIService method returned the APIManager.

func (APIManager) APIThreeDSBlock

func (this APIManager) APIThreeDSBlock(orderId string, paRes string) (*http.Response, error)

APIThreeDSPAY for completing blocking stage in two-stage charging on a card with 3-D Secure.

func (APIManager) APIThreeDSPAY

func (this APIManager) APIThreeDSPAY(orderId string, paRes string) (*http.Response, error)

APIThreeDSPAY for completing the one-stage charging on a card with 3-D Secure.

func (APIManager) Block

func (this APIManager) Block(order Payment, info PayInfo, additional CustParams, custKey string, paytureId string) (APIResponses, error)

Block blocking funds on card. For two-stage charge of funds from card.s

func (APIManager) Pay

func (this APIManager) Pay(order Payment, info PayInfo, additional CustParams, custKey string, paytureId string) (APIResponses, error)

Pay makes one stage charge of funds from card.

type APIResponses

type APIResponses struct {
	AddInfo   []AdditioanalInfo `xml:"AddInfo"`
	Success   bool              `xml:"Success,attr"`
	ErrorCode string            `xml:"ErrCode,attr"`
	Amount    int64             `xml:"Amount,attr"`
	OrderId   string            `xml:"OrderId,attr"`
	State     string            `xml:"State,attr"`
	NewAmount string            `xml:"NewAmount,attr"`
	Key       string            `xml:"Key,attr"`
}

func (*APIResponses) Unwrap

func (resp *APIResponses) Unwrap(byteBody []byte) error

type AdditioanalInfo

type AdditioanalInfo struct {
	Key   string `xml:"Key,attr"`
	Value string `xml:"Value,attr"`
}

type Card

type Card struct {
	CardHolder string
	EMonth     string
	EYear      string
	SecureCode string
}

type CardListResponse

type CardListResponse struct {
	CustomerResponse
	Cards []Item `xml:"Item"`
}

type CardResponse

type CardResponse struct {
	CustomerResponse
	CardId   string `xml:"CardId,attr"`
	CardName string `xml:"CardName,attr"`
}

func (*CardResponse) Unwrap

func (resp *CardResponse) Unwrap(byteBody []byte) error

type CustParams

type CustParams struct {
	CustomerFields map[string]string
}

type Customer

type Customer struct {
	VWUserLgn   string
	VWUserPsw   string
	PhoneNumber string
	Email       string
	Cards       []EWalletCard `xml:"Item"`
}

Customer type that represent information about customer.

func (*Customer) FillCardList

func (cust *Customer) FillCardList(resp *http.Response)

type CustomerResponse

type CustomerResponse struct {
	Success   bool   `xml:"Success,attr"`
	ErrorCode string `xml:"ErrCode,attr"`
	VWUserLgn string `xml:"VWUserLgn,attr"`
}

func (*CustomerResponse) Unwrap

func (resp *CustomerResponse) Unwrap(byteBody []byte) error

type DigitalResponse

type DigitalResponse struct {
	Success   string `xml:"Success,attr"`
	ErrorCode string `xml:"ErrCode,attr"`
	OrderId   string `xml:"OrderId,attr"`
	Amount    int64  `xml:"Amount,attr"`
	Key       string `xml:"Key,attr"`
}

func (*DigitalResponse) Unwrap

func (resp *DigitalResponse) Unwrap(byteBody []byte) error

type DigitalWalletManager

type DigitalWalletManager struct {
	OrderManager
	// contains filtered or unexported fields
}

DigitalWalletManager type provide the access for calling API Services for digital payments: Apple, Android and MasterPass.

func AndroidService

func AndroidService(merch Merchant) (digital DigitalWalletManager)

AndroidService returns DigitalWalletManager for Android system.

func AppleService

func AppleService(merch Merchant) (digital DigitalWalletManager)

AppleService returns DigitalWalletManager for Apple system.

func MasterPassService

func MasterPassService(merch Merchant) (digital DigitalWalletManager)

MasterPassService returns DigitalWalletManager for MasterPass system.

func (DigitalWalletManager) Block

func (this DigitalWalletManager) Block(order Payment, token string, secureCode string) (dRes DigitalResponse, err error)

Block perform bloking funds in two-stage charging.

func (DigitalWalletManager) Pay

func (this DigitalWalletManager) Pay(order Payment, token string, secureCode string) (dRes DigitalResponse, err error)

Pay makes one-stage charging of funds.

type EWalletCard

type EWalletCard struct {
	CardName   string `xml:"CardName,attr"`
	CardId     string `xml:"CardId,attr"`
	CardHolder string `xml:"CardHolder,attr"`
	Status     string `xml:"Status,attr"`
	Expired    bool   `xml:"Expired,attr"`
	NoCVV      bool   `xml:"NoCVV,attr"`
}

EWalletCard type that represent information about card that you recieved then call GetCardList method.

type EWalletPayResponse

type EWalletPayResponse struct {
	OrderId string `xml:"OrderId,attr"`
	Amount  int64  `xml:"Amount,attr"`
	CustomerResponse
}

func (*EWalletPayResponse) Unwrap

func (resp *EWalletPayResponse) Unwrap(byteBody []byte) error

type EwalletManager

type EwalletManager struct {
	Customers map[string]Customer
	OrderManager
}

EwalletManager type provide the access for calling EWallet Service API in Payture system.

func EwalletService

func EwalletService(merch Merchant) (ew EwalletManager)

EwalletService method that returns the EwalletManager.

func (EwalletManager) AddCustomerToCollection

func (this EwalletManager) AddCustomerToCollection(cust Customer) (EwalletManager, bool)

AddCustomerToCollection added customer to the EWalletManager's customer collection (but not in the Payture system).

func (EwalletManager) CardActivate

func (this EwalletManager) CardActivate(custLogin string, cardId string, amount string) (cardResp CardResponse, err error)

CardActivate method for activate card that was attached to specified customer.

func (EwalletManager) CardAdd

func (this EwalletManager) CardAdd(custLogin string, card NotRegisteredCard) (cardResp CardResponse, err error)

CardAdd method for add supplied card to specified customer.

func (EwalletManager) CardRemove

func (this EwalletManager) CardRemove(custLogin string, cardId string) (cardResp CardResponse, err error)

CardRemove method for remove card with specified CardId from cutomer cards list.

func (EwalletManager) CustomerCheck

func (this EwalletManager) CustomerCheck(cust Customer, addToCollection bool) (custResp CustomerResponse, err error)

CustomerCheck check is the customer was registered in Payture system.

func (EwalletManager) CustomerCheckBylogin

func (this EwalletManager) CustomerCheckBylogin(custLogin string) (custResp CustomerResponse, err error)

CustomerCheckBylogin check is the customer was registered in Payture system by login. The Customer must be in the customer's collection at the time when the method was called.

func (EwalletManager) CustomerDelete

func (this EwalletManager) CustomerDelete(custLogin string) (custResp CustomerResponse, err error)

CustomerDelete delete specified customer from Payture system.

func (EwalletManager) CustomerRegister

func (this EwalletManager) CustomerRegister(cust Customer) (custResp CustomerResponse, err error)

CustomerRegister method registers supplied customer in Payture system.

func (EwalletManager) CustomerUpdate

func (this EwalletManager) CustomerUpdate(cust Customer) (custResp CustomerResponse, err error)

CustomerUpdate changed some information in customer's account in Payture system.

func (EwalletManager) GetCardList

func (this EwalletManager) GetCardList(custLogin string) (*http.Response, error)

GetCardList returned the card's collection that was attached to specified customer.

func (EwalletManager) Init

func (this EwalletManager) Init(custLogin string, sessionType string, ip string, order Payment, tag string, lang string, cardId string) (initResp InitResponse, err error)

InitTransaction create and returned Session in Payture system by which the customer can make a payment or can registered card.

func (EwalletManager) OperationBySession

func (this EwalletManager) OperationBySession(cmd string, sessionId string) (*http.Response, error)

OperationBySession makes a payment, blocks funds on customer's card or registers card in Payture system by SessionId.

func (EwalletManager) PayNoRegCard

func (this EwalletManager) PayNoRegCard(custLogin string, card NotRegisteredCard, order Payment, ip string, confirmCode string, custFields map[string]string, addCardToCust bool) (payResp EWalletPayResponse, err error)

PayNoRegCard makes a payment or blocks funds on customer's card. Required full information about card that wasn't attached to customer.

func (EwalletManager) PayRegCard

func (this EwalletManager) PayRegCard(custLogin string, cardId string, secureCode string, order Payment, ip string, confirmCode string, custFields map[string]string) (payResp EWalletPayResponse, err error)

PayRegCard makes a payment or blocks funds on customer's card. Required information about card that was attached to specified customer.

func (EwalletManager) PaySubmit3DS

func (this EwalletManager) PaySubmit3DS(md string, paRes string) (*http.Response, error)

APIThreeDSPAY for completing payment on a card with 3-D Secure in EWallet Service.

func (EwalletManager) RemoveCustomerFromCollection

func (this EwalletManager) RemoveCustomerFromCollection(custLogin string) (EwalletManager, bool)

RemoveCustomerFromCollection removed customer from the EWalletManager's customer collection (but not from the Payture system).

func (EwalletManager) SendCode

func (this EwalletManager) SendCode(custLogin string) (*http.Response, error)

SendCode to customer in the process of payment for secure reasons.

type InitResponse

type InitResponse struct {
	SessionId string `xml:"SessionId,attr"`
	Success   string `xml:"Success,attr"`
	Amount    int64  `xml:"Amount,attr"`
	ErrorCode string `xml:"ErrCode,attr"`
	OrderId   string `xml:"OrderId,attr"`
}

func (*InitResponse) Unwrap

func (resp *InitResponse) Unwrap(byteBody []byte) error

type InpayManager

type InpayManager struct {
	OrderManager
}

InpayManager for payment management in InPay Service.

func InPayService

func InPayService(merch Merchant) (inpay InpayManager)

InPayService method returns the InpayManager.

func (InpayManager) Init

func (this InpayManager) Init(order Payment, sessionType string, tag string, lang string, ip string, urlReturn string, additionalFields CustParams) (initResp InitResponse, err error)

Init create and returned Session in Payture system by which the customer can make a payment.

type Item

type Item struct {
	CardName   string `xml:"CardName,attr"`
	CardId     string `xml:"CardId,attr"`
	CardHolder string `xml:"CardHolder,attr"`
	Status     string `xml:"Status,attr"`
	NoCVV      bool   `xml:"NoCVV,attr"`
	Expired    bool   `xml:"Expired,attr"`
}

type Merchant

type Merchant struct {
	Key, Password, Host string
}

type NotRegisteredCard

type NotRegisteredCard struct {
	CardHolder string
	EMonth     string
	EYear      string
	SecureCode string
	CardNumber string
}

NotRegisteredCard type that represent information about card that you must provide for registration in Payture system.

type OrderManager

type OrderManager struct {
	// contains filtered or unexported fields
}

OrderManager type for management of payment's state.

func GetOrderManager

func GetOrderManager(api string, merch Merchant) (ordM OrderManager)

GetOrderManager returned the OrderManager for specified api type and merchant.

func (OrderManager) Charge

func (this OrderManager) Charge(order Payment) (orderResp OrderResponse, err error)

Refund the funds that was block from the customer's card.

func (OrderManager) GetState

func (this OrderManager) GetState(order Payment) (orderResp OrderResponse, err error)

GetState returns the transaction's status for API service.

func (OrderManager) PayStatus

func (this OrderManager) PayStatus(order Payment) (orderResp OrderResponse, err error)

PayStatus returns the transaction's status for Ewallet and InPay services.

func (OrderManager) Refund

func (this OrderManager) Refund(order Payment) (orderResp OrderResponse, err error)

Refund the funds to customer.

func (OrderManager) Unblock

func (this OrderManager) Unblock(order Payment) (orderResp OrderResponse, err error)

Unblock unlocking the funds on the card.

type OrderResponse

type OrderResponse struct {
	Success   bool   `xml:"Success,attr"`
	OrderId   string `xml:"OrderId,attr"`
	Amount    int64  `xml:"Amount,attr"`
	ErrCode   string `xml:"ErrCode,attr"`
	NewAmount int64  `xml:"NewAmount,attr"`
}

func (*OrderResponse) Unwrap

func (resp *OrderResponse) Unwrap(byteBody []byte) error

type ParamsFormer

type ParamsFormer interface {
	// contains filtered or unexported methods
}

type PayAPITransaction

type PayAPITransaction struct {
	Key, CustomerKey string
	CustomerFields   CustParams
	PaytureId        string
	PaymentInfo      PayInfo
	Order            Payment
}

PayAPITransaction collection of fields that you must supplied for make pay or block operation.

type PayInfo

type PayInfo struct {
	Card  Card
	Order Payment
	PAN   string
}

PayInfo detailed information about transaction.

type Payment

type Payment struct {
	OrderId string
	Amount  string
}

func (Payment) GenerateId

func (order Payment) GenerateId(fixedPart string) string

type PaytureEncoder

type PaytureEncoder interface {
	// contains filtered or unexported methods
}

type Unwrapper

type Unwrapper interface {
	Unwrap(byteBody []byte) error
}

type UrlProvider

type UrlProvider interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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