Ahmad E. Posted August 29, 2018 Posted August 29, 2018 Hello everyone, so I've had a client contact me due to the following issue: When someone pays for some product (let's say an ad) through my commerce gateway (Coinpayments in this case), the ad is never created. The transaction shows up and is marked as approved but what the package is supposed to do, doesn't happen (be it create an ad, move into customer group etc.). Now after debugging I found out what the issue is: The commerce app was disabled except for some groups, what happens in this case is the following: IPN is received by the gateway - all ok Gateway tries to approve the transaction by calling "$transaction->approve()" In applications/nexus/sources/Transaction/Transaction.php:651 the invoice is marked as paid In applications/nexus/sources/Invoice/Invoice.php:1690 the foreach triggers the "current()" method in the items iterator "current()" method is in applications/nexus/sources/Invoice/ItemsIterator.php:246 In the "arrayToObject()" method on line 59 all commerce extensions are retrieved The bit of (problematic?) code is: foreach ( \IPS\Application::allExtensions( 'nexus', 'Item', TRUE, NULL, NULL, FALSE ) as $ext ) When the IPN request is asynchronous, the user is gonna be a guest for which commerce is disabled and thus the commerce extensions aren't included in the result. Which in turn leads to commerce not using the correct package class but the default one "IPS\nexus\extensions\nexus\Item\MiscellaneousCharge". The client said PayPal worked just fine - which is correct but that's because the IPN is called synchronously in the user request when the user is still authenticated. Now my question is: Is this the desired behavior? I can just do something like this in my gateway: if ($transaction->member ) { \IPS\Session::i()->setMember( $transaction->member ); } Which works fine but I want to make sure there isn't a bug in IPS which may be affecting other users. Best Regards, Ahmad E.
bfarber Posted August 30, 2018 Posted August 30, 2018 @Mark can you weigh in on this when you get a chance?
Mark Posted August 30, 2018 Posted August 30, 2018 Sounds like a bug to me. If you change the line you pointed out to: foreach ( \IPS\Application::allExtensions( 'nexus', 'Item', FALSE, NULL, NULL, FALSE ) as $ext ) Does it work?
Ahmad E. Posted September 3, 2018 Author Posted September 3, 2018 Hey, the question was marked as answered but the bug is in the IPS codebase, does this mean that a fix will be included in a following release? Best Regards, Ahmad E.
Mark Posted September 4, 2018 Posted September 4, 2018 I will make the change but it won't make it into 4.3.6 (which has already entered testing) - will be in the next release after that.
Bluto Posted January 31, 2019 Posted January 31, 2019 Needs to be tested but in 4.4.0: Quote Fixed purchase not being processed properly with third party payment gateways if Commerce app is only accessible to certain groups.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.