Update private invoice

The isDefault and email fields of a private invoice can be updated.
In order to do that, call the updatePrivateInvoice function, providing the updated PrivateInvoiceUpdateData.

Update a payment method

ParameterDescription
privateInvoiceUpdateDataA PrivateInvoiceUpdateData 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 = PrivateInvoiceUpdateData(
    alias: "invoice identifier",
    email: "updated email",
    isDefault: false
)

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

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

onSuccess

Returned when the private invoice is successfully updated.

onFailure

Returned when an error occurs. If this happens, the private 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 failedToUpdatePrivateInvoice  // Private invoice could not be updated.
case unknownError                  // An unknown error occurred.