Back to godoc.org

Package common

v1.1.0
Latest Go to latest

The highest tagged major version is .

Published: Dec 12, 2019 | License: GPL3 | Module: github.com/paysuper/paysuper-management-api

Index

Constants

const (
	MerchantIdField    = "MerchantId"
	MerchantSliceField = "Merchant"
	ParamTag           = "param"
)
const (
	Prefix                   = "internal.dispatcher"
	UnmarshalKey             = "dispatcher"
	UnmarshalGlobalConfigKey = "dispatcher.global"
	AuthProjectGroupPath     = "/auth/api/v1"
	AuthUserGroupPath        = "/admin/api/v1"
	SystemUserGroupPath      = "/system/api/v1"
	NoAuthGroupPath          = "/api/v1"
	WebHookGroupPath         = "/webhook"
)
const (
	RequestParameterId                       = "id"
	RequestParameterName                     = "name"
	RequestParameterSku                      = "sku"
	RequestParameterIsSigned                 = "is_signed"
	RequestParameterMerchantId               = "merchant_id"
	RequestParameterProject                  = "project[]"
	RequestParameterPaymentMethod            = "payment_method[]"
	RequestParameterCountry                  = "country"
	RequestParameterCountries                = "country[]"
	RequestParameterProjectId                = "project_id"
	RequestParameterPaymentMethodId          = "method_id"
	RequestParameterOrderId                  = "order_id"
	RequestParameterRefundId                 = "refund_id"
	RequestParameterNotificationId           = "notification_id"
	RequestParameterUserId                   = "user"
	RequestParameterLimit                    = "limit"
	RequestParameterOffset                   = "offset"
	RequestParameterFile                     = "file"
	RequestParameterUtmSource                = "utm_source"
	RequestParameterUtmMedium                = "utm_medium"
	RequestParameterUtmCampaign              = "utm_campaign"
	RequestParameterIsSystem                 = "is_system"
	RequestParameterAgreementType            = "agreement_type"
	RequestParameterHasMerchantSignature     = "has_merchant_signature"
	RequestParameterHasPspSignature          = "has_psp_signature"
	RequestParameterAgreementSentViaMail     = "agreement_sent_via_mail"
	RequestParameterMailTrackingLink         = "mail_tracking_link"
	RequestParameterImage                    = "image"
	RequestParameterCallbackCurrency         = "callback_currency"
	RequestParameterCallbackProtocol         = "callback_protocol"
	RequestParameterCreateOrderAllowedUrls   = "create_order_allowed_urls"
	RequestParameterAllowDynamicNotifyUrls   = "allow_dynamic_notify_urls"
	RequestParameterAllowDynamicRedirectUrls = "allow_dynamic_redirect_urls"
	RequestParameterLimitsCurrency           = "limits_currency"
	RequestParameterMinPaymentAmount         = "min_payment_amount"
	RequestParameterMaxPaymentAmount         = "max_payment_amount"
	RequestParameterNotifyEmails             = "notify_emails"
	RequestParameterIsProductsCheckout       = "is_products_checkout"
	RequestParameterSecretKey                = "secret_key"
	RequestParameterSignatureRequired        = "signature_required"
	RequestParameterSendNotifyEmail          = "send_notify_email"
	RequestParameterUrlCheckAccount          = "url_check_account"
	RequestParameterUrlProcessPayment        = "url_process_payment"
	RequestParameterUrlRedirectFail          = "url_redirect_fail"
	RequestParameterUrlRedirectSuccess       = "url_redirect_success"
	RequestParameterUrlChargebackPayment     = "url_chargeback_payment"
	RequestParameterUrlCancelPayment         = "url_cancel_payment"
	RequestParameterUrlFraudPayment          = "url_fraud_payment"
	RequestParameterUrlRefundPayment         = "url_refund_payment"
	RequestParameterStatus                   = "status"
	RequestAuthorizationTokenRegex           = "Bearer ([A-z0-9_.-]{10,})"
	RequestParameterZipUsa                   = "zip_usa"
	RequestParameterRateId                   = "rate_id"
	RequestParameterReceiptId                = "receipt_id"
	RequestParameterFullDescription          = "full_description"
	RequestParameterShortDescription         = "short_description"
	RequestParameterCover                    = "cover"
	RequestParameterLocalizations            = "localizations"
	RequestParameterCurrencies               = "currencies"
	RequestParameterVirtualCurrency          = "virtual_currency"
	RequestParameterRoleId                   = "role_id"
	RequestParameterReportId                 = "report_id"
	RequestProductId                         = "product_id"
	RequestRoleId                            = "role_id"
	RequestPayoutDocumentId                  = "payout_document_id"

	ImageCollectionImagesField  = "images"
	ImageCollectionUseOneForAll = "use_one_for_all"

	UserProfileFieldNumberOfEmployees = "NumberOfEmployees"
	UserProfileFieldAnnualIncome      = "AnnualIncome"
	UserProfileFieldCompanyName       = "CompanyName"
	UserProfileFieldPosition          = "Position"
	UserProfileFieldFirstName         = "FirstName"
	UserProfileFieldLastName          = "LastName"
	UserProfileFieldWebsite           = "Website"
	UserProfileFieldKindOfActivity    = "KindOfActivity"
	UserProfileFieldReview            = "Review"
	UserProfileFieldPageId            = "Url"

	OrderFieldProjectId     = "PP_PROJECT_ID"
	OrderFieldSignature     = "PP_SIGNATURE"
	OrderFieldAmount        = "PP_AMOUNT"
	OrderFieldCurrency      = "PP_CURRENCY"
	OrderFieldAccount       = "PP_ACCOUNT"
	OrderFieldOrderId       = "PP_ORDER_ID"
	OrderFieldPaymentMethod = "PP_PAYMENT_METHOD"
	OrderFieldUrlVerify     = "PP_URL_VERIFY"
	OrderFieldUrlNotify     = "PP_URL_NOTIFY"
	OrderFieldUrlSuccess    = "PP_URL_SUCCESS"
	OrderFieldUrlFail       = "PP_URL_FAIL"
	OrderFieldPayerEmail    = "PP_PAYER_EMAIL"
	OrderFieldPayerPhone    = "PP_PAYER_PHONE"
	OrderFieldDescription   = "PP_DESCRIPTION"
	OrderFieldRegion        = "PP_REGION"

	QueryParameterNameLimit  = "limit"
	QueryParameterNameOffset = "offset"
	QueryParameterNameSort   = "sort[]"

	QueryParameterNameUtmMedium   = "utm_medium"
	QueryParameterNameUtmCampaign = "utm_campaign"
	QueryParameterNameUtmSource   = "utm_source"

	ErrorMessageMask = "field validation for '%s' failed on the '%s' tag"

	HeaderAcceptLanguage      = "Accept-Language"
	HeaderUserAgent           = "User-Agent"
	HeaderXApiSignatureHeader = "X-API-SIGNATURE"
	HeaderReferer             = "referer"

	// EnvironmentProduction        = "prod"
	CustomerTokenCookiesName = "_ps_ctkn"

	CardPayPaymentResponseHeaderSignature = "Signature"

	AgreementPageTemplateName = "agreement.html"

	UserProfilePositionCEO               = "CEO"
	UserProfilePositionCTO               = "CTO"
	UserProfilePositionCMO               = "CMO"
	UserProfilePositionCFO               = "CFO"
	UserProfilePositionProjectManagement = "Project Management"
	UserProfilePositionGenericManagement = "Generic Management"
	UserProfilePositionSoftwareDeveloper = "Software Developer"
	UserProfilePositionMarketing         = "Marketing"
	UserProfilePositionSupport           = "Support"

	ErrorFieldService = "service"
	ErrorFieldMethod  = "method"
	ErrorFieldRequest = "request"

	InternalErrorTemplate = "internal error"
)
const (
	ErrorNamespaceMerchantCompanyInfoName                 = "OnboardingRequest.Company.Name"
	ErrorNamespaceMerchantCompanyInfoAlternativeName      = "OnboardingRequest.Company.AlternativeName"
	ErrorNamespaceMerchantCompanyInfoWebsite              = "OnboardingRequest.Company.Website"
	ErrorNamespaceMerchantCompanyInfoCountry              = "OnboardingRequest.Company.Country"
	ErrorNamespaceMerchantCompanyInfoState                = "OnboardingRequest.Company.State"
	ErrorNamespaceMerchantCompanyInfoZip                  = "OnboardingRequest.Company.Zip"
	ErrorNamespaceMerchantCompanyInfoCity                 = "OnboardingRequest.Company.City"
	ErrorNamespaceMerchantCompanyInfoAddress              = "OnboardingRequest.Company.Address"
	ErrorNamespaceMerchantContactAuthorized               = "OnboardingRequest.Contacts.Authorized"
	ErrorNamespaceMerchantContactTechnical                = "OnboardingRequest.Contacts.Technical"
	ErrorNamespaceMerchantContactAuthorizedName           = "OnboardingRequest.Contacts.Authorized.Name"
	ErrorNamespaceMerchantContactAuthorizedEmail          = "OnboardingRequest.Contacts.Authorized.Email"
	ErrorNamespaceMerchantContactAuthorizedPhone          = "OnboardingRequest.Contacts.Authorized.Phone"
	ErrorNamespaceMerchantContactAuthorizedPosition       = "OnboardingRequest.Contacts.Authorized.Position"
	ErrorNamespaceMerchantContactTechnicalName            = "OnboardingRequest.Contacts.Technical.Name"
	ErrorNamespaceMerchantContactTechnicalEmail           = "OnboardingRequest.Contacts.Technical.Email"
	ErrorNamespaceMerchantContactTechnicalPhone           = "OnboardingRequest.Contacts.Technical.Phone"
	ErrorNamespaceMerchantBankingCurrency                 = "OnboardingRequest.Banking.Currency"
	ErrorNamespaceMerchantBankingName                     = "OnboardingRequest.Banking.Name"
	ErrorNamespaceMerchantBankingAddress                  = "OnboardingRequest.Banking.Address"
	ErrorNamespaceMerchantBankingAccountNumber            = "OnboardingRequest.Banking.AccountNumber"
	ErrorNamespaceMerchantBankingSwift                    = "OnboardingRequest.Banking.Swift"
	ErrorNamespaceMerchantBankingCorrespondentAccount     = "OnboardingRequest.Banking.CorrespondentAccount"
	ErrorNamespaceGetDashboardMainRequestPeriod           = "GetDashboardMainRequest.Period"
	ErrorNamespaceGetDashboardMainRequestMerchantId       = "GetDashboardMainRequest.MerchantId"
	ErrorNamespaceGetDashboardBaseReportRequestPeriod     = "GetDashboardBaseReportRequest.Period"
	ErrorNamespaceGetDashboardBaseReportRequestMerchantId = "GetDashboardBaseReportRequest.MerchantId"
)

