Created
July 28, 2021 11:05
-
-
Save zaynkorai/b612c527f85c43c18fa878ef2a0e4b0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
"net/http" | |
"io/ioutil" | |
) | |
func main() { | |
url := "https://posgateway.cert.secureexchange.net/Hps.Exchange.PosGateway/POSGatewayService.asmx" | |
method := "POST" | |
payload := strings.NewReader(`<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hps="http://Hps.Exchange.PosGateway"> | |
<soapenv:Header/> | |
<soapenv:Body> | |
<hps:PosRequest> | |
<hps:Ver1.0> | |
<hps:Header> | |
<hps:LicenseId>${#Project#LicenseID-Retail}</hps:LicenseId> | |
<hps:SiteId>${#Project#SiteID-Retail}</hps:SiteId> | |
<hps:DeviceId>${#Project#DeviceID-Retail}</hps:DeviceId> | |
<hps:UserName>${#Project#UserName-Retail}</hps:UserName> | |
<hps:Password>${#Project#Password}</hps:Password> | |
<hps:SiteTrace>${#Project#SiteTrace}</hps:SiteTrace> | |
<hps:DeveloperID>${#Project#DeveloperID}</hps:DeveloperID> | |
<hps:VersionNbr>${#Project#VersionNbr}</hps:VersionNbr> | |
<hps:ClerkID>${#Project#ClerkID}</hps:ClerkID> | |
</hps:Header> | |
<hps:Transaction> | |
<hps:CreditAuth> | |
<hps:Block1> | |
<hps:CardData> | |
<hps:TrackData method="swipe">${#Project#VISA_EMV_TRACK2}</hps:TrackData> | |
</hps:CardData> | |
<hps:Amt>25.00</hps:Amt> | |
<hps:AllowDup>Y</hps:AllowDup> | |
<hps:TagData> | |
<hps:TagValues source="chip">${#Project#VISA_EMV_TAGS_ONLINE}</hps:TagValues> | |
</hps:TagData> | |
</hps:Block1> | |
</hps:CreditAuth> | |
</hps:Transaction> | |
</hps:Ver1.0> | |
</hps:PosRequest> | |
</soapenv:Body> | |
</soapenv:Envelope>`) | |
client := &http.Client { | |
} | |
req, err := http.NewRequest(method, url, payload) | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
req.Header.Add("Content-Type", "application/xml") | |
res, err := client.Do(req) | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
defer res.Body.Close() | |
body, err := ioutil.ReadAll(res.Body) | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
fmt.Println(string(body)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment