public void GetHeaderMapCertificateWithoutTokenTest() { credentialMngr = CredentialManager.Instance; credential = credentialMngr.GetCredentials(UnitTestConstants.CertificateAPIUserName); platformAPIHandler = new PlatformAPICallPreHandler("payload", "servicename", "method", credential); Dictionary<string, string> header = platformAPIHandler.GetHeaderMap(); Assert.AreEqual(UnitTestConstants.CertificateAPIUserName, header[BaseConstants.PAYPAL_SECURITY_USERID_HEADER]); Assert.AreEqual(UnitTestConstants.CertificateAPIPassword, header[BaseConstants.PAYPAL_SECURITY_PASSWORD_HEADER]); Assert.AreEqual(UnitTestConstants.ApplicationID, header[BaseConstants.PAYPAL_APPLICATION_ID]); Assert.AreEqual(BaseConstants.NVP, header[BaseConstants.PAYPAL_REQUEST_DATA_FORMAT_HEADER]); Assert.AreEqual(BaseConstants.NVP, header[BaseConstants.PAYPAL_RESPONSE_DATA_FORMAT_HEADER]); }
public void LoadSignatureCredential() { string apiUsername = UnitTestConstants.APIUserName; credentialMngr = CredentialManager.Instance; credential = credentialMngr.GetCredentials(apiUsername); Assert.NotNull(credential); Assert.IsInstanceOf(typeof(SignatureCredential), credential); SignatureCredential signCredential = (SignatureCredential) credential; Assert.AreEqual(apiUsername, signCredential.UserName); Assert.AreEqual(UnitTestConstants.APIPassword, signCredential.Password); Assert.AreEqual(UnitTestConstants.APISignature, signCredential.Signature); Assert.AreEqual(UnitTestConstants.ApplicationID, signCredential.ApplicationID); }
public void LoadSignatureCredential() { string apiUsername = Constants.APIUserName; credentialMngr = CredentialManager.Instance; credential = credentialMngr.GetCredentials(ConfigManager.Instance.GetProperties(), apiUsername); Assert.IsNotNull(credential); Assert.IsInstanceOfType(credential, typeof(SignatureCredential)); SignatureCredential signCredential = (SignatureCredential)credential; Assert.AreEqual(apiUsername, signCredential.UserName); Assert.AreEqual(Constants.APIPassword, signCredential.Password); Assert.AreEqual(Constants.APISignature, signCredential.Signature); Assert.AreEqual(Constants.ApplicationId, signCredential.ApplicationId); }
public void LoadCertificateCredential() { string apiUsername = UnitTestConstants.CertificateAPIUserName; credentialMngr = CredentialManager.Instance; credential = credentialMngr.GetCredentials(apiUsername); Assert.NotNull(credential); Assert.IsInstanceOf(typeof(CertificateCredential), credential); CertificateCredential certCredential = (CertificateCredential)credential; Assert.AreEqual(apiUsername, certCredential.UserName); Assert.AreEqual(UnitTestConstants.CertificateAPIPassword, certCredential.Password); Assert.AreEqual(UnitTestConstants.CertificatePath, certCredential.CertificateFile); Assert.AreEqual(UnitTestConstants.CertificatePassword, certCredential.PrivateKeyPassword); Assert.AreEqual(UnitTestConstants.ApplicationID, certCredential.ApplicationID); }
public void LoadCertificateCredential() { string apiUsername = Constants.CertificateAPIUserName; credentialMngr = CredentialManager.Instance; credential = credentialMngr.GetCredentials(ConfigManager.Instance.GetProperties(), apiUsername); Assert.NotNull(credential); Assert.IsInstanceOf(typeof(CertificateCredential), credential); CertificateCredential certCredential = (CertificateCredential)credential; Assert.AreEqual(apiUsername, certCredential.UserName); Assert.AreEqual(Constants.CertificateAPIPassword, certCredential.Password); Assert.AreEqual(Path.GetFileName(Constants.CertificatePath), Path.GetFileName(certCredential.CertificateFile)); Assert.AreEqual(Constants.CertificatePassword, certCredential.PrivateKeyPassword); Assert.AreEqual(Constants.ApplicationId, certCredential.ApplicationId); }
public MerchantAPICallPreHandlerTest() { defaultSoapHandler = new DefaultSOAPAPICallHandler(ConfigManager.Instance.GetProperties(), "<Request>test</Request>", null, null); credentialMngr = CredentialManager.Instance; accountConfig = new Dictionary<string, string>(); accountConfig.Add("account1.apiUsername", Constants.APIUserName); accountConfig.Add("account1.apiPassword", Constants.APIPassword); accountConfig.Add("account1.applicationId", Constants.ApplicationId); accountConfig.Add("account1.apiSignature", Constants.APISignature); accountConfig.Add("account2.apiUsername", Constants.CertificateAPIUserName); accountConfig.Add("account2.apiPassword", Constants.CertificateAPIPassword); accountConfig.Add("account2.applicationId", Constants.ApplicationId); accountConfig.Add("account2.apiCertificate", Constants.CertificatePath); accountConfig.Add("account2.privateKeyPassword", Constants.CertificatePassword); }
public void LoadCredentialForNonExistentAccount() { credentialMngr = CredentialManager.Instance; credential = credentialMngr.GetCredentials(ConfigManager.Instance.GetProperties(), "i-do-not-exist_api1.paypal.com"); }
public MerchantAPICallPreHandlerTest() { defaultSoapHandler = new DefaultSOAPAPICallHandler("<Request>test</Request>", null, null); credentialMngr = CredentialManager.Instance; }
public void GetHeaderMapCertificateWithoutTokenTest() { credentialMngr = CredentialManager.Instance; credential = credentialMngr.GetCredentials(ConfigManager.Instance.GetProperties(), Constants.CertificateAPIUserName); platformAPIHandler = new PlatformAPICallPreHandler(ConfigManager.Instance.GetProperties(), "payload", "servicename", "method", credential); Dictionary<string, string> header = platformAPIHandler.GetHeaderMap(); Assert.AreEqual(Constants.CertificateAPIUserName, header[BaseConstants.PayPalSecurityUserIdHeader]); Assert.AreEqual(Constants.CertificateAPIPassword, header[BaseConstants.PayPalSecurityPasswordHeader]); Assert.AreEqual(Constants.ApplicationId, header[BaseConstants.PayPalApplicationIdHeader]); Assert.AreEqual(BaseConstants.NVP, header[BaseConstants.PayPalRequestDataFormatHeader]); Assert.AreEqual(BaseConstants.NVP, header[BaseConstants.PayPalResponseDataFormatHeader]); }