Add a company invoice

Creating a company invoice

As the user enters their contact information, create a CompanyInvoiceInfo object.
The company invoice must contain a valid company registration number.

Adding a company invoice

ParameterDescription
companyInvoiceInfoA CompanyInvoiceInfo object.
receiveOnThe dispatch queue used when invoking the result callback handler. Defaults to main.
onResultResult callback handler.
Please note
SveaWalletClient is deprecated in version 3.1.0. Use new class SveaAppWallet instead.
SveaAppWalletSveaWalletClient (deprecated)
Copy
Copied
let myCompanyInvoiceInfo = CompanyInvoiceInfo(
    email: "company@email.com",
    organizationNumber: "a valid organization number",
    reference: "some reference",
    isDefault: false
)

SveaAppWallet.shared.addCompany(invoice: myCompanyInvoiceInfo) { [weak self] result in
    switch result {
    case .success(let paymentMethod):
        print("Invoice successfully added \(paymentMethod)")
    case .failure(let error):
        print("Invoice could not be added, got error \(error)")
    }
}
Copy
Copied
let myCompanyInvoiceInfo = CompanyInvoiceInfo(
    email: "company@email.com",
    organizationNumber: "a valid organization number",
    reference: "some reference",
    isDefault: false
)

SveaWalletClient.shared.addCompany(invoice: myCompanyInvoiceInfo) { [weak self] result in
    switch result {
    case .onSuccess(let paymentMethod):
        print("Invoice successfully added \(paymentMethod)")
    case .onFailure(let error):
        print("Invoice could not be added, got error \(error)")
    }
}

onSuccess

Returned if the invoice was successfully added, including the invoice information in a PaymentMethod.

onFailure

Returned if the company invoice cannot be added.

Possible errors

Copy
Copied
case unknownError                // An unknown error occurred.
case invalidEmailAddress         // The email is not valid.
case invalidOrganizationNumber   // The organisation number is not valid.
case failedToAddInvoice          // Something went wrong while adding an invoice.
case companyNotFound             // No Swedish company could be found with the provided registration number.

Test companies

In the stage environment test companies are expected. Use the organization number (org.no) below to test different results.

Note

These test companies should only be used in stage. Real company information should only be used in production.

ResultOrg.noNameStreetc/oZip codeCityTelephone
Approved4608142222Tess, T PerssonTestgatan 1c/o Eriksson, Erik99999Stan08 - 111 111 11
Denied4608302222Tess, T PerssonTestgatan 1c/o Eriksson, Erik99999Stan08 - 111 111 11
Abuse4609191111Tess, T PerssonTestgatan 1c/o Eriksson, Erik99999Stan08 - 111 111 11
Limit4506172222Tess, T PerssonTestgatan 1c/o Eriksson, Erik99999Stan08 - 111 111 11