News:

Support the VirtueMart project and become a member

Main Menu

PayPal New API Adds Credit Card Payment Option that causes error

Started by jdl777, February 06, 2011, 21:46:57 PM

Previous topic - Next topic

jdl777

When you select PayPal New API, it then adds "Credit Card" as a payment method option. If you select that as your payment method, then "Confirm Order", you get the following error:


  • Invalid Credit Card Number or Credit Card Verification Code.

    Error: Invalid Credit Card Number or Credit Card Verification Code.

    Error: Failure in Processing the Payment (ps_paypal_api)

    Invalid Credit Card Number or Credit Card Verification Code.


Obviously this error is because nobody entered any credit card information to check out! It should NOT have a Credit Card option to begin with.

How do we remove this Credit Card option when using PayPal New API? DO we go into the source files and delete the code that would call for that option?

Please advise. It makes little sense why it would do this.

jdl777

SOLVED:

in the file: components/com_virtuemart/themes/(your theme)/templates/checkout/list_payment_methods.tpl.php

...I commented out line 113 s shown below:

   <div class="yagendoo_vm_checkout_payment_elements">
         <?php $ps_payment_method->list_nocheck($payment_method_id,  false); ?>
         <?php $ps_payment_method->list_bank($payment_method_id,  false); ?>
         <!--<?php $ps_payment_method->list_paypalrelated($payment_method_id,  false); ?>-->
      </div>

You can see that I have commented out the "paypal related" line. This removed the "Credit Card" option but left the other option intact.

Hope this helps someone who gets lost like I was!


krofeta


piperpilot

I'm working on this...I have narrowed it down to this...

When you have another payment option enabled, you get the option to choose "PayPal".  That choice triggers the checkout module to tell it that there is an express checkout in process.  It sets up some variables that tells the system how to handle everything from that point forward.

Now with ONLY paypal as your payment option, it skips over that choice and the proper variables aren't getting set.

If I can figure out what is telling it to skip over the payment choice screen, I can probably fix this, but VM is very confusing as to the flow.

If anyone has any pointers on where the code snippet that checks for multiple payment options is and skips that step, I'd appreciate it.

PiperPilot

piperpilot

Update:

Well I figured out where the code to bypass the payment type selection is.  Its in ps_checkout.php.

If you comment out the following section like I have shown here, it will always ask for a payment method.  This makes the module work properly, but isn't ideal because the selection of a payment type when there is only one is an unnecessary step.  I'm gonna work on figuring out how to bypass this and have the module still work.


        // Redirect to the last step when there's only one payment method
//              if( $VM_CHECKOUT_MODULES['CHECK_OUT_GET_PAYMENT_METHOD']['order$
//                      if ($count <= 1 && $cc_payments==false) {
//                              $vmLogger->debug("Only One Payment, skipping se$
//                              vmRedirect($sess->url(SECUREURL.basename($_SERV$
//                      }
//                      elseif( isset($order_total) && $order_total <= 0.00 ) {
//                              // In case the order total is less than or equa$
//                              vmRedirect($sess->url(SECUREURL.basename($_SERV$
//                      }
//              }


ozkart

What version of VM are you using. I'm on 1.1.7 and I'm also getting the

Invalid Credit Card Number or Credit Card Verification Code.
Error: Invalid Credit Card Number or Credit Card Verification Code.
Error: Failure in Processing the Payment (ps_paypal_api)
Invalid Credit Card Number or Credit Card Verification Code.

But when I opened the ps_checkout.php to comment out the code I found the string "Redirect to the last step when there's only one payment method" however the code under it is not the same as your post.

This is a frustrating bug.

piperpilot

Quote from: ozkart on February 15, 2011, 11:37:25 AM
But when I opened the ps_checkout.php to comment out the code I found the string "Redirect to the last step when there's only one payment method" however the code under it is not the same as your post.

I am on 1.1.7 I thought.  Post that section and I'll take a look.  I also found the fix to still bypass it but have it work properly.

ssaarroo

hi,
piperpilot
I am trying to sort it out the problem too.
Actually I am trying to do that just doing files back up and then by copying and past whatever I find in the web web. :P   ;D
I am doing that because my php skills gets a 0 rate ( or under 0)
I found your line code but to me it seems that I can see ( and also do my magic copy and past) only the left half part of the code.
So the right side is missing if I am not wrong.
It is like I can watch only half part of the pic.
I am using VM 1.1.6 and last version of joomla
Thanks to piperlot for your help and to everybody who can participate to this post.

4lane

I had the same problem on 1.1.6, and due to a flaw in that build, updated to 1.1.7. In both versions I get the following error when trying to pay by credit card. Note: paying by paypal works fine.

"Error: Error - Paypal did not complete the transaction. Please try again in a little while.
Error: Failure in Processing the Payment (ps_paypal_api)"

piperpilot

OOPS...sorry about the cut and paste problem.  I was copying from a terminal window so it got truncated.  Here is the whole section:


        // Redirect to the last step when there's only one payment method
if( $VM_CHECKOUT_MODULES['CHECK_OUT_GET_PAYMENT_METHOD']['order'] != $VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'] ) {
if ($count <= 1 && $cc_payments==false) {
$vmLogger->debug("Only One Payment, skipping selection");
vmRedirect($sess->url(SECUREURL.basename($_SERVER['PHP_SELF'])."?page=checkout.index&payment_method_id=$first_payment_method_id&ship_to_info_id=$ship_to_info_id&shipping_rate_id=".urlencode($shipping_rate_id)."&checkout_stage=".$VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order']."&payment_method_ppex=2", false, false ),"");
}
elseif( isset($order_total) && $order_total <= 0.00 ) {
// In case the order total is less than or equal zero, we don't need a payment method
vmRedirect($sess->url(SECUREURL.basename($_SERVER['PHP_SELF'])."?page=checkout.index&ship_to_info_id=$ship_to_info_id&shipping_rate_id=".urlencode($shipping_rate_id)."&checkout_stage=".$VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'], false, false),"");
}
}



If you look at this line here:

vmRedirect($sess->url(SECUREURL.basename($_SERVER['PHP_SELF'])."?page=checkout.index&payment_method_id=$first_payment_method_id&ship_to_info_id=$ship_to_info_id&shipping_rate_id=".urlencode($shipping_rate_id)."&checkout_stage=".$VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order']."&payment_method_ppex=2", false, false ),"");

You will see that I added:


."&payment_method_ppex=2"


If you only have Paypal as your payment option, this will fix it so that it uses the express checkout option properly. 

Hope this helps everyone and that the devs might pick this up.  I'll see if I can figure out how to submit a bug and fix to the project when I have time.

Just to re-iterate, you can remove the comment // from my original post and this works fine.

PiperPilot

4lane

Nice job - works well. I'll just need to get in a Paypal logo w/ credit card icons so users know that they'll be paying via Paypal only.

zanardi

@piperpilot:
thank you for your input, i will surely check your fix as soon as i can, and hopefully include it VM code in time for 1.1.8 release.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

zanardi

Nope. In the clear light of the morning, i can see that this "fix" cannot be included in the code, since it is an hack for those who only use PayPal payment method.
But this sent me on the right track. I think i know what to do now, updates later.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

EdgeCrafter