Skip to content

Go source example for creating NMI payment gateway hash values

License

Notifications You must be signed in to change notification settings

jmadore/nmihash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nmihash

Package nmihash is used as a source code example for a Go (golang) implementation of the examples found at: // https://support.nmi.com/hc/en-gb/articles/115001683343-Implementation-Generating-a-Hash-Code

Go Report Card Documentation


Prerequisites

Installation

Using go get

You can run the following command to install nmihash:

go get -u github.com/jmadore/nmihash

The code is self-contained and doesn't have any external dependencies.

Build

Build

> go build

Tests

> go test -v

Example

package main

import (
	"fmt"

	"github.com/jmadore/nmihash"
)

func main() {

	hashKey := "trVxrnoz22bvwvnV"
	terminalID := "99999999"
	refNum := "0000000765"
	amount := "1.23"

	hash, err := nmihash.CalculateHash(hashKey, terminalID, refNum, amount)
	if err != nil {
		fmt.Printf("Hash failed with error %v", err.Error())
		return
	}

	fmt.Println("Base64 Encoded Hash =", hash)
	return
}

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Jay Madore - Initial work - jmadore

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

About

Go source example for creating NMI payment gateway hash values

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages