Skip to content

Commit 73da231

Browse files
committed
update promoter.rst
1 parent 29639ae commit 73da231

File tree

1 file changed

+125
-4
lines changed

1 file changed

+125
-4
lines changed

docs/promoter.rst

Lines changed: 125 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Promoter Logic
22
==============
33

44

5-
1. Promoter Creation
5+
Promoter Creation
66
--------------------
77

88
A promoter is created by associating a `User` with a referral token and referral link. Promoters are responsible for sending out referral links, tracking referrals, and earning commissions.
@@ -37,7 +37,26 @@ Example response:
3737
"commissionRate": 15.0
3838
}
3939
40-
2. Setting the Payout Method
40+
41+
Get Referral Link
42+
-----------------------------
43+
Promoters can retrieve their unique referral link, which they can share with others to invite referrals.
44+
45+
.. code-block:: bash
46+
47+
GET http://localhost:8000/referrals/get-referral-link
48+
Accept: application/json
49+
Authorization: Bearer your_token
50+
51+
Example response:
52+
53+
.. code-block:: json
54+
55+
{
56+
"referralLink": "http://localhost:8000/?ref=6B86B273FF"
57+
}
58+
59+
Set the Payout Method
4160
-----------------------------
4261

4362
Promoters can set their preferred payout method using the following API action:
@@ -81,7 +100,7 @@ Example response:
81100
82101
The promoter’s payout method is used when processing their earnings.
83102

84-
3. Tracking Referrals and Earnings
103+
Tracking Referrals and Earnings
85104
-----------------------------------
86105

87106
Once a promoter is created, they can start sharing their referral link. The system tracks clicks on the referral link and the earnings generated from those referrals. Promoters can retrieve their recent earnings and view a breakdown of their performance over the last 7 days.
@@ -131,7 +150,7 @@ Example response:
131150
132151
The response contains a list of the last 7 days, with each day showing the corresponding earnings value. Even if no earnings occurred on a particular day, it is still represented with a value of `0`. The earnings are grouped by the day of the week when they were created.
133152

134-
4. Incrementing Link Clicks
153+
Incrementing Link Clicks
135154
----------------------------
136155

137156
Every time a referral link is clicked, the system can increment the count of link clicks for the promoter. This can be done via the following API action:
@@ -153,4 +172,106 @@ Example response:
153172
154173
{
155174
"message": "Link clicked count incremented successfully"
175+
}
176+
177+
178+
179+
List of Referrals
180+
----------------------------
181+
182+
Promoters can retrieve a list of referrals they have invited.
183+
184+
.. code-block:: bash
185+
186+
GET http://localhost:8000/referrals/
187+
Accept: application/json
188+
Authorization: Bearer your_token
189+
190+
Example response:
191+
192+
.. code-block:: json
193+
194+
{
195+
"count": 1,
196+
"pages": 1,
197+
"results": [
198+
{
199+
"userId": 2,
200+
"email": "[email protected]",
201+
"status": "signup",
202+
"invitationMethod": "email",
203+
"commissionRate": "15.00",
204+
"commissionAmount": 0,
205+
"commissionStatus": null
206+
}
207+
]
208+
}
209+
210+
211+
Promoter Payment History
212+
----------------------------
213+
214+
Promoters can retrieve a history of their payouts, including details such as the payout amount and the date it was processed.
215+
216+
.. code-block:: bash
217+
218+
GET http://localhost:8000/referrals/payouts
219+
Accept: application/json
220+
Authorization: Bearer your_token
221+
222+
Example response:
223+
224+
.. code-block:: json
225+
226+
[
227+
{
228+
"id": 1,
229+
"created": "2024-08-30T10:00:00Z",
230+
"amount": 100
231+
},
232+
{
233+
"id": 2,
234+
"created": "2024-08-25T15:30:00Z",
235+
"amount": 50
236+
}
237+
]
238+
239+
This endpoint returns a list of payouts made to the authenticated promoter. Each payout includes the payout ID, the date and time when the payout was created, and the payout amount.
240+
241+
Set Minimum Withdrawal Balance
242+
---------------------------------
243+
244+
Promoters can set a custom minimum withdrawal balance. This balance determines the minimum amount the promoter needs to accumulate before they can request a payout.
245+
246+
.. code-block:: bash
247+
248+
PATCH http://localhost:8000/referrals/set-min-withdrawal-balance/
249+
Content-Type: application/json
250+
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzI1NzkwMTc2LCJpYXQiOjE3MjU3ODkyNzYsImp0aSI6ImJiMDFhMTJhNTZhODQyODNhMjJjYzg0NzIwZDFiMGVlIiwidXNlcl9pZCI6MX0.MqYcy-UTPeQY6Dy4gIMA3LMBOVHJihsHoeUpJSqNb1w
251+
252+
{
253+
"min_withdrawal_balance": 50.00
254+
}
255+
256+
Example response:
257+
258+
.. code-block:: json
259+
260+
{
261+
"id": 2,
262+
"user": 1,
263+
"referralToken": "6B86B273FF",
264+
"referralLink": "http://localhost:8000/?ref=6B86B273FF",
265+
"activePayoutMethod": {
266+
"method": "wise",
267+
"paymentAddress": "[email protected]"
268+
},
269+
"currentBalance": 0,
270+
"totalEarned": 0,
271+
"totalPaid": 0,
272+
"created": "2024-08-24T12:12:03.374694Z",
273+
"updated": "2024-09-08T09:54:46.883465Z",
274+
"linkClicked": 1,
275+
"minWithdrawalBalance": "50.00",
276+
"commissionRate": 15.0
156277
}

0 commit comments

Comments
 (0)