导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - SimplApproval.java 源代码

正在查看: bbinstant v6.24.0 应用的 SimplApproval.java JAVA 源代码文件

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


package com.simpl.approvalsdk;

import android.content.Context;
import android.text.TextUtils;
import com.simpl.android.fingerprint.FlagMode;
import com.simpl.android.fingerprint.SimplFingerprint;
import com.simpl.approvalsdk.model.UserApproval;

public class SimplApproval {
    private static final String TAG = "SimplApproval";
    private static SimplApproval instance;
    private Context applicationContext;
    private String approvalApi;
    private SimplUserApprovalListenerV2 globalSimplUserApprovalListener;
    private boolean isInDebug;
    private boolean isInSandboxMode;
    private boolean isInStaging;
    private String merchantId;
    private SimplUser simplUser;
    private UserApproval userApproval = new UserApproval();

    private SimplApproval(Context context, String str, boolean z) {
        this.merchantId = str;
        this.applicationContext = context.getApplicationContext();
        this.isInSandboxMode = z;
    }

    public static SimplApproval getInstance() {
        SimplApproval simplApproval = instance;
        if (simplApproval == null) {
            return null;
        }
        return simplApproval;
    }

    public static void init(Context context, String str) {
        if (instance != null) {
            return;
        }
        instance = new SimplApproval(context, str, false);
    }

    public void addFlags(FlagMode flagMode) {
        SimplFingerprint.getInstance().addFlags(flagMode);
    }

    protected String getApprovalsApiBaseUrl() {
        return this.isInStaging ? "https://approvals-api.stagingsimpl.com/api/v2/" : this.isInSandboxMode ? "https://sandbox-approvals-api.getsimpl.com/api/v2/" : this.isInDebug ? this.approvalApi : "https://approvals-api.getsimpl.com/api/v2/";
    }

    Context getCurrentApplicationContext() {
        return this.applicationContext;
    }

    public SimplUserApprovalListenerV2 getGlobalSimplUserApprovalListener() {
        return this.globalSimplUserApprovalListener;
    }

    public String getMerchantId() {
        return this.merchantId;
    }

    public SimplUser getSimplUser() {
        return this.simplUser;
    }

    public boolean isSimplApproved() {
        UserApproval userApproval = this.userApproval;
        return userApproval != null && userApproval.isApproved();
    }

    public SimplUserApprovalRequest isUserApproved(SimplUser simplUser) {
        return new SimplUserApprovalRequest(simplUser, this.merchantId);
    }

    public boolean isUserFirstTransaction() {
        UserApproval userApproval = this.userApproval;
        return userApproval != null && userApproval.isFirstTransaction();
    }

    public void runInDebugMode() {
        this.isInDebug = true;
    }

    public void runInSandboxMode() {
        this.isInSandboxMode = true;
    }

    public void runInStagingMode() {
        this.isInStaging = true;
    }

    public void setApprovalApi(String str) {
        this.approvalApi = str;
    }

    public void setGlobalSimplUserApprovalListener(SimplUserApprovalListenerV2 simplUserApprovalListenerV2) {
        this.globalSimplUserApprovalListener = simplUserApprovalListenerV2;
    }

    public void setMerchantId(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.merchantId = str;
    }

    public void setSimplUser(SimplUser simplUser) {
        this.simplUser = simplUser;
    }

    void setUserApproval(UserApproval userApproval) {
        this.userApproval = userApproval;
    }

    public void addFlags(String... strArr) {
        a.INSTANCE.b = strArr;
    }
}