Variables

var (
	SystemBinderDefault    = &SystemBinder{}
	MerchantBinderDefault  = &MerchantBinder{}
	BinderDefault          = &Binder{}
	EchoBinderDefault      = &echo.DefaultBinder{}
	AvailableProtocolTypes = []string{pkg.ProjectCallbackProtocolEmpty, pkg.ProjectCallbackProtocolDefault}
)
var (
	DefaultSort = []string{"_id"}

	OrderReservedWords = map[string]bool{
		OrderFieldProjectId:     true,
		OrderFieldSignature:     true,
		OrderFieldAmount:        true,
		OrderFieldCurrency:      true,
		OrderFieldAccount:       true,
		OrderFieldOrderId:       true,
		OrderFieldDescription:   true,
		OrderFieldPaymentMethod: true,
		OrderFieldUrlVerify:     true,
		OrderFieldUrlNotify:     true,
		OrderFieldUrlSuccess:    true,
		OrderFieldUrlFail:       true,
		OrderFieldPayerEmail:    true,
		OrderFieldPayerPhone:    true,
		OrderFieldRegion:        true,
	}

	ZipRegexp = map[string]*regexp.Regexp{ /* 182 elements not displayed */

	}

	TariffRegions = map[string]string{
		"cis":                "CIS",
		"russia":             "Russia",
		"west_asia":          "West Asia",
		"eu":                 "EU",
		"north_america":      "North America",
		"central_america":    "Central America",
		"south_america":      "South America",
		"uk":                 "United Kingdom",
		"worldwide":          "Worldwide",
		"south_pacific":      "South Pacific",
		"oceania":            "Oceania",
		"north_europe":       "North Europe",
		"north_africa":       "North Africa",
		"polynesia":          "Polynesia",
		"central_africa":     "Central Africa",
		"south_europe":       "South Europe",
		"antarctica":         "Antarctica",
		"south_asia":         "South Asia",
		"caribbean":          "Caribbean",
		"west_africa":        "West Africa",
		"southern_africa":    "Southern Africa",
		"southeast_asia":     "Southeast Asia",
		"east_africa":        "East Africa",
		"east_asia":          "East Asia",
		"micronesia":         "Micronesia",
		"west_europe":        "West Europe",
		"latin_america":      "Latin America",
		"melanesia":          "Melanesia",
		"sub_saharan_africa": "Sub-Saharan Africa",
		"south_africa":       "South Africa",
	}

	TestStubImplementMe = "implement me!"

	TokenRegex = regexp.MustCompile(RequestAuthorizationTokenRegex)
)
var (
	ErrorUnknown                                      = NewManagementApiResponseError("ma000001", "unknown error. try request later")
	ErrorValidationFailed                             = NewManagementApiResponseError("ma000002", "validation failed")
	ErrorInternal                                     = NewManagementApiResponseError("ma000003", InternalErrorTemplate)
	ErrorMessageAccessDenied                          = NewManagementApiResponseError("ma000004", "access denied")
	ErrorIdIsEmpty                                    = NewManagementApiResponseError("ma000005", "identifier can't be empty")
	ErrorIncorrectMerchantId                          = NewManagementApiResponseError("ma000006", "incorrect merchant identifier")
	ErrorIncorrectNotificationId                      = NewManagementApiResponseError("ma000007", "incorrect notification identifier")
	ErrorIncorrectOrderId                             = NewManagementApiResponseError("ma000008", "incorrect order identifier")
	ErrorIncorrectProductId                           = NewManagementApiResponseError("ma000009", "incorrect product identifier")
	ErrorIncorrectCountryIdentifier                   = NewManagementApiResponseError("ma000010", "incorrect country identifier")
	ErrorIncorrectCurrencyIdentifier                  = NewManagementApiResponseError("ma000011", "incorrect currency identifier")
	ErrorMessageOrdersNotFound                        = NewManagementApiResponseError("ma000012", "orders not found")
	ErrorCountryNotFound                              = NewManagementApiResponseError("ma000013", "country not found")
	ErrorCurrencyNotFound                             = NewManagementApiResponseError("ma000014", "currency not found")
	ErrorNotificationNotFound                         = NewManagementApiResponseError("ma000015", "notification not found")
	ErrorMessageAgreementCanNotBeGenerate             = NewManagementApiResponseError("ma000020", "agreement can't be generated for not checked merchant data")
	ErrorMessageAgreementNotGenerated                 = NewManagementApiResponseError("ma000021", "agreement for merchant not generated early")
	ErrorMessageSignatureHeaderIsEmpty                = NewManagementApiResponseError("ma000022", "header with request signature can't be empty")
	ErrorRequestParamsIncorrect                       = NewManagementApiResponseError("ma000023", "incorrect request parameters")
	ErrorEmailFieldIncorrect                          = NewManagementApiResponseError("ma000024", "incorrect email")
	ErrorRequestDataInvalid                           = NewManagementApiResponseError("ma000026", "request data invalid")
	ErrorCountriesListError                           = NewManagementApiResponseError("ma000027", "countries list error")
	ErrorAgreementFileNotExist                        = NewManagementApiResponseError("ma000028", "file for the specified key does not exist")
	ErrorNotMultipartForm                             = NewManagementApiResponseError("ma000029", "no multipart boundary param in Content-Type")
	ErrorUploadFailed                                 = NewManagementApiResponseError("ma000030", "upload failed")
	ErrorIncorrectProjectId                           = NewManagementApiResponseError("ma000031", "incorrect project identifier")
	ErrorIncorrectPaymentMethodId                     = NewManagementApiResponseError("ma000032", "incorrect payment method identifier")
	ErrorIncorrectPaylinkId                           = NewManagementApiResponseError("ma000033", "incorrect paylink identifier")
	ErrorMessageAuthorizationHeaderNotFound           = NewManagementApiResponseError("ma000034", "authorization header not found")
	ErrorMessageAuthorizationTokenNotFound            = NewManagementApiResponseError("ma000035", "authorization token not found")
	ErrorMessageAuthorizedUserNotFound                = NewManagementApiResponseError("ma000036", "information about authorized user not found")
	ErrorMessageStatusIncorrectType                   = NewManagementApiResponseError("ma000037", "status parameter has incorrect type")
	ErrorMessageAgreementNotFound                     = NewManagementApiResponseError("ma000038", "agreement for merchant not found")
	ErrorMessageAgreementUploadMaxSize                = NewManagementApiResponseError("ma000039", "agreement document max upload size exceeded")
	ErrorMessageAgreementContentType                  = NewManagementApiResponseError("ma000040", "agreement document type must be a pdf")
	ErrorMessageAgreementTypeIncorrectType            = NewManagementApiResponseError("ma000041", "agreement type parameter have incorrect type")
	ErrorMessageHasMerchantSignatureIncorrectType     = NewManagementApiResponseError("ma000042", "merchant signature parameter has incorrect type")
	ErrorMessageHasPspSignatureIncorrectType          = NewManagementApiResponseError("ma000043", "paysuper signature parameter has incorrect type")
	ErrorMessageAgreementSentViaMailIncorrectType     = NewManagementApiResponseError("ma000044", "agreement sent via email parameter has incorrect type")
	ErrorMessageMailTrackingLinkIncorrectType         = NewManagementApiResponseError("ma000045", "mail tracking link parameter has incorrect type")
	ErrorMessageNameIncorrectType                     = NewManagementApiResponseError("ma000046", "name parameter has incorrect type")
	ErrorMessageImageIncorrectType                    = NewManagementApiResponseError("ma000047", "image parameter has incorrect type")
	ErrorMessageCallbackCurrencyIncorrectType         = NewManagementApiResponseError("ma000048", "callback currency parameter has incorrect type")
	ErrorMessageCallbackProtocolIncorrectType         = NewManagementApiResponseError("ma000049", "callback protocol parameter has incorrect type")
	ErrorMessageCreateOrderAllowedUrlsIncorrectType   = NewManagementApiResponseError("ma000050", "create order allowed urls parameter has incorrect type")
	ErrorMessageAllowDynamicNotifyUrlsIncorrectType   = NewManagementApiResponseError("ma000051", "allow dynamic notify urls parameter has incorrect type")
	ErrorMessageAllowDynamicRedirectUrlsIncorrectType = NewManagementApiResponseError("ma000052", "allow dynamic redirect urls parameter has incorrect type")
	ErrorMessageLimitsCurrencyIncorrectType           = NewManagementApiResponseError("ma000053", "limits currency parameter has incorrect type")
	ErrorMessageMinPaymentAmountIncorrectType         = NewManagementApiResponseError("ma000054", "min payment amount parameter has incorrect type")
	ErrorMessageMaxPaymentAmountIncorrectType         = NewManagementApiResponseError("ma000055", "max payment amount parameter has incorrect type")
	ErrorMessageNotifyEmailsIncorrectType             = NewManagementApiResponseError("ma000056", "notify emails parameter has incorrect type")
	ErrorMessageIsProductsCheckoutIncorrectType       = NewManagementApiResponseError("ma000057", "is products checkout parameter has incorrect type")
	ErrorMessageSecretKeyIncorrectType                = NewManagementApiResponseError("ma000058", "secret key parameter has incorrect type")
	ErrorMessageSignatureRequiredIncorrectType        = NewManagementApiResponseError("ma000059", "signature required parameter has incorrect type")
	ErrorMessageSendNotifyEmailIncorrectType          = NewManagementApiResponseError("ma000060", "send notify email parameter has incorrect type")
	ErrorMessageUrlCheckAccountIncorrectType          = NewManagementApiResponseError("ma000061", "url check account parameter has incorrect type")
	ErrorMessageUrlProcessPaymentIncorrectType        = NewManagementApiResponseError("ma000062", "url process payment parameter has incorrect type")
	ErrorMessageUrlRedirectFailIncorrectType          = NewManagementApiResponseError("ma000063", "url redirect fail parameter has incorrect type")
	ErrorMessageUrlRedirectSuccessIncorrectType       = NewManagementApiResponseError("ma000064", "url redirect success parameter has incorrect type")
	ErrorMessageUrlChargebackPayment                  = NewManagementApiResponseError("ma000065", "url chargeback payment parameter has incorrect type")
	ErrorMessageUrlCancelPayment                      = NewManagementApiResponseError("ma000066", "url cancel payment parameter has incorrect type")
	ErrorMessageUrlFraudPayment                       = NewManagementApiResponseError("ma000067", "url fraud payment parameter has incorrect type")
	ErrorMessageUrlRefundPayment                      = NewManagementApiResponseError("ma000068", "url refund payment parameter has incorrect type")
	ErrorMessagePriceGroupByCountry                   = NewManagementApiResponseError("ma000069", "unable to get price group by country")
	ErrorMessagePriceGroupCurrencyList                = NewManagementApiResponseError("ma000070", "unable to get price group currencies")
	ErrorMessagePriceGroupCurrencyByRegion            = NewManagementApiResponseError("ma000071", "unable to get price group currency by region")
	ErrorMessagePriceGroupRecommendedList             = NewManagementApiResponseError("ma000072", "unable to get price group recommended prices")
	ErrorMessageGetProductPrice                       = NewManagementApiResponseError("ma000072", "unable to get price of product")
	ErrorMessageUpdateProductPrice                    = NewManagementApiResponseError("ma000072", "unable to update price of product")
	ErrorMessageIncorrectZip                          = NewManagementApiResponseError("ma000073", "incorrect zip code")
	ErrorMessageIncorrectNumberOfEmployees            = NewManagementApiResponseError("ma000074", "incorrect number of employees value")
	ErrorMessageIncorrectAnnualIncome                 = NewManagementApiResponseError("ma000075", "incorrect annual income value")
	ErrorMessageIncorrectCompanyName                  = NewManagementApiResponseError("ma000076", "incorrect company name")
	ErrorMessageIncorrectPosition                     = NewManagementApiResponseError("ma000077", "incorrect position")
	ErrorMessageIncorrectFirstName                    = NewManagementApiResponseError("ma000078", "incorrect first name")
	ErrorMessageIncorrectLastName                     = NewManagementApiResponseError("ma000079", "incorrect last name")
	ErrorMessageIncorrectWebsite                      = NewManagementApiResponseError("ma000080", "incorrect website")
	ErrorMessageIncorrectKindOfActivity               = NewManagementApiResponseError("ma000081", "incorrect kind of activity")
	ErrorMessageIncorrectReview                       = NewManagementApiResponseError("ma000082", "review must be text with length lower than or equal 500 characters")
	ErrorMessageIncorrectPageId                       = NewManagementApiResponseError("ma000083", "review page identifier must be one of next values: primary_onboarding, merchant_onboarding")
	ErrorMessageKeyProductIdInvalid                   = NewManagementApiResponseError("ma000082", "key product id is invalid")
	ErrorMessagePlatformIdInvalid                     = NewManagementApiResponseError("ma000083", "platform id is invalid")

	ErrorMessageIncorrectAlternativeName          = NewManagementApiResponseError("ma000084", "incorrect brand")
	ErrorMessageIncorrectState                    = NewManagementApiResponseError("ma000085", "incorrect state")
	ErrorMessageIncorrectCity                     = NewManagementApiResponseError("ma000086", "incorrect city")
	ErrorMessageIncorrectAddress                  = NewManagementApiResponseError("ma000087", "incorrect address")
	ErrorMessageRequiredContactAuthorized         = NewManagementApiResponseError("ma000088", "company authorized contact information is required")
	ErrorMessageRequiredContactTechnical          = NewManagementApiResponseError("ma000089", "company technical contact information is required")
	ErrorMessageIncorrectName                     = NewManagementApiResponseError("ma000090", "incorrect name")
	ErrorMessageIncorrectPhone                    = NewManagementApiResponseError("ma000091", "incorrect phone")
	ErrorMessageIncorrectBankName                 = NewManagementApiResponseError("ma000092", "incorrect bank name")
	ErrorMessageIncorrectBankAddress              = NewManagementApiResponseError("ma000093", "incorrect bank address")
	ErrorMessageIncorrectBankAccountNumber        = NewManagementApiResponseError("ma000094", "incorrect bank accounting number")
	ErrorMessageIncorrectBankSwift                = NewManagementApiResponseError("ma000095", "incorrect bank swift code")
	ErrorMessageIncorrectBankCorrespondentAccount = NewManagementApiResponseError("ma000096", "incorrect bank correspondent account")
	ErrorMessageFileNotFound                      = NewManagementApiResponseError("ma000097", "file with key was not specified")
	ErrorMessageCantReadFile                      = NewManagementApiResponseError("ma000098", "file can not be read")
	ErrorIncorrectPeriod                          = NewManagementApiResponseError("ma000099", "incorrect period")
	ErrorMessageMerchantNotFound                  = NewManagementApiResponseError("ma000100", "merchant not found")
	ErrorMessageCreateReportFile                  = NewManagementApiResponseError("ma000101", "unable to create report file")
	ErrorMessageDownloadReportFile                = NewManagementApiResponseError("ma000102", "unable to download report file")
	ErrorMessageLocalizedFieldIncorrectType       = NewManagementApiResponseError("ma000103", "localized field has invalid type")
	ErrorMessageCoverFieldIncorrectType           = NewManagementApiResponseError("ma000104", "cover field has invalid type")
	ErrorMessageUnableToSendInvite                = NewManagementApiResponseError("ma000105", "unable to send invite")
	ErrorMessageUnableToAcceptInvite              = NewManagementApiResponseError("ma000106", "unable to accept invite")
	ErrorMessageUnableToCheckInviteToken          = NewManagementApiResponseError("ma000107", "unable to check invite token")
	ErrorMessageInvalidRoleType                   = NewManagementApiResponseError("ma000108", "invalid role type")
	ErrorMessageUnableToDeleteUser                = NewManagementApiResponseError("ma000109", "unable to delete user")

	ValidationErrors = map[string]*grpc.ResponseErrorMessage{
		UserProfileFieldNumberOfEmployees: ErrorMessageIncorrectNumberOfEmployees,
		UserProfileFieldAnnualIncome:      ErrorMessageIncorrectAnnualIncome,
		UserProfileFieldCompanyName:       ErrorMessageIncorrectCompanyName,
		UserProfileFieldPosition:          ErrorMessageIncorrectPosition,
		UserProfileFieldFirstName:         ErrorMessageIncorrectFirstName,
		UserProfileFieldLastName:          ErrorMessageIncorrectLastName,
		UserProfileFieldWebsite:           ErrorMessageIncorrectWebsite,
		UserProfileFieldKindOfActivity:    ErrorMessageIncorrectKindOfActivity,
		UserProfileFieldReview:            ErrorMessageIncorrectReview,
		UserProfileFieldPageId:            ErrorMessageIncorrectPageId,
	}

	ValidationNamespaceErrors = map[string]*grpc.ResponseErrorMessage{
		ErrorNamespaceMerchantCompanyInfoName:                 ErrorMessageIncorrectCompanyName,
		ErrorNamespaceMerchantCompanyInfoAlternativeName:      ErrorMessageIncorrectAlternativeName,
		ErrorNamespaceMerchantCompanyInfoWebsite:              ErrorMessageIncorrectWebsite,
		ErrorNamespaceMerchantCompanyInfoCountry:              ErrorIncorrectCountryIdentifier,
		ErrorNamespaceMerchantCompanyInfoState:                ErrorMessageIncorrectState,
		ErrorNamespaceMerchantCompanyInfoZip:                  ErrorMessageIncorrectZip,
		ErrorNamespaceMerchantCompanyInfoCity:                 ErrorMessageIncorrectCity,
		ErrorNamespaceMerchantCompanyInfoAddress:              ErrorMessageIncorrectAddress,
		ErrorNamespaceMerchantContactAuthorized:               ErrorMessageRequiredContactAuthorized,
		ErrorNamespaceMerchantContactTechnical:                ErrorMessageRequiredContactTechnical,
		ErrorNamespaceMerchantContactAuthorizedName:           ErrorMessageIncorrectName,
		ErrorNamespaceMerchantContactAuthorizedEmail:          ErrorEmailFieldIncorrect,
		ErrorNamespaceMerchantContactAuthorizedPhone:          ErrorMessageIncorrectPhone,
		ErrorNamespaceMerchantContactAuthorizedPosition:       ErrorMessageIncorrectPosition,
		ErrorNamespaceMerchantContactTechnicalName:            ErrorMessageIncorrectName,
		ErrorNamespaceMerchantContactTechnicalEmail:           ErrorEmailFieldIncorrect,
		ErrorNamespaceMerchantContactTechnicalPhone:           ErrorMessageIncorrectPhone,
		ErrorNamespaceMerchantBankingCurrency:                 ErrorIncorrectCurrencyIdentifier,
		ErrorNamespaceMerchantBankingName:                     ErrorMessageIncorrectBankName,
		ErrorNamespaceMerchantBankingAddress:                  ErrorMessageIncorrectBankAddress,
		ErrorNamespaceMerchantBankingAccountNumber:            ErrorMessageIncorrectBankAccountNumber,
		ErrorNamespaceMerchantBankingSwift:                    ErrorMessageIncorrectBankSwift,
		ErrorNamespaceMerchantBankingCorrespondentAccount:     ErrorMessageIncorrectBankCorrespondentAccount,
		ErrorNamespaceGetDashboardMainRequestMerchantId:       ErrorIncorrectMerchantId,
		ErrorNamespaceGetDashboardMainRequestPeriod:           ErrorIncorrectPeriod,
		ErrorNamespaceGetDashboardBaseReportRequestPeriod:     ErrorIncorrectPeriod,
		ErrorNamespaceGetDashboardBaseReportRequestMerchantId: ErrorIncorrectMerchantId,
	}
)
var FuncMap = template.FuncMap{
	"Marshal": func(v interface{}) template.JS {
		a, _ := json.Marshal(v)
		return template.JS(a)
	},
}

