CardinalSession.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //
  2. // CardinalSession.h
  3. // CardinalMobileSDK
  4. //
  5. // Copyright © 2018 CardinalCommerce. All rights reserved.
  6. //
  7. #import <Foundation/Foundation.h>
  8. #import "Warning.h"
  9. #import "DirectoryServerIDConst.h"
  10. NS_ASSUME_NONNULL_BEGIN
  11. @class CardinalResponse;
  12. @class CardinalSessionConfiguration;
  13. @protocol CardinalValidationDelegate;
  14. /*!
  15. * Code block to be invoked on the main thread upon successful completion of Cardinal Setup.
  16. * If an error occurs this code block will not be invoked.
  17. *
  18. * @param consumerSessionId Pass this parameter to a CMPI LookUp upon successful completion of Setup.
  19. */
  20. typedef void (^CardinalSessionSetupDidCompleteHandler)(NSString *consumerSessionId);
  21. /*!
  22. * Code block to be invoked on the main thread if Cardinal Setup fails.
  23. * If no error occurs this code block will not be invoked.
  24. *
  25. * @param validateResponse This parameter will populated with data to indicate what problem occurred during Setup.
  26. */
  27. typedef void (^CardinalSessionSetupDidValidateHandler)(CardinalResponse *validateResponse);
  28. /*!
  29. * Code block to be invoked on the main thread upon successful completion of the Process Bin step.
  30. * If an error occurs this code block will not be invoked.
  31. */
  32. typedef void (^CardinalSessionProcessBinDidCompleteHandler)(void);
  33. /*!
  34. * @interface CardinalSession
  35. * @brief CardinalSession Class for configuring, setting up and providing information for a given session of transaction.
  36. */
  37. @interface CardinalSession : NSObject
  38. /*!
  39. * Sets parameters for this session
  40. * @param sessionConfig configurations for current CardinalSession
  41. */
  42. - (void)configure:(CardinalSessionConfiguration*)sessionConfig;
  43. /*!
  44. * Sets up the "frictionless" transaction flow that allows your app to provide its own JWT.
  45. * Only one of the handler code blocks will be invoked, depending on whether Cardinal Setup was successful or not. Handlers will be invoked on the main thread.
  46. * @param jwtString A valid JSON Web Token string obtained from the server.
  47. * @param didCompleteHandler Code to be invoked upon successful completion of Cardinal Setup.
  48. * @param didValidateHandler Code to be invoked if a problem occurs when attempting Cardinal Setup.
  49. */
  50. - (void)setupWithJWT:(NSString*)jwtString
  51. didComplete:(CardinalSessionSetupDidCompleteHandler)didCompleteHandler
  52. didValidate:(CardinalSessionSetupDidValidateHandler)didValidateHandler NS_SWIFT_NAME(setup(jwtString:completed:validated:));
  53. #if TARGET_OS_IOS
  54. /*!
  55. * Sets up the frictionless "Quick Authentication" transaction flow that allows your app to provide its own JWT and account number.
  56. * Only one of the handler code blocks will be invoked, depending on whether Cardinal Setup was successful or not. Handlers will be invoked on the main thread.
  57. * @brief This property is deprecated in v2.2.4. This feature will no longer be supported in the SDK.
  58. * @param jwtString A valid JSON Web Token string obtained from the Midas server.
  59. * @param accountNumber A valid account number ("bin number") string.
  60. * @param didCompleteHandler Code to be invoked upon successful completion of Cardinal Setup.
  61. * @param didValidateHandler Code to be invoked if a problem occurs when attempting Cardinal Setup.
  62. */
  63. - (void)setupWithJWT:(NSString*)jwtString
  64. accountNumber:(NSString*)accountNumber
  65. didComplete:(CardinalSessionSetupDidCompleteHandler)didCompleteHandler
  66. didValidate:(CardinalSessionSetupDidValidateHandler)didValidateHandler NS_SWIFT_NAME(setup(jwtString:account:completed:validated:))__deprecated;
  67. /*!
  68. * Process a "Bin" account number as part of the "Quick Authentication" transaction flow.
  69. * May be invoked multiple times with different account numbers.
  70. * @brief This property is deprecated in 2.2.4. This feature will no longer be supported in the SDK.
  71. * @param accountNumber A valid account number ("bin number") string.
  72. * @param didCompleteHandler Code to be invoked upon successfully processing an account number. Handler will be invoked on the main thread.
  73. */
  74. - (void)processBin:(NSString*)accountNumber
  75. didComplete:(nullable CardinalSessionProcessBinDidCompleteHandler)didCompleteHandler NS_SWIFT_NAME(processBin(_:completed:))__deprecated;
  76. #endif
  77. /*!
  78. * Continue the challenge flow using SDK Controlled UI with the transaction id and encoded payload.
  79. * @param transactionId Transaction ID
  80. * @param payload Encoded Payload from Lookup
  81. * @param validationDelegate Class confronting to CardinalValidationDelegate protocol which receives the Validation Response after the challenge completion.
  82. */
  83. - (void)continueWithTransactionId:(nonnull NSString *)transactionId
  84. payload:(nonnull NSString *)payload
  85. didValidateDelegate:(nonnull id<CardinalValidationDelegate>)validationDelegate NS_SWIFT_NAME(continueWith(transactionId:payload:validationDelegate:));
  86. /**
  87. * The getWarnings method returns the warnings produced by the 3DS SDK during initialization.
  88. * @return List of Warnings
  89. */
  90. - (NSArray<Warning *> *)getWarnings;
  91. /**
  92. * The getSDKBuildNumber method returns the build number of the Cardinal Mobile SDK.
  93. * @return SDK Build Number
  94. */
  95. + (NSString *)getSDKBuildNumber;
  96. /**
  97. * The getSDKBuildNumber method returns the build version of the Cardinal Mobile SDK.
  98. * @return SDK Build Version
  99. */
  100. + (NSString *)getSDKBuildVersion;
  101. @end
  102. NS_ASSUME_NONNULL_END