Skip to content

Dynamic payment modifier valid option updates#600

Open
racitup wants to merge 3 commits into
awesto:masterfrom
racitup:dyn_pay_modifiers
Open

Dynamic payment modifier valid option updates#600
racitup wants to merge 3 commits into
awesto:masterfrom
racitup:dyn_pay_modifiers

Conversation

@racitup

@racitup racitup commented Jun 19, 2017

Copy link
Copy Markdown
Collaborator

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

jrief commented Jun 19, 2017

Copy link
Copy Markdown
Member

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

@racitup

racitup commented Jun 20, 2017

Copy link
Copy Markdown
Collaborator Author

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

@racitup

racitup commented Jun 20, 2017

Copy link
Copy Markdown
Collaborator Author

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

racitup commented Aug 23, 2017

Copy link
Copy Markdown
Collaborator Author

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

racitup commented Aug 23, 2017

Copy link
Copy Markdown
Collaborator Author

Now also rebased on 0.11.dev0 here

@jrief

jrief commented Aug 24, 2017

Copy link
Copy Markdown
Member

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.

2 participants