MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / isLuckmailPurchaseReusable

Function isLuckmailPurchaseReusable

luckmail-utils.js:313–337  ·  view source on GitHub ↗
(purchase, options = {})

Source from the content-addressed store, hash-verified

311 }
312
313 function isLuckmailPurchaseReusable(purchase, options = {}) {
314 const normalizedPurchase = normalizeLuckmailPurchase(purchase);
315 const usedPurchases = normalizeLuckmailUsedPurchases(options.usedPurchases);
316 const purchaseId = normalizeLuckmailPurchaseId(normalizedPurchase.id);
317
318 if (!isLuckmailPurchaseForProject(normalizedPurchase, options.projectCode || DEFAULT_LUCKMAIL_PROJECT_CODE)) {
319 return false;
320 }
321 if (!normalizedPurchase.email_address || !normalizedPurchase.token) {
322 return false;
323 }
324 if (isLuckmailPurchaseDisabled(normalizedPurchase)) {
325 return false;
326 }
327 if (purchaseId && usedPurchases[purchaseId]) {
328 return false;
329 }
330 if (isLuckmailPurchasePreserved(normalizedPurchase, options)) {
331 return false;
332 }
333 if (isLuckmailPurchaseExpired(normalizedPurchase, options.now || Date.now())) {
334 return false;
335 }
336 return true;
337 }
338
339 function filterReusableLuckmailPurchases(purchases, options = {}) {
340 const list = Array.isArray(purchases)

Callers 2

Tested by

no test coverage detected