PPOTConfiguration.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // PPOTConfiguration.h
  3. // PayPalOneTouch
  4. //
  5. // Copyright © 2015 PayPal, Inc. All rights reserved.
  6. //
  7. #import <Foundation/Foundation.h>
  8. #import "PPOTCore.h"
  9. #import "PPOTRequest.h"
  10. @interface PPOTConfigurationRecipe : NSObject <NSCoding>
  11. @property (nonatomic, assign, readwrite) PPOTRequestTarget target;
  12. @property (nonatomic, strong, readwrite) NSNumber *protocolVersion;
  13. @property (nonatomic, strong, readwrite) NSArray *supportedLocales; // these have been uppercased, to prevent capitalization mistakes
  14. @property (nonatomic, strong, readwrite) NSString *targetAppURLScheme;
  15. @property (nonatomic, strong, readwrite) NSArray *targetAppBundleIDs;
  16. @end
  17. @interface PPOTConfigurationRecipeEndpoint : NSObject <NSCoding>
  18. @property (nonatomic, strong, readwrite) NSString *url;
  19. @property (nonatomic, strong, readwrite) NSString *certificateSerialNumber;
  20. @property (nonatomic, strong, readwrite) NSString *base64EncodedCertificate;
  21. @end
  22. @interface PPOTConfigurationOAuthRecipe : PPOTConfigurationRecipe <NSCoding>
  23. @property (nonatomic, strong, readwrite) NSSet *scope;
  24. @property (nonatomic, strong, readwrite) NSDictionary *endpoints; // dictionary of PPOTConfigurationRecipeEndpoint
  25. @end
  26. @interface PPOTConfigurationCheckoutRecipe : PPOTConfigurationRecipe <NSCoding>
  27. // no subclass-specific properties, so far
  28. @end
  29. @interface PPOTConfigurationBillingAgreementRecipe : PPOTConfigurationRecipe <NSCoding>
  30. // no subclass-specific properties, so far
  31. @end
  32. @class PPOTConfiguration;
  33. typedef void (^PPOTConfigurationCompletionBlock)(PPOTConfiguration *currentConfiguration);
  34. @interface PPOTConfiguration : NSObject <NSCoding>
  35. /**
  36. In the background: if the cached configuration is stale, then downloads the latest version.
  37. */
  38. + (void)updateCacheAsNecessary;
  39. /**
  40. Returns the current configuration, either from cache or else the hardcoded default configuration.
  41. */
  42. + (PPOTConfiguration *)getCurrentConfiguration;
  43. /**
  44. This method is here only for PPOTConfigurationTest.
  45. Everyone else, please stick to using [PPOTConfiguration getCurrentConfiguration]!!!
  46. */
  47. + (PPOTConfiguration *)configurationWithDictionary:(NSDictionary *)dictionary;
  48. #ifdef DEBUG
  49. + (void)useHardcodedConfiguration:(BOOL)useHardcodedConfiguration;
  50. #endif
  51. @property (nonatomic, strong, readwrite) NSString *fileTimestamp;
  52. @property (nonatomic, strong, readwrite) NSArray *prioritizedOAuthRecipes;
  53. @property (nonatomic, strong, readwrite) NSArray *prioritizedCheckoutRecipes;
  54. @property (nonatomic, strong, readwrite) NSArray *prioritizedBillingAgreementRecipes;
  55. @end
  56. // The following definitions are for backwards compatibility
  57. @interface PPConfiguration: PPOTConfiguration
  58. @end
  59. @interface PPConfigurationCheckoutRecipe : PPOTConfigurationCheckoutRecipe
  60. @end
  61. @interface PPConfigurationBillingAgreementRecipe : PPOTConfigurationBillingAgreementRecipe
  62. @end
  63. @interface PPConfigurationOAuthRecipe : PPOTConfigurationOAuthRecipe
  64. @end
  65. @interface PPConfigurationRecipeEndpoint : PPOTConfigurationRecipeEndpoint
  66. @end