Coder Social home page Coder Social logo

dhfinance / dhf-pay-python Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 8.0 64 KB

Python SDK to integrate with DHFinance in minutes

Home Page: https://dhfi.io/

License: Apache License 2.0

Python 100.00%
python-sdk cspr casper blockchain payment-gateway

dhf-pay-python's Introduction

DHF-SDK

Python SDK to integrate with DHFinance in minutes.

Getting Started

  1. Sign up - Before you begin, you need to sign up for your payment gateway account (https://pay.dhfi.online as example) and retrieve your store API token (add Store - APIKey Generate) and API_URL (https://pay.dhfi.online/api as example).
  2. Requirements โ€“ To run the SDK, your system will need to have Python >= 3.7.
  3. Install

Local build:

python setup.py install --user

From PyPi:

pip install dhf-sdk

Usage

from dhf_wrapper.client import TransactionClient, PaymentClient
from dhf_wrapper.entities.transaction import TransactionParamsDTO
from dhf_wrapper.entities.payment import PaymentDTO

transaction_client = TransactionClient('http://example.com', token='xxxxx')

#Get transactions list
transactions = transaction_client.get_transactions(
    params=TransactionParamsDTO(limit=1)
)

payment_client = PaymentClient('http://example.com', token='xxxxx')

#Get payments list
payments = payment_client.get_payments()

#Get payments by id
payment = payment_client.get_payment(payment_id=1)

#Add new payment
new_payment = payment_client.create_payment(payment=PaymentDTO(
    amount=2500000000,
    comment="test",
))

Note: amount should be in motes, for example 1 cspr = 1000000000 in motes

Run tests

To run unit tests:

nosetests --verbosity=2 tests/unit

To run integration tests set up environment variables:

TOKEN - Store API key.
API_BASE_URL - Base URL.

And then call for tests:

nosetests --verbosity=2 tests/integration

dhf-pay-python's People

Contributors

andarg avatar enflow-io avatar tqhuy2018 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.