Skip to content

Commit

Permalink
Merge pull request #2 from realexpayments-developers/master
Browse files Browse the repository at this point in the history
Resolve Issue With Component Imposing Structure On Data
  • Loading branch information
RealexITSO committed Jan 18, 2016
2 parents de98f60 + f0f7b62 commit 6090b1c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import retrofit.Callback;
import retrofit.RetrofitError;
Expand All @@ -47,7 +52,7 @@
**/

public class HPPManagerFragment extends Fragment implements Callback<HPPResponse> {
public class HPPManagerFragment extends Fragment implements Callback<Response> {

private HPPManagerListener mListener;
private View root;
Expand Down Expand Up @@ -130,7 +135,7 @@ public void onDestroy() {

@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void success(HPPResponse hppResponse, Response response) {
public void success(Response hppResponse, Response response) {

final WebView webView = (WebView) root.findViewById(R.id.hpp_web_view);

Expand Down Expand Up @@ -244,9 +249,13 @@ public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError e

List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();

HashMap<String, String> params = hppManager.getMap();

HashMap<String, String> consumer_response_params = hppResponse.getMap();
String resp = new String(((TypedByteArray) response.getBody()).getBytes());

HashMap<String, String> params = new HashMap<>();//hppManager.getMap();

Type mapType = new TypeToken<Map<String, String>>(){}.getType();
Map<String, String> consumer_response_params = new Gson().fromJson(resp, mapType);

//merge params
for (String key : consumer_response_params.keySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface IHPPServerAPI {
@FormUrlEncoded
@POST("/{path}")
public void getHPPRequest(@Path(value = "path", encode = false) String path, @FieldMap HashMap<String, String> args,
Callback<HPPResponse> callback);
Callback<Response> callback);

@FormUrlEncoded
@POST("/{path}")
Expand Down

0 comments on commit 6090b1c

Please sign in to comment.