本文整理汇总了C#中Transaction.Process方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.Process方法的具体用法?C# Transaction.Process怎么用?C# Transaction.Process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction.Process方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResultWrite
public void ResultWrite(tb_RecommendResultEntity rre)
{
Transaction t = new Transaction();
t.AddSaveObject(rre);
try
{
t.Process();
}
catch (PlException plex)
{ }
}
示例2: MsgEnQ
public void MsgEnQ(tb_MessageQueueEntity mqe)
{
Transaction t = new Transaction();
t.AddSaveObject(mqe);
try
{
t.Process();
}
catch(PlException plex)
{
//错误日志plex.Message;
}
}
示例3: EnQueueByScheduleRelist
public void EnQueueByScheduleRelist(IList<tb_ScheduleRelistQueueEntity> list)
{
Transaction t = new Transaction();
foreach (tb_ScheduleRelistQueueEntity srqe in list)
{
t.AddSaveObject(srqe);
}
try
{
t.Process();
}
catch (PlException plex)
{
//执行失败。
}
}
示例4: EndRelist
public void EndRelist(tb_MessageQueueEntity mqe,tb_RelistReslutEntity rre)
{
Transaction t = new Transaction();
UpdateCriteria uc = new UpdateCriteria(typeof(tb_MessageQueueEntity));
Condition c = uc.GetNewCondition();
c.AddEqualTo(tb_MessageQueueEntity.__ID,mqe.id);
uc.AddAttributeForUpdate(tb_MessageQueueEntity.__STATE,true);
t.AddUpdateCriteria(uc);
t.AddSaveObject(rre);
try
{
t.Process();
}
catch (PlException plex)
{
}
}
示例5: ResultWrite
public void ResultWrite(tb_TraderateResultEntity tce)
{
Transaction t = new Transaction();
t.AddSaveObject(tce);
try
{
t.Process();
}
catch (PlException plex)
{ }
}
示例6: VoidPayment
public IPaymentResult VoidPayment(IInvoice invoice, IPayment payment)
{
var address = invoice.GetBillingAddress();
// Declare a response
Paymentech.Response response;
// Create an authorize transaction
var transaction = new Transaction(RequestType.VOID);
var txRefNum = payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.TransactionReferenceNumber);
if (!payment.Authorized || string.IsNullOrEmpty(txRefNum))
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new InvalidOperationException("Payment is not Authorized or TransactionCodes not present")), invoice, false);
}
transaction["OrbitalConnectionUsername"] = _settings.Username;
transaction["OrbitalConnectionPassword"] = _settings.Password;
transaction["MerchantID"] = _settings.MerchantId;
transaction["BIN"] = _settings.Bin;
transaction["OrderID"] = invoice.InvoiceNumber.ToString(CultureInfo.InstalledUICulture);
transaction["TxRefNum"] = txRefNum;
response = transaction.Process();
// API Error
if (response == null)
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception("Chase Paymentech unknown error")), invoice, false);
}
if (response.Error)
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Error {0}", response))), invoice, false);
}
if (response.Declined)
{
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AuthorizeDeclinedResult, string.Format("Declined ({0} : {1})", response.ResponseCode, response.Message));
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.TransactionReferenceNumber, response.TxRefNum);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AuthorizationTransactionCode, string.Format("{0},{1},{2}", response.AuthCode, response.ResponseCode, "NA"));
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AvsResult, response.AVSRespCode);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.Cvv2Result, string.Format("{0},{1}", response.CVV2RespCode, response.CVV2ResponseCode));
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Declined ({0} : {1})", response.ResponseCode, response.Message))), invoice, false);
}
if (response.Approved)
{
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.TransactionReferenceNumber, response.TxRefNum);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AuthorizationTransactionCode, string.Format("{0},{1},{2}", response.AuthCode, response.ResponseCode, "NA"));
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AvsResult, response.AVSRespCode);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.Cvv2Result, string.Format("{0},{1}", response.CVV2RespCode, response.CVV2ResponseCode));
payment.Collected = false;
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true);
}
var procStatus = "";
if (response.XML != null)
{
var xml = XDocument.Parse(response.MaskedXML);
procStatus = xml.Descendants("ProcStatus").First().Value;
}
if (!string.IsNullOrEmpty(procStatus) && procStatus == "0")
{
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.VoidProcStatus, procStatus);
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true);
}
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Error {0}", response))), invoice, false);
}
示例7: ProcessPayment
/// <summary>
/// Processes the Authorize and AuthorizeAndCapture transactions
/// </summary>
/// <param name="invoice">The <see cref="IInvoice"/> to be paid</param>
/// <param name="payment">The <see cref="IPayment"/> record</param>
/// <param name="transactionMode">Authorize or AuthorizeAndCapture</param>
/// <param name="amount">The money amount to be processed</param>
/// <param name="creditCard">The <see cref="CreditCardFormData"/></param>
/// <returns>The <see cref="IPaymentResult"/></returns>
public IPaymentResult ProcessPayment(IInvoice invoice, IPayment payment, TransactionMode transactionMode, decimal amount, CreditCardFormData creditCard)
{
var address = invoice.GetBillingAddress();
var names = creditCard.CardholderName.Split(' ');
// Declare a response
Paymentech.Response response;
// Create an authorize transaction
var transaction = new Transaction(RequestType.NEW_ORDER_TRANSACTION);
// Populate the required fields for the given transaction type. You can use’
// the Paymentech Transaction Appendix to help you populate the transaction’
transaction["OrbitalConnectionUsername"] = _settings.Username;
transaction["OrbitalConnectionPassword"] = _settings.Password;
/*
* Message Types
* MO – Mail Order transaction
* RC – Recurring Payment
* EC– eCommerce transaction
* IV – IVR [PINLess Debit Only]
*/
transaction["IndustryType"] = "EC";
/*
* Message Types
* A – Authorization request
* AC – Authorization and Mark for Capture
* FC – Force-Capture request
* R – Refund request
*/
transaction["MessageType"] = transactionMode == TransactionMode.Authorize ? "A" : "AC";
transaction["MerchantID"] = _settings.MerchantId;
transaction["BIN"] = _settings.Bin;
// Credit Card Number
transaction["AccountNum"] = creditCard.CardNumber.Replace(" ", "").Replace("-", "").Replace("|", "");
transaction["OrderID"] = invoice.InvoiceNumber.ToString(CultureInfo.InstalledUICulture);
transaction["Amount"] = string.Format("{0:0}", amount * 100);
// Expiration date
var creditCardExpMonth = creditCard.ExpireMonth;
var creditCardExpYear = creditCard.ExpireYear.Length > 2
? creditCard.ExpireYear.Substring(2, 2)
: creditCard.ExpireYear;
transaction["Exp"] = creditCardExpMonth.PadLeft(2) + creditCardExpYear;
transaction["AVSname"] = address.Name;
transaction["AVSaddress1"] = address.Address1;
transaction["AVSaddress2"] = address.Address2;
transaction["AVScity"] = address.Locality;
transaction["AVSstate"] = address.Region;
transaction["AVSzip"] = address.PostalCode;
transaction["AVScountryCode"] = address.CountryCode;
transaction["CardSecVal"] = creditCard.CardCode;
transaction["TraceNumber"] = invoice.InvoiceNumber.ToString();
if (string.IsNullOrEmpty(creditCard.CreditCardType))
{
creditCard.CreditCardType = GetCreditCardType(creditCard.CardNumber);
}
if (creditCard.CreditCardType.ToLower().Contains("visa") || creditCard.CreditCardType.ToLower().Contains("chase"))
{
transaction["CAVV"] = creditCard.AuthenticationVerification;
// If no value for creditCard.CardCode, then CardSecValInd cannot be 1. Send 2 or 9 instead
if (string.IsNullOrEmpty(creditCard.CardCode))
{
transaction["CardSecValInd"] = "9";
}
else
{
transaction["CardSecValInd"] = "1";
}
}
else if (creditCard.CreditCardType.ToLower().Contains("mastercard"))
{
transaction["AAV"] = creditCard.AuthenticationVerification;
transaction["CardSecValInd"] = "";
}
transaction["AuthenticationECIInd"] = creditCard.AuthenticationVerificationEci;
/*
* CardSecValInd
* 1 - Value is Present
//.........这里部分代码省略.........
示例8: PriorAuthorizeCapturePayment
/// <summary>
/// Captures a previously authorized payment
/// </summary>
/// <param name="invoice">The invoice associated with the <see cref="IPayment"/></param>
/// <param name="payment">The <see cref="IPayment"/> to capture</param>
/// <returns>The <see cref="IPaymentResult"/></returns>
public IPaymentResult PriorAuthorizeCapturePayment(IInvoice invoice, IPayment payment)
{
var address = invoice.GetBillingAddress();
// Declare a response
Paymentech.Response response;
// Create an authorize transaction
var transaction = new Transaction(RequestType.MARK_FOR_CAPTURE_TRANSACTION);
var txRefNum = payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.TransactionReferenceNumber);
if (!payment.Authorized || string.IsNullOrEmpty(txRefNum))
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new InvalidOperationException("Payment is not Authorized or TransactionCodes not present")), invoice, false);
}
transaction["OrbitalConnectionUsername"] = _settings.Username;
transaction["OrbitalConnectionPassword"] = _settings.Password;
transaction["MerchantID"] = _settings.MerchantId;
transaction["BIN"] = _settings.Bin;
transaction["OrderID"] = invoice.InvoiceNumber.ToString(CultureInfo.InstalledUICulture);
transaction["TaxInd"] = "1";
transaction["Tax"] = invoice.TotalTax().ToString(CultureInfo.InstalledUICulture);
transaction["PCOrderNum"] = invoice.InvoiceNumber.ToString(CultureInfo.InstalledUICulture);
transaction["PCDestZip"] = address.PostalCode;
transaction["PCDestAddress1"] = address.Address1;
transaction["PCDestAddress2"] = address.Address2;
transaction["PCDestCity"] = address.Locality;
transaction["PCDestState"] = address.Region;
transaction["TxRefNum"] = txRefNum;
response = transaction.Process();
// API Error
if (response == null)
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception("Chase Paymentech unknown error")), invoice, false);
}
string approvalStatus = "";
if (response.XML != null)
{
var xml = XDocument.Parse(response.MaskedXML);
approvalStatus = xml.Descendants("ApprovalStatus").First().Value;
}
if (response.Error)
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Error {0}", response))), invoice, false);
}
if (response.Declined)
{
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AuthorizeDeclinedResult, string.Format("Declined ({0} : {1})", response.ResponseCode, response.Message));
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.TransactionReferenceNumber, response.TxRefNum);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AuthorizationTransactionCode, string.Format("{0},{1},{2}", response.AuthCode, response.ResponseCode, approvalStatus));
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AvsResult, response.AVSRespCode);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.Cvv2Result, string.Format("{0},{1}", response.CVV2RespCode, response.CVV2ResponseCode));
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Declined ({0} : {1})", response.ResponseCode, response.Message))), invoice, false);
}
if (response.Approved)
{
var txRefIdx = "";
if (response.XML != null)
{
var xml = XDocument.Parse(response.MaskedXML);
txRefIdx = xml.Descendants("TxRefIdx").First().Value;
}
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.TransactionReferenceNumber, response.TxRefNum);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.TransactionReferenceIndex, txRefIdx);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AuthorizationTransactionCode, string.Format("{0},{1},{2}", response.AuthCode, response.ResponseCode, approvalStatus));
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AvsResult, response.AVSRespCode);
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.Cvv2Result, string.Format("{0},{1}", response.CVV2RespCode, response.CVV2ResponseCode));
payment.Collected = true;
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true);
}
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Error {0}", response))), invoice, false);
}
示例9: ProcessPayment
/// <summary>
/// Processes the Authorize and AuthorizeAndCapture transactions
/// </summary>
/// <param name="invoice">The <see cref="IInvoice"/> to be paid</param>
/// <param name="payment">The <see cref="IPayment"/> record</param>
/// <param name="transactionMode">Authorize or AuthorizeAndCapture</param>
/// <param name="amount">The money amount to be processed</param>
/// <param name="creditCard">The <see cref="CreditCardFormData"/></param>
/// <returns>The <see cref="IPaymentResult"/></returns>
public IPaymentResult ProcessPayment(IInvoice invoice, IPayment payment, TransactionMode transactionMode, decimal amount, CreditCardFormData creditCard)
{
var address = invoice.GetBillingAddress();
var names = creditCard.CardholderName.Split(' ');
// Declare a response
Paymentech.Response response;
// Create an authorize transaction
var transaction = new Transaction(RequestType.NEW_ORDER_TRANSACTION);
// Populate the required fields for the given transaction type. You can use’
// the Paymentech Transaction Appendix to help you populate the transaction’
/*
* Message Types
* MO – Mail Order transaction
* RC – Recurring Payment
* EC– eCommerce transaction
* IV – IVR [PINLess Debit Only]
*/
transaction["IndustryType"] = "EC";
/*
* Message Types
* A – Authorization request
* AC – Authorization and Mark for Capture
* FC – Force-Capture request
* R – Refund request
*/
transaction["MessageType"] = transactionMode == TransactionMode.Authorize ? "A" : "AC";
transaction["MerchantID"] = "041756";
transaction["BIN"] = "000001";
// Credit Card Number
transaction["AccountNum"] = creditCard.CardNumber;
transaction["OrderID"] = invoice.InvoiceNumber.ToString(CultureInfo.InstalledUICulture);
transaction["Amount"] = amount.ToString("0.00", CultureInfo.InstalledUICulture);
// Expiration date
transaction["Exp"] = creditCard.ExpireMonth.PadLeft(2) + creditCard.ExpireYear;
transaction["AVSname"] = address.Name;
transaction["AVSaddress1"] = address.Address1;
transaction["AVSaddress2"] = address.Address2;
transaction["AVScity"] = address.Locality;
transaction["AVSstate"] = address.Region;
transaction["AVSzip"] = address.PostalCode;
transaction["AVScountryCode"] = address.CountryCode;
transaction["CardSecVal"] = creditCard.CardCode;
/*
* CardSecValInd
* 1 - Value is Present
* 2 - Value on card but illegible
* 9 - Cardholder states data not available
*/
transaction["CardSecValInd"] = "1";
/*
* CardSecValInd
* A – Auto Generate the CustomerRefNum
* S – Use CustomerRefNum Element
*/
transaction["CustomerProfileFromOrderInd"] = "A";
/*
* CustomerProfileOrderOverrideInd
* NO No mapping to order data
* OI Use <CustomerRefNum> for <OrderID> and <ECOrderNum> or <MailOrderNum>
* OD Use <CustomerReferNum> for <Comments>
* OA Use <CustomerRefNum> for <OrderID> and <Comments>
*/
transaction["CustomerProfileOrderOverrideInd"] = "NO";
transaction["Comments"] = invoice.InvoiceNumber.ToString(CultureInfo.InstalledUICulture);
response = transaction.Process();
// API Error
if (response == null)
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception("Chase Paymentech unknown error")), invoice, false);
}
if (response.Error)
//.........这里部分代码省略.........
示例10: VoidPayment
public IPaymentResult VoidPayment(IInvoice invoice, IPayment payment)
{
var address = invoice.GetBillingAddress();
// Declare a response
Paymentech.Response response;
// Create an authorize transaction
var transaction = new Transaction(RequestType.NEW_ORDER_TRANSACTION);
var txRefNum = payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.TransactionReferenceNumber);
if (!payment.Authorized || string.IsNullOrEmpty(txRefNum))
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new InvalidOperationException("Payment is not Authorized or TransactionCodes not present")), invoice, false);
}
transaction["MerchantID"] = "041756";
transaction["BIN"] = "000001";
transaction["OrderID"] = invoice.InvoiceNumber.ToString(CultureInfo.InstalledUICulture);
transaction["TxRefNum"] = txRefNum;
transaction["TxRefIdx"] = "0";
response = transaction.Process();
// API Error
if (response == null)
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception("Chase Paymentech unknown error")), invoice, false);
}
if (response.Error)
{
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Error {0}", response))), invoice, false);
}
if (response.Declined)
{
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AuthorizeDeclinedResult, string.Format("Declined ({0} : {1})", response.ResponseCode, response.Message));
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Declined ({0} : {1})", response.ResponseCode, response.Message))), invoice, false);
}
if (response.Approved)
{
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.TransactionReferenceNumber, string.Format("Approved ({0})", response.TxRefNum));
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AuthorizationTransactionCode, string.Format("{0},{1}", response.ResponseCode));
payment.ExtendedData.SetValue(Constants.ExtendedDataKeys.AvsResult, response.AVSRespCode);
payment.Collected = true;
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true);
}
return new PaymentResult(Attempt<IPayment>.Fail(payment, new Exception(string.Format("Error {0}", response))), invoice, false);
}