Get company name

To get a company name, call the getCompanyName function.
info

You need to register a user token and provide a valid organisation number to get a successful response.

Getting company name

ParameterDescription
organisationNumberA valid organisation number
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 organizationNumber = "a valid organisation number"

SveaAppWallet.shared.getCompanyName(organizationNumber: organizationNumber) { [weak self] result in
    switch result {
    case .success(let companyName):
        print("Company name \(companyName)")
    case .failure(let error):
        print("Company name could not be fetch, got error \(error)")
    }
}
Copy
Copied
let organizationNumber = "a valid organisation number"

SveaWalletClient.shared.getCompanyName(organizationNumber: organizationNumber) { [weak self] result in
    switch result {
    case .onSuccess(let companyName):
        print("Company name \(companyName)")
    case .onFailure(let error):
        print("Company name could not be fetch, got error \(error)")
    }
}

onSuccess

Returned if successful, includes a String containing the company name.

onFailure

Returned if the request to fetch the company name failed.

Possible errors

Copy
Copied
case noUserTokenProvided         // A user token has not been provided.
case invalidOrganizationNumber   // The organisation number is not valid.
case companyNotFound             // No Swedish company could be found with the provided registration number.
case unknownError                // An unknown error occurred.