本文整理匯總了C#中PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService類的典型用法代碼示例。如果您正苦於以下問題:C# PayPalAPIInterfaceServiceService類的具體用法?C# PayPalAPIInterfaceServiceService怎麽用?C# PayPalAPIInterfaceServiceService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PayPalAPIInterfaceServiceService類屬於PayPal.PayPalAPIInterfaceService命名空間,在下文中一共展示了PayPalAPIInterfaceServiceService類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: setKeyResponseObjects
private void setKeyResponseObjects(PayPalAPIInterfaceServiceService service, BMGetInventoryResponseType response)
{
HttpContext CurrContext = HttpContext.Current;
CurrContext.Items.Add("Response_apiName", "BMGetInventory");
CurrContext.Items.Add("Response_redirectURL", null);
CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());
Dictionary<string, string> responseParams = new Dictionary<string, string>();
responseParams.Add("Correlation Id", response.CorrelationID);
responseParams.Add("API Result", response.Ack.ToString());
if (response.Ack.Equals(AckCodeType.FAILURE) ||
(response.Errors != null && response.Errors.Count > 0))
{
CurrContext.Items.Add("Response_error", response.Errors);
}
else
{
CurrContext.Items.Add("Response_error", null);
responseParams.Add("Is inventory tracked", response.TrackInv);
responseParams.Add("Is Profit & Loss tracked", response.TrackPnl);
responseParams.Add("Item Number", response.ItemTrackingDetails.ItemNumber);
responseParams.Add("Item Quantity", response.ItemTrackingDetails.ItemQty);
responseParams.Add("Item Cost", response.ItemTrackingDetails.ItemCost);
responseParams.Add("Item Alert threshold quantity", response.ItemTrackingDetails.ItemAlert);
responseParams.Add("Soldout URL", response.SoldoutURL);
}
CurrContext.Items.Add("Response_keyResponseObject", responseParams);
Server.Transfer("../APIResponse.aspx");
}
示例2: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
DoReferenceTransactionRequestType request = new DoReferenceTransactionRequestType();
populateRequestObject(request);
// Invoke the API
DoReferenceTransactionReq wrapper = new DoReferenceTransactionReq();
wrapper.DoReferenceTransactionRequest = request;
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer in wiki page
// [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
// Create the PayPalAPIInterfaceServiceService service object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
// # API call
// Invoke the DoReferenceTransaction method in service wrapper object
DoReferenceTransactionResponseType doReferenceTxnResponse = service.DoReferenceTransaction(wrapper);
// Check for API return status
setKeyResponseObjects(service, doReferenceTxnResponse);
}
示例3: AgreementConfirmed
public ActionResult AgreementConfirmed(string token)
{
var service = new PayPalAPIInterfaceServiceService();
var request = new CreateBillingAgreementReq
{
CreateBillingAgreementRequest = new CreateBillingAgreementRequestType(token)
};
var response = service.CreateBillingAgreement(request);
if (response.Ack == AckCodeType.SUCCESS)
{
var billingAgreementId = response.BillingAgreementID;
// store the billing agreement id in a cookie
Response.Cookies.Add(new HttpCookie("pp_aid", billingAgreementId) { Expires = DateTime.Now.AddDays(365) });
return View(new AgreementConfirmedViewData { BillingAgreementId = billingAgreementId });
}
else
{
foreach (var error in response.Errors)
{
ModelState.AddModelError("__FORM", error.LongMessage);
}
}
return View("Error");
}
示例4: processResponse
private void processResponse(PayPalAPIInterfaceServiceService service, EnterBoardingResponseType response)
{
HttpContext CurrContext = HttpContext.Current;
CurrContext.Items.Add("Response_apiName", "EnterBoarding");
if (response.Token != null)
{
string baseUrl = ConfigurationManager.AppSettings["PAYPAL_REDIRECT_URL"].ToString().ToLower();
CurrContext.Items.Add("Response_redirectURL", baseUrl
+ "_partner-onboard-flow&onboarding_token=" + response.Token);
}
CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());
Dictionary<string, string> keyParameters = new Dictionary<string, string>();
keyParameters.Add("Correlation Id", response.CorrelationID);
keyParameters.Add("API Result", response.Ack.ToString());
if (response.Errors != null && response.Errors.Count > 0)
{
CurrContext.Items.Add("Response_error", response.Errors);
}
else
{
CurrContext.Items.Add("Response_error", null);
}
if (!response.Ack.Equals(AckCodeType.FAILURE))
{
}
CurrContext.Items.Add("Response_keyResponseObject", keyParameters);
Server.Transfer("../APIResponse.aspx");
}
示例5: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
DoVoidRequestType request =
new DoVoidRequestType();
// (Required) Original authorization ID specifying the authorization to void or, to void an order, the order ID.
// Important: If you are voiding a transaction that has been reauthorized, use the ID from the original authorization, and not the reauthorization.
request.AuthorizationID = authorizationId.Value;
// (Optional) Informational note about this void that is displayed to the buyer in email and in their transaction history.
if (note.Value != string.Empty)
{
request.Note = note.Value;
}
// Invoke the API
DoVoidReq wrapper = new DoVoidReq();
wrapper.DoVoidRequest = request;
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer in wiki page
// [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
// Create the PayPalAPIInterfaceServiceService service object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
// # API call
// Invoke the DoVoid method in service wrapper object
DoVoidResponseType doVoidResponse =
service.DoVoid(wrapper);
// Check for API return status
setKeyResponseObjects(service, doVoidResponse);
}
示例6: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
BMGetButtonDetailsRequestType request = new BMGetButtonDetailsRequestType();
// (Required) The ID of the hosted button whose details you want to obtain.
request.HostedButtonID = hostedID.Value;
// Invoke the API
BMGetButtonDetailsReq wrapper = new BMGetButtonDetailsReq();
wrapper.BMGetButtonDetailsRequest = request;
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer in wiki page
// (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters)
Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
// Creating service wrapper object to make an API call by loading configuration map.
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
BMGetButtonDetailsResponseType response = service.BMGetButtonDetails(wrapper);
// Check for API return status
setKeyResponseObjects(service, response);
}
示例7: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
SetCustomerBillingAgreementRequestType request = new SetCustomerBillingAgreementRequestType();
SetCustomerBillingAgreementRequestDetailsType requestDetails = new SetCustomerBillingAgreementRequestDetailsType();
requestDetails.BuyerEmail = buyerEmail.Value;
requestDetails.ReturnURL = returnUrl.Value;
requestDetails.CancelURL = cancelUrl.Value;
BillingAgreementDetailsType baDetails = new BillingAgreementDetailsType();
baDetails.BillingAgreementDescription = billingAgreementText.Value;
baDetails.BillingType = (BillingCodeType)
Enum.Parse( typeof(BillingCodeType), billingType.SelectedValue);
requestDetails.BillingAgreementDetails = baDetails;
request.SetCustomerBillingAgreementRequestDetails = requestDetails;
// Invoke the API
SetCustomerBillingAgreementReq wrapper = new SetCustomerBillingAgreementReq();
wrapper.SetCustomerBillingAgreementRequest = request;
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
SetCustomerBillingAgreementResponseType setCustomerBillingAgreementResponse =
service.SetCustomerBillingAgreement(wrapper);
// Check for API return status
setKeyResponseObjects(service, setCustomerBillingAgreementResponse);
}
示例8: setKeyResponseObjects
// A helper method used by APIResponse.aspx that returns select response parameters
// of interest.
private void setKeyResponseObjects(PayPalAPIInterfaceServiceService service, AddressVerifyResponseType response)
{
HttpContext CurrContext = HttpContext.Current;
CurrContext.Items.Add("Response_apiName", "AddressVerify");
CurrContext.Items.Add("Response_redirectURL", null);
CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());
Dictionary<string, string> keyResponseParameters = new Dictionary<string, string>();
keyResponseParameters.Add("Correlation Id", response.CorrelationID);
keyResponseParameters.Add("API Result", response.Ack.ToString());
if (response.Ack.Equals(AckCodeType.FAILURE) ||
(response.Errors != null && response.Errors.Count > 0))
{
CurrContext.Items.Add("Response_error", response.Errors);
}
else
{
CurrContext.Items.Add("Response_error", null);
keyResponseParameters.Add("Address confirmation code", response.ConfirmationCode.ToString());
keyResponseParameters.Add("Street address match", response.StreetMatch.ToString());
keyResponseParameters.Add("Zip code match", response.ZipMatch.ToString());
}
CurrContext.Items.Add("Response_keyResponseObject", keyResponseParameters);
Server.Transfer("../APIResponse.aspx");
}
示例9: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
ManageRecurringPaymentsProfileStatusRequestType request =
new ManageRecurringPaymentsProfileStatusRequestType();
ManageRecurringPaymentsProfileStatusRequestDetailsType details =
new ManageRecurringPaymentsProfileStatusRequestDetailsType();
request.ManageRecurringPaymentsProfileStatusRequestDetails = details;
details.ProfileID = profileId.Value;
details.Action = (StatusChangeActionType)
Enum.Parse(typeof(StatusChangeActionType), action.SelectedValue);
if (note.Value != "")
{
details.Note = note.Value;
}
// Invoke the API
ManageRecurringPaymentsProfileStatusReq wrapper = new ManageRecurringPaymentsProfileStatusReq();
wrapper.ManageRecurringPaymentsProfileStatusRequest = request;
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
ManageRecurringPaymentsProfileStatusResponseType manageProfileStatusResponse =
service.ManageRecurringPaymentsProfileStatus(wrapper);
// Check for API return status
setKeyResponseObjects(service, manageProfileStatusResponse);
}
示例10: setKeyResponseObjects
private void setKeyResponseObjects(PayPalAPIInterfaceServiceService service, DoUATPExpressCheckoutPaymentResponseType response)
{
HttpContext CurrContext = HttpContext.Current;
CurrContext.Items.Add("Response_apiName", "DoUATPExpressCheckoutPayment");
CurrContext.Items.Add("Response_redirectURL", null);
CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());
Dictionary<string, string> responseParams = new Dictionary<string, string>();
responseParams.Add("Correlation Id", response.CorrelationID);
responseParams.Add("API Result", response.Ack.ToString());
if (response.Ack.Equals(AckCodeType.FAILURE) ||
(response.Errors != null && response.Errors.Count > 0))
{
CurrContext.Items.Add("Response_error", response.Errors);
}
else
{
CurrContext.Items.Add("Response_error", null);
responseParams.Add("Transaction Id", response.DoExpressCheckoutPaymentResponseDetails.PaymentInfo[0].TransactionID);
responseParams.Add("UATP number", response.UATPDetails.UATPNumber);
}
CurrContext.Items.Add("Response_keyResponseObject", responseParams);
Server.Transfer("../APIResponse.aspx");
}
示例11: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
AddressVerifyRequestType request = new AddressVerifyRequestType();
// (Required) Email address of a PayPal member to verify.
request.Email = email.Value;
// (Required) First line of the billing or shipping postal address to verify. To pass verification, the value of Street must match the first 3 single-byte characters of a postal address on file for the PayPal member.
request.Street = street.Value;
// (Required) Postal code to verify. To pass verification, the value of Zip must match the first 5 single-byte characters of the postal code of the verified postal address for the verified PayPal member.
request.Zip = zip.Value;
// Invoke the API
AddressVerifyReq wrapper = new AddressVerifyReq();
wrapper.AddressVerifyRequest = request;
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer in wiki page
// [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
// Create the PayPalAPIInterfaceServiceService service object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
// # API call
// Invoke the AddressVerify method in service wrapper object
AddressVerifyResponseType addressVerifyResponse = service.AddressVerify(wrapper);
// Check for API return status
setKeyResponseObjects(service, addressVerifyResponse);
}
示例12: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
DoUATPExpressCheckoutPaymentRequestType request = new DoUATPExpressCheckoutPaymentRequestType();
DoExpressCheckoutPaymentRequestDetailsType paymentDetails = new DoExpressCheckoutPaymentRequestDetailsType();
request.DoExpressCheckoutPaymentRequestDetails = paymentDetails;
paymentDetails.PayerID = payerID.Value;
paymentDetails.Token = token.Value;
paymentDetails.PaymentAction = (PaymentActionCodeType)
Enum.Parse(typeof(PaymentActionCodeType), paymentAction.SelectedValue);
// Set payment amount
CurrencyCodeType currency = (CurrencyCodeType)
Enum.Parse(typeof(CurrencyCodeType), currencyID.Value);
paymentDetails.PaymentDetails.Add(new PaymentDetailsType());
paymentDetails.PaymentDetails[0].OrderTotal =
new BasicAmountType(currency, amount.Value);
// Invoke the API
DoUATPExpressCheckoutPaymentReq wrapper = new DoUATPExpressCheckoutPaymentReq();
wrapper.DoUATPExpressCheckoutPaymentRequest = request;
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer in wiki page
// [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
DoUATPExpressCheckoutPaymentResponseType response = service.DoUATPExpressCheckoutPayment(wrapper);
// Check for API return status
setKeyResponseObjects(service, response);
}
示例13: GetExpressCheckoutDetailsAPIOperation
// # GetExpressCheckout API Operation
// The GetExpressCheckoutDetails API operation obtains information about an Express Checkout transaction
public GetExpressCheckoutDetailsResponseType GetExpressCheckoutDetailsAPIOperation()
{
// Create the GetExpressCheckoutDetailsResponseType object
GetExpressCheckoutDetailsResponseType responseGetExpressCheckoutDetailsResponseType = new GetExpressCheckoutDetailsResponseType();
try
{
// Create the GetExpressCheckoutDetailsReq object
GetExpressCheckoutDetailsReq getExpressCheckoutDetails = new GetExpressCheckoutDetailsReq();
// A timestamped token, the value of which was returned by `SetExpressCheckout` response
GetExpressCheckoutDetailsRequestType getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType("EC-11U13522TP7143059");
getExpressCheckoutDetails.GetExpressCheckoutDetailsRequest = getExpressCheckoutDetailsRequest;
// Create the service wrapper object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
// # API call
// Invoke the GetExpressCheckoutDetails method in service wrapper object
responseGetExpressCheckoutDetailsResponseType = service.GetExpressCheckoutDetails(getExpressCheckoutDetails);
if (responseGetExpressCheckoutDetailsResponseType != null)
{
// Response envelope acknowledgement
string acknowledgement = "GetExpressCheckoutDetails API Operation - ";
acknowledgement += responseGetExpressCheckoutDetailsResponseType.Ack.ToString();
logger.Info(acknowledgement + "\n");
Console.WriteLine(acknowledgement + "\n");
// # Success values
if (responseGetExpressCheckoutDetailsResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS"))
{
// Unique PayPal Customer Account identification number. This
// value will be null unless you authorize the payment by
// redirecting to PayPal after `SetExpressCheckout` call.
logger.Info("Payer ID : " + responseGetExpressCheckoutDetailsResponseType.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerID + "\n");
Console.WriteLine("Payer ID : " + responseGetExpressCheckoutDetailsResponseType.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerID + "\n");
}
// # Error Values
else
{
List<ErrorType> errorMessages = responseGetExpressCheckoutDetailsResponseType.Errors;
foreach (ErrorType error in errorMessages)
{
logger.Debug("API Error Message : " + error.LongMessage);
Console.WriteLine("API Error Message : " + error.LongMessage + "\n");
}
}
}
}
// # Exception log
catch (System.Exception ex)
{
// Log the exception message
logger.Debug("Error Message : " + ex.Message);
Console.WriteLine("Error Message : " + ex.Message);
}
return responseGetExpressCheckoutDetailsResponseType;
}
示例14: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
GetBalanceRequestType request = new GetBalanceRequestType();
// (Optional) Indicates whether to return all currencies. It is one of the following values:
// * 0 – Return only the balance for the primary currency holding.
// * 1 – Return the balance for each currency holding.
// Note: This field is available since version 51. Prior versions return only the balance for the primary currency holding.
request.ReturnAllCurrencies = returnAllCurrencies.SelectedValue;
// Invoke the API
GetBalanceReq wrapper = new GetBalanceReq();
wrapper.GetBalanceRequest = request;
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer in wiki page
// [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
// Create the PayPalAPIInterfaceServiceService service object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
// # API call
// Invoke the GetBalance method in service wrapper object
GetBalanceResponseType getBalanceResponse = service.GetBalance(wrapper);
// Check for API return status
processResponse(service, getBalanceResponse);
}
示例15: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
DoUATPAuthorizationRequestType request = new DoUATPAuthorizationRequestType();
request.UATPDetails = new UATPDetailsType();
request.UATPDetails.UATPNumber = uatpNumber.Value;
request.UATPDetails.ExpMonth = Convert.ToInt32(expMonth.Value);
request.UATPDetails.ExpYear = Convert.ToInt32(expYear.Value);
request.TransactionEntity = (TransactionEntityType)
Enum.Parse(typeof(TransactionEntityType), transactionEntity.SelectedValue);
CurrencyCodeType currency = (CurrencyCodeType)
Enum.Parse( typeof(CurrencyCodeType), currencyID.Value);
request.Amount = new BasicAmountType(currency, amount.Value);
// Invoke the API
DoUATPAuthorizationReq wrapper = new DoUATPAuthorizationReq();
wrapper.DoUATPAuthorizationRequest = request;
// Configuration map containing signature credentials and other required configuration.
// For a full list of configuration parameters refer in wiki page
// [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
DoUATPAuthorizationResponseType response = service.DoUATPAuthorization(wrapper);
// Check for API return status
setKeyResponseObjects(service, response);
}