本文整理汇总了C#中PayPal.NVP.PlatformAPICallPreHandler类的典型用法代码示例。如果您正苦于以下问题:C# PlatformAPICallPreHandler类的具体用法?C# PlatformAPICallPreHandler怎么用?C# PlatformAPICallPreHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlatformAPICallPreHandler类属于PayPal.NVP命名空间,在下文中一共展示了PlatformAPICallPreHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEndpointForDefaultModeWithoutEndpoint
public void GetEndpointForDefaultModeWithoutEndpoint()
{
Dictionary<string, string> config = new Dictionary<string, string>(accountConfig);
PlatformAPICallPreHandler platformHandler = new PlatformAPICallPreHandler(config, "payload", "servicename", "method", Constants.APIUserName, "accessToken", "tokenSecret");
platformHandler.GetEndpoint();
}
示例2: GetEndpointForSandboxMode
public void GetEndpointForSandboxMode()
{
Dictionary<string, string> config = new Dictionary<string, string>(accountConfig);
config.Add(BaseConstants.ApplicationModeConfig, BaseConstants.LiveMode);
PlatformAPICallPreHandler platformHandler = new PlatformAPICallPreHandler(config, "payload", "servicename", "method", Constants.APIUserName, "accessToken", "tokenSecret");
Assert.AreEqual(BaseConstants.PlatformLiveEndpoint + "servicename/method", platformHandler.GetEndpoint());
}
示例3: GetEndpointForSandboxMode
public void GetEndpointForSandboxMode()
{
Dictionary<string, string> config = new Dictionary<string, string>(accountConfig);
config.Add(BaseConstants.APPLICATION_MODE_CONFIG, BaseConstants.LIVE_MODE);
PlatformAPICallPreHandler platformHandler = new PlatformAPICallPreHandler(config, "payload", "servicename", "method", UnitTestConstants.APIUserName, "accessToken", "tokenSecret");
Assert.AreEqual(BaseConstants.PLATFORM_LIVE_ENDPOINT + "servicename/method", platformHandler.GetEndPoint());
}
示例4: GetHeaderMapWithSignatureWithTokenTest
public void GetHeaderMapWithSignatureWithTokenTest()
{
platformAPIHandler = new PlatformAPICallPreHandler("payload", "servicename", "method", UnitTestConstants.APIUserName, "accessToken", "tokenSecret");
Dictionary<string, string> header = platformAPIHandler.GetHeaderMap();
string authHeader = header["X-PAYPAL-AUTHORIZATION"];
string[] headers = authHeader.Split(',');
Assert.AreEqual("token=accessToken", headers[0]);
}
示例5: CancelPermissions
/// <summary>
///
/// </summary>
///<param name="cancelPermissionsRequest"></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 CancelPermissionsResponse CancelPermissions(CancelPermissionsRequest cancelPermissionsRequest, string apiUserName)
{
IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, cancelPermissionsRequest.ToNVPString(string.Empty), ServiceName, "CancelPermissions", apiUserName, getAccessToken(), getAccessTokenSecret());
((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "Permissions";
NVPUtil util = new NVPUtil();
return CancelPermissionsResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
}
示例6: GetPayloadEndpointWithoutTokenTest
public void GetPayloadEndpointWithoutTokenTest()
{
platformAPIHandler = new PlatformAPICallPreHandler("payload", "servicename", "method", UnitTestConstants.APIUserName, "accessToken", "tokenSecret");
Assert.AreEqual("https://svcs.sandbox.paypal.com/servicename/method", platformAPIHandler.GetEndPoint());
Assert.AreEqual("payload", platformAPIHandler.GetPayLoad());
SignatureCredential signatureCredential = (SignatureCredential)platformAPIHandler.GetCredential();
TokenAuthorization thirdAuth = (TokenAuthorization)signatureCredential.ThirdPartyAuthorization;
Assert.AreEqual("accessToken", thirdAuth.AccessToken);
Assert.AreEqual("tokenSecret", thirdAuth.TokenSecret);
}
示例7: CancelInvoice
/// <summary>
///
/// </summary>
///<param name="cancelInvoiceRequest"></param>
///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param>
public CancelInvoiceResponse CancelInvoice(CancelInvoiceRequest cancelInvoiceRequest, ICredential credential)
{
IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, cancelInvoiceRequest.ToNVPString(string.Empty), ServiceName, "CancelInvoice", credential);
((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "Invoice";
NVPUtil util = new NVPUtil();
return CancelInvoiceResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
}
示例8: CancelPermissions
/**
*AUTO_GENERATED
*/
public CancelPermissionsResponse CancelPermissions(CancelPermissionsRequest cancelPermissionsRequest, ICredential credential)
{
IAPICallPreHandler apiCallPreHandler = null;
apiCallPreHandler = new PlatformAPICallPreHandler(cancelPermissionsRequest.ToNVPString(string.Empty), ServiceName, "CancelPermissions", credential);
((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
string response = Call(apiCallPreHandler);
NVPUtil util = new NVPUtil();
return CancelPermissionsResponse.CreateInstance(util.ParseNVPString(response), string.Empty, -1);
}
示例9: GetAccessToken
/**
*AUTO_GENERATED
*/
public GetAccessTokenResponse GetAccessToken(GetAccessTokenRequest getAccessTokenRequest, string apiUserName)
{
IAPICallPreHandler apiCallPreHandler = null;
apiCallPreHandler = new PlatformAPICallPreHandler(getAccessTokenRequest.ToNVPString(string.Empty), ServiceName, "GetAccessToken", apiUserName, getAccessToken(), getAccessTokenSecret());
((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
string response = Call(apiCallPreHandler);
NVPUtil util = new NVPUtil();
return GetAccessTokenResponse.CreateInstance(util.ParseNVPString(response), string.Empty, -1);
}
示例10: AddBankAccount
/// <summary>
/// Countries Supported:
/// AU - Australia
/// CA - Canada
/// FR -
/// France
/// DE - Germany
/// IL - Israel
/// IT - Italy
/// NL - Netherlands
/// UK - United
/// Kingdom
/// US - United States
///
///
///
///
///
/// </summary>
///<param name="addBankAccountRequest"></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 AddBankAccountResponse AddBankAccount(AddBankAccountRequest addBankAccountRequest, string apiUserName)
{
IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, addBankAccountRequest.ToNVPString(string.Empty), ServiceName, "AddBankAccount", apiUserName, getAccessToken(), getAccessTokenSecret());
((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "AdaptiveAccounts";
NVPUtil util = new NVPUtil();
return AddBankAccountResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
}
示例11: GetHeaderMapCertificateWithoutTokenTest
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]);
}
示例12: GetEndpointForDefaultModeWithExplicitEndpoint
public void GetEndpointForDefaultModeWithExplicitEndpoint()
{
Dictionary<string, string> config = new Dictionary<string, string>(accountConfig);
config.Add(BaseConstants.EndpointConfig, Constants.APIEndpointNVP);
PlatformAPICallPreHandler platformHandler = new PlatformAPICallPreHandler(config, "payload", "servicename", "method", Constants.APIUserName, "accessToken", "tokenSecret");
Assert.AreEqual(Constants.APIEndpointNVP + "servicename/method", platformHandler.GetEndpoint());
config.Add("PayPalAPI", Constants.APIEndpointSOAP);
platformHandler = new PlatformAPICallPreHandler(config, "payload", "servicename", "method", Constants.APIUserName, "accessToken", "tokenSecret");
platformHandler.PortName = "PayPalAPI";
Assert.AreEqual(Constants.APIEndpointSOAP + "/servicename/method", platformHandler.GetEndpoint());
}
示例13: AddPaymentCard
/// <summary>
/// Countries Supported:
/// AU - Australia
/// AT - Austria
/// BE
/// - Belgium
/// BR - Brazil
/// CA - Canada
/// CZ - Czech Republic
/// FR - France
/// DE -
/// Germany
/// GR - Greece
/// HK - Hong Kong
/// IE - Ireland
/// IT - Italy
/// JP - Japan
/// LU -
/// Luxembourg
/// MX - Mexico
/// NL - Netherlands
/// NZ - New Zealand (Aotearoa)
/// PL -
/// Poland
/// PT - Portugal
/// RU - Russian Federation
/// SG - Singapore
/// ZA - South
/// Africa
/// ES - Spain
/// CH - Switzerland
/// UK - United Kingdom
/// US - United
/// States
///
///
///
///
///
/// </summary>
///<param name="addPaymentCardRequest"></param>
///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param>
public AddPaymentCardResponse AddPaymentCard(AddPaymentCardRequest addPaymentCardRequest, ICredential credential)
{
IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, addPaymentCardRequest.ToNVPString(string.Empty), ServiceName, "AddPaymentCard", credential);
((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "AdaptiveAccounts";
NVPUtil util = new NVPUtil();
return AddPaymentCardResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
}
示例14: GetHeaderMapWithCertificateWithTokenTest
public void GetHeaderMapWithCertificateWithTokenTest()
{
platformAPIHandler = new PlatformAPICallPreHandler(ConfigManager.Instance.GetProperties(), "payload", "servicename", "method", Constants.CertificateAPIUserName, "accessToken", "tokenSecret");
Dictionary<string, string> header = platformAPIHandler.GetHeaderMap();
string authHeader = header[BaseConstants.PayPalAuthorizationPlatformHeader];
string[] headers = authHeader.Split(',');
Assert.AreEqual("token=accessToken", headers[0]);
}
示例15: GetBasicPersonalData
/**
*AUTO_GENERATED
*/
public GetBasicPersonalDataResponse GetBasicPersonalData(GetBasicPersonalDataRequest getBasicPersonalDataRequest, ICredential credential)
{
IAPICallPreHandler apiCallPreHandler = null;
apiCallPreHandler = new PlatformAPICallPreHandler(getBasicPersonalDataRequest.ToNVPString(string.Empty), ServiceName, "GetBasicPersonalData", credential);
((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
string response = Call(apiCallPreHandler);
NVPUtil util = new NVPUtil();
return GetBasicPersonalDataResponse.CreateInstance(util.ParseNVPString(response), string.Empty, -1);
}