I'm new to umbraco+merchello, and I have a cart page where the user can add a promocode which will update the total to be charged. (After this step, he will be asked to fulfill the address and then the payment details.)
I have a BasketController that calls the following function:
public void AddPromoCode(string promoCode)
{
var checkoutManager = _basket.GetCheckoutManager();
var result = checkoutManager.Offer.RedeemCouponOffer(promoCode);
if (!result.Success)
{
throw new Exception(result.Exception.Message);
}
}
When the user inserts a invalid promocode it works as expected: throws a "code doesnt exist" exception, that i take care. When he inserts a valid promocode it throws a "object reference not found" exception.
basically just defined a dummy billing address and it worked.
var checkoutManager = _basket.GetCheckoutManager();
checkoutManager.Customer.SaveBillToAddress(GetDummyAddress());
var result = checkoutManager.Offer.RedeemCouponOffer(promoCode);
however.. it doesnt update the basket total but the invoice total.. (if i do checkoutManager.Payment.PrepareInvoice() the invoice total includes the discount)
[discount coupons] Add promo code and calculating total amount
Hello!
I'm new to umbraco+merchello, and I have a cart page where the user can add a promocode which will update the total to be charged. (After this step, he will be asked to fulfill the address and then the payment details.)
I have a BasketController that calls the following function:
When the user inserts a invalid promocode it works as expected: throws a "code doesnt exist" exception, that i take care. When he inserts a valid promocode it throws a "object reference not found" exception.
Can you help me with this?
Thank you! :)
basically just defined a dummy billing address and it worked.
however.. it doesnt update the basket total but the invoice total.. (if i do checkoutManager.Payment.PrepareInvoice() the invoice total includes the discount)
is working on a reply...