(client, token, filters = {}, tokenCodeResult = null)
| 2576 | } |
| 2577 | |
| 2578 | async function resolveLuckmailVerificationMail(client, token, filters = {}, tokenCodeResult = null) { |
| 2579 | const tokenCode = tokenCodeResult ? normalizeLuckmailTokenCode(tokenCodeResult) : null; |
| 2580 | if (tokenCode?.mail) { |
| 2581 | const tokenMail = tokenCode.verification_code && !tokenCode.mail.verification_code |
| 2582 | ? { |
| 2583 | ...tokenCode.mail, |
| 2584 | verification_code: tokenCode.verification_code, |
| 2585 | } |
| 2586 | : tokenCode.mail; |
| 2587 | const inlineMatch = pickLuckmailVerificationMail([tokenMail], filters); |
| 2588 | if (inlineMatch) { |
| 2589 | return inlineMatch; |
| 2590 | } |
| 2591 | } |
| 2592 | |
| 2593 | const mailList = await client.user.getTokenMails(token); |
| 2594 | let match = pickLuckmailVerificationMail(mailList.mails, filters); |
| 2595 | if (match?.mail?.message_id && !match.mail.verification_code) { |
| 2596 | const detail = await client.user.getTokenMailDetail(token, match.mail.message_id); |
| 2597 | match = pickLuckmailVerificationMail([detail], filters); |
| 2598 | } |
| 2599 | return match || null; |
| 2600 | } |
| 2601 | |
| 2602 | async function pollLuckmailVerificationCode(step, state, pollPayload = {}) { |
| 2603 | const purchase = getCurrentLuckmailPurchase(state); |
no test coverage detected