BTPaymentMethodNonce.m 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #if __has_include(<Braintree/BraintreeCore.h>)
  2. #import <Braintree/BTPaymentMethodNonce.h>
  3. #else
  4. #import <BraintreeCore/BTPaymentMethodNonce.h>
  5. #endif
  6. @interface BTPaymentMethodNonce ()
  7. @property (nonatomic, copy, readwrite) NSString *nonce;
  8. @property (nonatomic, copy, readwrite) NSString *type;
  9. @property (nonatomic, readwrite, assign) BOOL isDefault;
  10. @end
  11. @implementation BTPaymentMethodNonce
  12. - (instancetype)initWithNonce:(NSString *)nonce type:(NSString *)type {
  13. if (!nonce) return nil;
  14. if (self = [super init]) {
  15. self.nonce = nonce;
  16. self.type = type;
  17. }
  18. return self;
  19. }
  20. - (nullable instancetype)initWithNonce:(NSString *)nonce {
  21. return [self initWithNonce:nonce type:@"Unknown"];
  22. }
  23. - (nullable instancetype)initWithNonce:(NSString *)nonce
  24. type:(nonnull NSString *)type
  25. isDefault:(BOOL)isDefault {
  26. if (self = [self initWithNonce:nonce type:type]) {
  27. _isDefault = isDefault;
  28. }
  29. return self;
  30. }
  31. @end