<commit_before>/*
	export ADYEN_CLIENT_TOKEN="YOUR_ADYEN_ENCRYPTED_URL"
	export ADYEN_USERNAME="YOUR_ADYEN_API_USERNAME"
	export ADYEN_PASSWORD="<PASSWORD>"
	export ADYEN_ACCOUNT="YOUR_MERCHANT_ACCOUNT"

	# API settings for Adyen Hosted Payment pages
	export ADYEN_HMAC="YOUR_HMAC_KEY"
	export ADYEN_SKINCODE="YOUR_SKIN_CODE"
	export ADYEN_SHOPPER_LOCALE="en_GB"
*/

package main

import (
	"encoding/json"
	"fmt"
	"html/template"
	"log"
	"math/rand"
	"net/http"
	"os"
	"path/filepath"
	"strconv"
	"time"

	"github.com/gorilla/mux"
	"github.com/zhutik/adyen-api-go"
)

// TemplateConfig for HTML template
type TemplateConfig struct {
	EncURL string
	Time   string
}

func randInt(min int, max int) int {
	return min + rand.Intn(max-min)
}

func randomString(l int) string {
	bytes := make([]byte, l)
	for i := 0; i < l; i++ {
		bytes[i] = byte(randInt(65, 90))
	}
	return string(bytes)
}

// initAdyen init Adyen API instance
func initAdyen() *adyen.Adyen {
	logger := log.New(os.Stdout, "Adyen Playground: ", log.Ldate|log.Ltime|log.Lshortfile)

	instance := adyen.New(
		adyen.Testing,
		os.Getenv("ADYEN_USERNAME"),
		os.Getenv("ADYEN_PASSWORD"),
		logger,
	)

	instance.Currency = "EUR"
	instance.MerchantAccount = os.Getenv("ADYEN_ACCOUNT")

	return instance
}

func initAdyenHPP() *adyen.Adyen {
	logger := log.New(os.Stdout, "Adyen Playground: ", log.Ldate|log.Ltime|log.Lshortfile)

	instance := adyen.NewWithHMAC(
		adyen.Testing,
		os.Getenv("ADYEN_USERNAME"),
		os.Getenv("ADYEN_PASSWORD"),
		os.Getenv("ADYEN_HMAC"),
		logger,
	)

	instance.Currency = "EUR"
	instance.MerchantAccount = os.Getenv("ADYEN_ACCOUNT")

	return instance
}

/**<commit_msg>Logger removed from api init<commit_after>/*
	export ADYEN_CLIENT_TOKEN="YOUR_ADYEN_ENCRYPTED_URL"
	export ADYEN_USERNAME="YOUR_ADYEN_API_USERNAME"
	export ADYEN_PASSWORD="<PASSWORD>"
	export ADYEN_ACCOUNT="YOUR_MERCHANT_ACCOUNT"

	# API settings for Adyen Hosted Payment pages
	export ADYEN_HMAC="YOUR_HMAC_KEY"
	export ADYEN_SKINCODE="YOUR_SKIN_CODE"
	export ADYEN_SHOPPER_LOCALE="en_GB"
*/

package main

import (
	"encoding/json"
	"fmt"
	"html/template"
	"math/rand"
	"net/http"
	"os"
	"path/filepath"
	"strconv"
	"time"

	"github.com/gorilla/mux"
	"github.com/zhutik/adyen-api-go"
)

// TemplateConfig for HTML template
type TemplateConfig struct {
	EncURL string
	Time   string
}

func randInt(min int, max int) int {
	return min + rand.Intn(max-min)
}

func randomString(l int) string {
	bytes := make([]byte, l)
	for i := 0; i < l; i++ {
		bytes[i] = byte(randInt(65, 90))
	}
	return string(bytes)
}

// initAdyen init Adyen API instance
func initAdyen() *adyen.Adyen {
	instance := adyen.New(
		adyen.Testing,
		os.Getenv("ADYEN_USERNAME"),
		os.Getenv("ADYEN_PASSWORD"),
	)

	instance.Currency = "EUR"
	instance.MerchantAccount = os.Getenv("ADYEN_ACCOUNT")

	return instance
}

func initAdyenHPP() *adyen.Adyen {
	instance := adyen.NewWithHMAC(
		adyen.Testing,
		os.Getenv("ADYEN_USERNAME"),
		os.Getenv("ADYEN_PASSWORD"),
		os.Getenv("ADYEN_HMAC"),
	)

	instance.Currency = "EUR"
	instance.MerchantAccount = os.Getenv("ADYEN_ACCOUNT")

	return instance
}

/**
{'fraction_non_alphanumeric': 0.1360153256704981, 'fraction_numerical': 0.0031928480204342275, 'mean_word_length': 4.878048780487805, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2661206', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1313, 'n_words': 233}