diff --git a/Sources/BraintreeDropIn/BTPaymentMethodNonce+DropIn.m b/Sources/BraintreeDropIn/BTPaymentMethodNonce+DropIn.m index 781d4793..7ebe42c5 100644 --- a/Sources/BraintreeDropIn/BTPaymentMethodNonce+DropIn.m +++ b/Sources/BraintreeDropIn/BTPaymentMethodNonce+DropIn.m @@ -37,7 +37,7 @@ - (NSString *)paymentDescription { - (BOOL)shouldDisplayVaultedNonceForRequest:(BTDropInRequest *)request config:(BTConfiguration *)configuration { if ([self isKindOfClass:BTCardNonce.class] && (request.cardDisabled || configuration.supportedCardTypes.count == 0)) { return NO; - } else if ([self isKindOfClass:BTPayPalAccountNonce.class] && (request.paypalDisabled || !configuration.isPayPalEnabled)) { + } else if ([self isKindOfClass:BTPayPalAccountNonce.class] && (request.paypalDisabled || request.vaultedPaypalAccountsDisabled || !configuration.isPayPalEnabled)) { return NO; } else if ([self isKindOfClass:BTVenmoAccountNonce.class] && (request.venmoDisabled || !configuration.isVenmoEnabled)) { return NO; diff --git a/Sources/BraintreeDropIn/Models/BTDropInRequest.m b/Sources/BraintreeDropIn/Models/BTDropInRequest.m index 7957fe2b..c28e9e6b 100644 --- a/Sources/BraintreeDropIn/Models/BTDropInRequest.m +++ b/Sources/BraintreeDropIn/Models/BTDropInRequest.m @@ -32,6 +32,7 @@ - (id)copyWithZone:(__unused NSZone *)zone { request.vaultManager = self.vaultManager; request.vaultCard = self.vaultCard; request.allowVaultCardOverride = self.allowVaultCardOverride; + request.vaultedPaypalAccountsDisabled = self.vaultedPaypalAccountsDisabled; return request; } diff --git a/Sources/BraintreeDropIn/Public/BraintreeDropIn/BTDropInRequest.h b/Sources/BraintreeDropIn/Public/BraintreeDropIn/BTDropInRequest.h index 2aa928d5..e768f68c 100644 --- a/Sources/BraintreeDropIn/Public/BraintreeDropIn/BTDropInRequest.h +++ b/Sources/BraintreeDropIn/Public/BraintreeDropIn/BTDropInRequest.h @@ -43,6 +43,9 @@ typedef NS_ENUM(NSInteger, BTFormFieldSetting) { /// Defaults to false. Set to true to hide all card logos for your account. @property (nonatomic, assign) BOOL cardLogosDisabled; +/// Defaults to false. Set to true to hide vaulted PayPal accounts even if enabled for your account. +@property (nonatomic, assign) BOOL vaultedPaypalAccountsDisabled; + /// Optional: Enable 3DS verification and specify options and additional information. /// /// Note: To encourage 3DS 2.0 flows, set `billingAddress`, `amount`, `email`, `mobilePhone` for best results. diff --git a/UnitTests/BTDropInRequestTests.m b/UnitTests/BTDropInRequestTests.m index 58518d46..0379cac2 100644 --- a/UnitTests/BTDropInRequestTests.m +++ b/UnitTests/BTDropInRequestTests.m @@ -52,6 +52,7 @@ - (void)test_copyProperties { originalRequest.vaultManager = YES; originalRequest.vaultCard = NO; originalRequest.allowVaultCardOverride = YES; + originalRequest.vaultedPaypalAccountsDisabled = YES; BTDropInRequest *copiedRequest = [originalRequest copy]; @@ -67,6 +68,7 @@ - (void)test_copyProperties { XCTAssertEqual(originalRequest.vaultManager, copiedRequest.vaultManager); XCTAssertEqual(originalRequest.vaultCard, copiedRequest.vaultCard); XCTAssertEqual(originalRequest.allowVaultCardOverride, copiedRequest.allowVaultCardOverride); + XCTAssertEqual(originalRequest.vaultedPaypalAccountsDisabled, copiedRequest.vaultedPaypalAccountsDisabled); XCTAssertEqual(originalRequest.threeDSecureRequest, copiedRequest.threeDSecureRequest); XCTAssertEqual(BTThreeDSecureVersion2, copiedRequest.threeDSecureRequest.versionRequested);