func CheckProjectAuthRequestSignature

func CheckProjectAuthRequestSignature(dispatch HandlerSet, ctx echo.Context, projectId string) error

CheckProjectAuthRequestSignature

func ContextWrapperCallback

func ContextWrapperCallback(fn func(ctx echo.Context, next echo.HandlerFunc) error) echo.MiddlewareFunc

ContextWrapperCallback

func ExtractBinderContext

func ExtractBinderContext(ctx echo.Context) echo.Binder

ExtractBinderContext

func ExtractRawBodyContext

func ExtractRawBodyContext(ctx echo.Context) []byte

ExtractRawBodyContext

func GetTimeRangeFrom

func GetTimeRangeFrom(t time.Time) time.Time

GetTimeRangeFrom

func GetTimeRangeTo

func GetTimeRangeTo(t time.Time) time.Time

GetTimeRangeTo

func GetValidationError

func GetValidationError(err error) (rspErr *grpc.ResponseErrorMessage)

GetValidationError

func LogSrvCallFailedGRPC

func LogSrvCallFailedGRPC(log logger.Logger, err error, name, method string, req interface{})

func NewManagementApiResponseError

func NewManagementApiResponseError(code, msg string, details ...string) *grpc.ResponseErrorMessage

NewManagementApiResponseError

