package com.genlot.ninglottery.module.cancel;

import android.os.Bundle;

import com.genlot.nativesdk.sender.EventToken;
import com.genlot.nativesdk.sender.TCPSender;
import com.genlot.ninglottery.base.BasePresenter;
import com.genlot.ninglottery.toolkit.LogTool;


class CancelPresenter extends BasePresenter<ICancelView> {

    /**
     * 注销
     * @param featureCode   特征码
     */
    public void t101300Cancel(String featureCode) {
        getView().showLoading();
        TCPSender.t101300Cancel(EventToken.T_CANCEL, 1, featureCode, new TCPSender.SenderCallback() {
            @Override
            public void onSenderSuccess(Bundle bundle) {
                long cancelTime = bundle.getLong(EventToken.EVENT_KEY_RESULT_OBJECT);
                LogTool.logI("cancelTime = " + cancelTime);
                getView().onCancelSuccess(cancelTime);
            }

            @Override
            public void onSenderFail(int tradingCode, String message) {
                getView().dismissLoading();
                getView().showToast(message);
            }

        });
    }

}
