Skip to content

Commit 949f522

Browse files
gzioloscruffian
authored andcommitted
Purchases: Add JSDoc for cancel related methods.
1 parent aa50d3f commit 949f522

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

client/lib/purchases/index.js

+26
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ function hasPrivateRegistration( purchase ) {
5656
return purchase.hasPrivateRegistration;
5757
}
5858

59+
/**
60+
* Checks if a purchase can be cancelled.
61+
* Returns true for purchases that aren't expired
62+
* Also returns true for purchases whether or not they are after the refund period.
63+
* Purchases included with a plan can't be cancelled.
64+
*
65+
* @param {Object} purchase
66+
* @return {boolean}
67+
*/
5968
function isCancelable( purchase ) {
6069
if ( isIncludedWithPlan( purchase ) ) {
6170
return false;
@@ -101,10 +110,27 @@ function isRedeemable( purchase ) {
101110
return purchase.isRedeemable;
102111
}
103112

113+
/**
114+
* Checks if a purchase can be canceled and refunded.
115+
* Purchases usually can be refunded up to 30 days after purchase.
116+
* Domains and domain mappings can be refunded up to 48 hours.
117+
* Purchases included with plan can't be refunded.
118+
*
119+
* @param {Object} purchase
120+
* @return {boolean}
121+
*/
104122
function isRefundable( purchase ) {
105123
return purchase.isRefundable;
106124
}
107125

126+
/**
127+
* Checks if an expired purchase can be removed from a user account.
128+
* Only domains and domain mappings can be removed.
129+
* Purchases included with plan can't be removed.
130+
*
131+
* @param {Object} purchase
132+
* @return {boolean}
133+
*/
108134
function isRemovable( purchase ) {
109135
if ( isIncludedWithPlan( purchase ) ) {
110136
return false;

0 commit comments

Comments
 (0)