当前位置: 首页>>代码示例>>C#>>正文


C# Connector.RequestTransaction方法代码示例

本文整理汇总了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;
        }
开发者ID:uWebshop,项目名称:-INACTIVE-PaymentProviders,代码行数:66,代码来源:IngAdvancedPaymentRequestHandler.cs


注:本文中的Connector.RequestTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。