Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/source/data_types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
=====================
Data Types module
=====================

This holds Pydantic models used to validate helper data structures before
passing them to Paystack API requests.

BulkChargeItem
---------------

.. py:class:: BulkChargeItem

Bases: BaseModel

Represents a single bulk charge item for payment processing.

.. py:attribute:: authorization

The authorization code for the payment method. Must be a non-empty
string after stripping whitespace.

.. py:attribute:: amount

The charge amount in the smallest currency unit. Must be greater than
0.

.. py:attribute:: reference

A unique reference identifier for this charge. Must be a non-empty
string after stripping whitespace.

BulkChargeListObject
---------------------

.. py:class:: BulkChargeListObject

Bases: BaseModel

Container for a list of bulk charge items with validation.

.. py:attribute:: charges

A list of validated :class:`BulkChargeItem` objects. Each item must
contain exactly ``authorization``, ``amount``, and ``reference`` keys.

.. py:property:: use_as_list

Convert the validated charges to a list of dictionaries for API use.

**USAGE**

.. code-block:: python

>>> from paystackease import BulkChargeListObject

>>> bulk_charges = BulkChargeListObject(
... charges=[
... {
... "authorization": "AUTH_12345",
... "amount": 1000,
... "reference": "REF_001",
... }
... ]
... )
>>> bulk_charges.use_as_list
[{'authorization': 'AUTH_12345', 'amount': 1000, 'reference': 'REF_001'}]
1 change: 1 addition & 0 deletions docs/source/paystackease.helpers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ This contains the functionality to ease the pain of knowing what values to use.
:maxdepth: 1

convert
data_types
toolkit

Loading