Update private invoice
TheisDefault 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
| Parameter | Description |
|---|---|
| privateInvoiceUpdateData | A PrivateInvoiceUpdateData 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 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)")
}
}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
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.