@descix/platform-api 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descix/platform-api",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "Shared platform infrastructure: Firestore models, auth/session, permissions, entitlements, email",
5
5
  "repository": {
6
6
  "type": "git",
@@ -177,70 +177,6 @@ export async function sendVerificationEmail(toEmail, code, expiryMinutes = 15) {
177
177
  await sendEmail(toEmail, subject, body);
178
178
  }
179
179
 
180
- /**
181
- * Send payment pending notification with deposit instructions.
182
- *
183
- * @param {Object} quote - The payment quote object
184
- * @param {string} quote.quote_id - Unique quote identifier
185
- * @param {string} quote.deposit_address - Deposit address
186
- * @param {string} quote.amount_formatted - Formatted amount (e.g., "0.5 ETH")
187
- * @param {string} quote.usd_amount_formatted - Formatted USD amount (e.g., "$10.00")
188
- * @param {string} quote.chain_name - Chain name (e.g., "Polygon")
189
- * @param {string} quote.expires_at - ISO timestamp when quote expires
190
- * @param {string} recipientEmail - Recipient email address
191
- * @returns {Promise<void>}
192
- */
193
- export async function sendPaymentPending(quote, recipientEmail) {
194
- const utils = getCloudConfig();
195
- const subject = `Payment Instructions - ${quote.usd_amount_formatted || `$${quote.usd_amount}`} via ${quote.chain_name || quote.chain}`;
196
-
197
- const expiryDate = new Date(quote.expires_at);
198
- const expiryStr = expiryDate.toLocaleString();
199
-
200
- const body = `Hello,
201
-
202
- You've initiated a crypto payment on DeSciX. Please complete your payment using the instructions below:
203
-
204
- ═══════════════════════════════════════════════
205
- PAYMENT DETAILS
206
- ═══════════════════════════════════════════════
207
-
208
- Quote ID: ${quote.quote_id}
209
- Amount: ${quote.amount_formatted}
210
- USD Value: ${quote.usd_amount_formatted || `$${quote.usd_amount}`}
211
- Chain: ${quote.chain_name || quote.chain?.toUpperCase()}
212
-
213
- DEPOSIT ADDRESS:
214
- ${quote.deposit_address}
215
-
216
- ⚠️ IMPORTANT: Send exactly ${quote.amount_formatted} to the address above.
217
- Sending the wrong amount may result in processing issues.
218
-
219
- Expires: ${expiryStr}
220
-
221
- ═══════════════════════════════════════════════
222
-
223
- Once your payment is confirmed on the blockchain, we'll send you a confirmation email.
224
-
225
- If you did not initiate this payment, please ignore this email.
226
-
227
- — The DeSciX Team
228
- `;
229
-
230
- // Send to user
231
- await sendEmail(recipientEmail, subject, body);
232
-
233
- // CC admin group if configured
234
- const adminGroup = utils.DESCIX_ADMIN_GROUP;
235
- if (adminGroup) {
236
- try {
237
- await sendEmail(adminGroup, `[ADMIN CC] ${subject}`, `Payment pending for: ${recipientEmail}\n\n${body}`);
238
- } catch (error) {
239
- console.warn(`Failed to send admin CC email: ${error.message}`);
240
- }
241
- }
242
- }
243
-
244
180
  /**
245
181
  * Render the receipt for a queued airdrop-wallet migration (the `pending_migrations` lane).
246
182
  *
@@ -305,74 +241,3 @@ export async function sendMigrationQueued(migration, recipientEmail) {
305
241
  await sendEmail(recipientEmail, subject, body);
306
242
  }
307
243
 
308
- /**
309
- * Send payment confirmation notification.
310
- *
311
- * @param {Object} quote - The fulfilled quote object
312
- * @param {string} quote.quote_id - Unique quote identifier
313
- * @param {string} quote.usd_amount - USD amount
314
- * @param {string} quote.chain - Chain identifier
315
- * @param {string} quote.payment_tx_hash - Transaction hash
316
- * @param {Object} fulfillment - Fulfillment details
317
- * @param {string} fulfillment.type - Fulfillment type (usdcx_credit or token_mint)
318
- * @param {number} [fulfillment.usdcx_credited] - USDCX amount credited
319
- * @param {number} [fulfillment.tokens_minted] - Tokens minted
320
- * @param {string} [fulfillment.token_symbol] - Token symbol
321
- * @param {string} recipientEmail - Recipient email address
322
- * @returns {Promise<void>}
323
- */
324
- export async function sendPaymentConfirmation(quote, fulfillment, recipientEmail) {
325
- const utils = getCloudConfig();
326
- const usdAmountFormatted = quote.usd_amount_formatted || `$${quote.usd_amount}`;
327
- const chainName = quote.chain_name || quote.chain?.toUpperCase();
328
-
329
- let subject, creditsText;
330
-
331
- if (fulfillment.type === 'usdcx_credit') {
332
- subject = `Payment Confirmed - ${usdAmountFormatted} USDCX Credited`;
333
- creditsText = `USDCX Credited: ${fulfillment.usdcx_credited?.toFixed(2) || quote.usd_amount}`;
334
- } else if (fulfillment.type === 'token_mint') {
335
- subject = `Payment Confirmed - ${fulfillment.tokens_minted} ${fulfillment.token_symbol} Tokens`;
336
- creditsText = `Tokens Received: ${fulfillment.tokens_minted} ${fulfillment.token_symbol}`;
337
- } else {
338
- subject = `Payment Confirmed - ${usdAmountFormatted}`;
339
- creditsText = `Amount: ${usdAmountFormatted}`;
340
- }
341
-
342
- const body = `Hello,
343
-
344
- Your crypto payment has been confirmed!
345
-
346
- ═══════════════════════════════════════════════
347
- PAYMENT CONFIRMATION
348
- ═══════════════════════════════════════════════
349
-
350
- Quote ID: ${quote.quote_id}
351
- Status: CONFIRMED
352
- Chain: ${chainName}
353
- ${creditsText}
354
-
355
- ${quote.payment_tx_hash ? `Transaction: ${quote.payment_tx_hash}` : ''}
356
-
357
- ═══════════════════════════════════════════════
358
-
359
- Your account has been updated with the purchased credits/tokens.
360
-
361
- Thank you for using DeSciX!
362
-
363
- — The DeSciX Team
364
- `;
365
-
366
- // Send to user
367
- await sendEmail(recipientEmail, subject, body);
368
-
369
- // CC admin group if configured
370
- const adminGroup = utils.DESCIX_ADMIN_GROUP;
371
- if (adminGroup) {
372
- try {
373
- await sendEmail(adminGroup, `[ADMIN CC] ${subject}`, `Payment confirmed for: ${recipientEmail}\n\n${body}`);
374
- } catch (error) {
375
- console.warn(`Failed to send admin CC email: ${error.message}`);
376
- }
377
- }
378
- }
package/src/index.js CHANGED
@@ -46,8 +46,6 @@ export {
46
46
  export {
47
47
  sendEmail,
48
48
  sendVerificationEmail,
49
- sendPaymentPending,
50
- sendPaymentConfirmation,
51
49
  renderMigrationQueuedEmail,
52
50
  sendMigrationQueued,
53
51
  normalizeEmail,