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
Parameter | Description |
---|---|
companyInvoiceInfo | A CompanyInvoiceInfo object. |
receiveOn | The dispatch queue used when invoking the result callback handler. Defaults to main. |
onResult | Result callback handler. |
Please note
SveaWalletClient
is deprecated in version 3.1.0. Use new class SveaAppWallet
instead.
SveaAppWalletSveaWalletClient (deprecated)
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)")
}
}
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
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.
Result | Org.no | Name | Street | c/o | Zip code | City | Telephone |
---|---|---|---|---|---|---|---|
Approved | 4608142222 | Tess, T Persson | Testgatan 1 | c/o Eriksson, Erik | 99999 | Stan | 08 - 111 111 11 |
Denied | 4608302222 | Tess, T Persson | Testgatan 1 | c/o Eriksson, Erik | 99999 | Stan | 08 - 111 111 11 |
Abuse | 4609191111 | Tess, T Persson | Testgatan 1 | c/o Eriksson, Erik | 99999 | Stan | 08 - 111 111 11 |
Limit | 4506172222 | Tess, T Persson | Testgatan 1 | c/o Eriksson, Erik | 99999 | Stan | 08 - 111 111 11 |