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

[Payum] Upgrade up to 0.12 #2027

Merged
merged 1 commit into from
Nov 3, 2014

Conversation

makasim
Copy link
Contributor

@makasim makasim commented Oct 16, 2014

This PR updates Payum up to 0.12 (it is still in development). With this version it is extremely easy to add a payment gateway.

  • Configure PayumBundle (follow the Payum's doc)
# app/config/config.yml

twig:
    paths:
        %kernel.root_dir%/../vendor/payum/payum/src/Payum/Core/Resources/views: PayumCore
        %kernel.root_dir%/../vendor/payum/payum/src/Payum/Stripe/Resources/views: PayumStripe

payum:
    storages:
        Sylius\Component\Core\Model\Order: { doctrine: orm }
        Sylius\Component\Core\Model\Payment: { doctrine: orm }

    security:
        token_storage:
            Sylius\Bundle\PayumBundle\Model\PaymentSecurityToken: { doctrine: orm }

        stripe_checkout:
            stripe_checkout:
                publishable_key: %stripe.publishable_key%
                secret_key: %stripe.secret_key%
  • Add stripe_checkout to sylius_payment_methods table.
  • Add stripe_checkout to
# app/config/config.yml

sylius_payment:
    gateways:
        stripe_checkout: Stripe Checkout

That's it. All other payments supported by Payum could be added similar way.

@makasim
Copy link
Contributor Author

makasim commented Oct 16, 2014

It is based on #1822, and I think we can close that.

@makasim makasim mentioned this pull request Oct 16, 2014
@pjedrzejewski
Copy link
Member

That, is, awesome... :)

@makasim makasim force-pushed the payum-012-upgrade branch 3 times, most recently from 4b6159f to ac80e7f Compare October 29, 2014 20:31
@makasim makasim changed the title [WIP][Payum] Payum upgrade up to 0.12 [Payum] Payum upgrade up to 0.12 Oct 29, 2014
@makasim makasim changed the title [Payum] Payum upgrade up to 0.12 [Payum] Upgrade up to 0.12 Oct 29, 2014
@makasim
Copy link
Contributor Author

makasim commented Oct 29, 2014

Ready for the final review and merge. ping @pjedrzejewski @stloyd

@@ -37,8 +37,9 @@
"knplabs/knp-snappy-bundle": "*@dev",
"liip/imagine-bundle": "~0.9",
"mathiasverraes/money": "*@dev",
"payum/payum": "~0.9.0",
"payum/payum-bundle": "~0.9.0",
"pagerfanta/pagerfanta": "1.0.*@dev",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted, we use stable versions now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@makasim
Copy link
Contributor Author

makasim commented Oct 30, 2014

the are some tests failed but as far as I can see they are not related to my changes. @pjedrzejewski is the master stable atm? Could you please checks those tests and tell whether it my fault or not.

@antonioperic
Copy link
Contributor

@pjedrzejewski do you have time to review this one?

@stloyd
Copy link
Contributor

stloyd commented Nov 3, 2014

@makasim Requires rebase...
@pjedrzejewski 👍 for merge after rebasing...

@makasim
Copy link
Contributor Author

makasim commented Nov 3, 2014

@pjedrzejewski @stloyd done

pjedrzejewski pushed a commit that referenced this pull request Nov 3, 2014
@pjedrzejewski pjedrzejewski merged commit c1c5490 into Sylius:master Nov 3, 2014
@pjedrzejewski
Copy link
Member

Woohoo! Thank you Maksim! 👍

@madc
Copy link

madc commented Jan 5, 2015

I'm having an issue configuring any kind of new payment gateway. What i'm trying to do is, to add offline or manual payment gateways to my sylius applicaton.

app/config/config.yml

sylius_payment:
    gateways:
        offline: Offline Payment

Its now possible to add a payment method using this gateway, but when it comes to finalizing an order, i get an exception ('Payum payment named offline does not exist.').

Looking into the payments, the offline gateway was not added:

array (size=6)
  'paypal_express_checkout' => string 'payum.context.paypal_express_checkout.payment' (length=45)
  'stripe' => string 'payum.context.stripe.payment' (length=28)
  'be2bill' => string 'payum.context.be2bill.payment' (length=29)
  'be2bill_onsite' => string 'payum.context.be2bill_onsite.payment' (length=36)
  'stripe_checkout' => string 'payum.context.stripe_checkout.payment' (length=37)
  'dummy' => string 'payum.context.dummy.payment' (length=27)

It feels like i've forgotten to configure something, but i I'm very certain, this has worked before.
Any hints?

@makasim
Copy link
Contributor Author

makasim commented Jan 5, 2015

This is not enough to configure sylius_payment, since it does not actually process any payments. By default Sylius uses Payum to process payments and you have to configure Payum too:

something like this: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/CoreBundle/Resources/config/app/payum.yml#L1

The payum bundle is here: http://payum.org/doc#PayumBundle

@makasim makasim deleted the payum-012-upgrade branch January 5, 2015 11:45
@madc
Copy link

madc commented Jan 5, 2015

Thanks. I really was convinced, that it had worked before.
Just for future reference the configuration for offline payment:

app/config/config.yml

sylius_payment:
    gateways:
        offline: Offline Payment

payum:
    contexts:
        offline:
            offline: ~

Btw, I think, this should be part of the default sylius config.

@kayue
Copy link
Contributor

kayue commented Jan 5, 2015

@makasim Actually which part of the code is using the following config? Because Sylius has a sylius_payment_method table, I thought it does everything already.

sylius_payment:
    gateways:
        stripe_checkout: Stripe Checkout

@makasim
Copy link
Contributor Author

makasim commented Jan 5, 2015

@kayue I believe it is need for the payment choice form type, that's it.

I am working on ability to configure payments in the backend and when I am ready to adopt it to Sylius I will change these parts.

@kayue
Copy link
Contributor

kayue commented Jan 5, 2015

@makasim Oh for the backend, I see, thanks.

@makasim
Copy link
Contributor Author

makasim commented Jan 5, 2015

Not only for the backend, it is used on the payment checkout step, where you asked to select a payment method.

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

Successfully merging this pull request may close these issues.

None yet

6 participants