BTVenmoAppSwitchReturnURL.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #import <Foundation/Foundation.h>
  2. extern NSString *const BTVenmoAppSwitchReturnURLErrorDomain;
  3. typedef NS_ENUM(NSUInteger, BTVenmoAppSwitchReturnURLState) {
  4. BTVenmoAppSwitchReturnURLStateSucceededWithPaymentContext,
  5. BTVenmoAppSwitchReturnURLStateSucceeded,
  6. BTVenmoAppSwitchReturnURLStateFailed,
  7. BTVenmoAppSwitchReturnURLStateCanceled,
  8. BTVenmoAppSwitchReturnURLStateUnknown
  9. };
  10. /**
  11. This class interprets URLs received from the Venmo app via app switch returns.
  12. Venmo Touch app switch authorization requests should result in success, failure or user-initiated cancelation. These states are communicated in the url.
  13. */
  14. @interface BTVenmoAppSwitchReturnURL : NSObject
  15. /**
  16. Evaluates whether the url represents a valid Venmo Touch return.
  17. @param url an app switch return URL
  18. @return YES if the url represents a Venmo Touch app switch return
  19. */
  20. + (BOOL)isValidURL:(NSURL *)url;
  21. /**
  22. Initializes a new BTVenmoAppSwitchReturnURL
  23. @param url an incoming app switch url
  24. @return An initialized app switch return url
  25. */
  26. - (instancetype)initWithURL:(NSURL *)url;
  27. /**
  28. The overall status of the app switch - success, failure or cancelation
  29. */
  30. @property (nonatomic, assign, readonly) BTVenmoAppSwitchReturnURLState state;
  31. /**
  32. The nonce from the return URL.
  33. */
  34. @property (nonatomic, copy, readonly) NSString *nonce;
  35. /**
  36. The username from the return URL.
  37. */
  38. @property (nonatomic, copy, readonly) NSString *username;
  39. /**
  40. The payment context ID from the return URL.
  41. */
  42. @property (nonatomic, copy, readonly) NSString *paymentContextID;
  43. /**
  44. If the return URL's state is BTVenmoAppSwitchReturnURLStateFailed, the error returned from Venmo via the app switch.
  45. */
  46. @property (nonatomic, strong, readonly) NSError *error;
  47. @end