Update company invoice

The isDefault, reference and email fields of a company invoice can be updated.
In order to do that, call the updateCompanyInvoice function, providing the updated CompanyInvoiceUpdateData.

Update a payment method

ParameterDescription
updateCompanyInvoiceA CompanyInvoiceUpdateData 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 invoiceUpdateData = CompanyInvoiceUpdateData(
    alias: "invoice identifier",
    email: "updated email",
    reference: "some reference",
    isDefault: false
)

SveaAppWallet.shared.updateCompanyInvoice(companyInvoiceUpdateData: invoiceUpdateData) { [weak self] result in
    switch result {
    case .success(let paymentMethod):
        print("Company invoice successfully updated!")
    case .failure(let error):
        print("Company invoice could not be updated, got error \(error)")
    }
}
Copy
Copied
let invoiceUpdateData = CompanyInvoiceUpdateData(
    alias: "invoice identifier",
    email: "updated email",
    reference: "some reference",
    isDefault: false
)

SveaWalletClient.shared.updateCompanyInvoice(companyInvoiceUpdateData: invoiceUpdateData) { [weak self] result in
    switch result {
    case .onSuccess(let paymentMethod):
        print("Company invoice successfully updated!")
    case .onFailure(let error):
        print("Company invoice could not be updated, got error \(error)")
    }
}

onSuccess

Returned when the company invoice is successfully updated.

onFailure

Returned when an error occurs. If this happens, the company invoice has not been updated.

Possible errors

Copy
Copied
case noUserTokenProvided           // A user token has not been provided.
case invalidEmailAddress           // The email is not valid.
case failedToUpdateCompanyInvoice  // Company invoice could not be updated.
case unknownError                  // An unknown error occurred.