How to pass the same value as Cash On Delivery to PayOnline in android -


i have 2 radio group button (cash on delivery , payonline) when click cash on delivery passes related data of cart , customer detalis, when click payonline passes activity ask fill amount...?? using atom payment gateway library

here code

    activitypayment.java     package com.www.prashant;      import android.app.progressdialog;     import android.content.intent;     import android.os.asynctask;     import android.os.bundle;     import android.support.annotation.nullable;     import android.support.v4.app.fragment;     import android.util.log;     import android.view.layoutinflater;     import android.view.menuitem;     import android.view.view;     import android.view.viewgroup;     import android.widget.*;      import com.atom.mobilepaymentsdk.payactivity;      import org.ksoap2.soapenvelope;     import org.ksoap2.serialization.soapobject;     import org.ksoap2.serialization.soapserializationenvelope;     import org.ksoap2.transport.httptransportse;     import org.xmlpull.v1.xmlpullparserexception;     import java.io.ioexception;       /**      * created dev on 10/1/2015.      */      public class activitypaymentoption extends fragment{          private radiogroup radiopaymentgroup;         private radiobutton radiocod,radioon;         private button placeorder;         private textview textview;         view view;         progressdialog pdialog;         progressdialog pdialog;         string getcustomerdataresult;         string getcustomerdataresult2;         string getcustomerdataresult3;         string getcustomerdataresult4;          @override         public void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);              ((mainactivity)getactivity()).getsupportactionbar().setdisplayhomeasupenabled(true);             ((mainactivity)getactivity()).actionbardrawertoggle.setdrawerindicatorenabled(false);             constants.lastdetails = true;             sethasoptionsmenu(true);         }           @override         public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) {              view v = inflater.inflate(r.layout.payment_option, container, false);             //set navigation mode statndard             ((mainactivity)getactivity()).getsupportactionbar().setnavigationmode(((mainactivity) getactivity()).getsupportactionbar().navigation_mode_standard);             view = v;              radiopaymentgroup = (radiogroup) v.findviewbyid(r.id.radiopaymentmethod);              placeorder = (button) v.findviewbyid(r.id.buttonplaceorder);             radiocod = (radiobutton) v.findviewbyid(r.id.radiocod);             radioon = (radiobutton) v.findviewbyid(r.id.radioon);             //textview = (textview) v.findviewbyid(r.id.textshipping);              placeorder.setonclicklistener(new view.onclicklistener() {                 @override                 public void onclick(view v) {                      // selected radio button radiogroup                     int selectedid = radiopaymentgroup.getcheckedradiobuttonid();                      // find radiobutton returned id                     if(selectedid == radiocod.getid()) {                         radiocod = (radiobutton) view.findviewbyid(selectedid);                         toast.maketext(getactivity(), radiocod.gettext(), toast.length_short).show();                         new getdatatask().execute();                     } else if(selectedid == radioon.getid()) {                         radioon = (radiobutton) view.findviewbyid(selectedid);                         toast.maketext(getactivity(), radioon.gettext(), toast.length_short).show();                         intent newpayintent = new intent(getactivity(), mpsactivity.class);                         startactivity(newpayintent);                          }                 }             });              return v;         }         @override         public boolean onoptionsitemselected(menuitem item) {             int id = item.getitemid();             if (id == android.r.id.home) {                 ((mainactivity)getactivity()).getsupportactionbar().setdisplayhomeasupenabled(true);                 ((mainactivity)getactivity()).actionbardrawertoggle.setdrawerindicatorenabled(true);     //            productslistfragment productslistfragment=new productslistfragment();     //            getactivity().getsupportfragmentmanager().begintransaction().replace(r.id.main_content, productslistfragment, null).addtobackstack(null).commit();     //            getactivity().settitle(constants.category_name.get(constants.position - 1));                 mainactivity.getinstance().callfragment(constants.position);             }             return true;         }              public class getdatatask extends asynctask<void, void, void> {              @override             protected void onpreexecute() {                 super.onpreexecute();                 if (pdialog==null){                     pdialog=new progressdialog(getactivity());                     pdialog.setmessage("loading...");                     pdialog.setcanceledontouchoutside(getretaininstance());                     pdialog.setcancelable(false);                     pdialog.show();                 }             }              @override             protected void doinbackground(void... arg0) {                 // todo auto-generated method stub                 // parse json data server in background                 shoppingcartshippingmethod();                  return null;             }              @override             protected void onpostexecute(void result) {                 // todo auto-generated method stub                  if (pdialog.isshowing()){                     pdialog.dismiss();                     pdialog=null;                 }                 //textview.settext(getcustomerdataresult3);                 //toast.maketext(getactivity(),"result1:=> "+ getcustomerdataresult2, toast.length_short).show();                 //toast.maketext(getactivity(),"result: "+ getcustomerdataresult4, toast.length_short).show();                 if (getcustomerdataresult4!=null){                        toast.maketext(getactivity(), "order placed", toast.length_long).show();                  }                 else                      constants.orderno = integer.parseint(getcustomerdataresult4);                 orderconfirmation orderconfirmation=new orderconfirmation();                 getactivity().getsupportfragmentmanager().begintransaction().replace(r.id.main_content,orderconfirmation,null).addtobackstack(null).commit();                 getactivity().settitle("order");             }         }          // method set shopping cart shipping method         public void shoppingcartshippingmethod(){              try {                 // add paramaters , values                 soapobject request = new soapobject(constants.namespace, "shoppingcartshippingmethod");                 request.addproperty("sessionid", constants.sessionid);                 request.addproperty("quoteid", constants.cartid);                 request.addproperty("method", "flatrate_flatrate");                  soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11);                 envelope.dotnet = true;                 envelope.setoutputsoapobject(request);                  //web method call                 httptransportse androidhttptransport = new httptransportse(constants.url);                 androidhttptransport.debug = true;                 androidhttptransport.call("", envelope);                 //get response                 string result = string.valueof(envelope.getresponse());                 getcustomerdataresult2 = result.tostring();      //            // call shopping cart payment method                 if(getcustomerdataresult2.equals("true")){                     shoppingcartpaymentmethod();                 }                 else {                     getcustomerdataresult = "false";                     return;                 }              } catch (ioexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }             catch (xmlpullparserexception e) {                 e.printstacktrace();             }          }          // method set shopping cart payment method         public void shoppingcartpaymentmethod(){              try {                  soapobject paymentmethodentity = new soapobject(constants.namespace, "shoppingcartpaymentmethodentity");                  paymentmethodentity.addproperty("method","cashondelivery");                  // add paramaters , values                 soapobject request = new soapobject(constants.namespace, "shoppingcartpaymentmethod");                 request.addproperty("sessionid", constants.sessionid);                 request.addproperty("quoteid", constants.cartid);                 request.addproperty("method", paymentmethodentity);                  soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11);                 envelope.dotnet = true;                 envelope.setoutputsoapobject(request);                  //web method call                 httptransportse androidhttptransport = new httptransportse(constants.url);                 androidhttptransport.debug = true;                 androidhttptransport.call("", envelope);                 //get response                 string result = string.valueof(envelope.getresponse());                 getcustomerdataresult3 = result.tostring();      //            // call place shopping cart order                 if(getcustomerdataresult3.equals("true")){                     shoppingcartorder();                 }                 else {                     getcustomerdataresult = "false";                     return;                 }              } catch (ioexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }             catch (xmlpullparserexception e) {                 e.printstacktrace();             }          }          // method place shopping cart order         public void shoppingcartorder(){              try {                 // add paramaters , values                 soapobject request = new soapobject(constants.namespace, "shoppingcartorder");                 request.addproperty("sessionid", constants.sessionid);                 request.addproperty("quoteid", constants.cartid);                  soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11);                 envelope.dotnet = true;                 envelope.setoutputsoapobject(request);                  //web method call                 httptransportse androidhttptransport = new httptransportse(constants.url);                 androidhttptransport.debug = true;                 androidhttptransport.call("", envelope);                 //get response                 string result = string.valueof(envelope.getresponse());                 getcustomerdataresult4 = result.tostring();              } catch (ioexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }             catch (xmlpullparserexception e) {                 e.printstacktrace();             }          }      }    mpsactivity.java   package com.www.prashant; import android.app.activity; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; import com.atom.mobilepaymentsdk.payactivity;    public class mpsactivity extends activity implements onclicklistener {     button paymerchantnb;     textview et_nb_amt;     progressdialog pdialog;     view v;        @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);      }      @override     public void onresume() {         super.onresume();         system.out.println("in on resume");         setcontentview(r.layout.mainpage);         et_nb_amt = (edittext) findviewbyid(r.id.et_nb_amt);           paymerchantnb = (button) findviewbyid(r.id.btn_paymerchantnb);         paymerchantnb.setonclicklistener(new view.onclicklistener() {              public void onclick(view v) {                   string amt = et_nb_amt.gettext().tostring();                    if (amt.equalsignorecase("")) {                     toast.maketext(mpsactivity.this, "please enter valid amount", toast.length_long).show();                 }                  else {                      double doubleamt = double.valueof(amt);                     amt = doubleamt.tostring();                       intent newpayintent = new intent(mpsactivity.this, payactivity.class);                      newpayintent.putextra("merchantid", "1111");                     newpayintent.putextra("txnscamt", "0"); //fixed. must �0�                     newpayintent.putextra("loginid", "1111");                     newpayintent.putextra("password", "test@123");                     newpayintent.putextra("prodid", "test");                     newpayintent.putextra("txncurr", "inr"); //fixed. must �inr�                     newpayintent.putextra("clientcode", "007");                     newpayintent.putextra("custacc", "100000036600");                     newpayintent.putextra("amt", amt);//should 3 decimal number i.e 1.000                     newpayintent.putextra("txnid", "013");                     newpayintent.putextra("date", "25/08/2015 18:31:00");//should in same format                     newpayintent.putextra("bankid", ""); //should valid bank id                      //use below production url production "library-mobilepaymentsdk", located inside prod folder                     newpayintent.putextra("ru", "https://payment.atomtech.in/mobilesdk/param"); //ru production                      //use below uat url uat "library-mobilepaymentsdk", located inside uat folder                     //newpayintent.putextra("ru", "https://paynetzuat.atomtech.in/mobilesdk/param"); // uat (testing)                      //optinal parameters                     newpayintent.putextra("customername", "prashant"); //only name                     newpayintent.putextra("customeremailid", "prashantlaldas@gmail.com");//only email id                     newpayintent.putextra("customermobileno", "xx85048450");//only mobile number                     newpayintent.putextra("billingaddress", "mumbai");//only address                     newpayintent.putextra("optionaludf9", "optional data 1");// can pass data                      startactivityforresult(newpayintent, 1);                 }             }         });      }      @override     protected void onactivityresult(int requestcode, int resultcode, intent data) {         super.onactivityresult(requestcode, resultcode, data);         // check if request code same passed here 2         system.out.println("resultcode--->" + resultcode);         system.out.println("requestcode--->" + requestcode);         system.out.println("result_ok--->" + result_ok);          if (requestcode == 1) {             system.out.println("---------inside-------");              if (data != null) {                 string message = data.getstringextra("status");                 string[] reskey = data.getstringarrayextra("responsekeyarray");                 string[] resvalue = data.getstringarrayextra("responsevaluearray");                  if (reskey != null && resvalue != null) {                     (int = 0; < reskey.length; i++)                         system.out.println("  " + + " reskey : " + reskey[i] + " resvalue : " + resvalue[i]);                 }                 toast.maketext(this, message, toast.length_long).show();                 system.out.println("received back--->" + message);             }          }      }      @override     public boolean oncreateoptionsmenu(menu menu) {          getmenuinflater().inflate(r.menu.menu_main, menu);         return true;     }      @override     public void onclick(view v) {         // todo auto-generated method stub      }  } 


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -