Update company invoice
TheisDefault
, 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
Parameter | Description |
---|---|
updateCompanyInvoice | A CompanyInvoiceUpdateData 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 = 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)")
}
}
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
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.