导航菜单

页面标题

页面副标题

Vi App v10.18.0 - GetTokenActivity.java 源代码

正在查看: Vi App v10.18.0 应用的 GetTokenActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.ybl.ypp.sdk;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.telephony.SubscriptionInfo;
import android.util.Base64;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.ybl.ypp.sdk.Modules.GetTokenModule;
import java.security.SecureRandom;
import java.util.List;
import one.upswing.sdk.R;
import one.upswing.sdk.a3;
import one.upswing.sdk.b;
import one.upswing.sdk.c1;
import one.upswing.sdk.c3;
import one.upswing.sdk.e1;
import one.upswing.sdk.h;
import one.upswing.sdk.m1;
import org.json.JSONObject;
import retrofit2.Call;
import retrofit2.Response;

public class GetTokenActivity extends AppCompatActivity {
    public List<SubscriptionInfo> a;
    public String b;
    public String c;

    public String f8d;

    public String f9e = "";

    public GetTokenActivity f10f = this;

    public int f11g = 1;

    public e1 f12h = e1.a();

    public boolean f13i = false;

    public class a implements m1<GetTokenModule> {
        public a() {
        }

        public final void a() {
            GetTokenActivity.this.a("Server not reachable", "DB118");
        }

        public final void onFailure(Call<GetTokenModule> call, Throwable th) {
            GetTokenActivity.this.a("Server not reachable", "DB118");
        }

        @RequiresApi
        public final void onResponse(Call<GetTokenModule> call, Response<GetTokenModule> response) {
            try {
                new JSONObject(new Gson().toJson(response.body()));
                GetTokenModule getTokenModule = (GetTokenModule) response.body();
                if (getTokenModule.getResult().getApi_status().equals("00")) {
                    GetTokenActivity.this.f12h.b();
                    Intent intent = new Intent();
                    intent.putExtra("result", getTokenModule.getResult().getApi_status_message());
                    intent.putExtra("status_code", getTokenModule.getResult().getApi_status());
                    intent.putExtra("device_token", getTokenModule.getResult().getDeviceToken());
                    intent.putExtra("ypp_reference_number", getTokenModule.getResult().getYppReferenceNumber());
                    GetTokenActivity.this.setResult(-1, intent);
                    GetTokenActivity.this.finish();
                } else if (getTokenModule.getResult().getApi_status().equals("DB109")) {
                    GetTokenActivity.this.a("Send SMS Outward", "DB109");
                } else if (getTokenModule.getResult().getApi_status().equals("DB113")) {
                    GetTokenActivity.this.a("Send SMS Outward", "DB009");
                } else {
                    GetTokenActivity.this.a(getTokenModule.getResult().getApi_status_message(), getTokenModule.getResult().getApi_status());
                }
            } catch (Exception e2) {
                e2.getMessage();
                GetTokenActivity getTokenActivity = GetTokenActivity.this;
                StringBuilder a = a3.a("Unknown Error - ");
                a.append(e2.getMessage());
                getTokenActivity.a(a.toString(), "DB011");
            }
        }
    }

    public final void a() {
        try {
            if (getIntent().hasExtra("isTalsecImported") && !getIntent().getStringExtra("isTalsecImported").equals("") && getIntent().getStringExtra("isTalsecImported").equals("true") && h.b(this.f10f)) {
                this.f13i = true;
            }
            h hVar = new h();
            if (getIntent().getStringExtra("key") == null) {
                a("Please Provide partner key", "P006");
                return;
            }
            if (getIntent().getStringExtra("key").trim().equals("")) {
                a("Please Provide partner key", "P006");
                return;
            }
            if (getIntent().getStringExtra("key").length() != 10) {
                a("Please Provide correct partner key", "P001");
                return;
            }
            if (getIntent().getStringExtra("PartnerReferenceNumber") == null) {
                a("Please Provide partner reference number", "P006");
                return;
            }
            if (getIntent().getStringExtra("PartnerReferenceNumber").equals("")) {
                a("Please Provide partner reference number", "P006");
                return;
            }
            if (getIntent().getStringExtra("mobileNumber") == null) {
                a("Please Provide mobile number", "P006");
                return;
            }
            if (getIntent().getStringExtra("mobileNumber").equals("")) {
                a("Please Provide mobile number", "P006");
                return;
            }
            if (getIntent().getStringExtra("mobileNumber").length() < 8 || getIntent().getStringExtra("mobileNumber").length() > 10) {
                a("Please Provide correct mobile number", "DB005");
                return;
            }
            if (getIntent().getStringExtra("encryptionkey") == null) {
                a("Please Provide encryption key", "P006");
                return;
            }
            if (getIntent().getStringExtra("encryptionkey").equals("")) {
                a("Please Provide encryption key", "P006");
                return;
            }
            if (getIntent().getStringExtra("servicename") == null) {
                a("Please Provide service name", "P006");
                return;
            }
            if (getIntent().getStringExtra("servicename").equals("")) {
                a("Please Provide service name", "P006");
                return;
            }
            if (c1.a(this.f10f, this.f13i)) {
                a("Device not supported", "DB010");
                return;
            }
            this.f8d = hVar.a(this);
            this.b = "Android " + Build.VERSION.RELEASE;
            this.c = getApplicationContext().getPackageName();
            h.a();
            if (this.f8d.equals("")) {
                a("Unknown Error", "DB011");
            } else if (this.c.equals("")) {
                a("Unknown Error", "DB011");
            } else {
                a((Context) this.f10f);
            }
        } catch (Exception e2) {
            StringBuilder a2 = a3.a("Unknown Error - ");
            a2.append(e2.getMessage());
            a(a2.toString(), "DB011");
        }
    }

