BTPayPalDriver_Internal.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #import "BTPayPalDriver.h"
  2. #import "BTPayPalRequestFactory.h"
  3. #import <SafariServices/SafariServices.h>
  4. NS_ASSUME_NONNULL_BEGIN
  5. @interface BTPayPalDriver ()
  6. /**
  7. Set up the callback to be invoked on return from browser or app switch for PayPal Express Checkout (Checkout Flow)
  8. Exposed internally to test BTPayPalDriver app switch return behavior by simulating an app switch return
  9. */
  10. - (void)setOneTimePaymentAppSwitchReturnBlock:(void (^)(BTPayPalAccountNonce * _Nullable tokenizedCheckout, NSError * _Nullable error))completionBlock;
  11. /**
  12. Set up the callback to be invoked on return from browser or app switch for PayPal Billing Agreement (Vault Flow)
  13. Exposed internally to test BTPayPalDriver app switch return behavior by simulating an app switch return
  14. */
  15. - (void)setBillingAgreementAppSwitchReturnBlock:(void (^)(BTPayPalAccountNonce * _Nullable tokenizedAccount, NSError * _Nullable error))completionBlock;
  16. /**
  17. Set up the callback to be invoked on return from browser or app switch for PayPal Future Payments (Vault Flow)
  18. Exposed internally to test BTPayPalDriver app switch return behavior by simulating an app switch return
  19. */
  20. - (void)setAuthorizationAppSwitchReturnBlock:(void (^)(BTPayPalAccountNonce * _Nullable tokenizedAccount, NSError * _Nullable error))completionBlock;
  21. - (void)informDelegatePresentingViewControllerRequestPresent:(NSURL*) appSwitchURL;
  22. - (void)informDelegatePresentingViewControllerNeedsDismissal;
  23. /**
  24. Exposed for testing to create stubbed versions of `PayPalOneTouchAuthorizationRequest` and `PayPalOneTouchCheckoutRequest`
  25. */
  26. @property (nonatomic, strong) BTPayPalRequestFactory *requestFactory;
  27. /**
  28. Exposed for testing to provide subclasses of PayPalOneTouchCore to stub class methods
  29. */
  30. + (Class)payPalClass;
  31. + (void)setPayPalClass:(Class)payPalClass;
  32. /**
  33. Exposed for testing to provide a convenient way to inject custom return URL schemes
  34. */
  35. @property (nonatomic, copy) NSString *returnURLScheme;
  36. /**
  37. Exposed for testing to get the instance of BTAPIClient after it has been copied by `copyWithSource:integration:`
  38. */
  39. @property (nonatomic, strong, nullable) BTAPIClient *apiClient;
  40. /**
  41. Exposed for testing the clientMetadataId associated with this request
  42. */
  43. @property (nonatomic, strong) NSString *clientMetadataId;
  44. /**
  45. Exposed for testing the intent associated with this request
  46. */
  47. @property (nonatomic, strong) BTPayPalRequest *payPalRequest;
  48. /**
  49. Exposed for testing, the safariViewController instance used for the PayPal flow on iOS 9 and 10
  50. */
  51. @property (nonatomic, strong, nullable) SFSafariViewController *safariViewController API_AVAILABLE(ios(9.0));
  52. /**
  53. Exposed for testing, the safariAuthenticationSession instance used for the PayPal flow on iOS >=11
  54. */
  55. @property (nonatomic, strong, nullable) SFAuthenticationSession *safariAuthenticationSession API_AVAILABLE(ios(11.0));
  56. /**
  57. Exposed for testing, for determining if SFAuthenticationSession was started
  58. */
  59. @property (nonatomic, assign) BOOL isSFAuthenticationSessionStarted;
  60. /**
  61. Exposed for testing, for disabling SFAuthenticationSession and use SFSafariViewController or Safari
  62. */
  63. @property (nonatomic, assign) BOOL disableSFAuthenticationSession;
  64. /**
  65. Used to test the Future Payments flow by force
  66. */
  67. - (void)authorizeAccountWithAdditionalScopes:(NSSet<NSString *> *)additionalScopes forceFuturePaymentFlow:(BOOL)forceFuturePaymentFlow completion:(void (^)(BTPayPalAccountNonce *, NSError *))completionBlock;
  68. + (nullable BTPayPalCreditFinancingAmount *)creditFinancingAmountFromJSON:(BTJSON *)amountJSON;
  69. + (nullable BTPayPalCreditFinancing *)creditFinancingFromJSON:(BTJSON *)creditFinancingOfferedJSON;
  70. @end
  71. NS_ASSUME_NONNULL_END