func NewValidationError

func NewValidationError(details string) *grpc.ResponseErrorMessage

NewValidationError

func RequestResponseHeadersToString

func RequestResponseHeadersToString(headers map[string][]string) string

RequestResponseHeadersToString

func SetBinder

func SetBinder(ctx echo.Context, binder echo.Binder)

SetBinder

func SetCursorContext

func SetCursorContext(ctx echo.Context, cursor *Cursor)

SetCursorContext

func SetRawBodyContext

func SetRawBodyContext(ctx echo.Context, rawBody []byte)

SetRawBodyContext

func SetUserContext

func SetUserContext(ctx echo.Context, user *AuthUser)

SetUserContext

type Auth1

type Auth1 struct {
	Issuer       string `envconfig:"AUTH1_ISSUER" default:"https://dev-auth1.tst.protocol.one"`
	ClientId     string `envconfig:"AUTH1_CLIENTID" required:"true"`
	ClientSecret string `envconfig:"AUTH1_CLIENTSECRET" required:"true"`
	RedirectUrl  string `envconfig:"AUTH1_REDIRECTURL" required:"true"`
}

type AuthUser

type AuthUser struct {
	Id         string
	Name       string
	Email      string
	Role       string
	MerchantId string
}

AuthUser

func ExtractUserContext

