Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
django-oscar-api-checkout
Advanced tools
An extension on top of django-oscar-api providing a more flexible checkout API with a pluggable payment methods interface.
| |build| |coverage| |license| |kit| |format|
An extension on top of django-oscar-api providing a more flexible checkout API with a pluggable payment methods interface.
.. |build| image:: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/badges/master/pipeline.svg :target: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/commits/master .. |coverage| image:: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/badges/master/coverage.svg :target: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/commits/master .. |license| image:: https://img.shields.io/pypi/l/django-oscar-api-checkout.svg :target: https://pypi.python.org/pypi/django-oscar-api-checkout .. |kit| image:: https://badge.fury.io/py/django-oscar-api-checkout.svg :target: https://pypi.python.org/pypi/django-oscar-api-checkout .. |format| image:: https://img.shields.io/pypi/format/django-oscar-api-checkout.svg :target: https://pypi.python.org/pypi/django-oscar-api-checkout
django-oscar-cybersource <https://gitlab.com/thelabnyc/django-oscar/django-oscar-cybersource>
_: Provides order payment using Cybersource Secure Acceptance Silent Order POST for PCI SAQ A-EP compliant credit card processing.django-oscar-wfrs <https://gitlab.com/thelabnyc/django-oscar/django-oscar-wfrs>
_: Provides order payment using financing via the Wells Fargo Retail Services SOAP API.Install django-oscar-api
using the documentation <https://django-oscar-api.readthedocs.io/en/latest/#installation>
_.
Install the django-oscar-api-checkout
package.::
$ pip install django-oscar-api-checkout
Add oscarapicheckout
to your INSTALLED_APPS
::
... INSTALLED_APPS = [ ... 'oscarapicheckout', ] + get_core_apps([]) ...
Configure Oscar's order status pipeline.::
...
ORDER_STATUS_PENDING = 'Pending' ORDER_STATUS_PAYMENT_DECLINED = 'Payment Declined' ORDER_STATUS_AUTHORIZED = 'Authorized'
ORDER_STATUS_SHIPPED = 'Shipped' ORDER_STATUS_CANCELED = 'Canceled'
OSCAR_INITIAL_ORDER_STATUS = ORDER_STATUS_PENDING OSCARAPI_INITIAL_ORDER_STATUS = ORDER_STATUS_PENDING OSCAR_ORDER_STATUS_PIPELINE = { ORDER_STATUS_PENDING: (ORDER_STATUS_PAYMENT_DECLINED, ORDER_STATUS_AUTHORIZED, ORDER_STATUS_CANCELED), ORDER_STATUS_PAYMENT_DECLINED: (ORDER_STATUS_AUTHORIZED, ORDER_STATUS_CANCELED), ORDER_STATUS_AUTHORIZED: (ORDER_STATUS_SHIPPED, ORDER_STATUS_CANCELED), ORDER_STATUS_SHIPPED: (), ORDER_STATUS_CANCELED: (), }
OSCAR_INITIAL_LINE_STATUS = ORDER_STATUS_PENDING OSCAR_LINE_STATUS_PIPELINE = { ORDER_STATUS_PENDING: (ORDER_STATUS_SHIPPED, ORDER_STATUS_CANCELED), ORDER_STATUS_SHIPPED: (), ORDER_STATUS_CANCELED: (), }
Configure what payment methods are enabled and who can use them.::
... API_ENABLED_PAYMENT_METHODS = [ { 'method': 'oscarapicheckout.methods.Cash', 'permission': 'oscarapicheckout.permissions.StaffOnly', }, { 'method': 'some.other.methods.CreditCard', 'permission': 'oscarapicheckout.permissions.Public', }, ]
Add oscarapicheckout
to your root URL configuration directly before oscarapi.::
... from django.apps import apps from oscarapi.app import application as oscar_api from oscarapicheckout.app import application as oscar_api_checkout
urlpatterns = patterns('', ... url(r'^api/', include(apps.get_app_config("oscarapicheckout").urls[0])), # Must be before oscar_api.urls url(r'^api/', include(oscar_api.urls)), ... )
These are the basic steps to add an item to the basket and checkout using the API.
Add an item to the basket.::
POST /api/basket/add-product/
{ "url": "/api/products/1/", "quantity": 1 }
List the payment methods available to the current user.::
GET /api/checkout/payment-methods/
Submit the order, specifying which payment method(s) to use.::
POST /api/checkout/
{ "guest_email": "joe@example.com", "basket": "/api/baskets/1/", "shipping_address": { "first_name": "Joe", "last_name": "Schmoe", "line1": "234 5th Ave", "line4": "Manhattan", "postcode": "10001", "state": "NY", "country": "/api/countries/US/", "phone_number": "+1 (717) 467-1111", }, "billing_address": { "first_name": "Joe", "last_name": "Schmoe", "line1": "234 5th Ave", "line4": "Manhattan", "postcode": "10001", "state": "NY", "country": "/api/countries/US/", "phone_number": "+1 (717) 467-1111", }, "payment": { "cash": { "enabled": true, "amount": "10.00", }, "creditcard": { "enabled": true, "pay_balance": true, } } }
Check the status of each enabled payment option.::
GET /api/checkout/payment-states/
FAQs
An extension on top of django-oscar-api providing a more flexible checkout API with a pluggable payment methods interface.
We found that django-oscar-api-checkout demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.