BTThreeDSecureInfo.m 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #if __has_include(<Braintree/BraintreeCard.h>)
  2. #import <Braintree/BTThreeDSecureInfo.h>
  3. #import <Braintree/BraintreeCore.h>
  4. #else
  5. #import <BraintreeCard/BTThreeDSecureInfo.h>
  6. #import <BraintreeCore/BraintreeCore.h>
  7. #endif
  8. @interface BTThreeDSecureInfo ()
  9. @property (nonatomic, strong) BTJSON *threeDSecureJSON;
  10. @end
  11. @implementation BTThreeDSecureInfo
  12. - (instancetype)initWithJSON:(BTJSON *)json {
  13. if (self = [super init]) {
  14. if (json != nil) {
  15. _threeDSecureJSON = json;
  16. } else {
  17. _threeDSecureJSON = [BTJSON new];
  18. }
  19. }
  20. return self;
  21. }
  22. - (NSString *)acsTransactionID {
  23. return [self.threeDSecureJSON[@"acsTransactionId"] asString];
  24. }
  25. - (NSString *)authenticationTransactionStatus {
  26. return [self.threeDSecureJSON[@"authentication"][@"transStatus"] asString];
  27. }
  28. - (NSString *)authenticationTransactionStatusReason {
  29. return [self.threeDSecureJSON[@"authentication"][@"transStatusReason"] asString];
  30. }
  31. - (NSString *)cavv {
  32. return [self.threeDSecureJSON[@"cavv"] asString];
  33. }
  34. - (NSString *)dsTransactionID {
  35. return [self.threeDSecureJSON[@"dsTransactionId"] asString];
  36. }
  37. - (NSString *)eciFlag {
  38. return [self.threeDSecureJSON[@"eciFlag"] asString];
  39. }
  40. - (NSString *)enrolled {
  41. return [self.threeDSecureJSON[@"enrolled"] asString];
  42. }
  43. - (BOOL)liabilityShifted {
  44. return [self.threeDSecureJSON[@"liabilityShifted"] isTrue];
  45. }
  46. - (BOOL)liabilityShiftPossible {
  47. return [self.threeDSecureJSON[@"liabilityShiftPossible"] isTrue];
  48. }
  49. - (NSString *)lookupTransactionStatus {
  50. return [self.threeDSecureJSON[@"lookup"][@"transStatus"] asString];
  51. }
  52. - (NSString *)lookupTransactionStatusReason {
  53. return [self.threeDSecureJSON[@"lookup"][@"transStatusReason"] asString];
  54. }
  55. - (NSString *)paresStatus {
  56. return [self.threeDSecureJSON[@"paresStatus"] asString];
  57. }
  58. - (NSString *)status {
  59. return [self.threeDSecureJSON[@"status"] asString];
  60. }
  61. - (NSString *)threeDSecureAuthenticationID {
  62. return [self.threeDSecureJSON[@"threeDSecureAuthenticationId"] asString];
  63. }
  64. - (NSString *)threeDSecureServerTransactionID {
  65. return [self.threeDSecureJSON[@"threeDSecureServerTransactionId"] asString];
  66. }
  67. - (NSString *)threeDSecureVersion {
  68. return [self.threeDSecureJSON[@"threeDSecureVersion"] asString];
  69. }
  70. - (BOOL)wasVerified {
  71. return ![self.threeDSecureJSON[@"liabilityShifted"] isError] &&
  72. ![self.threeDSecureJSON[@"liabilityShiftPossible"] isError];
  73. }
  74. - (NSString *)xid {
  75. return [self.threeDSecureJSON[@"xid"] asString];
  76. }
  77. @end