Documentation ¶
Index ¶
- Constants
- func ExtractRSAPrivateKey(keystorePath string, keystorePassword string) (*rsa.PrivateKey, error)
- type Client
- func (c *Client) GetCurrencyConversion(request *mastercardpb.MastercardCurrencyConversionRequest) (*mastercardpb.CurrencyResponse, error)
- func (c *Client) GetMerchantIdentifiers(merchantID string, search SearchMethod) (*mastercardpb.MerchantIDs, error)
- func (c *Client) MerchantTransferFundingAndPayment(request *mastercardpb.MerchantTransferFundingAndPaymentRequest) (*mastercardpb.MerchantTransferFundingAndPaymentResponse, error)
- type EnvType
- type SearchMethod
Constants ¶
const ( PRODUCTION = 0 STAGING = 1 DEV = 2 SANDBOX = 3 )
Environment types
const ( FuzzyMatch = 0 ExactMatch = 1 )
Search types that equals to the type of search that will be performed
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 ¶
func (c *Client) GetCurrencyConversion(request *mastercardpb.MastercardCurrencyConversionRequest) (*mastercardpb.CurrencyResponse, error)
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 ¶
func (c *Client) MerchantTransferFundingAndPayment(request *mastercardpb.MerchantTransferFundingAndPaymentRequest) (*mastercardpb.MerchantTransferFundingAndPaymentResponse, error)
MerchantTransferFundingAndPayment secures the funds from a person and transfer it to the merchant It is one of the p2m api
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