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()); }
/// <summary> /// /// </summary> ///<param name="addressVerifyReq"></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 AddressVerifyResponseType AddressVerify(AddressVerifyReq addressVerifyReq, string apiUserName) { setStandardParams(addressVerifyReq.AddressVerifyRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, addressVerifyReq.ToXMLString(null, "AddressVerifyReq"), 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 AddressVerifyResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='AddressVerifyResponse']") ); }
/** *AUTO_GENERATED */ public AddressVerifyResponseType AddressVerify(AddressVerifyReq addressVerifyReq, ICredential credential) { IAPICallPreHandler apiCallPreHandler = null; string portName = "PayPalAPI"; setStandardParams(addressVerifyReq.AddressVerifyRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(addressVerifyReq.ToXMLString(null, "AddressVerifyReq"), null, null); apiCallPreHandler = new MerchantAPICallPreHandler(defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = portName; string response = Call(apiCallPreHandler); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(response); XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='AddressVerifyResponse']"); return new AddressVerifyResponseType(xmlNode); }
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); }
/// <summary> /// /// </summary> ///<param name="managePendingTransactionStatusReq"></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 ManagePendingTransactionStatusResponseType ManagePendingTransactionStatus(ManagePendingTransactionStatusReq managePendingTransactionStatusReq, string apiUserName) { setStandardParams(managePendingTransactionStatusReq.ManagePendingTransactionStatusRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, managePendingTransactionStatusReq.ToXMLString(null, "ManagePendingTransactionStatusReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, apiUserName, getAccessToken(), getAccessTokenSecret()); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return new ManagePendingTransactionStatusResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='ManagePendingTransactionStatusResponse']") ); }
/// <summary> /// /// </summary> ///<param name="getBillingAgreementCustomerDetailsReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public GetBillingAgreementCustomerDetailsResponseType GetBillingAgreementCustomerDetails(GetBillingAgreementCustomerDetailsReq getBillingAgreementCustomerDetailsReq, ICredential credential) { setStandardParams(getBillingAgreementCustomerDetailsReq.GetBillingAgreementCustomerDetailsRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, getBillingAgreementCustomerDetailsReq.ToXMLString(null, "GetBillingAgreementCustomerDetailsReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return new GetBillingAgreementCustomerDetailsResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='GetBillingAgreementCustomerDetailsResponse']") ); }
/// <summary> /// /// </summary> ///<param name="externalRememberMeOptOutReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public ExternalRememberMeOptOutResponseType ExternalRememberMeOptOut(ExternalRememberMeOptOutReq externalRememberMeOptOutReq, ICredential credential) { setStandardParams(externalRememberMeOptOutReq.ExternalRememberMeOptOutRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, externalRememberMeOptOutReq.ToXMLString(null, "ExternalRememberMeOptOutReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return new ExternalRememberMeOptOutResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='ExternalRememberMeOptOutResponse']") ); }
/** *AUTO_GENERATED */ public DoUATPExpressCheckoutPaymentResponseType DoUATPExpressCheckoutPayment(DoUATPExpressCheckoutPaymentReq doUATPExpressCheckoutPaymentReq, string apiUserName) { IAPICallPreHandler apiCallPreHandler = null; string portName = "PayPalAPIAA"; setStandardParams(doUATPExpressCheckoutPaymentReq.DoUATPExpressCheckoutPaymentRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(doUATPExpressCheckoutPaymentReq.ToXMLString(null, "DoUATPExpressCheckoutPaymentReq"), null, null); apiCallPreHandler = new MerchantAPICallPreHandler(defaultHandler, apiUserName, getAccessToken(), getAccessTokenSecret()); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = portName; string response = Call(apiCallPreHandler); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(response); XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='DoUATPExpressCheckoutPaymentResponse']"); return new DoUATPExpressCheckoutPaymentResponseType(xmlNode); }
public void HeaderElement() { defaultSOAPHandler = new DefaultSOAPAPICallHandler(ConfigManager.Instance.GetProperties(), string.Empty, string.Empty, string.Empty); defaultSOAPHandler.HeaderElement = "HeaderElement"; Assert.AreEqual("HeaderElement", defaultSOAPHandler.HeaderElement); }
/// <summary> /// /// </summary> ///<param name="updateRecurringPaymentsProfileReq"></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 UpdateRecurringPaymentsProfileResponseType UpdateRecurringPaymentsProfile(UpdateRecurringPaymentsProfileReq updateRecurringPaymentsProfileReq, string apiUserName) { setStandardParams(updateRecurringPaymentsProfileReq.UpdateRecurringPaymentsProfileRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, updateRecurringPaymentsProfileReq.ToXMLString(null, "UpdateRecurringPaymentsProfileReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, apiUserName, getAccessToken(), getAccessTokenSecret()); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return new UpdateRecurringPaymentsProfileResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='UpdateRecurringPaymentsProfileResponse']") ); }
/** *AUTO_GENERATED */ public GetBillingAgreementCustomerDetailsResponseType GetBillingAgreementCustomerDetails(GetBillingAgreementCustomerDetailsReq getBillingAgreementCustomerDetailsReq, string apiUserName) { IAPICallPreHandler apiCallPreHandler = null; string portName = "PayPalAPIAA"; setStandardParams(getBillingAgreementCustomerDetailsReq.GetBillingAgreementCustomerDetailsRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(getBillingAgreementCustomerDetailsReq.ToXMLString(null, "GetBillingAgreementCustomerDetailsReq"), null, null); apiCallPreHandler = new MerchantAPICallPreHandler(defaultHandler, apiUserName, getAccessToken(), getAccessTokenSecret()); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = portName; string response = Call(apiCallPreHandler); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(response); XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='GetBillingAgreementCustomerDetailsResponse']"); return new GetBillingAgreementCustomerDetailsResponseType(xmlNode); }
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 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(ConfigManager.Instance.GetProperties(), string.Empty, string.Empty, string.Empty); defaultSOAPHandler.NamespaceAttributes = "NamespaceAttributes"; Assert.AreEqual("NamespaceAttributes", defaultSOAPHandler.NamespaceAttributes); }
/// <summary> /// /// </summary> ///<param name="setMobileCheckoutReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public SetMobileCheckoutResponseType SetMobileCheckout(SetMobileCheckoutReq setMobileCheckoutReq, ICredential credential) { setStandardParams(setMobileCheckoutReq.SetMobileCheckoutRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, setMobileCheckoutReq.ToXMLString(null, "SetMobileCheckoutReq"), 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 SetMobileCheckoutResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='SetMobileCheckoutResponse']") ); }
/// <summary> /// /// </summary> ///<param name="updateAccessPermissionsReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public UpdateAccessPermissionsResponseType UpdateAccessPermissions(UpdateAccessPermissionsReq updateAccessPermissionsReq, ICredential credential) { setStandardParams(updateAccessPermissionsReq.UpdateAccessPermissionsRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, updateAccessPermissionsReq.ToXMLString(null, "UpdateAccessPermissionsReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return new UpdateAccessPermissionsResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='UpdateAccessPermissionsResponse']") ); }
/** *AUTO_GENERATED */ public ManagePendingTransactionStatusResponseType ManagePendingTransactionStatus(ManagePendingTransactionStatusReq managePendingTransactionStatusReq, ICredential credential) { IAPICallPreHandler apiCallPreHandler = null; string portName = "PayPalAPIAA"; setStandardParams(managePendingTransactionStatusReq.ManagePendingTransactionStatusRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(managePendingTransactionStatusReq.ToXMLString(null, "ManagePendingTransactionStatusReq"), null, null); apiCallPreHandler = new MerchantAPICallPreHandler(defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = portName; string response = Call(apiCallPreHandler); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(response); XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='ManagePendingTransactionStatusResponse']"); return new ManagePendingTransactionStatusResponseType(xmlNode); }
/// <summary> /// /// </summary> ///<param name="createRecurringPaymentsProfileReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public CreateRecurringPaymentsProfileResponseType CreateRecurringPaymentsProfile(CreateRecurringPaymentsProfileReq createRecurringPaymentsProfileReq, ICredential credential) { setStandardParams(createRecurringPaymentsProfileReq.CreateRecurringPaymentsProfileRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, createRecurringPaymentsProfileReq.ToXMLString(null, "CreateRecurringPaymentsProfileReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return new CreateRecurringPaymentsProfileResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='CreateRecurringPaymentsProfileResponse']") ); }
/** *AUTO_GENERATED */ public UpdateRecurringPaymentsProfileResponseType UpdateRecurringPaymentsProfile(UpdateRecurringPaymentsProfileReq updateRecurringPaymentsProfileReq, ICredential credential) { IAPICallPreHandler apiCallPreHandler = null; string portName = "PayPalAPIAA"; setStandardParams(updateRecurringPaymentsProfileReq.UpdateRecurringPaymentsProfileRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(updateRecurringPaymentsProfileReq.ToXMLString(null, "UpdateRecurringPaymentsProfileReq"), null, null); apiCallPreHandler = new MerchantAPICallPreHandler(defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = portName; string response = Call(apiCallPreHandler); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(response); XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='UpdateRecurringPaymentsProfileResponse']"); return new UpdateRecurringPaymentsProfileResponseType(xmlNode); }
/// <summary> /// /// </summary> ///<param name="doReferenceTransactionReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public DoReferenceTransactionResponseType DoReferenceTransaction(DoReferenceTransactionReq doReferenceTransactionReq, ICredential credential) { setStandardParams(doReferenceTransactionReq.DoReferenceTransactionRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, doReferenceTransactionReq.ToXMLString(null, "DoReferenceTransactionReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return new DoReferenceTransactionResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='DoReferenceTransactionResponse']") ); }
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()); }