Author Topic: Error: PayPal returned: Order total is invalid.  (Read 4794 times)

Anthony C.

  • Jr. Member
  • **
  • Posts: 286
Error: PayPal returned: Order total is invalid.
« on: September 11, 2010, 01:45:01 am »
Use Paypal_api module. When the total is 0 (100% off coupon applied), the api returns that value.

Is there a way to skip the paypal_api when the total is 0?

The old paypal and other CC payment are skipped when total is 0.

Thank you

Anthony

Claude LaBadie

  • Beginner
  • *
  • Posts: 5
    • Your Internet Business Partner
Re: Error: PayPal returned: Order total is invalid.
« Reply #1 on: October 14, 2010, 05:01:57 am »
Hi,

Today I am happy I can give back to our great community by sharing how I solved this problem for myself. :D

The fact I found is that it is around lines 1190-1200 in the virtuemart file administrator/components/com_virtuemart/classes/ps_checkout.php that you can fix the erroneous checkout behavior.

The checkout process checks for the existence of payment processing capabilities before testing for a 0.00 total order amount.  ???

The solution I chose is to switch the order of those 2 tests, checking for a total of zero, then else for payment processing. ;D

on my version here is the code before my change:

      if (isset($_PAYMENT)) {
          if( $enable_processor == "Y" || stristr($_PAYMENT->payment_code, '_API' ) !== false ) {
         if( $d['new_order_status'] != 'P' ) {
             $d['order_status'] = $d['new_order_status'];
             $update_order = true;
         } elseif( defined($_PAYMENT->payment_code.'_VERIFIED_STATUS')) {
             $d['order_status'] = constant($_PAYMENT->payment_code.'_VERIFIED_STATUS');
             $update_order = true;
         }
          }
      } elseif( $order_total == 0.00 ) {
          // If the Order Total is zero, we can confirm the order to automatically enable the download
          $d['order_status'] = ENABLE_DOWNLOAD_STATUS;
          $update_order = true;
      }

and the code after the change:

      // If the Order Total is zero, we can confirm the order to automatically enable the download
      if ( $order_total == 0.00 ) {
          $d['order_status'] = ENABLE_DOWNLOAD_STATUS;
          $update_order = true;

      } elseif ( isset($_PAYMENT) ) {
          if( $enable_processor == "Y" || stristr($_PAYMENT->payment_code, '_API' ) !== false ) {
         if( $d['new_order_status'] != 'P' ) {
             $d['order_status'] = $d['new_order_status'];
             $update_order = true;
         } elseif( defined($_PAYMENT->payment_code.'_VERIFIED_STATUS')) {
             $d['order_status'] = constant($_PAYMENT->payment_code.'_VERIFIED_STATUS');
             $update_order = true;
         }
          }
      }


Have a nice day. :-*

[attachment cleanup by admin]

forresttw

  • Beginner
  • *
  • Posts: 12
Re: Error: PayPal returned: Order total is invalid.
« Reply #2 on: July 01, 2011, 04:14:20 am »
Which version of VM are you on? I'm on VM1.1.5 and it didn't work

Claude LaBadie

  • Beginner
  • *
  • Posts: 5
    • Your Internet Business Partner
Re: Error: PayPal returned: Order total is invalid.
« Reply #3 on: July 08, 2011, 03:42:32 am »
The version this change worked on was VM 1.1.15