func NewGateway(creds localconfig.APICredential) *Gateway {
	snapClient := &snap.Client{
		ServerKey: creds.SecretKey,
	}
	switch os.Getenv("ENVIRONMENT") {
	case "prod":
		snapClient.Env = midtrans.Production
		snapClient.HttpClient = midtrans.GetHttpClient(midtrans.Production)
	default:
		snapClient.Env = midtrans.Sandbox
		snapClient.HttpClient = midtrans.GetHttpClient(midtrans.Sandbox)
	}
	gateway := Gateway{
		serverKey:     creds.SecretKey,
		SnapV2Gateway: snapClient,
	}
	return &gateway
}
NewGateway creates new midtrans payment gateway
package midtrans
import (
	"os"
	"github.com/midtrans/midtrans-go"
	"github.com/midtrans/midtrans-go/snap"
	"github.com/imrenagi/go-payment/util/localconfig"
)