    public final void onBackPressed() {
    }

    public final void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        if (Build.VERSION.SDK_INT != 26) {
            setRequestedOrientation(1);
        }
        getWindow().setFlags(8192, 8192);
        setContentView(R.layout.activity_get_token);
        if (getIntent().getStringExtra("showProgressDialog") == null) {
            this.f12h.a(this.f10f, R.raw.clockwithborders);
        } else if (getIntent().getStringExtra("showProgressDialog").equalsIgnoreCase("true")) {
            this.f12h.a(this.f10f, R.raw.clockwithborders);
        } else if (!getIntent().getStringExtra("showProgressDialog").equalsIgnoreCase("false")) {
            this.f12h.a(this.f10f, R.raw.clockwithborders);
        }
        int checkSelfPermission = ContextCompat.checkSelfPermission(this.f10f, "android.permission.READ_PHONE_STATE");
        int checkSelfPermission2 = ContextCompat.checkSelfPermission(this.f10f, "android.permission.SEND_SMS");
        if (checkSelfPermission == 0 && checkSelfPermission2 == 0) {
            a();
        } else {
            ActivityCompat.requestPermissions(this, new String[]{"android.permission.READ_PHONE_STATE", "android.permission.SEND_SMS"}, this.f11g);
        }
    }

    public final void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
        super/*androidx.fragment.app.FragmentActivity*/.onRequestPermissionsResult(i2, strArr, iArr);
        if (i2 == 1) {
            int i3 = iArr[0];
            int i4 = iArr[1];
            if (i3 == -1) {
                a("READ_PHONE_STATE access denied", "DB017");
            }
            if (i4 == -1) {
                a("SEND_SMS access denied", "DB018");
            }
            if (i3 == 0 && i4 == 0) {
                a();
            }
        }
    }

    public final void a(String str, String str2) {
        this.f12h.b();
        Intent intent = new Intent();
        intent.putExtra("status_code", str2);
        intent.putExtra("error_msg", str);
        setResult(0, intent);
        finish();
    }

    @RequiresApi
    public final void a(Context context) {
        try {
            List<SubscriptionInfo> a2 = c3.a(context);
            this.a = a2;
            if (a2 != null) {
                if (a2.size() > 0) {
                    h hVar = new h();
                    for (SubscriptionInfo subscriptionInfo : this.a) {
                        if (this.f9e.equals("")) {
                            this.f9e = hVar.a(context) + String.valueOf(subscriptionInfo.getSubscriptionId());
                        } else {
                            this.f9e += "," + hVar.a(context) + String.valueOf(subscriptionInfo.getSubscriptionId());
                        }
                    }
                    if (!getIntent().getStringExtra("servicename").equals("TPT_BANKING_SERVICES_CONSENT")) {
                        if (!this.f9e.equals("")) {
                            a(this.f9e);
                            return;
                        } else {
                            a("Unable to send SMS due to issue detected with selected sim - subscriptionId empty", "DB116");
                            return;
                        }
                    }
                    a("Unknown Error - Service Not Allowed", "DB011");
                    return;
                }
                a("SIM not present", "DB008");
                return;
            }
            a("Unable to send SMS due to issue detected with selected sim - send sim details empty", "DB116");
        } catch (Exception e2) {
            e2.getMessage();
            a("Unable to send SMS due to issue detected with selected sim - " + e2.getMessage(), "DB116");
        }
    }

    public final void a(String str) {
        JsonObject jsonObject = new JsonObject();
        JsonObject jsonObject2 = new JsonObject();
        jsonObject.addProperty("partnerReferenceNumber", getIntent().getStringExtra("PartnerReferenceNumber"));
        jsonObject.addProperty("deviceId", this.f8d);
        jsonObject.addProperty("simId", str);
        jsonObject.addProperty("applicationPackageName", this.c);
        jsonObject.addProperty("deviceOS", this.b);
        jsonObject.addProperty("mobileNumber", getIntent().getStringExtra("mobileNumber"));
        jsonObject.addProperty("serviceName", getIntent().getStringExtra("servicename"));
        jsonObject.addProperty("sdkValidationCheck", "true");
        jsonObject.addProperty("udf1", "");
        jsonObject.addProperty("udf2", "");
        jsonObject.addProperty("udf3", "");
        jsonObject.addProperty("udf4", "");
        if (getIntent().hasExtra("registrationReferenceNumber") && !getIntent().getStringExtra("registrationReferenceNumber").equals("")) {
            jsonObject.addProperty("registrationReferenceNumber", getIntent().getStringExtra("registrationReferenceNumber"));
        }
        try {
            byte[] bArr = new byte[16];
            SecureRandom.getInstance("SHA1PRNG").nextBytes(bArr);
            String a2 = h.a(jsonObject.toString(), getIntent().getStringExtra("encryptionkey"), bArr);
            if (a2.equals("")) {
                a("Invalid encryption key passed", "DB117");
                return;
            }
            jsonObject2.addProperty("iv", Base64.encodeToString(bArr, 2));
            jsonObject2.addProperty("key", getIntent().getStringExtra("key"));
            jsonObject2.addProperty("serviceName", getIntent().getStringExtra("servicename"));
            jsonObject2.addProperty("body", a2);
            one.upswing.sdk.a.a(this.f10f, ((b) one.upswing.sdk.a.a(this.f10f).create(b.class)).b(jsonObject2, "3.17"), new a());
        } catch (Exception e2) {
            e2.getMessage();
            a("Unknown Error - " + e2.getMessage(), "DB011");
        }
    }
}