Documentation
¶
Index ¶
- type AdditionalDataField
- func (a *AdditionalDataField) BillNumberValue(billNumber string) (string, error)
- func (a *AdditionalDataField) PhoneNumberValue(phoneNumber string) (string, error)
- func (a *AdditionalDataField) StoreLabelValue(storeLabel string) (string, error)
- func (a *AdditionalDataField) TerminalLabelValue(terminalLabel string) (string, error)
- func (a *AdditionalDataField) Value(storeLabel, phoneNumber, billNumber, terminalLabel string) (string, error)
- type Amount
- type CRC
- type CountryCode
- type EMV
- type GlobalUniqueIdentifier
- type HASH
- type MCC
- type MerchantCity
- type MerchantName
- type PayloadFormatIndicator
- type PointOfInitiation
- type TimeStamp
- type TransactionCurrency
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionalDataField ¶
type AdditionalDataField struct { AdditionalDataTag string StoreLabelTag string MobileNumberTag string BillNumberTag string TerminalLabelTag string StoreLabelLength int MobileNumberLength int BillNumberLength int TerminalLabelLength int }
AdditionalDataField holds the configuration for additional data fields based on the EMV configuration.
func NewAdditionalDataField ¶
func NewAdditionalDataField(emv *EMV) *AdditionalDataField
NewAdditionalDataField initializes and returns an AdditionalDataField instance with EMV configurations.
func (*AdditionalDataField) BillNumberValue ¶
func (a *AdditionalDataField) BillNumberValue(billNumber string) (string, error)
BillNumberValue formats and validates the bill number value.
func (*AdditionalDataField) PhoneNumberValue ¶
func (a *AdditionalDataField) PhoneNumberValue(phoneNumber string) (string, error)
PhoneNumberValue formats and validates the phone number value.
func (*AdditionalDataField) StoreLabelValue ¶
func (a *AdditionalDataField) StoreLabelValue(storeLabel string) (string, error)
StoreLabelValue formats and validates the store label value.
func (*AdditionalDataField) TerminalLabelValue ¶
func (a *AdditionalDataField) TerminalLabelValue(terminalLabel string) (string, error)
TerminalLabelValue formats and validates the terminal label value.
type Amount ¶
Amount holds the transaction amount tag and its maximum length.
type CRC ¶
CRC holds the CRC tag and default CRC tag values.
func (*CRC) CalculateCRC16 ¶
CalculateCRC16 calculates the CRC-16 using the CRC-CCITT polynomial.
type CountryCode ¶
CountryCode holds the country code tag and default country code.
func NewCountryCode ¶
func NewCountryCode(emv *EMV) *CountryCode
NewCountryCode initializes and returns a CountryCode instance.
func (*CountryCode) Value ¶
func (c *CountryCode) Value(countryCode string) string
Value formats the country code according to the required structure.
type EMV ¶
type EMV struct { // Default QR Code Types DefaultDynamicQR string DefaultStaticQR string // Currency Codes TransactionCurrencyUSD string TransactionCurrencyKHR string TransactionCurrency string // Payload and Point of Initiation PayloadFormatIndicator string DefaultPayloadFormatIndicator string PointOfInitiationMethod string // Merchant Information MerchantName string MerchantCity string DefaultMerchantCity string MerchantCategoryCode string DefaultMerchantCategoryCode string // QR Code Identifiers StaticQR string DynamicQR string MerchantAccountInformationIndividual string MerchantAccountInformationMerchant string // Transaction Details TransactionAmount string DefaultTransactionAmount string CountryCode string DefaultCountryCode string // Additional Data Tags AdditionalDataTag string BillNumberTag string AdditionDataFieldMobileNumber string StoreLabel string TerminalLabel string PurposeOfTransaction string TimestampTag string MerchantInformationLanguageTemplate string // Language Preferences LanguagePreference string MerchantNameAlternativeLanguage string MerchantCityAlternativeLanguage string // UnionPay Specific UnionPayMerchantAccount string // CRC Tag CRC string CRCLength string DefaultCRCTag string // Invalid Length Constraints InvalidLengthKHQR int InvalidLengthMerchantName int InvalidLengthBakongAccount int InvalidLengthAmount int InvalidLengthCountryCode int InvalidLengthMerchantCategoryCode int InvalidLengthMerchantCity int InvalidLengthTimestamp int InvalidLengthTransactionAmount int InvalidLengthTransactionCurrency int InvalidLengthBillNumber int InvalidLengthStoreLabel int InvalidLengthTerminalLabel int InvalidLengthPurposeOfTransaction int InvalidLengthMerchantID int InvalidLengthAcquiringBank int InvalidLengthMobileNumber int InvalidLengthAccountInformation int InvalidLengthMerchantNameLanguageTemplate int InvalidLengthUPIMerchant int InvalidLengthLanguagePreference int InvalidLengthMerchantNameAlternativeLanguage int InvalidLengthMerchantCityAlternativeLanguage int }
EMV struct contains constants used for encoding and decoding QR codes for transactions supported by the Bakong app.
type GlobalUniqueIdentifier ¶
type GlobalUniqueIdentifier struct { PayloadFormatIndicator string MerchantAccountInformationIndividual string MaxLength int }
GlobalUniqueIdentifier holds the values for payload format indicator, merchant account information, and max length.
func NewGlobalUniqueIdentifier ¶
func NewGlobalUniqueIdentifier(emv *EMV) *GlobalUniqueIdentifier
NewGlobalUniqueIdentifier initializes and returns a new GlobalUniqueIdentifier instance.
type HASH ¶
type HASH struct{}
HASH struct is an empty struct to represent the hashing functionality.
type MerchantCity ¶
MerchantCity struct contains the merchant city logic
func NewMerchantCity ¶
func NewMerchantCity(emv *EMV) *MerchantCity
NewMerchantCity initializes and returns a new MerchantCity instance
type MerchantName ¶
MerchantName struct contains the merchant name logic
func NewMerchantName ¶
func NewMerchantName(emv *EMV) *MerchantName
NewMerchantName initializes and returns a new MerchantName instance
type PayloadFormatIndicator ¶
type PayloadFormatIndicator struct { PayloadFormatIndicator string DefaultPayloadFormatIndicator string }
PayloadFormatIndicator struct contains the payload format indicator logic
func NewPayloadFormatIndicator ¶
func NewPayloadFormatIndicator(emv *EMV) *PayloadFormatIndicator
NewPayloadFormatIndicator initializes and returns a new PayloadFormatIndicator instance
func (*PayloadFormatIndicator) Value ¶
func (p *PayloadFormatIndicator) Value() string
Value generates and returns the formatted payload format indicator value
type PointOfInitiation ¶
PointOfInitiation struct contains the logic for dynamic and static QR code settings
func NewPointOfInitiation ¶
func NewPointOfInitiation(emv *EMV) *PointOfInitiation
NewPointOfInitiation initializes and returns a new PointOfInitiation instance
func (*PointOfInitiation) Dynamic ¶
func (p *PointOfInitiation) Dynamic() string
Dynamic retrieves the dynamic QR code setting
func (*PointOfInitiation) Static ¶
func (p *PointOfInitiation) Static() string
Static retrieves the static QR code setting
type TimeStamp ¶
TimeStamp struct contains the logic for generating timestamp data
func NewTimeStamp ¶
NewTimeStamp initializes and returns a new TimeStamp instance
type TransactionCurrency ¶
type TransactionCurrency struct { TransactionCurrency string CurrencyUSD string CurrencyKHR string }
TransactionCurrency struct contains the logic for generating transaction currency data
func NewTransactionCurrency ¶
func NewTransactionCurrency(emv *EMV) *TransactionCurrency
NewTransactionCurrency initializes and returns a new TransactionCurrency instance