func ExtractUserContext(ctx echo.Context) *AuthUser

ExtractUserContext

type Binder

type Binder struct {
	LimitDefault, OffsetDefault, LimitMax int64
}

func (*Binder) Bind

func (b *Binder) Bind(i interface{}, ctx echo.Context) (err error)

type ChangeProjectRequestBinder

type ChangeProjectRequestBinder struct {
	provider.LMT

	Binder
	// contains filtered or unexported fields
}

ChangeProjectRequestBinder

func NewChangeProjectRequestBinder

func NewChangeProjectRequestBinder(set HandlerSet, cfg Config) *ChangeProjectRequestBinder

NewChangeProjectRequestBinder

func (*ChangeProjectRequestBinder) Bind

func (b *ChangeProjectRequestBinder) Bind(i interface{}, ctx echo.Context) error

Bind

type Config

type Config struct {
	Auth1

	HttpScheme              string `envconfig:"HTTP_SCHEME" default:"https"`
	PaymentFormJsLibraryUrl string `envconfig:"PAYMENT_FORM_JS_LIBRARY_URL" required:"true"`
	WebsocketUrl            string `envconfig:"WEBSOCKET_URL" default:"wss://cf.tst.protocol.one/connection/websocket"`

	AwsAccessKeyIdAgreement     string `envconfig:"AWS_ACCESS_KEY_ID_AGREEMENT" required:"true"`
	AwsSecretAccessKeyAgreement string `envconfig:"AWS_SECRET_ACCESS_KEY_AGREEMENT" required:"true"`
	AwsRegionAgreement          string `envconfig:"AWS_REGION_AGREEMENT" default:"eu-west-1"`
	AwsBucketAgreement          string `envconfig:"AWS_BUCKET_AGREEMENT" required:"true"`

	AwsAccessKeyIdReporter     string `envconfig:"AWS_ACCESS_KEY_ID_REPORTER" required:"true"`
	AwsSecretAccessKeyReporter string `envconfig:"AWS_SECRET_ACCESS_KEY_REPORTER" required:"true"`
	AwsRegionReporter          string `envconfig:"AWS_REGION_REPORTER" default:"eu-west-1"`
	AwsBucketReporter          string `envconfig:"AWS_BUCKET_REPORTER" required:"true"`

	LimitDefault                 int32 `default:"100"`
	OffsetDefault                int32 `default:"0"`
	LimitMax                     int32 `default:"1000"`
	DisableAuthMiddleware        bool
	CustomerTokenCookiesLifetime time.Duration // CustomerTokenCookiesLifetime = 2592000

	OrderInlineFormUrlMask string `envconfig:"ORDER_INLINE_FORM_URL_MASK" required:"true"`

	CookieDomain string `envconfig:"COOKIE_DOMAIN" required:"true"`
	AllowOrigin  string `envconfig:"ALLOW_ORIGIN" default:"*"`
}

type Cursor

type Cursor struct {
	Limit, Offset int32
	Sort          []string
}

Cursor

func ExtractCursorContext

func ExtractCursorContext(ctx echo.Context) *Cursor

ExtractCursorContext

type Dictionary

type Dictionary struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Groups

type Groups struct {
	AuthProject *echo.Group
	Access      *echo.Group
	AuthUser    *echo.Group
	WebHooks    *echo.Group
	Common      *echo.Group
	SystemUser  *echo.Group
}

Groups

type Handler

type Handler interface {
	Route(groups *Groups)
}

Handler

type HandlerSet

type HandlerSet struct {
	Services Services
	Validate *validator.Validate
	AwareSet provider.AwareSet
}

HandlerSet

func (HandlerSet) BindAndValidate

func (h HandlerSet) BindAndValidate(req interface{}, ctx echo.Context) *echo.HTTPError

BindAndValidate

func (*HandlerSet) RequestReportFile

func (h *HandlerSet) RequestReportFile(ctx echo.Context, data *ReportFileRequest) error

func (HandlerSet) SrvCallHandler

func (h HandlerSet) SrvCallHandler(req interface{}, err error, name, method string) *echo.HTTPError

SrvCallHandler returns error if present, otherwise response as JSON with 200 OK

type Handlers

