Skip to content

Commit

Permalink
fix: Fixed getNumberProfile function (fix #717)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Dec 9, 2021
1 parent 4f4a46e commit 89a0720
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/api/layers/retriever.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ export class RetrieverLayer extends SenderLayer {

/**
* Checks if a number is a valid whatsapp number
*
* Deprecated in favor of checkNumberStatus
* @deprecated Deprecated in favor of checkNumberStatus
* @category Contact
* @param contactId, you need to include the @c.us at the end.
* @returns contact detial as promise
Expand Down
11 changes: 8 additions & 3 deletions src/lib/wapi/functions/get-number-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@

export async function getNumberProfile(id, done) {
try {
const result = await window.Store.WapQuery.queryExist(id);
if (result.jid === undefined) throw 404;
const data = window.WAPI._serializeNumberStatusObj(result);
const result = await WPP.contact.queryExists(id).catch(() => null);
if (!result || result.wid === undefined) throw 404;

const data = window.WAPI._serializeNumberStatusObj({
jid: result.wid,
status: 200,
isBusiness: result.biz,
});
if (data.status == 200) data.numberExists = true;
if (done !== undefined) {
done(window.WAPI._serializeNumberStatusObj(result));
Expand Down

0 comments on commit 89a0720

Please sign in to comment.