// // PPOTCore.h // // Copyright © 2015 PayPal, Inc. All rights reserved. // // Required Frameworks for the library. Additionally, make sure to set OTHER_LDFLAGS = -ObjC #import #import #import #import #import "PPOTResult.h" /** Completion block for receiving the result of performing a request */ typedef void (^PPOTCompletionBlock)(PPOTResult * _Nonnull result); /** Used for PayPal payment processing */ @interface PPOTCore : NSObject /** Check if the application is configured correctly to handle responses for One Touch flow. @param callbackURLScheme The URL scheme which the app has registered for One Touch responses. @return `YES` iff the application is correctly configured. */ + (BOOL)doesApplicationSupportOneTouchCallbackURLScheme:(nonnull NSString *)callbackURLScheme; /** Check whether the PayPal Wallet app is installed on this device (iOS <= 8). Universal links are used in iOS >=9 so the check is not performed @return `YES` if the wallet app is installed */ + (BOOL)isWalletAppInstalled; /** Check whether the URL and source application are recognized and valid for One Touch. Usually called as a result of the `UIApplicationDelegate`'s `- (BOOL)application:openURL:sourceApplication:annotation:` method to determine if the URL is intended for the One Touch library. (To then actually process the URL, call `+ (void)parseOneTouchURL:completionBlock`.) @param url The URL of the app switch request @param sourceApplication The bundle ID of the source application @return `YES` iff the URL and sending app are both valid. */ + (BOOL)canParseURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication; /** Process a URL response. @param url The URL to process @param completionBlock completion block for receiving the result of performing a request */ + (void)parseResponseURL:(nonnull NSURL *)url completionBlock:(nonnull PPOTCompletionBlock)completionBlock; /** URLs to return control from the browser/wallet to the app containing the One Touch library. For payment processing, the client's server will first create a payment on the PayPal server. Creating that payment requires, among many other things, a `redirect_urls` object containing two strings: `return_url` and `cancel_url`. @note Both return values will be `nil` if [PPOTCore doesApplicationSupportOneTouchCallbackURLScheme:callbackURLScheme] is not true. @param callbackURLScheme The URL scheme which the app has registered for One Touch responses. @param returnURL A string containing the `return_url`. @param cancelURL A string containing the `cancel_url`. */ + (void)redirectURLsForCallbackURLScheme:(nonnull NSString *)callbackURLScheme withReturnURL:(NSString * _Nonnull * _Nonnull)returnURL withCancelURL:(NSString * _Nonnull * _Nonnull)cancelURL; /** The version of the SDK library in use. Version numbering follows http://semver.org/. @note Please be sure to include this library version in tech support requests. */ + (nonnull NSString *)libraryVersion; @end