PPOTRequest_Internal.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // PPOTRequest_Internal.h
  3. // PayPalOneTouch
  4. //
  5. // Copyright © 2015 PayPal, Inc. All rights reserved.
  6. //
  7. #import "PPOTRequest.h"
  8. @class PPOTSwitchRequest;
  9. @class PPOTConfigurationRecipe;
  10. // All requests must have this
  11. @interface PPOTRequest ()
  12. // mandatory fields
  13. /**
  14. All requests MUST include the app's Client ID, as obtained from developer.paypal.com
  15. */
  16. @property (nonatomic, readwrite) NSString *clientID;
  17. /**
  18. All requests MUST indicate the environment - PayPalEnvironmentProduction, PayPalEnvironmentMock, or PayPalEnvironmentSandbox;
  19. or else a stage indicated as `base-url:port`
  20. */
  21. @property (nonatomic, readwrite) NSString *environment;
  22. /**
  23. All requests MUST indicate the URL scheme to be used for returning to this app, following an app-switch
  24. */
  25. @property (nonatomic, readwrite) NSString *callbackURLScheme;
  26. /**
  27. If client calls getTargetApp:, then cache the result here for later use by performWithCompletionBlock:.
  28. */
  29. @property (nonatomic, readwrite) PPOTConfigurationRecipe *configurationRecipe;
  30. /**
  31. Recipe behavior override, for debugging purposes only.
  32. PPOTRequestTargetBrowser - always switch to browser; i.e., ignore all Wallet recipes
  33. PPOTRequestTargetOnDeviceApplication - always switch to Wallet; i.e., ignore all Browser recipes
  34. PPOTRequestTargetNone or PayPalOneTouchRequestTargetUnknown - obey recipes
  35. */
  36. @property (nonatomic, readwrite) NSNumber *forcedTarget;
  37. - (instancetype)initWithClientID:(NSString *)clientID
  38. environment:(NSString *)environment
  39. callbackURLScheme:(NSString *)callbackURLScheme;
  40. /**
  41. subclasses must override
  42. */
  43. - (PPOTSwitchRequest *)getAppSwitchRequestForConfigurationRecipe:(PPOTConfigurationRecipe *)configurationRecipe;
  44. - (void)getAppropriateConfigurationRecipe:(void (^)(PPOTConfigurationRecipe *configurationRecipe))completionBlock;
  45. - (BOOL)isConfigurationRecipeTargetSupported:(PPOTConfigurationRecipe *)configurationRecipe;
  46. - (BOOL)isConfigurationRecipeLocaleSupported:(PPOTConfigurationRecipe *)configurationRecipe;
  47. @end