PPOTResult.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // PPOTResult.h
  3. //
  4. // Copyright © 2015 PayPal, Inc. All rights reserved.
  5. //
  6. /**
  7. PayPal One Touch request targets.
  8. */
  9. typedef NS_ENUM(NSInteger, PPOTRequestTarget) {
  10. /// No app switch will occur
  11. PPOTRequestTargetNone,
  12. /// App switch to/from browser
  13. PPOTRequestTargetBrowser,
  14. /// App switch to/from PayPal Consumer App
  15. PPOTRequestTargetOnDeviceApplication,
  16. /// Response url was invalid; can't confirm source app's identity
  17. PPOTRequestTargetUnknown,
  18. };
  19. #define kPayPalOneTouchErrorDomain @"com.paypal.onetouch.error"
  20. /**
  21. Error codes associated with PayPal One Touch.
  22. */
  23. typedef NS_ENUM(NSInteger, PPOTErrorCode) {
  24. /// Unknown error
  25. PPOTErrorCodeUnknown = -1000,
  26. /// Parsing failed
  27. PPOTErrorCodeParsingFailed = -1001,
  28. /// App target not found
  29. PPOTErrorCodeNoTargetAppFound = -1002,
  30. /// Failed to open URL
  31. PPOTErrorCodeOpenURLFailed = -1003,
  32. /// Persisted data fetch failed
  33. PPOTErrorCodePersistedDataFetchFailed = -1004,
  34. };
  35. /**
  36. PayPal One Touch result types.
  37. */
  38. typedef NS_ENUM(NSInteger, PPOTResultType) {
  39. /// Error
  40. PPOTResultTypeError,
  41. /// Cancel
  42. PPOTResultTypeCancel,
  43. /// Success
  44. PPOTResultTypeSuccess,
  45. };
  46. /**
  47. The result of parsing the One Touch return URL
  48. */
  49. @interface PPOTResult : NSObject
  50. /**
  51. The status of the app switch
  52. */
  53. @property (nonatomic, readonly, assign) PPOTResultType type;
  54. /**
  55. When One Touch is successful, the response dictionary containing information that your server will need to process.
  56. */
  57. @property (nullable, nonatomic, readonly, copy) NSDictionary *response;
  58. /**
  59. When One Touch encounters an error, it is reported here. Otherwise this property will be `nil`.
  60. */
  61. @property (nullable, nonatomic, readonly, copy) NSError *error;
  62. /**
  63. The target app that is now switching back.
  64. */
  65. @property (nonatomic, readonly, assign) PPOTRequestTarget target;
  66. @end