mastercard

package
v0.0.0-...-7541330 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRODUCTION = 0
	STAGING    = 1
	DEV        = 2
	SANDBOX    = 3
)

Environment types

View Source
const (
	FuzzyMatch = 0
	ExactMatch = 1
)

Search types that equals to the type of search that will be performed

View Source
const (
	OAUTH_VERSION          = "1.0"
	SIGNATURE_METHOD       = "RSA-SHA256"
	OAUTH_HEADER           = "OAuth "
	BODY_HASH_PARAM        = "oauth_body_hash"
	CONSUMER_KEY_PARAM     = "oauth_consumer_key"
	NONCE_PARAM            = "oauth_nonce"
	SIGNATURE_METHOD_PARAM = "oauth_signature_method"
	SIGNATURE_PARAM        = "oauth_signature"
	TIMESTAMP_PARAM        = "oauth_timestamp"
	TOKEN_PARAM            = "oauth_token"
	VERSION_PARAM          = "oauth_version"
)

Variables

This section is empty.

Functions

func ExtractRSAPrivateKey

func ExtractRSAPrivateKey(keystorePath string, keystorePassword string) (*rsa.PrivateKey, error)

ExtractRSAPrivateKey from file

Types

type Client

type Client struct {

	// Base URL for API requests. Defaults to the public Mastercard API.
	BaseURL string

	// User agent used when communicating with the Mastercard API.
	UserAgent string

	// PrivateKey
	PrivateKey *rsa.PrivateKey

	// ConsumerKey
	ConsumerKey string

	// SignatureMethod
	SignatureMethod string
	// contains filtered or unexported fields
}

A Client manages communication with the Mastercard API.

func NewClient

func NewClient(consumerKey string, privateKey *rsa.PrivateKey, keystorePassword string, env EnvType) (*Client, error)

NewClient returns an instance of a Mastercard api client that allows accessing endpoints with more ease. Oauth1 authentification is managed internally, but you need to pass your mastercard consumerKey, the path to the .p12 file and the keystore password for the client to retrieve your RSA private key and sign requests correctly

func (*Client) GetCurrencyConversion

GetCurrencyConversion returns all the merchants that matches the merchantId pattern Default searchMethod equals to ExactMatch which returns either 1 or 0 merchant while FuzzyMatch returns from 0 to 20 merchants with a Matching confidence field that scores from 0 to 100

func (*Client) GetMerchantIdentifiers

func (c *Client) GetMerchantIdentifiers(merchantID string, search SearchMethod) (*mastercardpb.MerchantIDs, error)

GetMerchantIdentifiers returns all the merchants that matches the merchantId pattern Default searchMethod equals to ExactMatch which returns either 1 or 0 merchant while FuzzyMatch returns from 0 to 20 merchants with a Matching confidence field that scores from 0 to 100

func (*Client) MerchantTransferFundingAndPayment

MerchantTransferFundingAndPayment secures the funds from a person and transfer it to the merchant It is one of the p2m api

type EnvType

type EnvType int

EnvType equals the type of environment to work in

func (EnvType) BaseURL

func (e EnvType) BaseURL() string

BaseURL Returns a string that corresponds to the environment type

type SearchMethod

type SearchMethod int64

SearchMethod is the type of search to be performed

func (*SearchMethod) String

func (sm *SearchMethod) String() string

String returns a string that corresponds to the search method

Jump to

Keyboard shortcuts

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