Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
websuggest-django
websuggest-django
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 25
    • Issues 25
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 4
    • Merge Requests 4
  • Requirements
    • Requirements
    • List
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • websuggest
  • websuggest-djangowebsuggest-django
  • Issues
  • #48

Closed
Open
Opened Jun 30, 2019 by Francis Potter@francispotterMaintainer21 of 34 tasks completed21/34 tasks

Charging and paying people repeatedly

The current version of charges.py will charge and pay people a cumulative amount each month, rather than just the amount required for that month.

It seems that some of the charging/payment logic needs to be stored somewhere and managed more rigorously. What's the MVC for that?

Transactions

Includes both charges and payments. There is one transaction per profile per month. It records the total amount charged, paid, or owed to/from that individual. The AdClicks are linked to the Transactions so it's possible to trace the activity. There is a job (run nightly) to update the Transactions for the current month.

  • Month (is the first of the month that the payment applies)
  • Date (date the actual payment is executed)
  • Status (was it executed?)
  • Type (charge or payment) - could later be expanded to e.g. refund
  • Profile - the person being paid or charged
  • Create advertisement_amount
  • Create website_amount
  • Amounts should default to zero
  • Add a transaction_type of CURRENT for the current month
  • Remove the PAY-IN and PAY-OUT transaction types
  • Make website payments negative
  • Calculate a total amount dynamically from the two above
  • Handle other kinds of transactions such as refunds
  • Merge transaction_type with status

Showing current amounts to user

  • Show the user their current month advertisement charge total
  • Show the user their current month website payment total
  • Give the user the ability to view a time series chart of their advertisement clicks by ad
  • Give the user the ability to view a time series chart of their website clicks by website

Changes to AdClicks

  • advertisement_charge_transaction
  • website_payment_transaction

Transaction Update job

Meant to be run nightly, it updates the Transactions for the current month with the newest AdClicks. Note that if a profile has both ads and web sites, both are included in the same transaction.

  • Create new Transactions
  • Update a Transaction if it already exists
  • Enter amount charged
  • Enter amount paid
  • Limit to the current month
  • Double-check that Transactions whose time/status has passed don't update
  • View the results of recent job runs
  • Automatically run the job nightly
  • Incorporate a commission

Execute transactions job

  • Test for expected API responses with the test API token (e.g. HTTP 200)
  • Test for the balances of the different users with the test API token
  • Go through all the transactions with status NEW and find out which ones have negative and positive net_amount
  • If it has a negative net_amount, run on the 1st of the month
  • If it has a positive net_amount, run in the middle of the month to give time for the charge payments to execute (that way we don't lose money)

Transaction verification job

A job to confirm that the transactions agree with the adclicks for a given month

Edited Sep 23, 2019 by Jeremy Potter
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Release
Milestone
Release
Assign milestone
Time tracking
None
Due date
None
Reference: websuggest/websuggest-django#48