本文整理汇总了C#中Api.CreditInvoice方法的典型用法代码示例。如果您正苦于以下问题:C# Api.CreditInvoice方法的具体用法?C# Api.CreditInvoice怎么用?C# Api.CreditInvoice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api.CreditInvoice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FullRefund
public void FullRefund(global::Nop.Core.Domain.Orders.Order order)
{
try
{
var configuration = new Klarna.Api.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.CreditInvoice(order.CaptureTransactionId);
_logger.Information(string.Format(CultureInfo.InvariantCulture, "KlarnaCheckout: Order refunded. InvoiceNumber: {0}, AppliedTo: {1}",
result, result), customer: order.Customer);
order.OrderNotes.Add(new OrderNote
{
Note = string.Format(CultureInfo.CurrentCulture, "KlarnaCheckout: Order has been refunded. Invoice Number: {0}; Refund applied to: {1}",
order.CaptureTransactionId, result),
CreatedOnUtc = DateTime.UtcNow,
DisplayToCustomer = false
});
_orderService.UpdateOrder(order);
}
catch (Exception ex)
{
throw new KlarnaCheckoutException("An error occurred when refunding order " + order.Id, ex);
}
}