导航菜单

页面标题

页面副标题

Clash Legends v0.0.1 - Paystack.java 源代码

正在查看: Clash Legends v0.0.1 应用的 Paystack.java JAVA 源代码文件

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


package co.paystack.android;

import android.app.Activity;
import co.paystack.android.exceptions.AuthenticationException;
import co.paystack.android.exceptions.PaystackSdkNotInitializedException;
import co.paystack.android.model.Charge;
import co.paystack.android.model.PaystackModel;
import co.paystack.android.utils.Utils;

public class Paystack extends PaystackModel {
    static final boolean $assertionsDisabled = false;
    private String publicKey;

    private interface BaseCallback {
    }

    public interface TransactionCallback extends BaseCallback {
        void beforeValidate(Transaction transaction);

        void onError(Throwable th, Transaction transaction);

        void onSuccess(Transaction transaction);
    }

    protected Paystack() throws PaystackSdkNotInitializedException {
        Utils.Validate.validateSdkInitialized();
    }

    protected Paystack(String publicKey) throws AuthenticationException {
        setPublicKey(publicKey);
    }

    private void setPublicKey(String publicKey) throws AuthenticationException {
        validatePublicKey(publicKey);
        this.publicKey = publicKey;
    }

    private void validatePublicKey(String publicKey) throws AuthenticationException {
        if (publicKey == null || publicKey.length() < 1 || !publicKey.startsWith("pk_")) {
            throw new AuthenticationException("Invalid public key. To create a token, you must use a valid public key.\nEnsure that you have set a public key.\nCheck http://paystack.co for more");
        }
    }

    void chargeCard(Activity activity, Charge charge, TransactionCallback transactionCallback) {
        chargeCard(activity, charge, this.publicKey, transactionCallback);
    }

    private void chargeCard(Activity activity, Charge charge, String publicKey, TransactionCallback transactionCallback) {
        try {
            validatePublicKey(publicKey);
            TransactionManager transactionManager = new TransactionManager(activity, charge, transactionCallback);
            transactionManager.chargeCard();
        } catch (Exception ae) {
            if (transactionCallback == null) {
                throw new AssertionError();
            }
            transactionCallback.onError(ae, null);
        }
    }
}