本文整理汇总了C#中Connector.RequestTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# Connector.RequestTransaction方法的具体用法?C# Connector.RequestTransaction怎么用?C# Connector.RequestTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector.RequestTransaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePaymentRequest
public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo)
{
try
{
var paymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id);
var reportUrl = paymentProvider.ReportUrl();
//Use https://idealtest.secure-ing.com/ideal/iDEALv3 during integration/test
//Use https://ideal.secure-ing.com/ideal/iDEALv3 only for production
// <provider title="IngAdvanced">
// <IssuerId>1111111</IssuerId>
// <MerchantId>1111111</MerchantId>
// <EntranceCode>22222222</EntranceCode>
// </provider>
var issuerId = orderInfo.PaymentInfo.MethodId;
var merchantId = paymentProvider.GetSetting("MerchantId");
var entranceCode = paymentProvider.GetSetting("EntranceCode");
var transaction = new Transaction
{
Amount = orderInfo.ChargedAmount,
Description = orderInfo.OrderNumber,
PurchaseId = orderInfo.OrderNumber,
IssuerId = issuerId,
EntranceCode = entranceCode
};
var connector = new Connector
{
MerchantReturnUrl = new Uri(reportUrl),
MerchantId = merchantId,
SubId = "0",
ExpirationPeriod = "PT10M"
};
transaction = connector.RequestTransaction(transaction);
if (transaction.Status == Transaction.TransactionStatus.Success)
{
var transactionId = transaction.Id;
var authenticateUrl = transaction.IssuerAuthenticationUrl.ToString();
var acquirerId = transaction.AcquirerId;
PaymentProviderHelper.SetTransactionId(orderInfo, transactionId);
orderInfo.PaymentInfo.Url = authenticateUrl;
orderInfo.PaymentInfo.Parameters = acquirerId;
orderInfo.Save();
}
else
{
// todo: failure handling, so don't change anything, user will not be redirected
}
}
catch (IDealException ex)
{
Log.Instance.LogError("ING Advanced PaymentRequestHander: " + ex);
}
var request = new PaymentRequest();
return request;
}