diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index 4ec27a8c..11914f76 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -672,7 +672,10 @@ async function upsertWallet ( if (!me) throw new GqlAuthenticationError() assertApiKeyNotPermitted({ me }) - if (testCreateInvoice && !priorityOnly && canReceive) { + const { id, ...walletData } = data + const { autoWithdrawThreshold, autoWithdrawMaxFeePercent, enabled, priority } = settings + + if (testCreateInvoice && !priorityOnly && canReceive && enabled) { try { await testCreateInvoice(data) } catch (err) { @@ -685,15 +688,6 @@ async function upsertWallet ( } } - const { id, ...walletData } = data - const { - autoWithdrawThreshold, - autoWithdrawMaxFeePercent, - autoWithdrawMaxFeeTotal, - enabled, - priority - } = settings - return await models.$transaction(async (tx) => { if (canReceive) { await tx.user.update({