From 9cf4fc6eda2162cdb41de551fd150305e8bcd590 Mon Sep 17 00:00:00 2001 From: Condi <1440309@qq.com> Date: Fri, 27 Feb 2026 00:58:05 +0800 Subject: [PATCH] init --- android/build.gradle | 5 ++- example/App.tsx | 38 +++++++++++++-------- lib/commonjs/NativeRNBraintreeDropIn.js.map | 2 +- lib/commonjs/index.js.map | 2 +- lib/module/NativeRNBraintreeDropIn.js.map | 2 +- lib/module/index.js.map | 2 +- react-native-braintree-dropin-turbo.podspec | 11 +++--- src/NativeRNBraintreeDropIn.ts | 4 ++- src/index.ts | 6 +++- 9 files changed, 46 insertions(+), 26 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index eb7d808..30a7cd1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -71,10 +71,13 @@ dependencies { implementation "com.facebook.react:react-native:+" implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.21" - // Braintree Dependencies - Latest versions + // Braintree implementation 'com.braintreepayments.api:drop-in:6.16.0' implementation 'com.braintreepayments.api:card:4.45.0' implementation 'com.braintreepayments.api:data-collector:4.45.0' implementation 'com.braintreepayments.api:google-pay:4.45.0' implementation 'com.braintreepayments.api:venmo:4.45.0' + + // Google Pay + implementation 'com.google.android.gms:play-services-wallet:19.2.1' } diff --git a/example/App.tsx b/example/App.tsx index e86f6ac..20de3bd 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -20,7 +20,9 @@ import BraintreeDropIn, { const BRAINTREE_CLIENT_TOKEN = 'sandbox_g42y39zw_348pk9cgf3bgyw2b'; const App = () => { - const [paymentResult, setPaymentResult] = useState(null); + const [paymentResult, setPaymentResult] = useState( + null + ); const [loading, setLoading] = useState(false); const [deviceData, setDeviceData] = useState(''); @@ -42,7 +44,10 @@ const App = () => { const result = await BraintreeDropIn.show(options); setPaymentResult(result); - showAlert('Success!', `Payment nonce received: ${result.nonce.substring(0, 20)}...`); + showAlert( + 'Success!', + `Payment nonce received: ${result.nonce.substring(0, 20)}...` + ); console.log('Payment Result:', result); } catch (error: any) { if (error.message === 'USER_CANCELLATION') { @@ -96,7 +101,10 @@ const App = () => { // Test 3: Google Pay (Android only) const handleGooglePay = async () => { if (Platform.OS !== 'android') { - showAlert('Android Only', 'Google Pay is only available on Android devices'); + showAlert( + 'Android Only', + 'Google Pay is only available on Android devices' + ); return; } @@ -134,10 +142,10 @@ const App = () => { try { const options: DropInOptions = { clientToken: BRAINTREE_CLIENT_TOKEN, - orderTotal: 100.00, + orderTotal: 100.0, currencyCode: 'USD', threeDSecure: { - amount: 100.00, + amount: 100.0, }, venmo: true, payPal: true, @@ -192,7 +200,9 @@ const App = () => { const handleCollectDeviceData = async () => { setLoading(true); try { - const data = await BraintreeDropIn.collectDeviceData(BRAINTREE_CLIENT_TOKEN); + const data = await BraintreeDropIn.collectDeviceData( + BRAINTREE_CLIENT_TOKEN + ); setDeviceData(data); showAlert('Device Data Collected', `Length: ${data.length} characters`); console.log('Device Data:', data.substring(0, 100) + '...'); @@ -234,7 +244,7 @@ const App = () => { const options: DropInOptions = { clientToken: BRAINTREE_CLIENT_TOKEN, vaultManager: true, - orderTotal: 25.00, + orderTotal: 25.0, currencyCode: 'USD', }; @@ -299,7 +309,6 @@ const App = () => { - Braintree Drop-In React Native Turbo Module Example @@ -314,7 +323,7 @@ const App = () => { Basic Tests - + { Platform-Specific - + { Advanced Features - + { {paymentResult && ( Last Payment Result: - + Type: {paymentResult.type} @@ -389,7 +398,9 @@ const App = () => { Description: - {paymentResult.description} + + {paymentResult.description} + @@ -432,7 +443,6 @@ const App = () => { ⚠️ Remember to replace BRAINTREE_CLIENT_TOKEN with your actual token - ); diff --git a/lib/commonjs/NativeRNBraintreeDropIn.js.map b/lib/commonjs/NativeRNBraintreeDropIn.js.map index 5d72e89..3292ffe 100644 --- a/lib/commonjs/NativeRNBraintreeDropIn.js.map +++ b/lib/commonjs/NativeRNBraintreeDropIn.js.map @@ -1 +1 @@ -{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeRNBraintreeDropIn.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAgDpCC,gCAAmB,CAACC,YAAY,CAAO,mBAAmB,CAAC","ignoreList":[]} +{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeRNBraintreeDropIn.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAkDpCC,gCAAmB,CAACC,YAAY,CAAO,mBAAmB,CAAC","ignoreList":[]} diff --git a/lib/commonjs/index.js.map b/lib/commonjs/index.js.map index ebc4410..99b9701 100644 --- a/lib/commonjs/index.js.map +++ b/lib/commonjs/index.js.map @@ -1 +1 @@ -{"version":3,"names":["_NativeRNBraintreeDropIn","_interopRequireDefault","require","e","__esModule","default","BraintreeDropIn","show","options","NativeRNBraintreeDropIn","fetchMostRecentPaymentMethod","clientToken","tokenizeCard","cardInfo","collectDeviceData","exports"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAgE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKjD,MAAMG,eAAe,CAAC;EACnC;AACF;AACA;AACA;AACA;EACE,OAAOC,IAAIA,CAACC,OAAsB,EAA0B;IAC1D,OAAOC,gCAAuB,CAACF,IAAI,CAACC,OAAO,CAAC;EAC9C;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOE,4BAA4BA,CACjCC,WAAmB,EACY;IAC/B,OAAOF,gCAAuB,CAACC,4BAA4B,CAACC,WAAW,CAAC;EAC1E;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,YAAYA,CACjBD,WAAmB,EACnBE,QAAkB,EACM;IACxB,OAAOJ,gCAAuB,CAACG,YAAY,CAACD,WAAW,EAAEE,QAAQ,CAAC;EACpE;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,iBAAiBA,CAACH,WAAmB,EAAmB;IAC7D,OAAOF,gCAAuB,CAACK,iBAAiB,CAACH,WAAW,CAAC;EAC/D;AACF;AAACI,OAAA,CAAAV,OAAA,GAAAC,eAAA","ignoreList":[]} +{"version":3,"names":["_NativeRNBraintreeDropIn","_interopRequireDefault","require","e","__esModule","default","BraintreeDropIn","show","options","NativeRNBraintreeDropIn","fetchMostRecentPaymentMethod","clientToken","tokenizeCard","cardInfo","collectDeviceData","exports"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAgE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AASjD,MAAMG,eAAe,CAAC;EACnC;AACF;AACA;AACA;AACA;EACE,OAAOC,IAAIA,CAACC,OAAsB,EAA0B;IAC1D,OAAOC,gCAAuB,CAACF,IAAI,CAACC,OAAO,CAAC;EAC9C;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOE,4BAA4BA,CACjCC,WAAmB,EACY;IAC/B,OAAOF,gCAAuB,CAACC,4BAA4B,CAACC,WAAW,CAAC;EAC1E;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,YAAYA,CACjBD,WAAmB,EACnBE,QAAkB,EACM;IACxB,OAAOJ,gCAAuB,CAACG,YAAY,CAACD,WAAW,EAAEE,QAAQ,CAAC;EACpE;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,iBAAiBA,CAACH,WAAmB,EAAmB;IAC7D,OAAOF,gCAAuB,CAACK,iBAAiB,CAACH,WAAW,CAAC;EAC/D;AACF;AAACI,OAAA,CAAAV,OAAA,GAAAC,eAAA","ignoreList":[]} diff --git a/lib/module/NativeRNBraintreeDropIn.js.map b/lib/module/NativeRNBraintreeDropIn.js.map index 9a39b17..0bb985e 100644 --- a/lib/module/NativeRNBraintreeDropIn.js.map +++ b/lib/module/NativeRNBraintreeDropIn.js.map @@ -1 +1 @@ -{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeRNBraintreeDropIn.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAgDlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,mBAAmB,CAAC","ignoreList":[]} +{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeRNBraintreeDropIn.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAkDlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,mBAAmB,CAAC","ignoreList":[]} diff --git a/lib/module/index.js.map b/lib/module/index.js.map index 697c0cf..4434289 100644 --- a/lib/module/index.js.map +++ b/lib/module/index.js.map @@ -1 +1 @@ -{"version":3,"names":["NativeRNBraintreeDropIn","BraintreeDropIn","show","options","fetchMostRecentPaymentMethod","clientToken","tokenizeCard","cardInfo","collectDeviceData"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,OAAOA,uBAAuB,MAAM,2BAA2B;AAK/D,eAAe,MAAMC,eAAe,CAAC;EACnC;AACF;AACA;AACA;AACA;EACE,OAAOC,IAAIA,CAACC,OAAsB,EAA0B;IAC1D,OAAOH,uBAAuB,CAACE,IAAI,CAACC,OAAO,CAAC;EAC9C;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,4BAA4BA,CACjCC,WAAmB,EACY;IAC/B,OAAOL,uBAAuB,CAACI,4BAA4B,CAACC,WAAW,CAAC;EAC1E;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,YAAYA,CACjBD,WAAmB,EACnBE,QAAkB,EACM;IACxB,OAAOP,uBAAuB,CAACM,YAAY,CAACD,WAAW,EAAEE,QAAQ,CAAC;EACpE;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,iBAAiBA,CAACH,WAAmB,EAAmB;IAC7D,OAAOL,uBAAuB,CAACQ,iBAAiB,CAACH,WAAW,CAAC;EAC/D;AACF","ignoreList":[]} +{"version":3,"names":["NativeRNBraintreeDropIn","BraintreeDropIn","show","options","fetchMostRecentPaymentMethod","clientToken","tokenizeCard","cardInfo","collectDeviceData"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,OAAOA,uBAAuB,MAAM,2BAA2B;AAS/D,eAAe,MAAMC,eAAe,CAAC;EACnC;AACF;AACA;AACA;AACA;EACE,OAAOC,IAAIA,CAACC,OAAsB,EAA0B;IAC1D,OAAOH,uBAAuB,CAACE,IAAI,CAACC,OAAO,CAAC;EAC9C;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,4BAA4BA,CACjCC,WAAmB,EACY;IAC/B,OAAOL,uBAAuB,CAACI,4BAA4B,CAACC,WAAW,CAAC;EAC1E;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,YAAYA,CACjBD,WAAmB,EACnBE,QAAkB,EACM;IACxB,OAAOP,uBAAuB,CAACM,YAAY,CAACD,WAAW,EAAEE,QAAQ,CAAC;EACpE;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,iBAAiBA,CAACH,WAAmB,EAAmB;IAC7D,OAAOL,uBAAuB,CAACQ,iBAAiB,CAACH,WAAW,CAAC;EAC/D;AACF","ignoreList":[]} diff --git a/react-native-braintree-dropin-turbo.podspec b/react-native-braintree-dropin-turbo.podspec index e840bb6..39b1d64 100644 --- a/react-native-braintree-dropin-turbo.podspec +++ b/react-native-braintree-dropin-turbo.podspec @@ -39,11 +39,12 @@ Pod::Spec.new do |s| end # Braintree Dependencies - # s.dependency 'Braintree', '~> 6.0' - # s.dependency 'BraintreeDropIn', '~> 9.0' - # s.dependency 'Braintree/DataCollector', '~> 6.0' - # s.dependency 'Braintree/ApplePay', '~> 6.0' - # s.dependency 'Braintree/Venmo', '~> 6.0' + s.dependency 'BraintreeDropIn', '9.12.2' + s.dependency 'Braintree/Core', '5.26.0' + s.dependency 'Braintree/Card', '5.26.0' + s.dependency 'Braintree/DataCollector', '5.26.0' + s.dependency 'Braintree/ApplePay', '5.26.0' + s.dependency 'Braintree/Venmo', '5.26.0' s.swift_version = '5.0' end diff --git a/src/NativeRNBraintreeDropIn.ts b/src/NativeRNBraintreeDropIn.ts index f98a7ff..4caf35f 100644 --- a/src/NativeRNBraintreeDropIn.ts +++ b/src/NativeRNBraintreeDropIn.ts @@ -42,7 +42,9 @@ export interface PaymentResult { export interface Spec extends TurboModule { show(options: DropInOptions): Promise; - fetchMostRecentPaymentMethod(clientToken: string): Promise; + fetchMostRecentPaymentMethod( + clientToken: string + ): Promise; tokenizeCard(clientToken: string, cardInfo: CardInfo): Promise; collectDeviceData(clientToken: string): Promise; } diff --git a/src/index.ts b/src/index.ts index 91017ae..72c293f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,9 @@ import NativeRNBraintreeDropIn from './NativeRNBraintreeDropIn'; -import type { DropInOptions, CardInfo, PaymentResult } from './NativeRNBraintreeDropIn'; +import type { + DropInOptions, + CardInfo, + PaymentResult, +} from './NativeRNBraintreeDropIn'; export type { DropInOptions, CardInfo, PaymentResult };