Code Monkey home page Code Monkey logo

pyvdp's Introduction

PyVDP: VISA APIs. Wrapped in Python.

https://travis-ci.org/ppokrovsky/pyvdp.svg?branch=master https://api.codacy.com/project/badge/Grade/5a119e1aafb9480c87736df4d0ab2a24
  • Easy calls to VDP APIs, implemented through functions, named to reflect structure of actual VDP APIs..
  • Errors are handled as standard exceptions with meaningful messages.
  • OO-interface, data objects are simple Python classes.
  • Can be used with any web framework.
  • Includes demo Django application, demonstrating basic principles.
  • Full support for following APIs:
    • Payment Methods:
      • VisaDirect
    • Data and Analytics:
      • Merchant Search
      • Merchant Locator
      • Visa Global ATM Locator
      • Merchant Measurement
      • Payment Account Attibutes Inquiry
      • Foreign Exchange Rates
      • Digital Card and Account Services
    • Risk and Fraud
      • Mobile Location Confirmation
      • Payment Account Validation
$ pip install pyvdp

See Configuration section in documentation.

Here's an example snippet for Payment Account Validation call:

from pyvdp.visadirect import CardAcceptorModel
from pyvdp.pav import cardvalidation, CardValidationModel

ca_address_kwargs = {
    "city": "fostr city",
    "country": "PAKISTAN",
    "county": "CA",
    "state": "CA",
    "zipCode": "94404"
}

ca_kwargs = {
    "address": CardAcceptorModel.CardAcceptorAddress(**ca_address_kwargs),
    "idCode": "111111",
    "name": "rohan",
    "terminalId": "123"
}

avr_kwargs = {
    "postalCode": "T4B 3G5",
    "street": "2881 Main Street Sw"
}

data_kwargs = {
    "addressVerificationResults": CardValidationModel.AddressVerificationResults(**avr_kwargs),
    "cardAcceptor": CardAcceptorModel(**ca_kwargs),
    "cardCvv2Value": "672",
    "cardExpiryDate": "2018-06",
    "primaryAccountNumber": "4957030000313108",
    "retrievalReferenceNumber": "015221743720",
    "systemsTraceAuditNumber": "743720"
}

data = CardValidationModel(**data_kwargs)
result = cardvalidation.send(data)
print(result)

The implementation is straightforward:

  1. Build a data object;
  2. Submit this object to send() function of the corresponding module.

Under the hood, data object will be serialized to JSON and submitted to corresponding API endpoint. If returning HTTP code equals 200, response will contain a JSON string with headers and payload, otherwise an exception will be raised depending on returned HTTP code value.

A thorough documentation is located at <www.pyvdp.org>.

Please use the issue tracker to ask questions.

Copyright &copy; 2017 Pavel Pokrovskiy.

MIT licensed.

pyvdp's People

Contributors

ppokrovsky avatar

Watchers

James Cloos avatar Bob Mwenda avatar

Forkers

ralic

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.