'/plugins/bank/withdrawal',
toolsLib.security.verifyBearerTokenExpressMiddleware(['user']),
const { currency, amount, bank_account } = req.body;
const user_id = req.auth.sub.id;
const pendingBurn = await toolsLib.wallet.burnAssetByKitId(
status: false, // status false will make this burn pending
description: 'Bank Withdrawal', // description
transactionId: transaction_id // transaction id
const library = PAYMENT_SERVICE_SDK_LIBRARY; // Payment service sdk
const amount, currency = // withdrawal data from request
// Withdrawal method for payment service sdk
await library.withdrawal(amount, currency, bank_account)
// If the withdrawal was successful
return toolsLib.wallet.updatePendingBurn(
pendingBurn.transaction_id, // transaction_id saved from phase 1
// Optional: Update burn's transaction id to match
// payment service withdrawal's transaction id
updatedTransactionId: data.transaction_id
} else if (data.failed) {
// If the withdrawal failed
return toolsLib.wallet.updatePendingBurn(
pendingBurn.transaction_id, // transaction_id saved from phase 1
// withdrawal request failed
return toolsLib.wallet.updatePendingBurn(
pendingBurn.transaction_id, // transaction_id saved from phase 1