Problem when add Coupon to a invoice and try to realice paiment whit PayPal
Hi and thanks first of all,
We are beginners with Merchello and we are trying to generate a invoice and payment with the basket.GetCheckoutManager(), if we dont put any Coupon it works correctly and when we do the payment attempt generates the redirectUrl to paypal with the Token. The problem appears when we add a coupon to this same invoice, paypal dont generate token. In the attempt variable (var attempt = checkoutManager.Payment.AuthorizePayment(paymentMethod);) we found this error in -> Payment.Result.ExtendedData
If we check the invoice generated all is fine and have the four Items (product 20€, Tax 2€, Shipping 10€ and the coupon -10€) with the correct total amount = 22€
This is the base code where we are working
public string GenerateInvoice()
{
var currentCustomer = MerchelloServices.CustomerService.GetByLoginName("[email protected]"); ;
var basket = currentCustomer.Basket();
var product = MerchelloServices.ProductService.GetBySku("producto01");
basket.Empty();
basket.AddItem(product, product.Name, 1);
basket.Save();
var checkoutManager = basket.GetCheckoutManager();
var shipAd = new Address()
{
Name = "a",
Address1 = "a",
Address2 = "a",
Locality = "a",
Region = "a",
PostalCode = "a",
CountryCode = "ES",
Phone = "a",
Organization = "a",
AddressType = AddressType.Shipping
};
checkoutManager.Customer.SaveShipToAddress(shipAd);
var billAd = new Address()
{
AddressType = AddressType.Billing,
CountryCode = "ES"
};
checkoutManager.Customer.SaveBillToAddress(billAd);
var coupon = MerchelloServices.OfferSettingsService.GetByOfferCode("11");
checkoutManager.Offer.RedeemCouponOffer(coupon.OfferCode);
IShipment shipment = basket.PackageBasket(shipAd).ElementAt(0);
var shipmentRateQuotes = Enumerable.Empty<IShipmentRateQuote>().ToArray();
shipmentRateQuotes = shipment.ShipmentRateQuotes().ToArray();
if (shipmentRateQuotes.Any())
{
checkoutManager.Shipping.ClearShipmentRateQuotes();
checkoutManager.Shipping.SaveShipmentRateQuote(shipmentRateQuotes.First());
}
//Default method is PayPal
var methodsPayment = GatewayContext.Payment.GetPaymentGatewayMethods();
var paymentMethod = GatewayContext.Payment.GetPaymentGatewayMethodByKey(methodsPayment.FirstOrDefault().PaymentMethod.Key);
checkoutManager.Payment.SavePaymentMethod(paymentMethod.PaymentMethod);
var attempt = checkoutManager.Payment.AuthorizePayment(paymentMethod);
return "";
}
I am able to see the same thing here - so the problem appears to be in the Core PayPalProvider. I'll put this in the issue tracker as a major issue and post a patch.
Problem when add Coupon to a invoice and try to realice paiment whit PayPal
Hi and thanks first of all,
We are beginners with Merchello and we are trying to generate a invoice and payment with the basket.GetCheckoutManager(), if we dont put any Coupon it works correctly and when we do the payment attempt generates the redirectUrl to paypal with the Token. The problem appears when we add a coupon to this same invoice, paypal dont generate token. In the attempt variable (var attempt = checkoutManager.Payment.AuthorizePayment(paymentMethod);) we found this error in -> Payment.Result.ExtendedData
If we check the invoice generated all is fine and have the four Items (product 20€, Tax 2€, Shipping 10€ and the coupon -10€) with the correct total amount = 22€
This is the base code where we are working
Regards,
Hi Richard,
I am able to see the same thing here - so the problem appears to be in the Core PayPalProvider. I'll put this in the issue tracker as a major issue and post a patch.
http://issues.merchello.com/youtrack/issue/M-1082
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.