Search in sources :

Example 1 with ContactAcctDetails

use of com.moneychanger.core.dataobjects.ContactAcctDetails in project otapij by FellowTraveler.

the class AddressBookHelper method getContactAccDetails.

public static ContactAcctDetails getContactAccDetails(Contact contact, int index) {
    AddressBook addressBook = Helpers.getAddressBook();
    if (addressBook == null) {
        System.out.println("getContactAccDetails - addressBook returns null");
        return null;
    }
    for (int i = 0; i < addressBook.GetContactCount(); i++) {
        Contact newContact = addressBook.GetContact(i);
        if (contact == null)
            continue;
        if (newContact.getContact_id().equals(contact.getContact_id())) {
            contact = newContact;
            break;
        }
    }
    ContactAcctDetails data = new ContactAcctDetails();
    if (contact != null && index > -1) {
        ContactAcct contactAcct = contact.GetContactAcct(index);
        if (contactAcct == null) {
            System.out.println("getContactNymDetails contact.getContactAccDetails(index) returned null");
            return null;
        }
        data.setLabel(contactAcct.getGui_label());
        data.setMemo(contactAcct.getMemo());
        data.setNymID(contactAcct.getNym_id());
        data.setAcctID(contactAcct.getAcct_id());
        data.setAssetID(contactAcct.getAsset_type_id());
        data.setServerID(contactAcct.getServer_id());
        data.setServerType(contactAcct.getServer_type());
        data.setPublicKey(contactAcct.getPublic_key());
    }
    return data;
}
Also used : ContactAcct(org.opentransactions.otapi.ContactAcct) AddressBook(org.opentransactions.otapi.AddressBook) ContactAcctDetails(com.moneychanger.core.dataobjects.ContactAcctDetails) Contact(org.opentransactions.otapi.Contact)

Aggregations

ContactAcctDetails (com.moneychanger.core.dataobjects.ContactAcctDetails)1 AddressBook (org.opentransactions.otapi.AddressBook)1 Contact (org.opentransactions.otapi.Contact)1 ContactAcct (org.opentransactions.otapi.ContactAcct)1