type Handlers []Handler

Handlers

type MerchantBinder

type MerchantBinder struct{}

func (*MerchantBinder) Bind

func (b *MerchantBinder) Bind(bindInterface interface{}, ctx echo.Context) (err error)

type OnboardingChangeMerchantStatusBinder

type OnboardingChangeMerchantStatusBinder struct{}

func (*OnboardingChangeMerchantStatusBinder) Bind

func (b *OnboardingChangeMerchantStatusBinder) Bind(i interface{}, ctx echo.Context) error

Bind

type OnboardingChangePaymentMethodBinder

type OnboardingChangePaymentMethodBinder struct{}

func (*OnboardingChangePaymentMethodBinder) Bind

func (cb *OnboardingChangePaymentMethodBinder) Bind(i interface{}, ctx echo.Context) error

Bind

type OnboardingCreateNotificationBinder

type OnboardingCreateNotificationBinder struct{}

func (*OnboardingCreateNotificationBinder) Bind

func (b *OnboardingCreateNotificationBinder) Bind(i interface{}, ctx echo.Context) error

Bind

type OnboardingGetPaymentMethodBinder

type OnboardingGetPaymentMethodBinder struct{}

func (*OnboardingGetPaymentMethodBinder) Bind

func (cb *OnboardingGetPaymentMethodBinder) Bind(i interface{}, ctx echo.Context) error

