WePay iOS SDK  3.0.0
 All Classes Files Functions Variables Enumerations Enumerator Properties Macros
WPError.h File Reference

WPError.h serves as documentation for all errors surfaced by the WePay iOS SDK. More...

#import <Foundation/Foundation.h>

Go to the source code of this file.

Macros

#define WPUnexpectedErrorMessage   NSLocalizedStringFromTable(@"There was an unexpected error.", @"WePay", @"There was an unexpected error.");
 
#define WPNoDataReturnedErrorMessage   NSLocalizedStringFromTable(@"There was no data returned.", @"WePay", @"There was no data returned.");
 
#define WPCardReaderGeneralErrorMessage   NSLocalizedStringFromTable(@"Swipe failed due to: (a) uneven swipe speed, (b) fast swipe, (c) slow swipe, or (d) damaged card.", @"WePay", @"Swipe failed due to: (a) uneven swipe speed, (b) fast swipe, (c) slow swipe, or (d) damaged card.");
 
#define WPCardReaderInitializationErrorMessage   NSLocalizedStringFromTable(@"Failed to initialize card reader.", @"WePay", @"Failed to initialize card reader.");
 
#define WPCardReaderTimeoutErrorMessage   NSLocalizedStringFromTable(@"Card reader timed out.", @"WePay", @"Card reader timed out.");
 
#define WPSignatureInvalidImageErrorMessage   NSLocalizedStringFromTable(@"Inavlid signature image provided.", @"WePay", @"Inavlid signature image provided.");
 
#define WPNameNotFoundErrorMessage   NSLocalizedStringFromTable(@"Name not found.", @"WePay", @"Name not found.");
 

Enumerations

enum  WPErrorCode {
  WPErrorUnknown = -10000, WPErrorNoDataReturned = -10015, WPErrorCardReaderGeneralError = -10016, WPErrorCardReaderInitialization = -10017,
  WPErrorCardReaderTimeout = -10018, WPErrorCardReaderStatusError = -10019, WPErrorInvalidSignatureImage = -10020, WPErrorNameNotFound = -10021
}
 

Variables

FOUNDATION_EXPORT NSString *const kWPErrorAPIDomain
 
FOUNDATION_EXPORT NSString *const kWPErrorSDKDomain
 
FOUNDATION_EXPORT NSString *const kWPErrorCategoryKey
 
FOUNDATION_EXPORT NSString *const kWPErrorCategoryNone
 
FOUNDATION_EXPORT NSString *const kWPErrorCategoryCardReader
 
enum WPErrorCode WPErrorCode
 

Detailed Description

WPError.h serves as documentation for all errors surfaced by the WePay iOS SDK.

When errors occur, the WePay iOS SDK returns NSError instances to delegate methods. Each error instance has the following components:

  • [error code] gives the integer code corresponding with the error
  • [error domain] gives the domain that the error belongs to
  • [error userInfo] gives a dictionary with some more useful info, which can be accessed with the keys kWPErrorCategoryKey and NSLocalizedDescriptionKey

The WePay iOS SDK can return errors in various error domains:

  • WePay server API errors are in the kWPErrorAPIDomain
  • Errors generated by the SDK itself are in the kWPErrorSDKDomain
  • System errors generated by iOS are passed through as-is, for example in the NSURLErrorDomain

See the WPErrorCode section for more details about error codes.

Macro Definition Documentation

#define WPCardReaderGeneralErrorMessage   NSLocalizedStringFromTable(@"Swipe failed due to: (a) uneven swipe speed, (b) fast swipe, (c) slow swipe, or (d) damaged card.", @"WePay", @"Swipe failed due to: (a) uneven swipe speed, (b) fast swipe, (c) slow swipe, or (d) damaged card.");

The localizable user facing message for WPErrorCardReaderGeneralError, that can be retrieved by calling [error localizedDescription].

#define WPCardReaderInitializationErrorMessage   NSLocalizedStringFromTable(@"Failed to initialize card reader.", @"WePay", @"Failed to initialize card reader.");

The localizable user facing message for WPErrorCardReaderInitialization, that can be retrieved by calling [error localizedDescription].

#define WPCardReaderTimeoutErrorMessage   NSLocalizedStringFromTable(@"Card reader timed out.", @"WePay", @"Card reader timed out.");

The localizable user facing message for WPErrorCardReaderTimeout, that can be retrieved by calling [error localizedDescription].

#define WPNameNotFoundErrorMessage   NSLocalizedStringFromTable(@"Name not found.", @"WePay", @"Name not found.");

The localizable user facing message for WPErrorNameNotFound, that can be retrieved by calling [error localizedDescription].

#define WPNoDataReturnedErrorMessage   NSLocalizedStringFromTable(@"There was no data returned.", @"WePay", @"There was no data returned.");

The localizable user facing message for WPErrorNoDataReturned, that can be retrieved by calling [error localizedDescription].

#define WPSignatureInvalidImageErrorMessage   NSLocalizedStringFromTable(@"Inavlid signature image provided.", @"WePay", @"Inavlid signature image provided.");

The localizable user facing message for WPErrorInavlidSignatureImage, that can be retrieved by calling [error localizedDescription].

#define WPUnexpectedErrorMessage   NSLocalizedStringFromTable(@"There was an unexpected error.", @"WePay", @"There was an unexpected error.");

The localizable user facing message for WPErrorUnknown, that can be retrieved by calling [error localizedDescription].

Enumeration Type Documentation

Error codes for NSErrors surfaced by the WePay iOS SDK in the kWPErrorSDKDomain. For a full list of error codes in the kWPErrorAPIDomain, visit https://www.wepay.com/developer/reference/errors

Enumerator
WPErrorUnknown 

-10000 Unknown error.

WPErrorNoDataReturned 

-10015 No data returned by the API call.

WPErrorCardReaderGeneralError 

-10016 General error reported by the card reader - usually due to a bad swipe.

WPErrorCardReaderInitialization 

-10017 Error while initializing the card reader.

WPErrorCardReaderTimeout 

-10018 Timeout occurred while waiting for card.

WPErrorCardReaderStatusError 

-10019 Special error reported by card reader - very rare.

WPErrorInvalidSignatureImage 

-10020 Invalid signature image.

WPErrorNameNotFound 

-10021 Name not found.

Variable Documentation

FOUNDATION_EXPORT NSString* const kWPErrorAPIDomain

The NSError domain of all errors surfaced by the WePay iOS SDK that were returned by the WePay API. For a full list of error codes in the kWPErrorAPIDomain, visit https://www.wepay.com/developer/reference/errors

FOUNDATION_EXPORT NSString* const kWPErrorCategoryCardReader

The value used in the NSError's userInfo dictionary to return the "card reader" error category.

FOUNDATION_EXPORT NSString* const kWPErrorCategoryKey

The key used in the NSError's userInfo dictionary to return the error category.

FOUNDATION_EXPORT NSString* const kWPErrorCategoryNone

The value used in the NSError's userInfo dictionary to return the "none" error category.

FOUNDATION_EXPORT NSString* const kWPErrorSDKDomain

The NSError domain of all errors returned by the WePay iOS SDK itself. For a full list of error codes in the kWPErrorSDKDomain, look at WPErrorCode.