Examples of OTAPI_Func


Examples of com.moneychanger.core.util.OTAPI_Func

        // ----------------------------------------
        // Make sure we have the proper asset contract for the withdrawal.
        //
        String assetContract = otapiJNI.OTAPI_Basic_LoadAssetContract(assetID);
        if (!Utility.VerifyStringVal(assetContract)) {
            OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.GET_CONTRACT, serverID, nymID, assetID);
            String strResponse = OTAPI_Func.SendRequest(theRequest, "GET_CONTRACT");

            if (!Utility.VerifyStringVal(strResponse)) {
                System.out.println("IN withdrawCash: OTAPI_Func.SendRequest(GET_CONTRACT) failed. (I give up.) (Unable to find asset contract.)");
                return false;
            }
            // ----------------------------------------
            assetContract = otapiJNI.OTAPI_Basic_LoadAssetContract(assetID);
            if (!Utility.VerifyStringVal(assetContract)) {
                System.out.println("OT_API_LoadAssetContract returned null even after OT_API_getContract (Unable to find asset contract.)");
                return false;
            }
        }
        // ---------------------------------------------------------
        // Download the public mintfile if it's not there, or if it's expired.
        // Also load it up into memory as a string (just to make sure it works.)
        // Then we can actually send the withdrawal transaction request. (Until
        // then, why bother?)
        //
        String mintFile;

        // expired or missing.
        if (true != otapiJNI.OTAPI_Basic_Mint_IsStillGood(serverID, assetID))
        {
            // ----------------------------------------
            OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.GET_MINT, serverID, nymID, assetID);
            String strResponse = OTAPI_Func.SendRequest(theRequest, "GET_MINT");

            if (!Utility.VerifyStringVal(strResponse)) {
                System.out.println("IN withdrawCash: OTAPI_Func.SendRequest(GET_MINT) failed. (I give up.) (Unable to get mint.)");
                return false;
            }
            // ----------------------------------------
            mintFile = otapiJNI.OTAPI_Basic_LoadMint(serverID, assetID);
            if (!Utility.VerifyStringVal(mintFile)) {
                System.out.println("OT_API_LoadMint returned null even after OT_API_getMint (I give up.) (Unable to find mint.)");
                return false;
            }
        }
        else // current mint IS available already on local storage (and not expired.)
        {
            mintFile = otapiJNI.OTAPI_Basic_LoadMint(serverID, assetID);
            if (!Utility.VerifyStringVal(mintFile)) {
                System.out.println("OT_API_LoadMint returned null even after successful OT_API_Mint_IsStillGood (I give up.) (Unable to find mint.)");
                return false;
            }
        }       
        // ---------------------------------------------------
        // By this point, the mintfile is DEFINITELY good (available, not null,
        // not expired, and loaded up.) Now we know for a fact that when the API
        // call is made to withdraw cash, that it will find the mint properly.
        //
        OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.WITHDRAW_CASH, serverID, nymID, accountID, amount);
        String strResponse = OTAPI_Func.SendTransaction(theRequest, "WITHDRAW_CASH"); // <========================

        if (!Utility.VerifyStringVal(strResponse)) {
            System.out.println("OTAPI_Func.SendTransaction() failed, in withdrawCash.");
            return false;
View Full Code Here

Examples of com.moneychanger.core.util.OTAPI_Func

        boolean isSuccess = false;
        System.out.println("In sendTransfer serverID:" + serverID + " nymID:" + nymID + " acount ID:" + accountID);

        // ---------------------------------------------------
        OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.SEND_TRANSFER, serverID, nymID, accountID, recepientAccountID, amount, note);
        String strResponse = OTAPI_Func.SendTransaction(theRequest, "SEND_TRANSFER"); // <========================

        if (!Utility.VerifyStringVal(strResponse)) {
            System.out.println("OTAPI_Func.SendTransaction() failed, in sendTransfer.");
            return false;
View Full Code Here

Examples of com.moneychanger.core.util.OTAPI_Func

    public boolean depositCheque(String serverID, String nymID, String accountID, String cheque) {

        System.out.println("In depositCheque serverID:" + serverID + " nymID:" + nymID + " acount ID:" + accountID);

        // ---------------------------------------------------
        OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.DEPOSIT_CHEQUE, serverID, nymID, accountID, cheque);
        String strResponse = OTAPI_Func.SendTransaction(theRequest, "DEPOSIT_CHEQUE"); // <========================

        if (!Utility.VerifyStringVal(strResponse)) {
            System.out.println("OTAPI_Func.SendTransaction() failed, in depositCheque.");
            return false;
View Full Code Here

Examples of com.moneychanger.core.util.OTAPI_Func

            // This whole block is all just about loading the pubkey for the recipient, (if I don't already have it.)
            //
            if (!Utility.VerifyStringVal(recepientPubKey)) {
                // ----------------------------------------------------------
                OTAPI_Func  theRequest   = new OTAPI_Func(OTAPI_Func.FT.CHECK_USER, serverID, nymID, recepientNymID);
                String      strResponse  = OTAPI_Func.SendRequest(theRequest, "CHECK_USER");

                if (!Utility.VerifyStringVal(strResponse))
                {
                    System.out.println("IN exportCashPurse: OTAPI_Func.SendRequest() failed. (I give up.) ");
View Full Code Here

Examples of com.moneychanger.core.util.OTAPI_Func

        if (!Utility.VerifyStringVal(newPurse)) {
            System.out.println("Before server OT_API_exchangePurse call, new Purse is emtpty.. returning false ");
            return false;
        }
        // ----------------------------------------
        OTAPI_Func  theRequest   = new OTAPI_Func(OTAPI_Func.FT.DEPOSIT_CASH, serverID, recepientNymID, accountID, newPurse);
        String      strResponse  = OTAPI_Func.SendTransaction(theRequest, "DEPOSIT_CASH"); // <========================
       
        if (!Utility.VerifyStringVal(strResponse))
        {
            System.out.println("IN depositCashPurse: OTAPI_Func.SendTransaction(() failed. (I give up.) ");
View Full Code Here

Examples of com.moneychanger.core.util.OTAPI_Func

        if (!Utility.VerifyStringVal(newPurse)) {
            System.out.println("exchangeCashPurse: Before server OT_API_exchangePurse call, new Purse is empty.. returning false ");
            return false;
        }
        // ------------------------
        OTAPI_Func  theRequest   = new OTAPI_Func(OTAPI_Func.FT.EXCHANGE_CASH, serverID, nymID, assetID, newPurse);
        String      strResponse  = OTAPI_Func.SendTransaction(theRequest, "EXCHANGE_CASH"); // <========================
       
        if (!Utility.VerifyStringVal(strResponse))
        {
            System.out.println("IN exchangeCashPurse: OTAPI_Func.SendTransaction(() failed. (I give up.) ");
View Full Code Here

Examples of com.moneychanger.core.util.OTAPI_Func

        int status = 2;

        if (otapiJNI.OTAPI_Basic_IsNym_RegisteredAtServer(nymID, serverID)) {
            status = 1;
        } else {
            OTAPI_Func  theRequest   = new OTAPI_Func(OTAPI_Func.FT.CREATE_USER_ACCT, serverID, nymID);
            String      strResponse  = OTAPI_Func.SendRequest(theRequest, "CREATE_USER_ACCT");

            if (!Utility.VerifyStringVal(strResponse))
            {
                System.out.println("IN registerNym: OTAPI_Func.SendRequest() failed. (I give up.) ");
View Full Code Here

Examples of com.moneychanger.core.util.OTAPI_Func

        // If the Nym's not registered at the server, we do that first...
        //
        if (!otapiJNI.OTAPI_Basic_IsNym_RegisteredAtServer(nymID, serverID)) {

            OTAPI_Func  theRequest   = new OTAPI_Func(OTAPI_Func.FT.CREATE_USER_ACCT, serverID, nymID);
            String      strResponse  = OTAPI_Func.SendRequest(theRequest, "CREATE_USER_ACCT");

            if (!Utility.VerifyStringVal(strResponse))
            {
                System.out.println("IN sendMessage: OTAPI_Func.SendRequest() failed. (I give up.) ");
                return false;
            }
        }
        // -----------------------------------------------
        // Okay the Nym is definitely registered at the server       
       
        String recipientPubKey = otapiJNI.OTAPI_Basic_LoadPubkey_Encryption(recipientNymID);
        System.out.println("recepientPubKey:" + recipientPubKey);
        // Download the recipient's pubkey since we don't already have it.
        if (!Utility.VerifyStringVal(recipientPubKey)) {
           
            // ----------------------------------------------------------
            OTAPI_Func  theRequest   = new OTAPI_Func(OTAPI_Func.FT.CHECK_USER, serverID, nymID, recipientNymID);
            String      strResponse  = OTAPI_Func.SendRequest(theRequest, "CHECK_USER");

            if (!Utility.VerifyStringVal(strResponse))
            {
                System.out.println("IN sendMessage: OTAPI_Func.SendRequest() failed. (I give up.) ");
                return false;
            }
            // ----------------------------------------------------------
            recipientPubKey = otapiJNI.OTAPI_Basic_LoadPubkey_Encryption(recipientNymID);
        }
        if (!Utility.VerifyStringVal(recipientPubKey)) {
            System.out.println("recepientPubKey is null");
            return false;
        }
        System.out.println("Just before api call recepientNymID:" + recipientNymID + " nymID:" + nymID + " serverID:" + serverID);
        // --------------------------------------------------------
       
        OTAPI_Func  theRequest   = new OTAPI_Func(OTAPI_Func.FT.SEND_USER_MESSAGE, serverID, nymID, recipientNymID, recipientPubKey, message);
        String      strResponse  = OTAPI_Func.SendRequest(theRequest, "SEND_USER_MESSAGE");

        if (!Utility.VerifyStringVal(strResponse))
        {
            System.out.println("IN sendMessage: OTAPI_Func.SendRequest() failed. (I give up.) ");
View Full Code Here

Examples of com.moneychanger.core.util.OTAPI_Func

        return registeredServers;
    }

    public boolean deleteNym(String nymID, String serverID, boolean deleteWalletNym) {

        OTAPI_Func  theRequest   = new OTAPI_Func(OTAPI_Func.FT.DELETE_USER_ACCT, serverID, nymID);
        String      strResponse  = OTAPI_Func.SendRequest(theRequest, "DELETE_USER_ACCT");

        if (!Utility.VerifyStringVal(strResponse))
        {
            System.out.println("IN deleteNym: OTAPI_Func.SendRequest() failed. (I give up.) ");
View Full Code Here

Examples of com.moneychanger.core.util.OTAPI_Func

        }
        Helpers.clearBasketExistingAssets();
        if (!Helpers.getCancelBasket()) {

            OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.ISSUE_BASKET, serverID, nymID, basket);

            String strResponse = OTAPI_Func.SendRequest(theRequest, "ISSUE_BASKET");
            System.out.println("strResponse:" + strResponse);
            if (!Utility.VerifyStringVal(strResponse)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.