Giter Site home page Giter Site logo

studybuffalo / django-helcim Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 5.0 6.02 MB

A Django-based integration with the Helcim Commerce API

License: GNU General Public License v3.0

Python 89.32% HTML 8.33% JavaScript 2.17% Shell 0.19%
django django-oscar helcim

django-helcim's Introduction

Study Buffalo

Codecov code coverage License

The website and applications of the Study Buffalo.

What You Will Find

Hello, we are the Study Buffalo! We are excited to see you taking an interest in our project. This area is specifically the web hosting side of our projects. This website is currently created with the Django framework.

Licensing

We strive to keep our projects accessible to all. Everything here is open source under the GNU Public License version 3. We are always open to discussing other licensing options, so please contact us if this is an issue for you.

Contact Us

You can always get a hold of us at [email protected], [email protected], or through GitHub itself.

Setting Up Development Environment

  1. Install Python 3.8:
  1. Install PostgreSQL (version 9.4 or higher is required). You will need to create an admin account to create the required databases. You may use whatever interface you wish to run SQL commands; the following instructions assume you are using a commandline interace tool, such as psql.
  1. Once PostgreSQL is installed you will need to create a database and user for Django. The following provides a minimal setup with some sane defaults (you may update the database_name, user, and password sections to whatever you prefer):

    CREATE DATABASE database_name;
    CREATE USER user WITH PASSWORD 'password';
    ALTER ROLE user SET client_encoding TO 'utf8';
    ALTER ROLE user SET default_transaction_isolation TO 'read committed';
    ALTER ROLE user SET timezone TO 'UTC';
    GRANT ALL PRIVILEGES ON DATABASE database_name TO user;
    ALTER USER user CREATEDB;
    ALTER DATABASE database_name OWNER TO user;
    
  2. Install pipenv via command line:

    $ pip install pipenv
    
  3. Clone the github repository (https://github.com/studybuffalo/studybuffalo.git)

  4. In the /config/settings directory of the repo copy the .study_buffalo.env file and rename it study_buffalo.env

  5. If needed, update the variables in the study_buffalo.env file to use your database credentials and any secret keys/API details.

  6. In the root directory of the repository, run the Makefile install command to setup Django.

    You may setup the environment with no database content with the following command:

    $ make --file=Makefile install-development-fresh
    

    You may setup the environment with fixture content with the following command:

    $ make --file=Makefile install-development-fixtures
    
  7. You should now be able to run the Django development server. You can test this with the following command, which will generate output similar to below:

    $ pipenv run python manage.py runserver 127.0.0.1:8000
    
    > Performing system checks...
    > System check identified no issues (0 silenced).
    > Django version #.#.#, using settings 'config.settings.development'
    > Starting development server at http://127.0.0.1:8000/
    > Quit the server with CTRL-BREAK.
    
  8. If fixture data was loaded, the following user accounts will be available:

    DO NOT use these accounts in a production environment.

Running development server

To start the development server:

$ pipenv run python manage.py runserver 127.0.0.1:8000

Running Tests

To run tests:

$ pipenv run pytest

To generate coverage report:

# XML Report
$ pipenv run pytest --cov study_buffalo --cov-report xml

# HTML Report
$ pipenv run pytest --cov study_buffalo --cov-report html

Running Linters

To run linting:

# Run Pylint
$ pipenv run pylint study_buffalo/ config/

# Run Pycodestyle
$ pipenv run pycodestyle study_buffalo/ config/

Documentation Style

Docstrings are documented using the reStructuredText format. Details of this style can be found here: https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html

django-helcim's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar qsaiqkhxsa avatar robotbuffalo avatar studybuffalo avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

django-helcim's Issues

Add tests for the Sandbox site

To ensure the sandbox site keeps up with package updates it would be helpful to have tests to cover the main functionality.

Improve templates

Templates are currently very minimal. Considerations

  • Improve UI and accessibility
  • Look at easy way to integrate with sites base template
  • Add easy navigation from detail/delete views back to main view
  • Consider adding small dashboard

Standardize Helcim response time zone

Helcim API responses appear to use PST/PDT in date/time fields. Try and standardize this to the database timezone settings.

Could add a default setting to specify this and allow users to update it should the timezone be user-location specific.

Dependabot can't evaluate your Python dependency files

Dependabot can't evaluate your Python dependency files.

As a result, Dependabot couldn't check whether any of your dependencies are out-of-date.

The error Dependabot encountered was:

Illformed requirement ["==3.8.2pytest-cov==2.6.0"]

You can mention @dependabot in the comments below to contact the Dependabot team.

Contributing Documentation Missing config.env Details

Sandbox site requires the addition of a config.env file in the root directory of the sandbox. Documentation does not make reference to this anywhere and you will get an error trying to run the sandbox without it. Will need to update the docs to include this detail as well as adding a template of the .env file to streamline the process.

Response field not in FROM_API_FIELDS: csrfmiddlewaretoken

I am trying to integrate Helcim Payment Method in django, i have written all the logic to make the payment, when i open up the page page, fill in my cards detail and amount to be paid and hit the submit button, it shows processing then refresh the page, then in the terminal i got this error that says Response field not in FROM_API_FIELDS: csrfmiddlewaretoken.

I know this error is related to a csrf issue, i have added csrf_token to my form and even added csrf_exempt to the View but the error keeps showing up, i would really appreciate it if i can get some guide on what to look for or do concerning this issue.

This is the view to process the payment


@method_decorator(csrf_exempt, name='dispatch')
class HelcimJSPaymentView(HelcimJSMixin, FormView):
    form_class = HelcimjsPaymentForm
    success_url = 'example:complete'
    template_name = 'core/example_app/helcimjs_payment_details.html'

    def get_success_url(self, **kwargs): # pylint: disable=arguments-differ
        """Returns the success URL."""
        return reverse_lazy(self.success_url, kwargs=kwargs)

    def post(self, request, *args, **kwargs):
        """Handles remaining processing after Helcim.js processing."""
        response = HelcimJSResponse(
            response=request.POST, save_token=True, django_user=request.user
        )

        if response.is_valid():
            # NOTE: the type of transaction made by Helcim.js is determined by
            # the Helcim.js configuration. You will need to decide on the
            # proper "record" method to use for your situation.
            transaction, token = response.record_purchase()

            # NOTE: you generally wouldn't want to transmit these
            # details as query parameters; this is just done to
            # simplify this sandbox example
            url = '{}?transaction_type={}&transaction={}&token={}'.format(
                self.get_success_url(),
                'helcimjs',
                transaction.id,
                token.id,
            )
            return HttpResponseRedirect(url)

        # Invalid form submission/payment - render payment details again
        # TODO: add some basic initial data to the form
        form = self.get_form()

        return self.form_invalid(form)

ImportError: cannot import name 'url' from 'django.conf.urls'

I have Django 4.2.1 installed. In the urls.py inside the helcim folder, the ImportError: cannot import name 'url' from 'django.conf.urls occurs because django.conf.urls.url() has been deprecated and removed in version 4 of Django. To solve this import error, I used the re_path() method instead which is from django.urls.re_path()

Unpin Django-Oscar Version

Django Oscar currently making use of a pre-release version of django-haystack. Do not want to enable pre-releases in this fashion given potential for untested bugs. Will pin to django-oscar 2.0.z for now and will unpin when this dependency is no longer an issue.

helcim.com offline

For about a day I have watched https://www.helcim.com and secure.myhelcim.com are offline. I havent seen any news about the company/service falling over/shutting down, but then the news is a bit preoccupied atm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.