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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Content Editor Discussions /

Forum for content editors and CMS users.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Swipestripe Payment Checkout error


Go to End


3 Posts   3062 Views

Avatar
Nwa9ja

Community Member, 8 Posts

26 January 2015 at 9:41pm

Hi guys,

I am trying to build an online store using Swipestripe.
I have the payment and the payment-cheque modules installed correctly but I keep getting this error when I try to check out.

<code>
User Error] Method Cheque not defined in factory
GET /checkout/
Line 50 in /Users/ada/Sites/clevermash/payment/code/PaymentProcessor.php
Source
41 * @return array
42 */
43 public static function get_supported_methods() {
44 $methodConfig = Config::inst()->get('PaymentProcessor', 'supported_methods');
45 $environment = PaymentGateway::get_environment();
46
47 // Check if all methods are defined in factory
48 foreach ($methodConfig[$environment] as $method) {
49 if (! PaymentFactory::get_factory_config($method)) {
50 user_error("Method $method not defined in factory", E_USER_ERROR);
51 }
52 }
53 return $methodConfig[$environment];
54 }
55
56 /**
Trace
Method Cheque not defined in factory
PaymentProcessor.php:50
PaymentProcessor::get_supported_methods()
OrderForm.php:134
OrderForm->createFields()
OrderForm.php:39
OrderForm->__construct(CheckoutPage_Controller,OrderForm)
ReflectionClass->newInstanceArgs(Array)
InjectionCreator.php:17
InjectionCreator->create(OrderForm,Array)
Injector.php:548
Injector->instantiate(Array)
Injector.php:857
Injector->get(OrderForm,,Array)
Injector.php:894
Injector->createWithArgs(OrderForm,Array)
Object.php:142
Object::create(CheckoutPage_Controller,OrderForm)
CheckoutPage.php:143
CheckoutPage_Controller->OrderForm()
CheckoutPage.php:131
CheckoutPage_Controller->index(SS_HTTPRequest)
RequestHandler.php:288
RequestHandler->handleAction(SS_HTTPRequest,index)
Controller.php:194
Controller->handleAction(SS_HTTPRequest,index)
RequestHandler.php:200
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153
Controller->handleRequest(SS_HTTPRequest,DataModel)
ContentController.php:198
ContentController->handleRequest(SS_HTTPRequest,DataModel)
ModelAsController.php:78
ModelAsController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153
Director::direct(/checkout/,DataModel)
main.php:177
</code>

I am guessing the problem may be from my config.yaml, it looks like this

<code>
---
Name: mysite
After:
- 'framework/*'
- 'cms/*'
---
# YAML configuration for SilverStripe
# See http://doc.silverstripe.org/framework/en/topics/configuration
# Caution: Indentation through two spaces, not tabs
SSViewer:
theme: 'simple'

PaymentGateway:
environment:
'dev'

PaymentProcessor:
supported_methods:
dev:
- 'Cheque'
live:
- 'Cheque'
</code>

I don't know what else to do.

Avatar
helenclarko

Community Member, 166 Posts

29 January 2015 at 1:30pm

Hey Nwa9ja,

Do you have spaces in your .yml file?

PaymentGateway:
  environment:
    'dev'


PaymentProcessor:
  supported_methods:
    dev:
     - 'Cheque'
    live:
     - 'Cheque'

Avatar
Nwa9ja

Community Member, 8 Posts

29 January 2015 at 9:09pm

Yes I did all that.