Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Payments and Payment Gateway / APIs /

This is a forum for discussing SilverStripe can-do payments and their APIs / Gateways.

Moderators: martimiz, Sean, Normann, biapar, Willr, Ingo, swaiba, simon_w

PayPal - Front-end fail or back-end fail: it's my choice!


Reply


1600 Views

Avatar
bones

Community Member, 104 Posts

24 October 2011 at 11:44pm

I really really hope that someone can help me with this.

After downloading and installing the current versions of SS, ecommerce, payment and payment_payPal mods, and configuring, all seems fine until PayPal attempts to return me to my website (either after payment is made or aborted), then I this error:

[User Error] singleton() Called without a class
GET /fstest/PaypalExpressCheckoutaPayment_Handler/cancel?token=EC-37W42336T7825260H Line 343 in /Applications/MAMP/htdocs/fstest/sapphire/core/Core.php
Source
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
* data (e.g. the custom SilverStripe static handling). * * @uses Object::strong_create() *
* @param string $className * @return Object */
function singleton($className) { global $_SINGLETONS; if(!isset($className)) user_error("singleton() Called without a class", E_USER_ERROR); if(!is_string($className)) user_error("singleton() passed bad class_name: " . var_export($className,true), E_USER_ERROR); if(!isset($_SINGLETONS[$className])) {
if(!class_exists($className)) user_error("Bad class to singleton() - $className", E_USER_ERROR); $_SINGLETONS[$className] = Object::strong_create($className,null, true); if(!$_SINGLETONS[$className]) user_error("singleton() Unknown class '$className'", E_USER_ERROR);
Trace
}
singleton() Called without a class
Line 343 of Core.php
singleton()
Line 2794 of DataObject.php
DataObject::get_one(,"ID" = 0,1)
Line 2921 of DataObject.php
DataObject::get_by_id(,0)
Line 265 of Payment.php
Payment->PaidObject()
Line 470 of PayPalExpressCheckoutPayment.php
PaypalExpressCheckoutaPayment_Handler->doRedirect()
Line 463 of PayPalExpressCheckoutPayment.php
PaypalExpressCheckoutaPayment_Handler->cancel(SS_HTTPRequest)
Line 193 of Controller.php
Controller->handleAction(SS_HTTPRequest)
Line 143 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 282 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
Line 125 of Director.php
Director::direct(/PaypalExpressCheckoutaPayment_Handler/cancel)
Line 127 of main.php

After I highlighted this, a fix was posted to payment (https://github.com/burnbright/silverstripe-payment/commit/6ab0e8b349d2c1f92c014309cedf1916c145b501) which corrected the earlier problem and allowed visitors to return to the website after PayPal.

However, I now have a new problem: in the CMS, clicking the "Store" tab produces this:

[User Error] Uncaught Exception: Unable to traverse to related object field [PaymentMethod] on [Payment]
GET /fstest/admin/store/

Line 2492 in /Applications/MAMP/htdocs/fstest/sapphire/core/model/DataObject.php

Source

2483          } elseif($className = $this->castingClass($relation)) {
2484             $component = $className;
2485          }
2486       }
2487
2488       $object = $component->dbObject($fieldName);
2489
2490       if (!($object instanceof DBField) && !($object instanceof ComponentSet)) {
2491          // Todo: come up with a broader range of exception objects to describe differnet kinds of errors programatically
2492          throw new Exception("Unable to traverse to related object field [$fieldPath] on [$this->class]");
2493       }
2494       return $object;
2495    }
2496
2497    /**
2498     * Temporary hack to return an association name, based on class, to get around the mangle
Trace

DataObject->relObject(PaymentMethod)
Line 1866 of DataObject.php
DataObject->scaffoldSearchFields()
Line 1812 of DataObject.php
DataObject->getDefaultSearchContext()
Line 396 of ModelAdmin.php
ModelAdmin_CollectionController->SearchForm()
Line 369 of ViewableData.php
ViewableData->obj(SearchForm,,,1)
Line 446 of ViewableData.php
ViewableData->XML_val(SearchForm,,1)
Line 31 of .cache.cms.templates.ModelSidebar.ss
include(/private/var/folders/8p/8pflKOk9GwWGbZTbO1QAa++++TI/-Tmp-/silverstripe-cache-Applications-MAMP-htdocs-FStest/.cache.cms.templates.ModelSidebar.ss)
Line 429 of SSViewer.php
SSViewer->process(StoreAdmin_CollectionController)
Line 342 of ViewableData.php
ViewableData->renderWith(ModelSidebar)
Line 387 of ModelAdmin.php
ModelAdmin_CollectionController->getModelSidebar()
Line 258 of ModelAdmin.php
ModelAdmin->getModelForms()
Line 112 of ViewableData.php
ViewableData->__get(ModelForms)
Line 371 of ViewableData.php
ViewableData->obj(ModelForms)
Line 24 of .cache.cms.templates.Includes.ModelAdmin_left.ss
include(/private/var/folders/8p/8pflKOk9GwWGbZTbO1QAa++++TI/-Tmp-/silverstripe-cache-Applications-MAMP-htdocs-FStest/.cache.cms.templates.Includes.ModelAdmin_left.ss)
Line 429 of SSViewer.php
SSViewer->process(StoreAdmin)
Line 342 of ViewableData.php
ViewableData->renderWith(Array)
Line 488 of LeftAndMain.php
LeftAndMain->Left()
Line 369 of ViewableData.php
ViewableData->obj(Left,,,1)
Line 446 of ViewableData.php
ViewableData->XML_val(Left,,1)
Line 59 of .cache.cms.templates.LeftAndMain.ss
include(/private/var/folders/8p/8pflKOk9GwWGbZTbO1QAa++++TI/-Tmp-/silverstripe-cache-Applications-MAMP-htdocs-FStest/.cache.cms.templates.LeftAndMain.ss)
Line 429 of SSViewer.php
SSViewer->process(StoreAdmin)
Line 202 of Controller.php
Controller->handleAction(SS_HTTPRequest)
Line 143 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 282 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
Line 125 of Director.php
Director::direct(/admin/store/)
Line 127 of main.php

This is happening on my store which is otherwise ready to go live now, but I've been able to replicate this problem on a completely fresh install. Can anybody please help? Many thanks.