Skip to content

Commit

Permalink
update dropin, add optional card vaulting
Browse files Browse the repository at this point in the history
  • Loading branch information
GFean committed Aug 31, 2021
1 parent 5582c8f commit 0f42369
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Binary file added .DS_Store
Binary file not shown.
11 changes: 8 additions & 3 deletions ios/RNBraintreeDropIn.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ - (dispatch_queue_t)methodQueue
self.resolve = resolve;
self.reject = reject;
self.applePayAuthorized = NO;


NSString* clientToken = options[@"clientToken"];
if (!clientToken) {
Expand Down Expand Up @@ -67,7 +68,10 @@ - (dispatch_queue_t)methodQueue
if([options[@"vaultManager"] boolValue]){
request.vaultManager = YES;
}


if(![options[@"savePaymentDetails"]boolValue]){
request.vaultCard = NO;
}
if(![options[@"payPal"] boolValue]){ //disable paypal
request.paypalDisabled = YES;
}
Expand All @@ -87,12 +91,13 @@ - (dispatch_queue_t)methodQueue
return;
}
self.braintreeClient = [[BTAPIClient alloc] initWithAuthorization:clientToken];

self.paymentRequest = [[PKPaymentRequest alloc] init];
self.paymentRequest.merchantIdentifier = merchantIdentifier;
self.paymentRequest.merchantCapabilities = PKMerchantCapability3DS;
self.paymentRequest.countryCode = countryCode;
self.paymentRequest.currencyCode = currencyCode;

self.paymentRequest.supportedNetworks = @[PKPaymentNetworkAmex, PKPaymentNetworkVisa, PKPaymentNetworkMasterCard, PKPaymentNetworkDiscover, PKPaymentNetworkChinaUnionPay];
self.paymentRequest.paymentSummaryItems =
@[
Expand Down Expand Up @@ -188,7 +193,7 @@ - (void)paymentAuthorizationViewControllerDidFinish:(PKPaymentAuthorizationViewC
}

+ (void)resolvePayment:(BTDropInResult* _Nullable)result deviceData:(NSString * _Nonnull)deviceDataCollector resolver:(RCTPromiseResolveBlock _Nonnull)resolve {
//NSLog(@"result = %@", result);
NSLog(@"result = %@", result);

NSMutableDictionary* jsResult = [NSMutableDictionary new];

Expand Down

0 comments on commit 0f42369

Please sign in to comment.