PPOTCore.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // PPOTCore.h
  3. //
  4. // Copyright © 2015 PayPal, Inc. All rights reserved.
  5. //
  6. // Required Frameworks for the library. Additionally, make sure to set OTHER_LDFLAGS = -ObjC
  7. #import <MessageUI/MessageUI.h>
  8. #import <CoreLocation/CoreLocation.h>
  9. #import <SystemConfiguration/SystemConfiguration.h>
  10. #import <Foundation/Foundation.h>
  11. #import "PPOTResult.h"
  12. /**
  13. Completion block for receiving the result of performing a request
  14. */
  15. typedef void (^PPOTCompletionBlock)(PPOTResult * _Nonnull result);
  16. /**
  17. Used for PayPal payment processing
  18. */
  19. @interface PPOTCore : NSObject
  20. /**
  21. Check if the application is configured correctly to handle responses for One Touch flow.
  22. @param callbackURLScheme The URL scheme which the app has registered for One Touch responses.
  23. @return `YES` iff the application is correctly configured.
  24. */
  25. + (BOOL)doesApplicationSupportOneTouchCallbackURLScheme:(nonnull NSString *)callbackURLScheme;
  26. /**
  27. Check whether the PayPal Wallet app is installed on this device (iOS <= 8).
  28. Universal links are used in iOS >=9 so the check is not performed
  29. @return `YES` if the wallet app is installed
  30. */
  31. + (BOOL)isWalletAppInstalled;
  32. /**
  33. Check whether the URL and source application are recognized and valid for One Touch.
  34. Usually called as a result of the `UIApplicationDelegate`'s
  35. `- (BOOL)application:openURL:sourceApplication:annotation:` method
  36. to determine if the URL is intended for the One Touch library.
  37. (To then actually process the URL, call `+ (void)parseOneTouchURL:completionBlock`.)
  38. @param url The URL of the app switch request
  39. @param sourceApplication The bundle ID of the source application
  40. @return `YES` iff the URL and sending app are both valid.
  41. */
  42. + (BOOL)canParseURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication;
  43. /**
  44. Process a URL response.
  45. @param url The URL to process
  46. @param completionBlock completion block for receiving the result of performing a request
  47. */
  48. + (void)parseResponseURL:(nonnull NSURL *)url completionBlock:(nonnull PPOTCompletionBlock)completionBlock;
  49. /**
  50. URLs to return control from the browser/wallet to the app containing the One Touch library.
  51. For payment processing, the client's server will first create a payment on the PayPal server.
  52. Creating that payment requires, among many other things, a `redirect_urls` object containing two strings:
  53. `return_url` and `cancel_url`.
  54. @note Both return values will be `nil` if [PPOTCore doesApplicationSupportOneTouchCallbackURLScheme:callbackURLScheme] is not true.
  55. @param callbackURLScheme The URL scheme which the app has registered for One Touch responses.
  56. @param returnURL A string containing the `return_url`.
  57. @param cancelURL A string containing the `cancel_url`.
  58. */
  59. + (void)redirectURLsForCallbackURLScheme:(nonnull NSString *)callbackURLScheme withReturnURL:(NSString * _Nonnull * _Nonnull)returnURL withCancelURL:(NSString * _Nonnull * _Nonnull)cancelURL;
  60. /**
  61. The version of the SDK library in use. Version numbering follows http://semver.org/.
  62. @note Please be sure to include this library version in tech support requests.
  63. */
  64. + (nonnull NSString *)libraryVersion;
  65. @end