我有一个桌面应用程序 Foxpro 9.0 Executive,它需要连接到 Payeezy 并通过他们的 API 传输和接收 XML 数据。我使用 WinHttpRequest.5.1 从 UPS 地址验证 API 发送和接收 XML 数据。但我似乎对 SHA-1 HMAC 哈希计算头有问题。谁能给我一些关于如何在 Foxpro 中完成此操作的示例代码? https://support.payeezy.com/hc/en-us/articles/203731149-API-Security-HMAC-Hash
*api.demo.globalgatewaye4.firstdata.com
***************************
If Vartype(loReq)='U'
Public loReq
ENDIF
lcURL='https://api-cert.payeezy.com/v1/transactions/v12'
lcPassWd ='Password'
lcExactID='ExactID'
lcKeyCode='Keycode'
ldDate=dtos(DATE())
lcDate=SUBSTR(ldDate,1,4)+'-'+SUBSTR(ldDate,5,2)+'-'+SUBSTR(ldDate,7,2)
ltTime=TIME()
lcDateTime=lcDate+'T'+TRANSFORM(ltTime)+'Z'
uri='transaction/v12'
lcTranstype='00'
lcAmount='1299.00'
lctype='visa'
lcname='John Smith'
lncc_no='4788250000028291'
lcExp_Date='1020'
lccvv='123'
lcAddress='21 Jump Street'
lcCity='Los Angeles'
lcZip='90210'
lcPhone='5557891234'
lcOrderno='12345678'
CustID='87654321'
lcTransactionType="00"
lcShip_Name="Customer Name"
XMLRequest='<?xml version="1.0" encoding="utf-8" ?>'+Chr(13)+;
'<Transaction>'+Chr(13)+;
'<Transaction_Type>'+lcTranstype+'</Transaction_Type>'+CHR(13)+;
'<DollarAmount>'+lcAmount+'</DollarAmount>'+CHR(13)+;
'<Expiry_Date>'+lcExp_Date+'</Expiry_Date>'+CHR(13)+;
'<CardHolderName>'+lcname+'</CardHolderName>'+Chr(13)+;
'<Reference_No>'+lcOrderno+'</Reference_No>'+CHR(13)+;
'<Customer_Ref>'+CustID+'</Customer_Ref>'+CHR(13)+;
'<Reference_3>'+lcname+'</Reference_3>'+CHR(13)+;
'<ExactID>'+lcExactID+'</ExactID>'+CHR(13)+;
'<Password>'+lcPassWd+ '</Password>'+CHR(13)+;
'<Card_Number>'+lncc_no+'</Card_Number>'+chr(13)+;
'</Transaction>'
Hashme='POST'+chr(13)+'SOAP'+chr(13)+XMLRequest+chr(13)+lcDateTime+chr(13)+lcURL
baseHash=STRCONV(Hashme, 13)
loReq = Createobject('WinHttp.WinHttpRequest.5.1')
loReq.SetTimeouts(2500, 2500, 2500, 2500)
loReq.Open('POST', 'https://api-cert.payeezy.com/v1/transactions/v12', .F.)
loReq.SetCredentials(lcExactID, lcPassWd , 0)
loReq.SetRequestHeader('authorization', 'GGE4_API 14:'+lcKeyCode)
loReq.SetRequestHeader('x-gge4-content-sha1',baseHash )
loReq.SetRequestHeader('content-type', 'application/xml')
loReq.SetRequestHeader('accept', 'text/xml')
loReq.Send(XMLRequest)
Xmltocursor(loReq.responsetext,'Payeezy')
loReq=""