I am trying to make an open-source generic payment gateways library on java. where we will integrate all types of payment gateways so other developers can easily integrate any payment gateway in there system.
But i stuck on a point as you know data could be posted in two ways.
- old method para1=val1¶2=val2
- new one (JSON) {para1:val1, para2:val2}
For http post i choose apache http client but HttpPost accept List
List<NameValuePair> postParams = new ArrayList<>();
postParams.add(new BasicNameValuePair("name", "test"));
postParams.add(new BasicNameValuePair("email", "testemail@domain.com"));
httpPost.setEntity(new UrlEncodedFormEntity(postParams))
for json i am using Gson google json library for java.
I would like to make a parameter layer that could be easily converted in both of the form explained above.
I would like to take care of complex parameters too. Like, card[name]=some name & card[no] = 14444444444
your expert advise is highly appreciable.