Hi folks, latest plugin files have been re uploaded.
Please could you add issues to CodePlex for us to track?
Thanks
public PaymentDetailsType[] GetPaymentDetails(IList<ShoppingCartItem> cart)
{
var currencyCode = _payPalCurrencyCodeParser.GetCurrencyCodeType(_workContext.WorkingCurrency);
decimal orderTotalDiscountAmount;
Discount appliedDiscount;
int redeemedRewardPoints;
decimal redeemedRewardPointsAmount;
List<AppliedGiftCard> appliedGiftCards;
var orderTotalWithDiscount = _payPalCartItemService.GetCartTotal(cart, out orderTotalDiscountAmount,
out appliedDiscount,
out redeemedRewardPoints,
out redeemedRewardPointsAmount,
out appliedGiftCards);
decimal subTotalWithDiscount;
decimal subTotalWithoutDiscount;
Discount subTotalAppliedDiscount;
decimal subTotalDiscountAmount;
var itemTotalWithDiscount = _payPalCartItemService.GetCartItemTotal(cart,
out subTotalDiscountAmount,
out subTotalAppliedDiscount,
out subTotalWithoutDiscount,
out subTotalWithDiscount);
var giftCardsAmount = appliedGiftCards.Sum(x => x.AmountCanBeUsed);
itemTotalWithDiscount = itemTotalWithDiscount - orderTotalDiscountAmount - giftCardsAmount;
var taxTotal = _payPalCartItemService.GetTax(cart);
var shippingTotal = _payPalCartItemService.GetShippingTotal(cart);
var items = GetPaymentDetailsItems(cart);
if (orderTotalDiscountAmount > 0 || subTotalDiscountAmount > 0)
{
var discountItem = new PaymentDetailsItemType()
{
Name = "Discount",
Amount = new BasicAmountType()
{
currencyID = currencyCode,
Value = (-orderTotalDiscountAmount + -subTotalDiscountAmount).ToString("N2")
},
Quantity = "1"
};
Array.Resize(ref items, items.Count() + 1);
items[items.Count() - 1] = discountItem;
}
foreach (var appliedGiftCard in appliedGiftCards)
{
var giftCardItem = new PaymentDetailsItemType()
{
Name = "Gift Card (" + appliedGiftCard.GiftCard.GiftCardCouponCode + ")",
Amount = new BasicAmountType()
{
currencyID = currencyCode,
Value = (-appliedGiftCard.AmountCanBeUsed).ToString("N2")
},
Quantity = "1"
};
Array.Resize(ref items, items.Count() + 1);
items[items.Count() - 1] = giftCardItem;
}
/*var rewardPointsAmountItem = new PaymentDetailsItemType()
{
Name = "Reward Points Credit", // Use resource value (e.g. {0} Amount)
Amount = new BasicAmountType()
{
currencyID = currencyCode,
Value = -redeemedRewardPointsAmount
},
Quantity = "1"
};
Array.Resize(ref items, items.Count() + 1);
items[items.Count() - 1] = rewardPointsAmountItem;
*/
return new[]
{
new PaymentDetailsType
{
OrderTotal = orderTotalWithDiscount.GetBasicAmountType(currencyCode),
ItemTotal = itemTotalWithDiscount.GetBasicAmountType(currencyCode),
TaxTotal = taxTotal.GetBasicAmountType(currencyCode),
ShippingTotal = shippingTotal.GetBasicAmountType(currencyCode),
PaymentDetailsItem = items,
PaymentAction = _payPalExpressCheckoutPaymentSettings.PaymentAction,
PaymentActionSpecified = true,
ButtonSource = "nopCommerce_Cart_EC"
}
};
}