Git Product home page Git Product logo

django-oscar-zarinpal-gateway's Introduction

django-oscar-zarrinpal-gateway v0.12
Payment gateway integration for Zarinpal Payments in django-oscar.

Zarinpal Payments is a large payment gateway based in The I.R. Iran .

Installation

Install via pip:

pip install django-oscar-zarinpal-gateway==0.12

Configuration

Configure the application in settings.py:

ZARRIN_USE_SANDBOX (optional)

app use sandbox for payment by default, for disable set this to False.

ZARRIN_MERCHANT_ID

zarrin pal merchand id . If you do not enter a valid value, you will encounter the problem of non-approval . Also, if you do not use the sandbox, you will receive an error if you do not enter this value

ZARRIN_ERROR_MSG_UNSECESSFUL_PAGE (optional)

this message showed when unexpected error happen before redirect to zarrinpal gateway.

ZARRIN_INFO_TEXT (optional)

the amount you enter here will be displayed to the user when paying in ZarrinPal, You can also pass a function to this variable, This feature is for you to be able to generate values ​​dynamically. Your function will receive two values :‌ request & order_number .

consider the following example :

def my_dynamic_value(request, order_number):
    return f"{order_number} is my dynamic value but i do not need to request. But maybe someone needs it."

ZARRIN_INFO_TEXT = my_dynamic_value 

The following values ​​are for after payment messages :

ZARRIN_402_PAYMENT_MSG (optional)

unsucessfull payment in zarrin pal message .

ZARRIN_410_PAYMENT_MSG (optional)

process cancelled in zarrin pal message .

ZARRIN_422_PAYMENT_MSG (optional)

This message is displayed when payment is made correctly but the user's shopping cart is not approved . It is one of the error modes that Django Oscar raises . You can read Django Oscar's document for more information .

ZARRIN_500_PAYMENT_MSG (optional)

Do not worry . In this case, the user's shopping cart becomes unpaid. Django Oscar used an interesting phrase in his document : hopefully, you will only ever see this in development...

in settings.py:

comment 'oscar.apps.checkout.apps.CheckoutConfig', and add 'django_oscar_zarinpal_gateway.checkout.apps.ZarrinCheckoutConfig'

INSTALLED_APPS = [
    ...,

    # 'oscar.apps.checkout.apps.CheckoutConfig',
    django_oscar_zarinpal_gateway.checkout.apps.ZarrinCheckoutConfig'
    ...,
]

add OSCAR_PAYMENT_METHODS in settings.py:

OSCAR_PAYMENT_METHODS = (
    ('django_oscar_zarinpal_gateway', ('Django Zarrin Pal')),
)

run following command :

python manage.py makemigrations checkout
python manage.py migrate

important points -------------

  • To use the package, your basket must have its own currency set to IRR.
  • if all the activity of your store is related to Iran, you can set the variable OSCAR_DEFAULT_CURRENCY to IRR, You can read Django Oscar's document for more information .

Thanks for the inspirations of other packages written, especially https://github.com/udox/oscar-sagepay . If you find a bug or have a question, you can contact me via the link below [email protected].

django-oscar-zarinpal-gateway's People

Contributors

mojtabaakbari221b avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.