A Go library to work with TheMAP.
Install by import github.com/sendtips/themap
or via go get github.com/sendtips/themap
The library itself can be compiled on go1.13,
but to run tests you need go1.14 due to strconv.NumError
received Unwrap()
method only in v1.14
Run tests using THEMAPTERMID=TestTerminal THEMAPTERMPW=123 THEMAPMERCHID=TestMerchant THEMAPMERCHPW=123 THEMAPAPIHOST=https://api-stage.mapcard.pro go test -v .
Note: Use your credentials. The provided above will not work.
There also THEMAPSIGNKEY
variable exists, but currently, no one test uses it properly.
To obtain a payment session you need to call Init()
method.
package main
import (
"fmt"
"context"
"github.com/sendtips/themap"
)
func main() {
pay := themap.New("TestTerminal", "TestOrder123")
pay.SetTerm("123") // Set Terminal password
err := pay.Init(context.TODO(), 300) // Create a session for 3.00RUB
if err != nil {
fmt.Printf("Error occurred: %v", err)
}
fmt.Printf("%s", pay.SessionGUID) // TheMAP payment session identifier
}