Skip to content

Commit 3caadd7

Browse files
authored
Merge pull request #11 from thepeerstack/update-methods
Update methods
2 parents 7f748a7 + 43f1c93 commit 3caadd7

File tree

2 files changed

+7
-52
lines changed

2 files changed

+7
-52
lines changed

README.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,10 @@ let user = thepeer.indexUser("Thor Odin", "thor", "thor@odin.com");
2222
- signature (object)
2323
- `returns`: boolean
2424

25-
* getSendReceipt
25+
* authorizeCharge
2626
- `accepts`:
27-
- receipt_id (string)
28-
- `returns`: object
29-
30-
* processSendReceipt
31-
- `accepts`:
32-
- receipt_id (string)
33-
- event (string)
34-
- `returns`: object
27+
- charge_id (string)
28+
- `returns`: boolean
3529

3630
* indexUser
3731
- `accepts`:
@@ -61,12 +55,6 @@ let user = thepeer.indexUser("Thor Odin", "thor", "thor@odin.com");
6155
- lind_id (string)
6256
- amount (integer)
6357
- `returns`: object
64-
65-
* authorizeDirectCharge
66-
- `accepts`:
67-
- reference (string)
68-
- event (string)
69-
- `returns`: object
7058

7159
## Extra
7260

lib/Thepeer.js

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class ThePeer {
121121
/**
122122
* A function that charges your user's linked account at any time
123123
* @param {string} linkid - The id of the link
124-
* @param {integer} amount - amount in kobo
124+
* @param {int} amount - amount in kobo
125125
* @param {string} remark - The reason for initiating a direct charge
126126
* @returns {JSON} A JSON response containing the details of the user
127127
* @memberof ThePeer
@@ -140,15 +140,15 @@ class ThePeer {
140140
}
141141

142142
/**
143-
* Authorize direct charge request via webhooks
143+
* Authorize charge request via webhooks
144144
* @param {*} reference - The direct charge reference sent via webhook
145145
* @param {string} event - Event type (success, insufficient_funds)
146146
* @returns {JSON} A JSON response containing the details of the user
147147
* @memberof ThePeer
148148
*/
149-
async authorizeDirectCharge (reference, event) {
149+
async authorizeCharge (reference, event) {
150150
try {
151-
const response = await this.request.post(`/debit/${reference}`, {
151+
const response = await this.request.post(`/authorization/${reference}`, {
152152
event: event
153153
})
154154

@@ -157,39 +157,6 @@ class ThePeer {
157157
Helper.processError(e)
158158
}
159159
}
160-
161-
/**
162-
* @memberof ThePeer
163-
* @param {string} receipt - The reference returned to your receiptURL via the Chain SDK
164-
* @param {string} event - Event type (success, insufficient_funds)
165-
* @returns {JSON} A JSON response containing the details of the user
166-
*/
167-
async processSendReceipt (receipt, event) {
168-
try {
169-
const response = await this.request.post(`/send/${receipt}`, {
170-
event: event
171-
})
172-
173-
return response.data
174-
} catch (e) {
175-
Helper.processError(e)
176-
}
177-
}
178-
179-
/**
180-
* @memberof ThePeer
181-
* @param {string} receipt - The reference returned to your receiptURL via the Chain SDK
182-
* @returns {JSON} A JSON response containing the details of the user
183-
*/
184-
async getSendReceipt (receipt) {
185-
try {
186-
const response = await this.request.get(`/send/${receipt}`)
187-
188-
return response.data
189-
} catch (e) {
190-
Helper.processError(e)
191-
}
192-
}
193160
}
194161

195162
module.exports = ThePeer

0 commit comments

Comments
 (0)