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


C# Api.Activate方法代码示例

本文整理汇总了C#中Api.Activate方法的典型用法代码示例。如果您正苦于以下问题:C# Api.Activate方法的具体用法?C# Api.Activate怎么用?C# Api.Activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Api的用法示例。


在下文中一共展示了Api.Activate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Activate

        public ActivateReservationResponse Activate(global::Nop.Core.Domain.Orders.Order order)
        {
            var reservation = order.AuthorizationTransactionId;

            if (!string.IsNullOrEmpty(order.CaptureTransactionId))
            {
                throw new KlarnaCheckoutException("The payment has already been captured. Order Id: " + order.Id);
            }

            try
            {
                var configuration = new Configuration(Country.Code.SE, Language.Code.SV, Currency.Code.SEK, Encoding.Sweden)
                {
                    Eid = _klarnaSettings.EId,
                    Secret = _klarnaSettings.SharedSecret,
                    IsLiveMode = !_klarnaSettings.TestMode
                };

                var api = new Api(configuration);
                return api.Activate(reservation);
            }
            catch (Exception ex)
            {
                throw new KlarnaCheckoutException("Error activating Klarna reservation for order " + order.Id, ex);
            }
        }
开发者ID:NicLars,项目名称:klarna-checkout-nopcommerce,代码行数:26,代码来源:KlarnaCheckoutPaymentService.cs

示例2: Activate

        public ActivateReservationResponse Activate(string reservation, global::Nop.Core.Domain.Customers.Customer customer)
        {
            try
            {
                var configuration = new Configuration(Country.Code.SE, Language.Code.SV, Currency.Code.SEK, Encoding.Sweden)
                {
                    Eid = _klarnaSettings.EId,
                    Secret = _klarnaSettings.SharedSecret,
                    IsLiveMode = !_klarnaSettings.TestMode
                };

                var api = new Api(configuration);
                var result = api.Activate(reservation);

                _logger.Debug(string.Format(CultureInfo.InvariantCulture, "KlarnaCheckout: Reservation Activated: RiskStatus: {0}, InvoiceNumber: {1}",
                    result.RiskStatus, result.InvoiceNumber), customer: customer);

                return result;
            }
            catch (Exception ex)
            {
                _logger.Error("KlarnaCheckout: Error activating reservation: " + reservation, exception: ex, customer: customer);
            }

            return null;
        }
开发者ID:propeersinfo,项目名称:nopcommerce-klarna-checkout-3.7,代码行数:26,代码来源:KlarnaCheckoutPaymentService.cs


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