IsPaymentWorkFlowRequired - Logic Problems

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
v2.3

It seems that in both the controllers PaymentMethod and SelectPaymentMethod there are some logic problems with IsPaymentWorkFlowRequired.

For instance, if the user chooses to redeem with reward points (has enough to cover the order) and is on the confirm screen and then decides to go back to shipping to pass through the process again, IsPaymentWorkFlowRequired returns false and the user never is able to get back to the payment select screen (to not use reward points).

On PaymentMethod, the user is redirected to confirm if the user had already previously chosen to use reward points (I rewrote part of this first and then encountered the issue above in SelectPaymentMethod) they are redirected to confirm... I"m not sure what happens with gift cards or coupons as I've only tested with reward points.

On SelectPaymentMethod, if the user had turned off reward points, the user is redirected before the customer record is updated to reflect this.

Current Code (SelectPaymentMethod):
  bool isPaymentWorkflowRequired = IsPaymentWorkflowRequired(cart);
            if (!isPaymentWorkflowRequired)
            {
                _workContext.CurrentCustomer.SelectedPaymentMethodSystemName = "";
                _customerService.UpdateCustomer(_workContext.CurrentCustomer);
                return RedirectToRoute("CheckoutPaymentInfo");
            }
            //payment method
            if (String.IsNullOrEmpty(paymentmethod))
                return PaymentMethod();

            //reward points
            _workContext.CurrentCustomer.UseRewardPointsDuringCheckout = model.UseRewardPoints;
            _customerService.UpdateCustomer(_workContext.CurrentCustomer);


Probably be changed to something like:


  
_workContext.CurrentCustomer.UseRewardPointsDuringCheckout = model.UseRewardPoints;
            _customerService.UpdateCustomer(_workContext.CurrentCustomer);
bool isPaymentWorkflowRequired = IsPaymentWorkflowRequired(cart);
            if (!isPaymentWorkflowRequired)
            {
                _workContext.CurrentCustomer.SelectedPaymentMethodSystemName = "";
                _customerService.UpdateCustomer(_workContext.CurrentCustomer);
                return RedirectToRoute("CheckoutPaymentInfo");
            }
            //payment method
            if (String.IsNullOrEmpty(paymentmethod))
                return PaymentMethod();

            //reward points
            


I created a work item for part of this..  http://nopcommerce.codeplex.com/workitem/10428
12 years ago
Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.