Subversion Repositories SmartDukaan

Rev

Rev 15356 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15356 Rev 15588
Line 124... Line 124...
124
        TestinAgent.setUserInfo(userData.getString("id",""));
124
        TestinAgent.setUserInfo(userData.getString("id",""));
125
        amazonapiSettingsEditor = amazonData.edit();
125
        amazonapiSettingsEditor = amazonData.edit();
126
        flipkartDataEditor = flipkartData.edit();
126
        flipkartDataEditor = flipkartData.edit();
127
        affliateUrl=getArguments().getString("key");
127
        affliateUrl=getArguments().getString("key");
128
        orderDetails =  new OrderTransactionDetails(getActivity());
128
        orderDetails =  new OrderTransactionDetails(getActivity());
129
        Log.d("Order details","Orders");
-
 
130
 
129
 
131
 
130
 
132
      if(isInternetOn()) {
131
      if(isInternetOn()) {
-
 
132
          if(orderDetails.countTotalRecords()>0){
-
 
133
              sendQueuedResponse();
-
 
134
          }
-
 
135
          type1 = userData.getString("type",null);
133
          if(type1!=null && type1.equalsIgnoreCase("google")) {
136
          if(type1!=null && type1.equalsIgnoreCase("google")) {
134
              mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
137
              mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
135
                      .addConnectionCallbacks(this)
138
                      .addConnectionCallbacks(this)
136
                      .addOnConnectionFailedListener(this).addApi(Plus.API)
139
                      .addOnConnectionFailedListener(this).addApi(Plus.API)
137
                      .addScope(Plus.SCOPE_PLUS_LOGIN).build();
140
                      .addScope(Plus.SCOPE_PLUS_LOGIN).build();
Line 219... Line 222...
219
        @Override
222
        @Override
220
        public void onReceivedHttpAuthRequest(WebView view,
223
        public void onReceivedHttpAuthRequest(WebView view,
221
                                              HttpAuthHandler handler, String host, String realm) {
224
                                              HttpAuthHandler handler, String host, String realm) {
222
 
225
 
223
            handler.proceed("dtr", "dtr18Feb2015");
226
            handler.proceed("dtr", "dtr18Feb2015");
224
 
-
 
225
        }
227
        }
226
 
228
 
227
        
-
 
228
        @Override
229
        @Override
229
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
230
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
230
 
231
 
231
            if(url.contains(apiData.getString("wallet.auth","api.profittill.com/special/native/login"))){
232
            if(url.contains(apiData.getString("wallet.auth","api.profittill.com/special/native/login"))){
232
                //Toast.makeText(getActivity(),apiData.getString("wallet.error", "Error while logging in to the wallet. Please log in again"), Toast.LENGTH_SHORT).show();
233
                //Toast.makeText(getActivity(),apiData.getString("wallet.error", "Error while logging in to the wallet. Please log in again"), Toast.LENGTH_SHORT).show();
Line 298... Line 299...
298
        public synchronized  void onPageStarted(final WebView view, String url, Bitmap favicon) {
299
        public synchronized  void onPageStarted(final WebView view, String url, Bitmap favicon) {
299
            super.onPageStarted(view, url, favicon);
300
            super.onPageStarted(view, url, favicon);
300
            final CharSequence[] items = {" Don't show me again "};
301
            final CharSequence[] items = {" Don't show me again "};
301
            final ArrayList seletedItems=new ArrayList();
302
            final ArrayList seletedItems=new ArrayList();
302
                try {
303
                try {
303
/*                    Toast.makeText(getActivity(),"Wifi " + UtilityFunctions.checkWifi(getActivity()),Toast.LENGTH_SHORT).show();*/
-
 
304
                    /*if(Uri.parse(url).getHost().contains("saholic.com")) {*/
-
 
305
                        CookieSyncManager.createInstance(getActivity());
304
                        CookieSyncManager.createInstance(getActivity());
306
                        CookieManager cookieManager = CookieManager.getInstance();
305
                        CookieManager cookieManager = CookieManager.getInstance();
307
                        cookieManager.setCookie(url, "token=" + userData.getString("token", ""));
306
                        cookieManager.setCookie(url, "token=" + userData.getString("token", ""));
308
                        cookieManager.setCookie(url, "walletAuthentication=true");
307
                        cookieManager.setCookie(url, "walletAuthentication=true");
309
                    /*if(Uri.parse(url).getHost().contains("snapdeal") && url.contains("supc")){
-
 
310
                        new SnapdealSUPCCall().execute(url);
-
 
311
                    }*/
-
 
312
                    //}
-
 
313
                    if(url.contains("dl.flipkart.com/dl/")){
308
                    if(url.contains("dl.flipkart.com/dl/")){
314
                        flipkartUrl=url;
309
                        flipkartUrl=url;
315
 
310
 
316
                        if(flipkartData.getInt("showagainflag",0)<3) {
311
                        if(flipkartData.getInt("showagainflag",0)<3) {
317
                            AlertDialog dialog;
312
                            AlertDialog dialog;
Line 1170... Line 1165...
1170
            super.onPostExecute(result);
1165
            super.onPostExecute(result);
1171
        }
1166
        }
1172
    }*/
1167
    }*/
1173
 
1168
 
1174
    class PushRawHTML extends AsyncTask<List<NameValuePair>, Integer, JSONObject> {
1169
    class PushRawHTML extends AsyncTask<List<NameValuePair>, Integer, JSONObject> {
1175
        private StringBuilder sb;
-
 
1176
 
-
 
1177
        private HttpResponse req;
-
 
1178
        private InputStream is;
-
 
1179
 
-
 
1180
        @Override
1170
        @Override
1181
        protected void onPreExecute() {
1171
        protected void onPreExecute() {
1182
            super.onPreExecute();
1172
            super.onPreExecute();
1183
            Log.e("Pre execute", "Pre execute");
-
 
1184
 
-
 
1185
        }
1173
        }
1186
 
1174
 
1187
        @Override
1175
        @Override
1188
        protected JSONObject doInBackground(List<NameValuePair>... orderDetail) {
1176
        protected JSONObject doInBackground(List<NameValuePair>... orderDetail) {
1189
 
1177
 
Line 1195... Line 1183...
1195
                HttpResponse response = httpclient.execute(httppost);
1183
                HttpResponse response = httpclient.execute(httppost);
1196
                HttpEntity entity = response.getEntity();
1184
                HttpEntity entity = response.getEntity();
1197
                int status = response.getStatusLine().getStatusCode();
1185
                int status = response.getStatusLine().getStatusCode();
1198
 
1186
 
1199
                if(status == 200){
1187
                if(status == 200){
1200
                    //System.out.println("ResponseCode of record: "+ status + " is " + status);
-
 
1201
                    NameValuePair y = orderDetail[0].get(2);
1188
                    NameValuePair y = orderDetail[0].get(2);
1202
                    //System.out.println("Value to be deleted is " + " is " + y.getValue());
-
 
1203
                    int z =orderDetails.deleteRecord(y.getName(),new String[]{y.getValue()});
1189
                    int z =orderDetails.deleteRecord(y.getName(),new String[]{y.getValue()});
1204
                    //Log.d("inserting into database","1 " + z);
-
 
1205
                } else {
1190
                } else {
1206
                /*    Log.d("ResponseCode",status+"");
-
 
1207
                    System.out.println(" NOT Transfered");
-
 
1208
                    Log.d("ResponseCode",status+"");*/
-
 
1209
                }
1191
                }
1210
                JSONObject jObjGmail = new JSONObject(EntityUtils.toString(entity));
1192
                JSONObject jObjGmail = new JSONObject(EntityUtils.toString(entity));
1211
                System.out.println(jObjGmail.toString());
-
 
1212
                Log.e("pass 1", "connection success ");
-
 
-
 
1193
 
1213
                return jObjGmail;
1194
                return jObjGmail;
1214
            } catch (Exception e) {
1195
            } catch (Exception e) {
1215
               /* Log.e("Fail 1", e.toString());*/
-
 
1216
                return null;
1196
                return null;
1217
            }
1197
            }
1218
        }
1198
        }
1219
 
1199
 
1220
        @Override
1200
        @Override
Line 1226... Line 1206...
1226
                    amazonapiSettingsEditor.putString("amazonurl",result.getString("url"));
1206
                    amazonapiSettingsEditor.putString("amazonurl",result.getString("url"));
1227
                    amazonapiSettingsEditor.commit();
1207
                    amazonapiSettingsEditor.commit();
1228
                    pushDataInAmazon(orderId);
1208
                    pushDataInAmazon(orderId);
1229
                }
1209
                }
1230
            }catch (Exception e){
1210
            }catch (Exception e){
1231
            }
-
 
1232
 
-
 
1233
 
1211
 
-
 
1212
            }
1234
        }
1213
        }
1235
    }
1214
    }
1236
 
1215
 
1237
    class AmazonOrderTrackingDetails extends AsyncTask<List<NameValuePair>, Integer, JSONObject> {
1216
    class AmazonOrderTrackingDetails extends AsyncTask<List<NameValuePair>, Integer, JSONObject> {
1238
        private StringBuilder sb;
-
 
1239
 
-
 
1240
        private HttpResponse req;
-
 
1241
        private InputStream is;
-
 
1242
 
-
 
1243
        @Override
1217
        @Override
1244
        protected void onPreExecute() {
1218
        protected void onPreExecute() {
1245
            super.onPreExecute();
1219
            super.onPreExecute();
1246
            Log.e("Pre execute", "AmazonOrderTrackingDetails");
-
 
1247
        }
1220
        }
1248
 
1221
 
1249
        @Override
1222
        @Override
1250
        protected JSONObject doInBackground(List<NameValuePair>... arg0) {
1223
        protected JSONObject doInBackground(List<NameValuePair>... arg0) {
1251
            Log.e("Pre execute", "AmazonOrderTrackingDetails");
-
 
1252
            try {
1224
            try {
1253
                HttpClient httpclient = new DefaultHttpClient();
1225
                HttpClient httpclient = new DefaultHttpClient();
1254
                HttpPost httppost = new HttpPost(apiData.getString("orderpagehtml.push.api",null));
1226
                HttpPost httppost = new HttpPost(apiData.getString("orderpagehtml.push.api",null));
1255
                httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
1227
                httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
1256
                httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
1228
                httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
Line 1857... Line 1829...
1857
                startActivity(new Intent(getActivity(), LoginActivity.class));
1829
                startActivity(new Intent(getActivity(), LoginActivity.class));
1858
            }
1830
            }
1859
        },3000);
1831
        },3000);
1860
 
1832
 
1861
    }
1833
    }
-
 
1834
 
-
 
1835
    public void sendQueuedResponse(){
-
 
1836
 
-
 
1837
        List<List<NameValuePair>> postDataNameValuePair =  new ArrayList<List<NameValuePair>>();
-
 
1838
        postDataNameValuePair=orderDetails.readData1();
-
 
1839
        for(List<NameValuePair> orderDetail : postDataNameValuePair) {
-
 
1840
            orderDetail.add(new BasicNameValuePair("zip", "1"));
-
 
1841
            orderDetail.add(new BasicNameValuePair("wifi",UtilityFunctions.checkWifi(getActivity())+""));
-
 
1842
            orderDetail.add(new BasicNameValuePair("imeinumber",UtilityFunctions.getImeiNumber(getActivity())));
-
 
1843
            orderDetail.add(new BasicNameValuePair("appversion",UtilityFunctions.getAppVersion(getActivity())));
-
 
1844
            PushRawHTML pm =new  PushRawHTML();
-
 
1845
            pm.execute(orderDetail);
-
 
1846
        }
-
 
1847
    }
1862
}
1848
}
1863
 
1849
 
1864
 
1850
 
1865
//https://www.amazon.in/ap/forgotpassword?suppressSignInRadioButtons=0&openid.pape.max_auth_age=0&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&prevRID=1JZA0HFF0Z954AGQ0HX2&pageId=anywhere_in&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&siteState=IMBMsgs.&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.assoc_handle=anywhere_in&showRmrMe=1&openid.return_to=https%3A%2F%2Fwww.amazon.in%2Fgp%2Fcheckoutportal%2Fenter-checkout.html%3Fie%3DUTF8%26asin%3DB00GX9XFRM%26buyNow%3D1%26cartCustomerID%3DA36HI1A7IGU0T1%26fromSignIn%3D1%26offeringID%3DJh6%25252F3Ub%25252BpthAXjVfYxwB75kQiqEGByG9y2mMF1g%25252BhlBjgWsDLnX4sroH6dhJsVS9lMBaR%25252FW2m%25252FhYIqNkUAKNs97nPaxfPIbRsqftx5EseYCQWzJ45%25252F%25252BU3bW8p6PLoKGRkCg7s50jNROGKZHzSy3aBXT5iLQ1ALRG%26registryID%3D%26registryItemID%3D%26sessionID%3D276-7977280-3606555
1851
//https://www.amazon.in/ap/forgotpassword?suppressSignInRadioButtons=0&openid.pape.max_auth_age=0&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&prevRID=1JZA0HFF0Z954AGQ0HX2&pageId=anywhere_in&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&siteState=IMBMsgs.&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.assoc_handle=anywhere_in&showRmrMe=1&openid.return_to=https%3A%2F%2Fwww.amazon.in%2Fgp%2Fcheckoutportal%2Fenter-checkout.html%3Fie%3DUTF8%26asin%3DB00GX9XFRM%26buyNow%3D1%26cartCustomerID%3DA36HI1A7IGU0T1%26fromSignIn%3D1%26offeringID%3DJh6%25252F3Ub%25252BpthAXjVfYxwB75kQiqEGByG9y2mMF1g%25252BhlBjgWsDLnX4sroH6dhJsVS9lMBaR%25252FW2m%25252FhYIqNkUAKNs97nPaxfPIbRsqftx5EseYCQWzJ45%25252F%25252BU3bW8p6PLoKGRkCg7s50jNROGKZHzSy3aBXT5iLQ1ALRG%26registryID%3D%26registryItemID%3D%26sessionID%3D276-7977280-3606555
1866
 
1852