mobilpay

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Cert - parsed

View Source
var ConfirmURL = ""

ConfirmURL -

View Source
var MobilpayEndpoint = "http://sandboxsecure.mobilpay.ro"

MobilpayEndpoint - Mobilpay gateway

View Source
var PrivateKey *rsa.PrivateKey

PrivateKey - parsed

View Source
var PrivateKeyFile = "sandbox.LK1F-GMV1-YWRD-7J6T-QD55private.key" // mobilpay test sandbox key

PrivateKeyFile - Private key of the mobilpay merchant, used to decript the confirm response.

View Source
var PublicCer = "sandbox.LK1F-GMV1-YWRD-7J6T-QD55.public.cer" // mobilpay test sandbox cer

PublicCer - Public key used to encript the requests made to mobilpay.

View Source
var ReturnURL = ""

ReturnURL -

View Source
var Signature = "LK1F-GMV1-YWRD-7J6T-QD55"

Signature - merchant signature

Functions

func Decrypt

func Decrypt(encKey string, encryptedText string) ([]byte, []byte, error)

Decrypt returns plainTextData and randomKey

func Encrypt

func Encrypt(publicKey *rsa.PublicKey, sourceText []byte) (string, string, error)

Encrypt returns encryptedData and encryptedRandomKey base64 encoded

func SetMobilpayVars

func SetMobilpayVars(mobilpayEndpoint, signature, privateKeyFile, publicKeyFile, confirmURL, returnURL string)

SetMobilpayVars -

Types

type CB

type CB struct {
	DBh *multidb.MultiDB
}

CB - contains the http cb method and depends on DBh *multidb.MultiDB handle

func (*CB) MobilpayConfirm

func (o *CB) MobilpayConfirm(wr http.ResponseWriter, r *http.Request)

MobilpayConfirm - Confirms and logs the processing of the payment.

func (*CB) ParseKeys

func (o *CB) ParseKeys()

ParseKeys - reads the files that PrivateKeyFile and PublicCer point to.

type EncriptedData

type EncriptedData struct {
	EnvKey string `json:"env_key"`
	Data   string `json:"data"`
}

EncriptedData - Contains the client data that needs to be POST'ed

type H

type H struct{}

H - helper

type MResponse

type MResponse struct {
	Order orderM `xml:"order"`
}

MResponse - is the response decripted XML structure containing the aditional Mobilpay Order property.

type MerchantsResponse

type MerchantsResponse struct {
	CRC string `xml:"crc"`
}

MerchantsResponse -

type MerchantsResponseE

type MerchantsResponseE struct {
	CRC crc `xml:"crc"`
}

MerchantsResponseE - represents the ping back that the confirm endpoint will make with attributes that specify error.

ErrorType - 1 = temp error ; 2 = perm error ;

type Request

type Request struct {
	Order order `xml:"order"`
}

Request - Mobilpay XML request that gets marshalled by GetOrderEncriptedData

Mandatory fields:
r.Order.Signature = "xxxx-xxxx-xxxx-xxxx-xxxx"
r.Order.URL.Return = ""
r.Order.URL.Confirm = ""
r.Order.Invoice.ContactInfo.Billing.Type = "person"
r.Order.Invoice.Currency = "RON"
r.Order.Invoice.Amount = "3"
r.Order.Type = "card"
r.Order.ID = "1"
r.Order.Invoice.Details = "CreditCard payment."
r.Order.Invoice.ContactInfo.Billing.Fname = "Foo"
r.Order.Invoice.ContactInfo.Billing.Lname = "Bar"

Jump to

Keyboard shortcuts

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