public GetHeaderMap ( ) : string>.Dictionary |
||
Résultat | string>.Dictionary |
public Dictionary<string, string> GetHeaderMap()
{
try
{
if (headers == null)
{
headers = apiCallHandler.GetHeaderMap();
if (credential is SignatureCredential)
{
SignatureHttpHeaderAuthStrategy signatureHttpHeaderAuthStrategy = new SignatureHttpHeaderAuthStrategy(GetEndpoint());
headers = signatureHttpHeaderAuthStrategy.GenerateHeaderStrategy((SignatureCredential)credential);
}
else if (credential is CertificateCredential)
{
CertificateHttpHeaderAuthStrategy certificateHttpHeaderAuthStrategy = new CertificateHttpHeaderAuthStrategy(GetEndpoint());
headers = certificateHttpHeaderAuthStrategy.GenerateHeaderStrategy((CertificateCredential)credential);
}
foreach (KeyValuePair<string, string> pair in GetDefaultHttpHeadersSOAP())
{
headers.Add(pair.Key, pair.Value);
}
}
}
catch (OAuthException oex)
{
throw oex;
}
return headers;
}
public void GetHeaderMapSignature() { credential = credentialMngr.GetCredentials(UnitTestConstants.APIUserName); soapHandler = new MerchantAPICallPreHandler(defaultSoapHandler, credential); Dictionary<String, String> headers = soapHandler.GetHeaderMap(); Assert.IsNotNull(headers); Assert.IsTrue(headers.Count > 0); Assert.AreEqual(UnitTestConstants.APIUserName, headers[BaseConstants.PAYPAL_SECURITY_USERID_HEADER]); Assert.AreEqual(UnitTestConstants.APIPassword, headers[BaseConstants.PAYPAL_SECURITY_PASSWORD_HEADER]); Assert.AreEqual(UnitTestConstants.APISignature, headers[BaseConstants.PAYPAL_SECURITY_SIGNATURE_HEADER]); Assert.AreEqual(BaseConstants.SOAP, headers[BaseConstants.PAYPAL_REQUEST_DATA_FORMAT_HEADER]); Assert.AreEqual(BaseConstants.SOAP, headers[BaseConstants.PAYPAL_RESPONSE_DATA_FORMAT_HEADER]); }