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

Allow altering config values based on request #14

Merged
merged 7 commits into from Jul 8, 2015

Conversation

maiksprenger
Copy link
Member

The goal of this PR is to allow altering Adyen config values based on the request. That is needed to e.g. switch the identifier if a shop serves different domains.
I couldn't help myself and cleaned up a bit along the way.

This PR does mean interface changes for the Scaffold. Given that suspect this extension gets close to no outside users, I have not made any arrangements for backwards-compatibility. The changes should be easy to implement anyway and are documented.

I accidentally based my PR against master. I'm not sure if it makes much of a difference.

We will need to be able to alter settings based on e.g. the request, so
as a first step, I'm introducing a layer between Django settings and the
Adyen code.

We introduce the concept of a config class, that can be set from the
Django settings. It defaults to a supplied config class that just
fetches the needed values from the Django settings as before. But now we
have the possibility of switiching out the config class to fetch those
values from elsewhere.
This commit adds a few basic tests to check things work as expected.
The idea is that we want to change certain configuration values based on
the request. To get this working, we need to change the interface for
the config class to pass the request to most of it's methods.

To get the request object, we need to also alter the facade's and
scaffold's interface to more often include the request.

For this commit, I had a look at how data gets passed from e.g. Oscaro
to the scaffold. Unfortunately I discovered an anti-pattern, where a lot
of required data is passed in via an undocumented order_data dictionary.

That needs to be cleaned up separately.
This commit improves upon the situation by making the dictionary
explicitly required.
get_form_fields concatenated the form fields together to produce some
HTML. Arguably, that's out of scope for a payment gateway. Furthermore,
it's not currently used.

Hence, I removed it and renamed the more useful get_form_fields_list.

This allows dropping a requirement.
@maiksprenger
Copy link
Member Author

I pushed two commits to incorporate your feedback. Will rebase into semantic commits at the end.

@aaugustin
Copy link

Looks good, thanks.

This was feedback given in the review.
In the feedback round, we spotted that the tests could be improved.
maiksprenger added a commit that referenced this pull request Jul 8, 2015
Allow altering config values based on request
@maiksprenger maiksprenger merged commit f2c7ccc into master Jul 8, 2015
@maiksprenger maiksprenger deleted the feature/variable-config branch July 8, 2015 15:35
@maiksprenger
Copy link
Member Author

Thanks for the interesting discussion!

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