/* * This file is part of WPPConnect. * * WPPConnect is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * WPPConnect is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with WPPConnect. If not, see . */ window.WAPI.sendPaymentRequest = async function ( chatId, amount1000, currency, noteMessage ) { var chat = WPP.whatsapp.ChatStore.get(chatId); var tempMsg = Object.create(chat.msgs.filter((msg) => msg.__x_isSentByMe)[0]); var newId = WPP.chat.generateMessageID(chatId); var extend = { ack: 0, id: newId, local: !0, self: 'out', t: parseInt(new Date().getTime() / 1000), to: chatId, isNewMsg: !0, type: 'payment', subtype: 'request', amount1000, requestFrom: chatId, currency, noteMessage, expiryTimestamp: parseInt( new Date(new Date().setDate(new Date().getDate() + 1)).getTime() / 1000 ), }; Object.assign(tempMsg, extend); await WPP.whatsapp.functions.addAndSendMsgToChat(chat, tempMsg); };