本文整理汇总了C#中NVPCodec.Decode方法的典型用法代码示例。如果您正苦于以下问题:C# NVPCodec.Decode方法的具体用法?C# NVPCodec.Decode怎么用?C# NVPCodec.Decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NVPCodec
的用法示例。
在下文中一共展示了NVPCodec.Decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ECGetExpressCheckout
public PayPalResponse ECGetExpressCheckout(string token)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = getProfile();
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "84.0";
encoder["METHOD"] = "GetExpressCheckoutDetails";
// Add request-specific fields to the request.
encoder["TOKEN"] = token; // Pass the token returned in SetExpressCheckout.
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
PayPalResponse response = new PayPalResponse {
token = (decoder["TOKEN"] != null) ? decoder["TOKEN"] : "",
acknowledgement = decoder["ACK"],
first = decoder["FIRSTNAME"],
last = decoder["LASTNAME"],
email = decoder["EMAIL"],
amount = decoder["PAYMENTREQUEST_0_AMT"],
payerID = decoder["PAYERID"]
};
return response;
}
示例2: ECSetExpressCheckout_PayLaterCode
public string ECSetExpressCheckout_PayLaterCode(string returnURL,string cancelURL,string amount,string paymentType,string currencyCode)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "SetExpressCheckout";
encoder["RETURNURL"] = returnURL;
encoder["CANCELURL"] = cancelURL;
encoder["AMT"] = amount;
encoder["PAYMENTACTION"] = paymentType;
encoder["CURRENCYCODE"] = currencyCode;
encoder["L_PROMOCODE0"] = "101";
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例3: GetTransactionDetailsCode
public string GetTransactionDetailsCode(string transactionID)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "GetTransactionDetails";
// Add request-specific fields to the request.
encoder["TRANSACTIONID"] = transactionID;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例4: DoCheckoutPayment
public bool DoCheckoutPayment(string finalPaymentAmount, string token, string PayerID, ref NVPCodec decoder, ref string retMsg)
{
if (bSandbox)
{
pEndPointURL = pEndPointURL_SB;
}
NVPCodec encoder = new NVPCodec();
encoder["METHOD"] = "DoExpressCheckoutPayment";
encoder["TOKEN"] = token;
encoder["PAYERID"] = PayerID;
encoder["PAYMENTREQUEST_0_AMT"] = finalPaymentAmount;
encoder["PAYMENTREQUEST_0_CURRENCYCODE"] = "USD";
encoder["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = HttpCall(pStrrequestforNvp);
decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
string strAck = decoder["ACK"].ToLower();
if (strAck != null && (strAck == "success" || strAck == "successwithwarning"))
{
return true;
}
else
{
retMsg = "ErrorCode=" + decoder["L_ERRORCODE0"] + "&" +
"Desc=" + decoder["L_SHORTMESSAGE0"] + "&" +
"Desc2=" + decoder["L_LONGMESSAGE0"];
return false;
}
}
示例5: GetBalanceCode
public string GetBalanceCode()
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "GetBalance";
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例6: MassPayCode
public string MassPayCode(string emailSubject,string receiverType,string currencyCode,string ReceiverEmail0,string amount0,string UniqueID0,string Note0,string ReceiverEmail1,string amount1,string UniqueID1,string Note1)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "MassPay";
// Add request-specific fields to the request.
encoder["EMAILSUBJECT"] = emailSubject;
encoder["RECEIVERTYPE"] = receiverType;
encoder["CURRENCYCODE"]=currencyCode;
if(ReceiverEmail0.Length>0)
{
encoder["L_EMAIL0"] = ReceiverEmail0;
encoder["L_Amt0"] = amount0;
encoder["L_UNIQUEID0"] = UniqueID0;
encoder["L_NOTE0"] = Note0;
}
if(ReceiverEmail1.Length>0)
{
encoder["L_EMAIL1"] = ReceiverEmail1;
encoder["L_Amt1"] = amount1;
encoder["L_UNIQUEID1"] = UniqueID1;
encoder["L_NOTE1"] = Note1;
}
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例7: ECGetExpressCheckoutCode
public NVPCodec ECGetExpressCheckoutCode(string token)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "T")
{
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment = "sandbox";
}
else if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "L")
{
profile.APIUsername = "murty.korada_api1.cybertech.com";
profile.APIPassword = "KKKC8PY8E4R9LN48";
profile.APISignature = "AFcWxV21C7fd0v3bYYYRCpSSRl31Ab5GxWPc-1XSb8rJctwNCFHIYb84";
profile.Environment = "live";
}
else
{
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment = "sandbox";
}
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "65.1";
encoder["METHOD"] = "GetExpressCheckoutDetails";
// Add request-specific fields to the request.
encoder["TOKEN"] = token; // Pass the token returned in SetExpressCheckout.
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder;
}
示例8: ECDoExpressCheckout
public string ECDoExpressCheckout(string token, string payerID, string amount, Cart cart)
{
Settings settings = new Settings();
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = getProfile();
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder.Add("VERSION","84.0");
encoder.Add("METHOD","DoExpressCheckoutPayment");
// Add request-specific fields to the request.
encoder.Add("TOKEN",token);
encoder.Add("PAYERID",payerID);
encoder.Add("RETURNURL",getSiteURL() + "Payment/PayPalCheckout");
encoder.Add("CANCELURL",getSiteURL() + "Payment");
encoder.Add("PAYMENTREQUEST_0_AMT",amount);
encoder.Add("PAYMENTREQUEST_0_PAYMENTACTION","Sale");
encoder.Add("PAYMENTREQUEST_0_CURRENCYCODE","USD");
encoder.Add("BRANDNAME",settings.Get("SiteName"));
encoder.Add("LOGIN","Login");
encoder.Add("HDRIMG",settings.Get("EmailLogo"));
encoder.Add("CUSTOMERSERVICENUMBER",settings.Get("PhoneNumber"));
encoder.Add("PAYMENTREQUEST_0_SHIPPINGAMT",cart.shipping_price.ToString());
encoder.Add("PAYMENTREQUEST_0_DESC","Your " + settings.Get("SiteName") + " Order");
encoder.Add("ALLOWNOTE","0");
encoder.Add("NOSHIPPING","1");
int count = 0;
decimal total = 0;
foreach (CartItem item in cart.CartItems) {
encoder.Add("L_PAYMENTREQUEST_0_NUMBER" + count, item.partID.ToString());
encoder.Add("L_PAYMENTREQUEST_0_NAME" + count, item.shortDesc);
encoder.Add("L_PAYMENTREQUEST_0_AMT" + count, String.Format("{0:N2}", item.price));
encoder.Add("L_PAYMENTREQUEST_0_QTY" + count, item.quantity.ToString());
encoder.Add("L_PAYMENTREQUEST_0_ITEMCATEGORY" + count, "Physical");
encoder.Add("L_PAYMENTREQUEST_0_ITEMURL" + count, settings.Get("SiteURL") + "part/" + item.partID);
total += item.price * item.quantity;
count++;
}
encoder.Add("PAYMENTREQUEST_0_TAXAMT", String.Format("{0:N2}", cart.tax));
encoder.Add("PAYMENTREQUEST_0_ITEMAMT", String.Format("{0:N2}", total));
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例9: DoDirectPaymentCode
public string DoDirectPaymentCode(string paymentAction,string amount,string creditCardType,string creditCardNumber,string expdate_month,string cvv2Number,string firstName,string lastName,string address1,string city,string state,string zip,string countryCode,string currencyCode)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "DoDirectPayment";
// Add request-specific fields to the request.
encoder["PAYMENTACTION"] = paymentAction;
encoder["AMT"] = amount;
encoder["CREDITCARDTYPE"] = creditCardType;
encoder["ACCT"] = creditCardNumber;
encoder["EXPDATE"] = expdate_month;
encoder["CVV2"] = cvv2Number;
encoder["FIRSTNAME"] = firstName;
encoder["LASTNAME"] = lastName;
encoder["STREET"] = address1;
encoder["CITY"] = city;
encoder["STATE"] = state;
encoder["ZIP"] = zip;
encoder["COUNTRYCODE"] = countryCode;
encoder["CURRENCYCODE"] = currencyCode;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例10: VerifyCreditCardInfo
public ICreditCardAuthorizationResponse VerifyCreditCardInfo(ICreditCardAuthorizationRequest request)
{
var caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "mv1_1302977681_biz_api1.hotmail.com";
profile.APIPassword = "1302977698";
profile.APISignature = "AzbQABSL2jEPPHG.eDus2jfMT0xEAUITxvhhUWGmd3DHxaPXx6Zs1MPR";
profile.Environment = "sandbox";
caller.APIProfile = profile;
var encoder = new NVPCodec();
encoder["SIGNATURE"] = "AzbQABSL2jEPPHG.eDus2jfMT0xEAUITxvhhUWGmd3DHxaPXx6Zs1MPR";
encoder["USER"] = "mv1_1302977681_biz_api1.hotmail.com";
encoder["PWD"] = "1302977698";
encoder["VERSION"] = "60.0";
encoder["METHOD"] = "DoDirectPayment";
// Add request-specific fields to the request.
encoder["PAYMENTACTION"] = CreditCardPaymentActions.Authorization.ToString();
encoder["AMT"] = "100";
encoder["CREDITCARDTYPE"] = request.CreditCardInfo.Type.ToString();
encoder["IPADDRESS"] = "192.168.0.1";
encoder["ACCT"] = request.CreditCardInfo.CreditCardNumber;
encoder["EXPDATE"] = request.CreditCardInfo.ExpirationDate.ToString("MMyyyy");
encoder["CVV2"] = request.CreditCardInfo.Cvv2Number;
encoder["FIRSTNAME"] = request.FirstName;
encoder["LASTNAME"] = request.LastName;
encoder["STREET"] = request.AddressInfo.Address1;
encoder["CITY"] = request.AddressInfo.City;
encoder["STATE"] = request.AddressInfo.State;
encoder["ZIP"] = request.AddressInfo.ZipCode;
encoder["COUNTRYCODE"] = request.AddressInfo.Country;
encoder["CURRENCYCODE"] = "USD";
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
var decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return new CreditCardAuthorizationReponse(decoder["ACK"] == "Success");
}
示例11: SetCustomerBillingAgreementCode
public string SetCustomerBillingAgreementCode(string returnURL,string cancelURL,string billingDesc)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "SetCustomerBillingAgreement";
// Add request-specific fields to the request.
encoder["RETURNURL"] = returnURL;
encoder["CANCELURL"] = cancelURL;
encoder["BILLINGTYPE"] = "RecurringPayments";
encoder["BILLINGAGREEMENTDESCRIPTION"] = billingDesc;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例12: CreateRecurringPaymentsProfileCode
public string CreateRecurringPaymentsProfileCode(string token,string amount,string profileDate, string billingPeriod, string billingFrequency)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "sdk-three_api1.sdk.com";
profile.APIPassword = "QFZCWN5HZM8VBG7Q";
profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
// Add request-specific fields to the request.
encoder["METHOD"] = "CreateRecurringPaymentsProfile";
encoder["TOKEN"] = token;
encoder["AMT"] = amount;
encoder["PROFILESTARTDATE"] = profileDate; //Date format from server expects Ex: 2006-9-6T0:0:0
encoder["BILLINGPERIOD"] = billingPeriod;
encoder["BILLINGFREQUENCY"] = billingFrequency;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"];
}
示例13: DoCaptureCode
public NVPCodec DoCaptureCode(string authorization_id, string amount, string invoice_Id, string note)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = apiUserName;
profile.APIPassword = apiPassword;
profile.APISignature = apiSignature;
profile.Environment = apiEnvironment;
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "DoCapture";
// Add request-specific fields to the request.
encoder["TRXTYPE"] = "D";
encoder["AUTHORIZATIONID"] = authorization_id;
encoder["COMPLETETYPE"] = "Complete";
encoder["AMT"] = amount;
encoder["INVNUM"] = invoice_Id;
encoder["NOTE"] = note;
// Execute the API operation and obtain the response.
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder;
}
示例14: ConfirmPayment
/// <summary>
/// ConfirmPayment: The method that calls DoExpressCheckoutPayment, invoked from the
/// Billing Page EC placement
/// </summary>
/// <param name="token"></param>
/// <param ref name="retMsg"></param>
/// <returns></returns>
public bool ConfirmPayment(string finalPaymentAmount, string token, string PayerId, ref NVPCodec decoder, ref string retMsg )
{
if (Env == "pilot")
{
pendpointurl = "https://pilot-payflowpro.paypal.com";
}
NVPCodec encoder = new NVPCodec();
encoder["TOKEN"] = token;
encoder["TENDER"] = "P";
encoder["ACTION"] = "D";
if ("Authorization" == "Sale")
{
encoder["TRXTYPE"] = "A";
}
else /* sale */
{
encoder["TRXTYPE"] = "S";
}
encoder["PAYERID"] = PayerId;
encoder["AMT"] = finalPaymentAmount;
// unique request ID
string unique_id;
if (HttpContext.Current.Session["unique_id"] == null)
{
System.Guid uid = System.Guid.NewGuid();
unique_id = uid.ToString();
HttpContext.Current.Session["unique_id"] = unique_id;
}
else
{
unique_id = (string)HttpContext.Current.Session["unique_id"];
}
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = HttpCall(pStrrequestforNvp,unique_id);
decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
string strAck = decoder["RESULT"].ToLower();
if (strAck != null && strAck == "0")
{
return true;
}
else
{
retMsg = "ErrorCode=" + strAck + "&" +
"Desc=" + decoder["RESPMSG"];
return false;
}
}
示例15: ShortcutExpressCheckout
/// <summary>
/// ShortcutExpressCheckout: The shortcut implementation of SetExpressCheckout
/// </summary>
/// <param name="amt"></param>
/// <param ref name="token"></param>
/// <param ref name="retMsg"></param>
/// <returns></returns>
public bool ShortcutExpressCheckout(string amt, ref string token, ref string retMsg)
{
string host = "www.paypal.com";
if (Env == "pilot")
{
pendpointurl = "https://pilot-payflowpro.paypal.com";
host = "www.sandbox.paypal.com";
}
string returnURL = "http://www.careerjudge.com/FJAHome.aspx";
string cancelURL = "https://www.novasoftindia.com";
NVPCodec encoder = new NVPCodec();
encoder["TENDER"] = "P";
encoder["ACTION"] = "S";
if ("Authorization" == "Sale")
{
encoder["TRXTYPE"] = "A";
}
else /* sale */
{
encoder["TRXTYPE"] = "S";
}
encoder["RETURNURL"] = returnURL;
encoder["CANCELURL"] = cancelURL;
encoder["AMT"] = amt;
encoder["CURRENCY"] = "USD";
// unique request ID
System.Guid uid = System.Guid.NewGuid();
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = HttpCall(pStrrequestforNvp,uid.ToString());
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
string strAck = decoder["RESULT"].ToLower();
if (strAck != null && strAck == "0")
{
token = decoder["TOKEN"];
string ECURL = "https://" + host + "/cgi-bin/webscr?cmd=_express-checkout&" + "token=" + token;
retMsg = ECURL;
return true;
}
else
{
retMsg = "ErrorCode=" + strAck + "&" +
"Desc=" + decoder["RESPMSG"];
return false;
}
}