# 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.





# Packages

The anybill SDK is build with a modular software architecture to provide tools for a flexible integration of the anybill services into your products. Additionally every module can be customized and extended at your needs.

# Core features


Core Module
Contains fundamental technical functions
Authentication Module
Contains login and registration functions for the app
Bill Module
Contains functionalities to receive the receipts from the POS
Category Module
Provides categories to relate receipts and items to the corresponding categories

# Optional features


OCR Module
Paper receipts can be scanned via the anybill OCR-function
Document Manager Module
Permits the export of receipts directly to a document manager like GetMyInvoices, DATEV or fileee
Yoli Module
Connection to the bank account via PSD2 interface for a full financial overview
Smart Receipt Actions Module
Smart functions on a receipt based on the receipt data e.g. review of the shopping experience, recipe suggestions or adding of insurances
Expense Manager Module
Provides an automatically categorized overview of all expenses the user had
Marketing Module
Provides features to display offers customized on the customers purchasing behaviour
Loyalty Module
Provides features, to provide customer loyalty with personalized offers based on the customers purchasing behaviour
Tree Gamification Module
Offers a „tree level system“ to enhance the motivation of the user by planting trees for scanned receipts
Warranty Tracker Module
Notifies the user about due warranties
Shopping List Module
anybill provides a fully automatic shopping list with personalized suggestions based on the purchasing history


# Data Models

# Authentication

AnybillUser
data class AnybillUser(
    val id: String,
    val email: String,
    val password: String,
    val firstName: String,
    val lastName: String,
    val birthday: String,
    val gender: String
)
UserInfo
data class UserInfo {
    val firstName: String,
    val lastName: String,
    val birthday: String,
    val gender: String
}

# Category

Category
data class Category(
    val id: String,
    val name: String,
    val iconResource: String,
    val color: Double
)

# Bills

Bill
abstract class Bill(
    open val id: String,
    open val categoryIds: List<String>,
    open val createdAtDate: String,
    open val currencyCode: String,
    open val date: String,
    open val discounts: List<Discount>,
    open val fileeeId: String,
    open val gmiDocumentId: Int,
    open val hasTaxReturnFlag: Boolean,
    open val isDeleted: Boolean,
    open val lastModifiedDate: String,
    open val lineItems: List<LineItem>,
    open val posBillId: String,
    open val returnBarcode: Boolean,
    open val returnCodeType: ReturnCodeType,
    open val tenders: List<Tender>,
    open val totalGrossAmount: Double,
    open val totalNetAmount: Double,
    open val totalTaxAmount: Double,
    open val type: BillType,
    open val warranties: List<Warranty>
    ) 
NoScanBill
data class NoScanBill
    val customText: String,
    val storeId: String,
    val vendor: Vendor,
    val legalInformation: LegalInformation,
    val store: Store
) : Bill()
ScanBill
data class ScanBill(
    val store: ScanStore,
    val vendorName: String,
    val hasScan: Boolean,
    val hasOCRRun: Boolean
) : Bill()
NoScanBillDTO
data class NoScanBillDTO(
    val vendorName: String,
    val date: String,
    val totalGrossAmount: Double,
    val categoryIds: List<String>,
    val currencyCode: String,
    val discounts: List<Discount>,
    val lineItems: List<LineItem>,
    val posBillId: String,
    val returnBarcode: String,
    val tenders: List<Tender>,
    val totalNetAmount: Double,
    val totalTaxAmount: Double
)
Discount
data class Discount(
    val name: String,
    val value: Double
) 
LegalInformation
data class LegalInformation(
    val beginDateTime: String,
    val cashierName: String,
    val endDateTime: String,
    val posInspectionQRData: String,
    val securityModuleNumber: String,
    val transactionId: String,
    val tseFailure: Boolean
)
LineItem
data class LineItem(
    val name: String,
    val quantity: Double,
    val unitOriginalGrossPrice: Double,
    val quantityType: QuantityType? = QuantityType.Count,
    val priceModifier: PriceModifier? = PriceModifier.None,
    val vat: Double,
    val sequenceNumber: Int,
    val categoryId: String,
    val description: String,
    val discountValue: Double,
    val ean: String,
    val id: String,
    val returnBarcode: String,
    val text: String,
    val totalGrossPrice: Double,
    val totalNetPrice: Double,
    val totalVatAmount: Double,
    val unitGrossPrice: Double,
    val unitNetPrice: Double
)
Tender
data class Tender(
    val amount: Double,
    val currencyCode: String,
    val tenderType: TenderType,
    val detailedType: String,
    val id: String,
    val paymentDetails: PaymentDetailsBase
) 
Warranty
data class Warranty(
    val articleName: String,
    val billId: String,
    val id: String,
    val lineItemId: String,
    val reminders: List<Reminder>,
    val warrantyDate: String
)
Reminder
data class Reminder(
    val days: Int
) 

# Payment Details

PaymentDetails
data class PaymentDetails(
    val id: String
)
OnlinePaymentDetails
data class OnlinePaymentDetails(
    val id: String,
    val senderAccountName: String,
    val recipientAccountName: String,
    val transactionId: String
    ) : PaymentDetails()
LoyaltyCardPaymentDetails
data class LoyaltyCardPaymentDetails(
    val id: String,
    val name: String,
    val accountNumber: String,
    val pointsUsed: Double,
    val pointsLeft: Double,
    val pointsGained: Double
    ) : PaymentDetails()
GiftCardPaymentDetails
data class GiftCardPaymentDetails(
    val id: String,
    val initialBalance: Double,
    val remainingBalance: Double,
    val dateOfExpiry: String
    ) : PaymentDetails()
DirectDebitPaymentDetails
data class DirectDebitPaymentDetails(
    val id: String,
    val sepaCreditorId: String,
    val sepaMandateReference: String,
    val cardNumber: String,
    val bankName: String
    ) : PaymentDetails()
CreditCardPaymentDetails
data class CreditCardPaymentDetails(
    val id: String,
    val cardNumber: String,
    val bankName: String
    ) : PaymentDetails()
CheckPaymentDetails
data class CheckPaymentDetails(
    val id: String,
    val drawee: String,
    val payee: String,
    val dateOfIssue: String,
    val drawer: String,
    val sortCode: String,
    val accountNumber: String
    ) : PaymentDetails()
CheckPaymentDetails
data class CashPaymentDetails(
    val id: String,
    val amountGiven: Double,
    val amountReturned: Double
    ) : PaymentDetails()
BankTransferPaymentDetails
data class BankTransferPaymentDetails(
    val id: String,
    val iban: String,
    val bic: String,
    val accountHolderName: String,
    val accountNumber: String,
    val bankName: String,
    val bankAddress: String,
    val sortCode: String,
    val routingNumber: String,
    val ifscCode: String,
    val routingCode: String
    ) : PaymentDetails()

# Vendor

Vendor
data class Vendor(
    val id: String,
    val name: String,
    val categoryIds: List<String>,
    val iconResource: String
) 
BaseStore
abstract class BaseStore
Store
data class Store(
    val vatId: String,
    val id: String,
    val address: Address,
    val displayName: String,
    val googlePlacesId: String,
    val legalName: String
) : BaseStore()
ScanStore
data class ScanStore(
    val city: String,
    val country: String,
    val street: String,
    val vatId: String,
    val zip: String
): BaseStore()
Address
data class Address(
    val zip: String,
    val city: String,
    val country: String,
    val number: String,
    val street: String
)