Skip to content

Commit

Permalink
feat(api): add get single subscription method
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Nov 13, 2022
1 parent 3d882d8 commit 552d513
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/paddle/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,33 @@ module.exports = class {
}))
}

/**
*
* @param {Object} subscription the target subscription object
* @param {Number} perPage limit the response to a certain number of results
*/
async getSubscription({ subscription_id }) {
const form = {
vendor_id: this._vendorId,
vendor_auth_code: this._authCode,
subscription_id
}

return this._returnResponseIf200(this._got(PATH_LIST_USERS, {
form
}))
.catch((e) => {
if (e.message.includes('119')) {
form.state = 'deleted'
return this._returnResponseIf200(this._got(PATH_LIST_USERS, {
form
}))
} else {
throw e
}
})
}

/**
*
* @param {String} plan return only specific plan info
Expand Down

0 comments on commit 552d513

Please sign in to comment.