package libebics import ( "io" "net/http" "path/filepath" "strings" "testing" ) func TestSendIniRequest(t *testing.T) { signatureCertificate, err := ReadCertificateFromFile(filepath.Join("certs", "signature_cert.pem"), A006) if err != nil { t.Error(err.Error()) } ini, err := GenerateIniRequest(*signatureCertificate) if err != nil { t.Error(err.Error()) } t.Log(ini) resp, err := http.Post( "https://ebics-test.multivia-suite.de/MVB_ENT/ebicsweb", "text/xml; charset=UTF-8", strings.NewReader(ini), ) if err != nil { t.Error(err.Error()) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) t.Log(string(body)) } func TestSendHiaRequest(t *testing.T) { authenticationCertificate, err := ReadCertificateFromFile(filepath.Join("certs", "authentication_cert.pem"), X002) if err != nil { t.Error(err.Error()) } encryptionCertificate, err := ReadCertificateFromFile(filepath.Join("certs", "encryption_cert.pem"), E002) if err != nil { t.Error(err.Error()) } ini, err := GenerateHiaRequest(*authenticationCertificate, *encryptionCertificate) if err != nil { t.Error(err.Error()) } t.Log(ini) resp, err := http.Post( "https://ebics-test.multivia-suite.de/MVB_ENT/ebicsweb", "text/xml; charset=UTF-8", strings.NewReader(ini), ) if err != nil { t.Error(err.Error()) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) t.Log(string(body)) } func TestSendHpbRequest(t *testing.T) { authenticationCertificate, err := ReadCertificateFromFile(filepath.Join("certs", "authentication_cert.pem"), X002) if err != nil { t.Error(err.Error()) } authenticationKey, err := ReadKeypairFromFile(filepath.Join("certs", "authentication_key.pem")) if err != nil { t.Error(err.Error()) } hpb, err := GenerateHpbRequest(*authenticationCertificate, authenticationKey) if err != nil { t.Error(err.Error()) } t.Log(hpb) resp, err := http.Post( "https://ebics-test.multivia-suite.de/MVB_ENT/ebicsweb", "text/xml; charset=UTF-8", strings.NewReader(hpb), ) if err != nil { t.Error(err.Error()) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) t.Log(string(body)) }