Subversion Repositories SmartDukaan

Rev

Rev 32854 | Rev 33025 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32854 Rev 32874
Line 187... Line 187...
187
    }
187
    }
188
 
188
 
189
    @Override
189
    @Override
190
    public void sendWhatsappMessage(String message, String title, String mobile)
190
    public void sendWhatsappMessage(String message, String title, String mobile)
191
            throws Exception {
191
            throws Exception {
-
 
192
        if (isProd) {
192
        this.sendWhatsappMessage(WhatsappMessageType.TEXT, message, title, mobile, null, null);
193
            this.sendWhatsappMessage(WhatsappMessageType.TEXT, message, title, mobile, null, null);
-
 
194
        }
193
    }
195
    }
194
 
196
 
195
    @Override
197
    @Override
196
    public void sendWhatsappMediaMessage(String message, String mobile, String mediaUrl, String fileName, WhatsappMessageType whatsappMessageType)
198
    public void sendWhatsappMediaMessage(String message, String mobile, String mediaUrl, String fileName, WhatsappMessageType whatsappMessageType)
197
            throws Exception {
199
            throws Exception {
-
 
200
        if(isProd) {
198
        this.sendWhatsappMessage(whatsappMessageType, message, null, mobile, mediaUrl, fileName);
201
            this.sendWhatsappMessage(whatsappMessageType, message, null, mobile, mediaUrl, fileName);
-
 
202
        }
199
 
203
 
200
    }
204
    }
201
 
205
 
202
    @Override
206
    @Override
203
    public void optIn(String phoneNumber) throws Exception {
207
    public void optIn(String phoneNumber) throws Exception {
Line 264... Line 268...
264
        LOGGER.info("response  - {}", response);
268
        LOGGER.info("response  - {}", response);
265
 
269
 
266
        JSONObject jsonObject = new JSONObject(response);
270
        JSONObject jsonObject = new JSONObject(response);
267
 
271
 
268
        JSONObject whatsappResponse = (JSONObject) jsonObject.get("response");
272
        JSONObject whatsappResponse = (JSONObject) jsonObject.get("response");
269
        if(whatsappResponse.getString("status").equals("error")) {
273
        if (whatsappResponse.getString("status").equals("error")) {
270
            LOGGER.error("Invalid Whatsapp message, Reason - {}",whatsappResponse.getString("details"));
274
            LOGGER.error("Invalid Whatsapp message, Reason - {}", whatsappResponse.getString("details"));
271
            return;
275
            return;
272
        }
276
        }
273
        String externalId = whatsappResponse.getString("id");
277
        String externalId = whatsappResponse.getString("id");
274
        String phone = whatsappResponse.getString("phone");
278
        String phone = whatsappResponse.getString("phone");
275
 
279