Skip to content

Request to expand / align refund error codes in SDK #457

Description

@mortenbekditlevsen

Expected Behavior

I expect to be able to distinguish different error codes in my code base, so that I can communicate correctly with the end user.

This issue is related to previously closed issue: #249

Please describe the behavior you are expecting.

Current Behavior

I am trying to make sense of the various refund errors that can occur through the API.

Currently it appears that the refund errors are not covered by the error codes defined in the SDK - and furthermore we get different error codes for apparently similar error situations based on wether we are in developer mode or on a demo account.

Here are some errors that we experience when using a demo account:

Error Domain=com.izettle.payments-sdk-ios.refund.error Code=2 "#AlreadyRefunded" UserInfo={izTitle=An error has occurred, NSLocalizedDescription=#AlreadyRefunded, izMessage=#AlreadyRefunded}

Error Domain=com.izettle.payments-sdk-ios.refund.error Code=2 "#RefundInsufficientFunds" UserInfo={izTitle=An error has occurred, NSLocalizedDescription=#RefundInsufficientFunds, izMessage=#RefundInsufficientFunds}

Error Domain=com.izettle.payments-sdk-ios.refund.error Code=2 "#RefundAmountExceedOriginalAmount" UserInfo={izTitle=An error has occurred, NSLocalizedDescription=#RefundAmountExceedOriginalAmount, izMessage=#RefundAmountExceedOriginalAmount}

And some errors from when we are in developer mode:

Error Domain=com.izettle.sdk.error Code=-100 "An error has occurred / Payment not found" UserInfo={izTitle=An error has occurred, NSLocalizedDescription=An error has occurred / Payment not found, izMessage=Payment not found}

Error Domain=com.izettle.payments-sdk-ios.refund.error Code=1 "An error has occurred / Refund not approved by acquirer." UserInfo={izTitle=An error has occurred, NSLocalizedDescription=An error has occurred / Refund not approved by acquirer., izMessage=Refund not approved by acquirer.}

Error Domain=com.izettle.payments-sdk-ios.refund.error Code=2 "An error has occurred / Refund amount exceeds original amount." UserInfo={izTitle=An error has occurred, NSLocalizedDescription=An error has occurred / Refund amount exceeds original amount., izMessage=Refund amount exceeds original amount.}

It appears that in developer mode, the errors that we can provoke do indeed have different error codes. But one of those codes (2) occurs for every error that we have been able to provoke using a demo account.

We do not have access to a production account, so we have no guess as to whether it behaves more like a demo account or developer mode - or in a third fashion.

Can you give any advice for error handling for refunds - and specifically for distinguishing different error scenarios?

Steps to Reproduce

Perform refunds in developer mode and on a demo account and observe the details of the NSErrors that are thrown.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating Version:
    iOS 17

  • SDK version:
    4.0.1

Failure Logs

Please include any relevant log snippets or files here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions