public void MakeRequestUsingSOAPSignatureCredential() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(UnitTestConstants.PayloadSOAP, null, null); handler = new MerchantAPICallPreHandler(defaultSOAPHandler, UnitTestConstants.APIUserName, null, null); service = new APIService(); string response = service.MakeRequestUsing(handler); Assert.IsNotNull(response); Assert.IsTrue(response.Contains("<Ack xmlns=\"urn:ebay:apis:eBLBaseComponents\">Success</Ack>")); }
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 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); }
/// <summary> /// /// </summary> ///<param name="bMGetInventoryReq"></param> ///<param name="apiUserName">API Username that you want to authenticate this call against. This username and the corresponding 3-token/certificate credentials must be available in Web.Config/App.Config</param> public BMGetInventoryResponseType BMGetInventory(BMGetInventoryReq bMGetInventoryReq, string apiUserName) { setStandardParams(bMGetInventoryReq.BMGetInventoryRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, bMGetInventoryReq.ToXMLString(null, "BMGetInventoryReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, apiUserName, getAccessToken(), getAccessTokenSecret()); ((MerchantAPICallPreHandler)apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler)apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler)apiCallPreHandler).PortName = "PayPalAPI"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return(new BMGetInventoryResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='BMGetInventoryResponse']") )); }
/// <summary> /// /// </summary> ///<param name="bMCreateButtonReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public BMCreateButtonResponseType BMCreateButton(BMCreateButtonReq bMCreateButtonReq, ICredential credential) { setStandardParams(bMCreateButtonReq.BMCreateButtonRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, bMCreateButtonReq.ToXMLString(null, "BMCreateButtonReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential); ((MerchantAPICallPreHandler)apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler)apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler)apiCallPreHandler).PortName = "PayPalAPI"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return(new BMCreateButtonResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='BMCreateButtonResponse']") )); }
public void DomPayloadTest() { DefaultSOAPAPICallHandler.XMLNamespaceProvider = new XmlNamespacePrefixProvider(); APIContext api = new APIContext(); api.SOAPHeader = new SampleHeader(); Dictionary <string, string> configurationMap = new Dictionary <string, string>(); configurationMap.Add("service.EndPoint", "https://api-3t.sandbox.paypal.com/2.0"); api.Config = configurationMap; DefaultSOAPAPICallHandler defHandler = new DefaultSOAPAPICallHandler(new SampleBody(), api, null, "DoDirectPayment"); string payload = defHandler.GetPayload().Trim(); string expectedPayload = "<soapenv:Envelope xmlns:xml=\"http://www.w3.org/XML/1998/namespace\" xmlns:ed=\"urn:ebay:apis:EnhancedDataTypes\" xmlns:cc=\"urn:ebay:apis:CoreComponentTypes\" xmlns:ebl=\"urn:ebay:apis:eBLBaseComponents\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:wsdlsoap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:ns=\"urn:ebay:api:PayPalAPI\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<soapenv:Header>" + "<ns:RequesterCredentials>" + "<ebl:Credentials>" + "<ebl:Username>jb-us-seller_api1.paypal.com</ebl:Username>" + "</ebl:Credentials>" + "</ns:RequesterCredentials>" + "</soapenv:Header>" + "<soapenv:Body>" + "<ns:DoDirectPaymentReq>" + "<ns:DoDirectPaymentRequest>" + "<ebl:Version>98.0</ebl:Version>" + "<ebl:DoDirectPaymentRequestDetails>" + "<ebl:CreditCard>" + "<ebl:CreditCardType>Visa</ebl:CreditCardType>" + "<ebl:CreditCardNumber>4202297003827029</ebl:CreditCardNumber>" + "<ebl:CVV2>962</ebl:CVV2>" + "</ebl:CreditCard>" + "</ebl:DoDirectPaymentRequestDetails>" + "</ns:DoDirectPaymentRequest>" + "</ns:DoDirectPaymentReq>" + "</soapenv:Body>" + "</soapenv:Envelope>"; Assert.AreEqual(expectedPayload, payload); }
public void GetPayloadForEmptyRawPayload() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(ConfigManager.Instance.GetProperties(), string.Empty, string.Empty, string.Empty); Assert.AreEqual("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" ><soapenv:Header></soapenv:Header><soapenv:Body></soapenv:Body></soapenv:Envelope>", defaultSOAPHandler.GetPayload()); }
public void NamespaceAttributes() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(ConfigManager.Instance.GetProperties(), string.Empty, string.Empty, string.Empty); defaultSOAPHandler.NamespaceAttributes = "NamespaceAttributes"; Assert.AreEqual("NamespaceAttributes", defaultSOAPHandler.NamespaceAttributes); }
public void HeaderElement() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(ConfigManager.Instance.GetProperties(), string.Empty, string.Empty, string.Empty); defaultSOAPHandler.HeaderElement = "HeaderElement"; Assert.AreEqual("HeaderElement", defaultSOAPHandler.HeaderElement); }
public void Endpoint() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(ConfigManager.Instance.GetProperties(), Constants.PayloadNVP, string.Empty, string.Empty); Assert.AreEqual(Constants.APIEndpointSOAP, defaultSOAPHandler.GetEndpoint()); }
public void NamespaceAttributes() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(string.Empty, string.Empty, string.Empty); defaultSOAPHandler.NamespaceAttributes = "NamespaceAttributes"; Assert.AreEqual("NamespaceAttributes", defaultSOAPHandler.NamespaceAttributes); }
public void HeaderElement() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(string.Empty, string.Empty, string.Empty); defaultSOAPHandler.HeaderElement = "HeaderElement"; Assert.AreEqual("HeaderElement", defaultSOAPHandler.HeaderElement); }
public void GetPayloadForEmptyRawPayload() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(string.Empty, string.Empty, string.Empty); Assert.AreEqual("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" ><soapenv:Header></soapenv:Header><soapenv:Body></soapenv:Body></soapenv:Envelope>", defaultSOAPHandler.GetPayLoad()); }
public void EndPoint() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(UnitTestConstants.PayloadNVP, string.Empty, string.Empty); Assert.AreEqual(UnitTestConstants.APIEndpointSOAP, defaultSOAPHandler.GetEndPoint()); }
public void DomPayloadTest() { DefaultSOAPAPICallHandler.XMLNamespaceProvider = new XmlNamespacePrefixProvider(); APIContext api = new APIContext(); api.SOAPHeader = new SampleHeader(); Dictionary<string, string> configurationMap = new Dictionary<string, string>(); configurationMap.Add("service.EndPoint", "https://api-3t.sandbox.paypal.com/2.0"); api.Config = configurationMap; DefaultSOAPAPICallHandler defHandler = new DefaultSOAPAPICallHandler(new SampleBody(), api, null, "DoDirectPayment"); string payload = defHandler.GetPayload().Trim(); string expectedPayload = "<soapenv:Envelope xmlns:xml=\"http://www.w3.org/XML/1998/namespace\" xmlns:ed=\"urn:ebay:apis:EnhancedDataTypes\" xmlns:cc=\"urn:ebay:apis:CoreComponentTypes\" xmlns:ebl=\"urn:ebay:apis:eBLBaseComponents\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:wsdlsoap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:ns=\"urn:ebay:api:PayPalAPI\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<soapenv:Header>" + "<ns:RequesterCredentials>" + "<ebl:Credentials>" + "<ebl:Username>jb-us-seller_api1.paypal.com</ebl:Username>" + "</ebl:Credentials>" + "</ns:RequesterCredentials>" + "</soapenv:Header>" + "<soapenv:Body>" + "<ns:DoDirectPaymentReq>" + "<ns:DoDirectPaymentRequest>" + "<ebl:Version>98.0</ebl:Version>" + "<ebl:DoDirectPaymentRequestDetails>" + "<ebl:CreditCard>" + "<ebl:CreditCardType>Visa</ebl:CreditCardType>" + "<ebl:CreditCardNumber>4202297003827029</ebl:CreditCardNumber>" + "<ebl:CVV2>962</ebl:CVV2>" + "</ebl:CreditCard>" + "</ebl:DoDirectPaymentRequestDetails>" + "</ns:DoDirectPaymentRequest>" + "</ns:DoDirectPaymentReq>" + "</soapenv:Body>" + "</soapenv:Envelope>"; Assert.AreEqual(expectedPayload, payload); }
public MerchantAPICallPreHandlerTest() { defaultSoapHandler = new DefaultSOAPAPICallHandler("<Request>test</Request>", null, null); credentialMngr = CredentialManager.Instance; }
public void EndPoint() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(ConfigManager.Instance.GetProperties(), UnitTestConstants.PayloadNVP, string.Empty, string.Empty); Assert.AreEqual(UnitTestConstants.APIEndpointSOAP, defaultSOAPHandler.GetEndPoint()); }
public void GetPayloadForEmptyRawPayloadTest() { defaultHandler = new DefaultSOAPAPICallHandler(new Dictionary <string, string>(), string.Empty, string.Empty, string.Empty); Assert.AreEqual("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" ><soapenv:Header></soapenv:Header><soapenv:Body></soapenv:Body></soapenv:Envelope>", defaultHandler.GetPayload()); }
public void DomEndpointTest() { APIContext baseAPIContext = new APIContext(); Dictionary<string, string> configurationMap = new Dictionary<string, string>(); configurationMap.Add("endpoint", "https://api-3t.sandbox.paypal.com/2.0"); DefaultSOAPAPICallHandler defHandler = new DefaultSOAPAPICallHandler(new SampleBody(), baseAPIContext, configurationMap, "DoDirectPayment"); Assert.AreEqual("https://api-3t.sandbox.paypal.com/2.0", defHandler.GetEndpoint()); }