Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Post OSC WPP module - Direct Payment setpaymentaction() error


Recommended Posts

Posted

I have a fresh install of:

 

* OSCommerce 2.2

 

* PostOSC free 'osCommerce Payment Module for PayPal Website Payments Pro'

 

 

-- I copied all the PostOSC files over to my web server in their appropriate directories and enabled Direct Payments.

 

-- When I click "Confirm Order" this error message appears:

 

Fatal error: Call to undefined function: setpaymentaction() in .../includes/modules/payment/paypal_dp.php on line 349

 

 

It seems the Paypal API isn't even activated (no log file is generated in Debug mode). It's some error prior to that. I've searched and searched all forums but I am not a PHP programmer so I do not know how to troubleshoot this problem.

 

Express Checkout creates a similar error.

 

 

Any help would be greatly appreciated!!!

Posted
I have a fresh install of:

 

* OSCommerce 2.2

 

* PostOSC free 'osCommerce Payment Module for PayPal Website Payments Pro'

-- I copied all the PostOSC files over to my web server in their appropriate directories and enabled Direct Payments.

 

-- When I click "Confirm Order" this error message appears:

 

Fatal error: Call to undefined function: setpaymentaction() in .../includes/modules/payment/paypal_dp.php on line 349

It seems the Paypal API isn't even activated (no log file is generated in Debug mode). It's some error prior to that. I've searched and searched all forums but I am not a PHP programmer so I do not know how to troubleshoot this problem.

 

Express Checkout creates a similar error.

Any help would be greatly appreciated!!!

 

My guess is this is a typo. Try replacing "setpaymentaction" with "setPaymentAction". Notice the change in case for the starting letters "P"ayment and "A"ction.

 

These are Paypal-specific routines. Basically, the routine is being invoked but PHP can not find any definition for it, so it is complaining.

 

Let me know what you find out.

 

I hope this helps.

 

Feel free to send me a note. If possible, please include a snippet of the code from the paypal_dp.php file.

 

Amit

Posted

Thank you for replying Amit. I receive this error when I click "Confirm Order" in OSCommerce:

 

Fatal error: Call to undefined function: setpaymentaction() in .../includes/modules/payment/paypal_dp.php on line 349

 

 

Here is a snippet of code from the Paypal_dp.php file:

 

 

*** begin snippet ****

 

$pdt->setButtonSource(POSTOSC_PRODUCT_NAME);

 

$details =& Services_PayPal::getType('DoDirectPaymentRequestDetailsType');

$details->setPaymentAction(MODULE_PAYMENT_PAYPAL_DP_PAYMENT_ACTION);

$details->setPaymentDetails($pdt);

$details->setCreditCard($cc);

$details->setIPAddress(getenv('REMOTE_ADDR'));

$details->setMerchantSessionId(tep_session_id());

 

$ddp =& Services_PayPal::getType('DoDirectPaymentRequestType');

$ddp->setDoDirectPaymentRequestDetails($details);

 

$response = $caller->DoDirectPayment($ddp);

 

 

*** End snippet ***

 

I see that setPaymentAction is indeed uppercase (unlike the error message). I changed it to lowercase but it still reports the same error message.

 

I searched through a lot of files looking for the word "setpaymentaction" but I do not find it anywhere. DO you know where else this function name would appear? I looked in the Pear directory and the Pear/Services directory.

 

Thank you so much for your help!

Posted
Thank you for replying Amit. I receive this error when I click "Confirm Order" in OSCommerce:

 

Fatal error: Call to undefined function: setpaymentaction() in .../includes/modules/payment/paypal_dp.php on line 349

Here is a snippet of code from the Paypal_dp.php file:

*** begin snippet ****

 

$pdt->setButtonSource(POSTOSC_PRODUCT_NAME);

 

$details =& Services_PayPal::getType('DoDirectPaymentRequestDetailsType');

$details->setPaymentAction(MODULE_PAYMENT_PAYPAL_DP_PAYMENT_ACTION);

$details->setPaymentDetails($pdt);

$details->setCreditCard($cc);

$details->setIPAddress(getenv('REMOTE_ADDR'));

$details->setMerchantSessionId(tep_session_id());

 

$ddp =& Services_PayPal::getType('DoDirectPaymentRequestType');

$ddp->setDoDirectPaymentRequestDetails($details);

 

$response = $caller->DoDirectPayment($ddp);

*** End snippet ***

 

I see that setPaymentAction is indeed uppercase (unlike the error message). I changed it to lowercase but it still reports the same error message.

 

I searched through a lot of files looking for the word "setpaymentaction" but I do not find it anywhere. DO you know where else this function name would appear? I looked in the Pear directory and the Pear/Services directory.

 

Thank you so much for your help!

 

That function is defined in the PEAR folder. Specifically, it is in:

....../pear/Services/PayPal/Type/DoDirectPaymentRequestDetailsType.php

 

So open that file and verify that the file and function does exist.

 

My suggestion, re-upload the entire Pear directory. Some FTP clients have issues when transferring files that have long names.

I always use FileZilla. It is fast, secure and free, available for download at :

http://filezilla.sourceforge.net

 

My suspicion is that the particular file, DoDirectPaymentRequestDetailsType.php and/or other files may have been corrupted or never uploaded in the first place. So re-uploading will fix the issue.

 

Do let me know what you find.

 

I have other things you can try if it still does not work.

 

 

-Amit

Posted

Hello Amit: Thank you for the help. Missing files and directories in the Pear subdirectory was the problem. I use a Macintosh (Mac), and apparently Transmit (an FTP program) and Dreamweaver 8 are horrible at FTP! It is hard to believe they cannot copy properly but it seems to be true.

 

 

I used Filezilla to re-copy all the Pear directories and files and now I can submit payment requests.

 

New problems have appeared with my sandbox testing ("Order Failure" emails) but I think it is due to Virtual Terminal - which you must sign up for but Paypal does not tell you about it (could this be any more difficult? Thank you Paypal...).

 

 

Another issue might be the state name: apparently Paypal only works with two-letter state codes, such as CA or NY. If you create an account in OSCommerce you cannot type "California" or "New York" for your state <-- that will fail when the purchase is sent to Paypal. I'm still researching this.

 

 

Regardless, I've made progress and I really appreciate your help. Thank you for replying!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...