Cobalt Chemical Symbol Cobalt Dollar Symbol

Supporting the Payments Application#

Internal Operation#

This section describes the internal workings of this application and is intended to help you if you need to support the code.

Payments Diagram

There are three broad categories of functions: Member (relating to members), Organisation (relating to Organisations) and Admin (for administrators).

Internal - Member#

  • payments.core.auto_topup_member() - processes an auto top up for a member.

  • payments.views.setup_autotopup() - view for a user to sign up for auto top up.

  • payments.core.get_balance() - get member’s balance.

  • payments.core.get_balance_detail() - get details of member’s balance.

  • payments.core.update_account() - registers transaction against member account.

  • payments.core.update_organisation() - registers transaction against an organisations account.

  • payments.views.update_auto_amount() - Ajax call to update member top up amount.

  • payments.views.member_transfer() - transfer money to another member.

  • payments.views.statement() - show member’s statement.

  • payments.views.statement_csv() - show member’s statement as CSV.

  • payments.views.statement_common() - common code across all statements.

  • payments.views.manual_topup() - manually add to account.

  • payments.views.cancel_auto_top_up() - turn off Auto Top Up.

  • payments.views.stripe_webpage_confirm() - called by the webpage when Stripe has notified the user of successful one off payment. We do not trust the client, but update the status in case of Stripe problems. Usually the webhook will have been called before this gets called so it will do nothing.

  • payments.views.stripe_autotopup_confirm() - called by the webpage when Stripe has notified the user of successful card registration. We do not trust the client, but update the status in case of Stripe problems. Usually the webhook will have been called before this gets called so it will do nothing.

  • payments.views.stripe_autotopup_off() - called by the webpage just before registering new card details. Required to track status.

Internal - Organisations#

  • payments.views.statement_org() - shows an organisation’s statement.

  • payments.views.statement_csv_org() - downloads an organisation’s statement.

  • payments.views.statement_org_summary_ajax() - called by the web page when the summary date range changes to update the summary amounts.

Internal - Admin#

  • payments.views.statement_admin_summary() - main page for admins.

  • payments.views.statement_admin_view() - wrapper for viewing member statements by admins. Accepts member_id as paramter.

  • payments.views.settlement() - view to make settlements to clubs

  • payments.views.manual_adjust_member() - adjust member balance

  • payments.views.manual_adjust_org() - adjust org balance

Stripe#

The Stripe functions interact with the Stripe payments platform to perform external activities.

  • payments.core.stripe_manual_payment_intent() - informs Stripe that a member may be going to make a manual payment.

  • payments.core.stripe_auto_payment_intent() - informs Stripe that a member may be going to register a credit card.

  • payments.views.stripe_create_customer() - creates a new customer in Stripe and records the customer number against the member.

  • payments.core.stripe_webhook() - this is the method for Stripe to contact us. Can be for a number reasons. Calls one of the next two functions.

  • payments.core.stripe_webhook_manual() - handles one off transactions.

  • payments.core.stripe_webhook_autosetup() - handles auto top up set up.

API#

These functions allow the other applications in Cobalt to interact with Payments.

  • payments.core.payment_api() - main entry point to make a payment happen.

  • payments.core.callback_router() - this is the exit point from payments to return information when an asynchronous event has happened, such as payment being made.