# The anybill SDK

# Overview

With the anybill SDK, which is available for Android and iOS, the services provided by anybill can be easily integrated natively into any app.



# Architecture

To be able to use the anybill SDK, the endpoints for the desired features must be connected in the POS software.



# Functional description

In the following section, the individual features are described in detail and it is shown how these can be integrated.

# Authentication

To be able to use the anybill functions, the user has to first log in or register with an anybill account. The SDK provides the following functionality:

Login

AnybillSdk anybillSdk = new AnybillSdk();
AnbillLoginCredentials anybillLoginCredentials = AnbillLoginCredentials();
AnybillUser anybillUser = await anybillSdk.login(anybillLoginCredentials);

Register a new user with anybill.

Registration

AnybillSdk anybillSdk = new AnybillSdk();
AnbillRegisterUser anybillRegisterUser = AnbillRegisterUser();
AnybillUser anybillUser = await anybillSdk.registerUser(anybillLoginCredentials);

Returns a bool value if an anybill user is logged in.

Authentication status

AnybillSdk anybillSdk = new AnybillSdk();
bool isAuthenticated = anybillSdk.isAuthenticated;

Returns the currently logged in anybill user.

Query user

AnybillSdk anybillSdk = new AnybillSdk();
AnybillUser anybillUser = anybillSdk.getUser();

# Retrieve digital receipts

Returns a list of all saved receipts.

Retrieve documents

AnybillSdk anybillSdk = new AnybillSdk();
List<AnybillBaseBill> bills = await anybillSdk.getBills();

Returns a list of all saved documents, sorted by month and category. This makes it easy to display an expenditure control, comparable to overview of expenses in the anybill App.

Retrieve documents for the expenditure manager

AnybillSdk anybillSdk = new AnybillSdk();
List<AnybillExpensesMonth> expenses = await anybillSdk.getExpenses();

# OCR and Scan Bills

Analyzes an image file using OCR and displays the data contained in it in a AnybillScanBill Object back.

Analyze document from image file using OCR

AnybillSdk anybillSdk = new AnybillSdk();
File imageFile = getSomePhotoFromCamera();
AnybillScanBill scanBill = await anybillSdk.analyzeBill(imageFile);

Saves a ScanBill object to the anybill account. The ScanBill object can be either created by OCR or added manually by the user.

Add document manually

AnybillSdk anybillSdk = new AnybillSdk();
AnybillScanBill newScanBill = new AnybillScanBill();
AnybillScanBill responseScanBill = await anybillSdk.addScanBill(newScanBill);

# Data Models

AnbillLoginCredentials
class AnybillLoginCredentials {
    String email;
    String password;
}
AnbillRegisterUser
class AnybillRegisterUser {
    String firstname;
    String email;
    String password;
    String repeatPassword;
}
AnybillUser
class AnybillUser {
    String firstname;
    String email;
}
AnybillExpensesMonth
class AnybillExpensesMonth {
    DateTime month;
    List<Category> categories;
}
AnybillBaseBill
class AnybillBaseBill {
    String id;
    DateTime date;
    DateTime createdAtDate;
    double totalGrossAmount;
    double totalNetAmount;
    double totalTaxAmount;
    String currencyCode;
    List<CategoryWithoutBills> categories
    List<Tender> tenders;
    List<LineItem> lineItems;
    bool isDeleted;
}
AnybillBill
class AnybillBill extends AnybillBaseBill {
    String customText;
    Store store;
    String transactionId;
    String securityModuleNumber;
    DateTime beginDateTime;
    DateTime endDateTime;
}
AnybillScanBill
class AnybillScanBill extends AnybillBaseBill {
    String vendorName;
    bool hasScan;
    File imgFile;
}
LineItem
class LineItem {
    String id;
    double quantity;
    int quantityType;
    double unitGrossPrice;
    double unitNetPrice;
    double unitOriginalGrossPrice;
    double totalNetPrice;
    double totalGrossPrice;
    double totalVatAmount;
    double vat;
    String text;
    int sequenceNumber;
    int priceModifier;
    String name;
    String description;
    String ean;
}
Category
class Category {
    String id;
    String name;
    String iconResource;
    Color color;
    List<AnybillBaseBill> bills;
}
CategoryWithoutBills
class CategoryWithoutBills {
    String id;
    String name;
    String iconResource;
    Color color;
}
Tender
class Tender {
    int tenderType;
    String detailedType;
    String currencyCode;
    double amount;
}