Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paypal repeated ipn_ logs / PHP Fatal error: Uncaught Error: Class "Customer" not found in functions_prices.php #6100

Closed
torvista opened this issue Dec 27, 2023 · 2 comments

Comments

@torvista
Copy link
Member

Get a coffee first.
php 8.1.4, hosting, using current Z200 with many mods.
All was quiet until I uploaded the current tranche including wholesale (after local testing). Wholesale is off.

Now I'm getting error logs only post-Paypal transactions.
2023-12-27 15_52_52-logs - Folder Compare - Beyond Compare

The actual transaction completes ok, with no errors.

Subsequently, occur multiple ipn_xxx logs all containing the same data from the last transaction, which appear to be instigated from Paypal.

Dec 27 2023 13:58 50 -- IPN PROCESSING INITIATED.
*** Originating IP: 173.0.81.65 notify.paypal.com
*** Browser/User Agent: PayPal IPN ( https://www.paypal.com/ipn )

I added the POST array to the ipn_ log for more info, but they are all identical, the only thing different about each one is sometimes the ip:
*** Originating IP: 173.0.81.65 notify.paypal.com
*** Originating IP: 173.0.81.140 notify.paypal.com
*** Originating IP: 66.211.170.66 notify.paypal.com
*** Originating IP: 173.0.81.140 notify.paypal.com
*** Originating IP: 173.0.81.65 notify.paypal.com
and all subsequent logs are 173.0.81.65
These do all resolve to Paypal.

The error debugs associated with every ipn_ log have the same timestamp (to the same second), so I can't say which comes first...but I assume it's the ipn_ log.

PHP Fatal error: Uncaught Error: Class "Customer" not found in /includes/functions/functions_prices.php:1686
Stack trace:
#0 /includes/functions/functions_prices.php(478): zen_get_retail_or_wholesale_price()
#1 /includes/functions/functions_prices.php(188): zen_get_products_base_price()
#2 /includes/languages/spanish/extra_definitions/aa_z_motorvista_boilerplate_text.php(303): zen_get_products_display_price()
#3 /includes/classes/ResourceLoaders/FilesLanguageLoader.php(39): include_once('...')
#4 /includes/classes/ResourceLoaders/CatalogFilesLanguageLoader.php(92): Zencart\LanguageLoader\FilesLanguageLoader->loadFileDefineFile()
#5 /includes/classes/ResourceLoaders/CatalogFilesLanguageLoader.php(18): Zencart\LanguageLoader\CatalogFilesLanguageLoader->LoadLanguageExtraDefinitions()
#6 /includes/classes/ResourceLoaders/LanguageLoader.php(29): Zencart\LanguageLoader\CatalogFilesLanguageLoader->loadInitialLanguageDefines()
#7 /includes/init_includes/init_templates.php(72): Zencart\LanguageLoader\LanguageLoader->loadInitialLanguageDefines()
#8 /includes/autoload_func.php(40): require_once('...')
#9 /includes/application_top.php(257): require('...')
#10 /ipn_main_handler.php(122): require('...')
#11 {main}
thrown in /includes/functions/functions_prices.php on line 1686
my 1686 equates to

if (Customer::isWholesaleCustomer() === false || empty($wholesale_pricing_tier)) {

The other stuff I have in that file relates to wholesale mods which are commented out at this point/not enabled

Before you ask, this language define

#2 /includes/languages/spanish/extra_definitions/aa_z_motorvista_boilerplate_text.php(303): zen_get_products_display_price()

has embedded uses of zen_get_products_display_price. These are used in some tables of product-comparisons to show prices of similar products, and so avoids having to manually update them in the language define.
These defines are used in multiple product descriptions as boilerplate text.
This means the actual product description contains
PRODUCT_X_COMPARISON_TABLE
which is swapped for the define content via $zco_notifier->notify('NOTIFY_GET_PRODUCT_DETAILS'
All well and good/there no errors from this in normal use.

So two queries.
a) Is paypal repeating it's notification as something is now missing from the original transaction/handshaking?
b) Does ipn_handler need something more to initiate the missing Customer class?

@drbyte
Copy link
Member

drbyte commented Dec 27, 2023

I think it might be easily fixable by copying this from /includes/autoloaders/config.core.php to the paypal_ipn.core.php file. It's found near the end of the breakpoint [0] list:

  $autoLoadConfig[0][] = array('autoType'=>'class',
                               'loadFile'=>'Customer.php');

@torvista
Copy link
Member Author

I didn't realise it had it's own loader: that seems to have fixed the problem, thanks.
So would I be correct in assuming the handshaking was broken, and Paypal was missing some final confirmation?

@drbyte drbyte closed this as completed in 7e20a7c Dec 28, 2023
drbyte added a commit to drbyte/zencart that referenced this issue Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants