Skip to content

Commit

Permalink
Purchases: Add JSDoc for cancel related methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo authored and scruffian committed Nov 27, 2015
1 parent aa50d3f commit 949f522
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions client/lib/purchases/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ function hasPrivateRegistration( purchase ) {
return purchase.hasPrivateRegistration;
}

/**
* Checks if a purchase can be cancelled.
* Returns true for purchases that aren't expired
* Also returns true for purchases whether or not they are after the refund period.
* Purchases included with a plan can't be cancelled.
*
* @param {Object} purchase
* @return {boolean}
*/
function isCancelable( purchase ) {
if ( isIncludedWithPlan( purchase ) ) {
return false;
Expand Down Expand Up @@ -101,10 +110,27 @@ function isRedeemable( purchase ) {
return purchase.isRedeemable;
}

/**
* Checks if a purchase can be canceled and refunded.
* Purchases usually can be refunded up to 30 days after purchase.
* Domains and domain mappings can be refunded up to 48 hours.
* Purchases included with plan can't be refunded.
*
* @param {Object} purchase
* @return {boolean}
*/
function isRefundable( purchase ) {
return purchase.isRefundable;
}

/**
* Checks if an expired purchase can be removed from a user account.
* Only domains and domain mappings can be removed.
* Purchases included with plan can't be removed.
*
* @param {Object} purchase
* @return {boolean}
*/
function isRemovable( purchase ) {
if ( isIncludedWithPlan( purchase ) ) {
return false;
Expand Down

0 comments on commit 949f522

Please sign in to comment.