Bind

type OnboardingMerchantListingBinder

type OnboardingMerchantListingBinder struct {
	LimitDefault, OffsetDefault int64
}

func (*OnboardingMerchantListingBinder) Bind

func (cb *OnboardingMerchantListingBinder) Bind(i interface{}, ctx echo.Context) (err error)

Bind

type OnboardingNotificationsListBinder

type OnboardingNotificationsListBinder struct {
	LimitDefault, OffsetDefault int64
}

func (*OnboardingNotificationsListBinder) Bind

func (cb *OnboardingNotificationsListBinder) Bind(i interface{}, ctx echo.Context) error

Bind

type OrderFormBinder

type OrderFormBinder struct{}

func (*OrderFormBinder) Bind

func (cb *OrderFormBinder) Bind(i interface{}, ctx echo.Context) (err error)

Bind

type OrderJsonBinder

type OrderJsonBinder struct{}

func (*OrderJsonBinder) Bind

func (cb *OrderJsonBinder) Bind(i interface{}, ctx echo.Context) (err error)

Bind

type PaymentCreateProcessBinder

type PaymentCreateProcessBinder struct{}

func (*PaymentCreateProcessBinder) Bind

func (cb *PaymentCreateProcessBinder) Bind(i interface{}, ctx echo.Context) (err error)

Bind

type ProductsCreateProductBinder

type ProductsCreateProductBinder struct{}

func (*ProductsCreateProductBinder) Bind

func (b *ProductsCreateProductBinder) Bind(i interface{}, ctx echo.Context) error

Bind

type ProductsGetProductsListBinder

type ProductsGetProductsListBinder struct {
	LimitDefault, OffsetDefault int64
}

type ProductsUpdateProductBinder

type ProductsUpdateProductBinder struct{}

func (*ProductsUpdateProductBinder) Bind

func (b *ProductsUpdateProductBinder) Bind(i interface{}, ctx echo.Context) error

Bind

type ReportFileRequest

type ReportFileRequest struct {
	MerchantId string                 `json:"merchant_id" validate:"required"`
	FileType   string                 `json:"file_type" validate:"required"`
	ReportType string                 `json:"report_type"`
	Template   string                 `json:"template"`
	Params     map[string]interface{} `json:"params"`
}

type SystemBinder

type SystemBinder struct{}

func (*SystemBinder) Bind

func (b *SystemBinder) Bind(i interface{}, ctx echo.Context) (err error)

type Template

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

Template

func NewTemplate

func NewTemplate(tpl *template.Template) *Template

NewTemplate

func (*Template) Render

func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Render

type Validator

type Validator interface {
	Use(validator *validator.Validate)
}

Validate

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier