Giter Site home page Giter Site logo

django-pain's Introduction

django-pain's People

Contributors

stinovlas avatar

Stargazers

Sammy Mwangangi avatar  avatar

Watchers

Vlastimil Zíma avatar James Cloos avatar  avatar  avatar

Forkers

sammymwangangi

django-pain's Issues

New command process_payments

django-admin process_payments [--from isodatetime --to isodatetime]

Command process_payments will take all payments in state IMPORTED (with optional date limitation). For each payment, it calls one or more payment processors, until one of them succeeds or all processors return negative answer. If any payment processor returns True, payment will be marked as PROCESSED. Otherwise, payment will be marked as DEFERRED (new payment state).

Every processor is a Python class, that MUST implement following methods:

  • process_payment(BankPayment) -> bool
    • This method will return True if payment is recognized and processed by the processor. Otherwise, this method returns False.

Generate UUID for payments

Add field uuid of type UUIDField to BankPayment model in order to generate nice unique identifier for each payment. Values will be generated by uuid.uuid4() function.

This identifier will be used by payment processors in communication with various systems to prevent data mismatch in case of broken connection or other unexpected events.

Manually assigning the purpose of payment

Add new web interface for choosing purpose of payment. Any payment in state imported or deferred can be manually assigned its purpose. Each payment processor has to advertise the required items for manual assignment.

  • Add field processor to BankPayment model. Fill this field when payment is processed.
  • Add field objective to BankPayment model. This field will be filled with value returned by payment processor for each individual payment.
  • Each payment processor must return iterable of tuples instead of iterable of booleans. In tuple, there will be processing result followed by objective:
    (True, 'Registrar payment')
  • Add django.admin interface to handle payments and allow manual assigning the purpose.
    • Add new field client_id to edit form. This field will be used to manually assign the payment, but it won't be saved into database.
  • Each payment processor must implement new method assign_payment(self, payment: BankPayment, client_id: str) -> Tuple[bool, str]. This method will be used to manually assign payment using client_id.
  • Remove view PaymentListView.
  • Add new field default_objective to each payment processor to advertize human readable payment processor description.

Change process_payments to allow bulk processing

Processing payments now takes one payment at a time and feeds it to the processor. However, in some cases (such as communication through REST API) sending payments in bulk is much more efficient. We should extend the interface to allow bulk processing.

Proposed implementation

  • Add new method process_payments(self, payments: Iterable[BankPayment]) -> Iterable[bool] to processors.common.AbstractPaymentProcessor.
  • Drop old method process_payment(self, payment: BankPayment) -> bool from processors.common.AbstractPaymentProcessor.
  • Update management.commands.process_paymentsappropriately.

This change breaks backwards compatibility and minor version should be bumped up.

Add changelog

Add CHANGELOG.rst with changelog informations for all existing versions.

Add payment processor for FRED backend

Add new payment processor (see #12) for FRED backend. Communication with FRED backend will be done through CORBA interface. Method process_payment will be implemented as follows:

  • processor asks backend whether it recognizes the variable symbol
    • if no, processor returns False
    • if yes, processor saves invoice details and continue
  • processor asks backend to create invoice; in return, it will recieve total amount of credits that should be added to registrar account
  • processor asks backend to add designated amount of credits to registrar account in appropriate zone

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.