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

Dynamic payment modifier valid option updates #600

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

racitup
Copy link
Collaborator

@racitup racitup commented Jun 19, 2017

Payment modifier is_disabled() changes will be reflected in radio options being disabled dynamically.
This has specifically been developed to allow changes in shipping modifier to dynamically affect the available payment modifiers and is a solution to issue #592 -

Shipping modifier:

    def add_extra_cart_row(self, cart, request):
        cart.total_incomplete = False
        # if not added and others available
        if not self.is_active(cart, request) and len(cart_modifiers_pool.get_shipping_modifiers()) > 1:
            return
        ...
        cart.total_incomplete = True

Payment modifier:

    def is_disabled(self, cart):
        "if shipping cost is unknown, disable"
        disable = (cart.total == 0) or getattr(cart, 'total_incomplete')
        return disable

@jrief
Copy link
Member

jrief commented Jun 19, 2017

Please be patient on this pull request.
I have to check on its side-effects.

@racitup
Copy link
Collaborator Author

racitup commented Jun 20, 2017

I've noticed the "Purchase" button no longer works on my implementation, but seems to work on the example..

@racitup
Copy link
Collaborator Author

racitup commented Jun 20, 2017

The "Purchase" button is now working on my project too. I noticed some differences in the settings between my project and the example project. It could have been that or something else that fixed it. Possibly the addition of the fontawesome iconfont?

@racitup
Copy link
Collaborator Author

racitup commented Aug 23, 2017

This requires some changes to work properly, for example it is possible to select a payment option radio button, change the conditions so that the radio button gets disabled yet the form still validates successfully. Ideally form validation would fail forcing the user to select a valid payment option.
I'm not sure how to fix that..

@racitup
Copy link
Collaborator Author

racitup commented Aug 23, 2017

Now also rebased on 0.11.dev0 here

@jrief
Copy link
Member

jrief commented Aug 24, 2017

Feel free to remind me. There was too much stuff awaiting for 0.11

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

2 participants