BTCardClient+UnionPay.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #if __has_include("BraintreeCard.h")
  2. #import "BraintreeCard.h"
  3. #else
  4. #import <BraintreeCard/BraintreeCard.h>
  5. #endif
  6. @class BTCardCapabilities, BTCardRequest;
  7. NS_ASSUME_NONNULL_BEGIN
  8. /**
  9. BTCardClient category for UnionPay
  10. */
  11. @interface BTCardClient (UnionPay)
  12. /**
  13. Fetches the capabilities of a card number.
  14. This should be used to look up a card PAN to see whether it is UnionPay, and if so, what is required to tokenize it.
  15. @param cardNumber The card number.
  16. @param completion A completion block that is invoked when the card capabilities have been fetched.
  17. */
  18. - (void)fetchCapabilities:(NSString *)cardNumber
  19. completion:(void (^)(BTCardCapabilities * _Nullable cardCapabilities, NSError * _Nullable error))completion;
  20. /**
  21. Enrolls a UnionPay card and returns an enrollment ID. The `enrollmentID` property of `BTCardRequest` must be set to this IDbefore the card can be tokenized.
  22. Attempting to enroll cards that do not require enrollment -- including non-UnionPay cards -- will cause an error. This
  23. can be prevented by checking the card's capabilities first.
  24. @param request A card tokenization request that contains a card, mobile phone number, and country code. Cannot be `nil`.
  25. @param completion A callback block that will be invoked on the main thread when enrollment has completed. When enrollment succeeds, `error` is `nil`, `enrollmentID` contains the enrollment ID, and `smsCodeRequired` indicates whether an SMS code was sent to the customer. If an SMS code is not sent, tokenization can occur immediately afterwards.
  26. @see -fetchCapabilities:completion:
  27. @see BTCardClient -tokenizeCard:options:completion:
  28. */
  29. - (void)enrollCard:(BTCardRequest *)request
  30. completion:(void (^)(NSString * _Nullable enrollmentID, BOOL smsCodeRequired, NSError * _Nullable error))completion;
  31. @end
  32. NS_ASSUME_NONNULL_END