@yuno-payments/yuno-sdk-react-native 1.0.17-rc.1 → 1.0.17-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/yunosdkreactnative/YunoSdkModule.kt +178 -0
- package/ios/YunoSdk.m +16 -0
- package/ios/YunoSdk.swift +108 -0
- package/lib/commonjs/YunoPaymentMethods.js.map +1 -1
- package/lib/commonjs/YunoSdk.js +85 -4
- package/lib/commonjs/YunoSdk.js.map +1 -1
- package/lib/commonjs/core/types/HeadlessTypes.js +16 -0
- package/lib/commonjs/core/types/HeadlessTypes.js.map +1 -0
- package/lib/module/YunoPaymentMethods.js.map +1 -1
- package/lib/module/YunoSdk.js +85 -4
- package/lib/module/YunoSdk.js.map +1 -1
- package/lib/module/core/types/HeadlessTypes.js +11 -0
- package/lib/module/core/types/HeadlessTypes.js.map +1 -0
- package/package.json +1 -1
- package/src/YunoPaymentMethods.tsx +5 -5
- package/src/YunoSdk.ts +106 -6
- package/src/core/types/HeadlessTypes.ts +89 -0
- package/src/core/types/OneTimeTokenInfo.ts +0 -1
- package/src/core/types/index.ts +14 -0
|
@@ -821,4 +821,182 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
821
821
|
}
|
|
822
822
|
return array
|
|
823
823
|
}
|
|
824
|
+
|
|
825
|
+
// ==================== HEADLESS PAYMENT FLOW ====================
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Generate a one-time token (OTT) from collected payment data using the headless flow.
|
|
829
|
+
* This method mirrors the native SDK's generateToken() API.
|
|
830
|
+
*
|
|
831
|
+
* @param tokenCollectedData Map containing checkout_session, customer_session, and payment_method data
|
|
832
|
+
* @param checkoutSession The checkout session ID
|
|
833
|
+
* @param countryCode The country code for the payment
|
|
834
|
+
* @param promise Promise to resolve with token or error
|
|
835
|
+
*/
|
|
836
|
+
@ReactMethod
|
|
837
|
+
fun generateToken(
|
|
838
|
+
tokenCollectedData: ReadableMap,
|
|
839
|
+
checkoutSession: String,
|
|
840
|
+
countryCode: String,
|
|
841
|
+
promise: Promise
|
|
842
|
+
) {
|
|
843
|
+
try {
|
|
844
|
+
Log.d(TAG, "generateToken called with checkoutSession: $checkoutSession")
|
|
845
|
+
|
|
846
|
+
// Convert ReadableMap to TokenCollectedData using Gson
|
|
847
|
+
val gson = Gson()
|
|
848
|
+
val jsonString = convertReadableMapToJson(tokenCollectedData)
|
|
849
|
+
val collectedData = gson.fromJson(jsonString, TokenCollectedData::class.java)
|
|
850
|
+
|
|
851
|
+
// Create API client
|
|
852
|
+
val apiClient = Yuno.apiClientPayment(
|
|
853
|
+
checkoutSession = checkoutSession,
|
|
854
|
+
countryCode = countryCode,
|
|
855
|
+
context = reactContext
|
|
856
|
+
)
|
|
857
|
+
|
|
858
|
+
// Generate token
|
|
859
|
+
apiClient.generateToken(collectedData, reactContext).observe { result ->
|
|
860
|
+
try {
|
|
861
|
+
when {
|
|
862
|
+
result.containsKey("token") && result["token"] != null -> {
|
|
863
|
+
val token = result["token"] as String
|
|
864
|
+
Log.d(TAG, "✅ Token generated successfully")
|
|
865
|
+
|
|
866
|
+
val response = Arguments.createMap().apply {
|
|
867
|
+
putString("token", token)
|
|
868
|
+
}
|
|
869
|
+
promise.resolve(response)
|
|
870
|
+
}
|
|
871
|
+
result.containsKey("error") && result["error"] != null -> {
|
|
872
|
+
val error = result["error"] as String
|
|
873
|
+
Log.e(TAG, "❌ Token generation failed: $error")
|
|
874
|
+
promise.reject("TOKEN_GENERATION_ERROR", error)
|
|
875
|
+
}
|
|
876
|
+
else -> {
|
|
877
|
+
Log.e(TAG, "❌ Unknown response from token generation")
|
|
878
|
+
promise.reject("TOKEN_GENERATION_ERROR", "Unknown error occurred")
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
} catch (e: Exception) {
|
|
882
|
+
Log.e(TAG, "❌ Error processing token generation result: ${e.message}")
|
|
883
|
+
promise.reject("TOKEN_GENERATION_ERROR", e.message)
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
} catch (e: Exception) {
|
|
887
|
+
Log.e(TAG, "❌ Error in generateToken: ${e.message}")
|
|
888
|
+
promise.reject("TOKEN_GENERATION_ERROR", e.message)
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Get the 3D Secure challenge URL for a checkout session.
|
|
894
|
+
* This method mirrors the native SDK's getThreeDSecureChallenge() API.
|
|
895
|
+
*
|
|
896
|
+
* @param checkoutSession The checkout session ID
|
|
897
|
+
* @param countryCode The country code for the payment
|
|
898
|
+
* @param promise Promise to resolve with URL or error
|
|
899
|
+
*/
|
|
900
|
+
@ReactMethod
|
|
901
|
+
fun getThreeDSecureChallenge(
|
|
902
|
+
checkoutSession: String,
|
|
903
|
+
countryCode: String,
|
|
904
|
+
promise: Promise
|
|
905
|
+
) {
|
|
906
|
+
try {
|
|
907
|
+
Log.d(TAG, "getThreeDSecureChallenge called with checkoutSession: $checkoutSession")
|
|
908
|
+
|
|
909
|
+
// Create API client
|
|
910
|
+
val apiClient = Yuno.apiClientPayment(
|
|
911
|
+
checkoutSession = checkoutSession,
|
|
912
|
+
countryCode = countryCode,
|
|
913
|
+
context = reactContext
|
|
914
|
+
)
|
|
915
|
+
|
|
916
|
+
// Get 3DS challenge
|
|
917
|
+
apiClient.getThreeDSecureChallenge(reactContext, checkoutSession).observe { result ->
|
|
918
|
+
try {
|
|
919
|
+
val response = Arguments.createMap().apply {
|
|
920
|
+
putString("type", result.type)
|
|
921
|
+
putString("data", result.data)
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
if (result.type == "URL") {
|
|
925
|
+
Log.d(TAG, "✅ 3DS Challenge URL retrieved successfully")
|
|
926
|
+
promise.resolve(response)
|
|
927
|
+
} else {
|
|
928
|
+
Log.e(TAG, "❌ 3DS Challenge failed: ${result.data}")
|
|
929
|
+
promise.reject("THREE_DS_ERROR", result.data)
|
|
930
|
+
}
|
|
931
|
+
} catch (e: Exception) {
|
|
932
|
+
Log.e(TAG, "❌ Error processing 3DS challenge result: ${e.message}")
|
|
933
|
+
promise.reject("THREE_DS_ERROR", e.message)
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
} catch (e: Exception) {
|
|
937
|
+
Log.e(TAG, "❌ Error in getThreeDSecureChallenge: ${e.message}")
|
|
938
|
+
promise.reject("THREE_DS_ERROR", e.message)
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Helper function to convert ReadableMap to JSON string.
|
|
944
|
+
*/
|
|
945
|
+
private fun convertReadableMapToJson(readableMap: ReadableMap): String {
|
|
946
|
+
val json = JSONObject()
|
|
947
|
+
val iterator = readableMap.keySetIterator()
|
|
948
|
+
|
|
949
|
+
while (iterator.hasNextKey()) {
|
|
950
|
+
val key = iterator.nextKey()
|
|
951
|
+
val value = when (readableMap.getType(key)) {
|
|
952
|
+
ReadableType.Boolean -> readableMap.getBoolean(key)
|
|
953
|
+
ReadableType.Number -> readableMap.getDouble(key)
|
|
954
|
+
ReadableType.String -> readableMap.getString(key)
|
|
955
|
+
ReadableType.Map -> convertReadableMapToJsonObject(readableMap.getMap(key)!!)
|
|
956
|
+
ReadableType.Array -> convertReadableArrayToJsonArray(readableMap.getArray(key)!!)
|
|
957
|
+
ReadableType.Null -> JSONObject.NULL
|
|
958
|
+
}
|
|
959
|
+
json.put(key, value)
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
return json.toString()
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
private fun convertReadableMapToJsonObject(readableMap: ReadableMap): JSONObject {
|
|
966
|
+
val json = JSONObject()
|
|
967
|
+
val iterator = readableMap.keySetIterator()
|
|
968
|
+
|
|
969
|
+
while (iterator.hasNextKey()) {
|
|
970
|
+
val key = iterator.nextKey()
|
|
971
|
+
val value = when (readableMap.getType(key)) {
|
|
972
|
+
ReadableType.Boolean -> readableMap.getBoolean(key)
|
|
973
|
+
ReadableType.Number -> readableMap.getDouble(key)
|
|
974
|
+
ReadableType.String -> readableMap.getString(key)
|
|
975
|
+
ReadableType.Map -> convertReadableMapToJsonObject(readableMap.getMap(key)!!)
|
|
976
|
+
ReadableType.Array -> convertReadableArrayToJsonArray(readableMap.getArray(key)!!)
|
|
977
|
+
ReadableType.Null -> JSONObject.NULL
|
|
978
|
+
}
|
|
979
|
+
json.put(key, value)
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
return json
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
private fun convertReadableArrayToJsonArray(readableArray: ReadableArray): JSONArray {
|
|
986
|
+
val json = JSONArray()
|
|
987
|
+
|
|
988
|
+
for (i in 0 until readableArray.size()) {
|
|
989
|
+
val value = when (readableArray.getType(i)) {
|
|
990
|
+
ReadableType.Boolean -> readableArray.getBoolean(i)
|
|
991
|
+
ReadableType.Number -> readableArray.getDouble(i)
|
|
992
|
+
ReadableType.String -> readableArray.getString(i)
|
|
993
|
+
ReadableType.Map -> convertReadableMapToJsonObject(readableArray.getMap(i))
|
|
994
|
+
ReadableType.Array -> convertReadableArrayToJsonArray(readableArray.getArray(i))
|
|
995
|
+
ReadableType.Null -> JSONObject.NULL
|
|
996
|
+
}
|
|
997
|
+
json.put(value)
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
return json
|
|
1001
|
+
}
|
|
824
1002
|
}
|
package/ios/YunoSdk.m
CHANGED
|
@@ -82,5 +82,21 @@ RCT_EXTERN_METHOD(addListener:(NSString *)eventName)
|
|
|
82
82
|
|
|
83
83
|
RCT_EXTERN_METHOD(removeListeners:(double)count)
|
|
84
84
|
|
|
85
|
+
// Headless Payment Flow
|
|
86
|
+
RCT_EXTERN_METHOD(
|
|
87
|
+
generateToken:(NSDictionary *)tokenCollectedData
|
|
88
|
+
checkoutSession:(NSString *)checkoutSession
|
|
89
|
+
countryCode:(NSString *)countryCode
|
|
90
|
+
resolver:(RCTPromiseResolveBlock)resolver
|
|
91
|
+
rejecter:(RCTPromiseRejectBlock)rejecter
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
RCT_EXTERN_METHOD(
|
|
95
|
+
getThreeDSecureChallenge:(NSString *)checkoutSession
|
|
96
|
+
countryCode:(NSString *)countryCode
|
|
97
|
+
resolver:(RCTPromiseResolveBlock)resolver
|
|
98
|
+
rejecter:(RCTPromiseRejectBlock)rejecter
|
|
99
|
+
)
|
|
100
|
+
|
|
85
101
|
@end
|
|
86
102
|
|
package/ios/YunoSdk.swift
CHANGED
|
@@ -559,3 +559,111 @@ extension YunoSdk: YunoEnrollmentDelegate {
|
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
|
|
562
|
+
// MARK: - Headless Payment Flow
|
|
563
|
+
extension YunoSdk {
|
|
564
|
+
/**
|
|
565
|
+
* Generate a one-time token (OTT) from collected payment data using the headless flow.
|
|
566
|
+
* This method mirrors the native SDK's generateToken() API.
|
|
567
|
+
*
|
|
568
|
+
* @param tokenCollectedData Dictionary containing checkout_session and payment_method data
|
|
569
|
+
* @param checkoutSession The checkout session ID
|
|
570
|
+
* @param countryCode The country code for the payment
|
|
571
|
+
* @param resolver Promise resolver
|
|
572
|
+
* @param rejecter Promise rejecter
|
|
573
|
+
*/
|
|
574
|
+
@objc
|
|
575
|
+
func generateToken(
|
|
576
|
+
_ tokenCollectedData: NSDictionary,
|
|
577
|
+
checkoutSession: String,
|
|
578
|
+
countryCode: String,
|
|
579
|
+
resolver: @escaping RCTPromiseResolveBlock,
|
|
580
|
+
rejecter: @escaping RCTPromiseRejectBlock
|
|
581
|
+
) {
|
|
582
|
+
Task { @MainActor [weak self] in
|
|
583
|
+
guard let self = self else { return }
|
|
584
|
+
|
|
585
|
+
do {
|
|
586
|
+
// Convert NSDictionary to JSON Data
|
|
587
|
+
guard JSONSerialization.isValidJSONObject(tokenCollectedData) else {
|
|
588
|
+
rejecter("INVALID_DATA", "Invalid token collected data", nil)
|
|
589
|
+
return
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
let jsonData = try JSONSerialization.data(withJSONObject: tokenCollectedData, options: [])
|
|
593
|
+
|
|
594
|
+
// Decode to TokenCollectedData using the native SDK's Codable model
|
|
595
|
+
let decoder = JSONDecoder()
|
|
596
|
+
decoder.keyDecodingStrategy = .convertFromSnakeCase
|
|
597
|
+
let collectedData = try decoder.decode(TokenCollectedData.self, from: jsonData)
|
|
598
|
+
|
|
599
|
+
// Create API client using the native SDK's factory method
|
|
600
|
+
let apiClient = Yuno.apiClientPayment(
|
|
601
|
+
countryCode: countryCode,
|
|
602
|
+
checkoutSession: checkoutSession
|
|
603
|
+
)
|
|
604
|
+
|
|
605
|
+
// Generate token using async/await (native SDK uses async throws)
|
|
606
|
+
let response = try await apiClient.generateToken(data: collectedData)
|
|
607
|
+
|
|
608
|
+
// The native SDK returns [String: Any] with token in "token" key
|
|
609
|
+
if let token = response["token"] as? String {
|
|
610
|
+
let responseDict: [String: Any] = ["token": token]
|
|
611
|
+
resolver(responseDict)
|
|
612
|
+
} else if let error = response["error"] as? String {
|
|
613
|
+
rejecter("TOKEN_GENERATION_ERROR", error, nil)
|
|
614
|
+
} else {
|
|
615
|
+
rejecter("TOKEN_GENERATION_ERROR", "No token in response", nil)
|
|
616
|
+
}
|
|
617
|
+
} catch {
|
|
618
|
+
rejecter("TOKEN_GENERATION_ERROR", "Failed to generate token: \(error.localizedDescription)", error)
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Get the 3D Secure challenge URL for a checkout session.
|
|
625
|
+
* This method mirrors the native SDK's getThreeDSecureChallenge() API.
|
|
626
|
+
*
|
|
627
|
+
* @param checkoutSession The checkout session ID
|
|
628
|
+
* @param countryCode The country code for the payment
|
|
629
|
+
* @param resolver Promise resolver
|
|
630
|
+
* @param rejecter Promise rejecter
|
|
631
|
+
*/
|
|
632
|
+
@objc
|
|
633
|
+
func getThreeDSecureChallenge(
|
|
634
|
+
_ checkoutSession: String,
|
|
635
|
+
countryCode: String,
|
|
636
|
+
resolver: @escaping RCTPromiseResolveBlock,
|
|
637
|
+
rejecter: @escaping RCTPromiseRejectBlock
|
|
638
|
+
) {
|
|
639
|
+
Task { @MainActor [weak self] in
|
|
640
|
+
guard let self = self else { return }
|
|
641
|
+
|
|
642
|
+
do {
|
|
643
|
+
// Create API client using the native SDK's factory method
|
|
644
|
+
let apiClient = Yuno.apiClientPayment(
|
|
645
|
+
countryCode: countryCode,
|
|
646
|
+
checkoutSession: checkoutSession
|
|
647
|
+
)
|
|
648
|
+
|
|
649
|
+
// Get 3DS challenge using async/await (native SDK uses async throws)
|
|
650
|
+
let response = try await apiClient.getThreeDSecureChallenge(checkoutSession: checkoutSession)
|
|
651
|
+
|
|
652
|
+
// The native SDK returns ThreeDSecureChallengeResponse with url property
|
|
653
|
+
let responseDict: [String: Any] = [
|
|
654
|
+
"type": "URL",
|
|
655
|
+
"data": response.url
|
|
656
|
+
]
|
|
657
|
+
|
|
658
|
+
resolver(responseDict)
|
|
659
|
+
} catch {
|
|
660
|
+
rejecter("THREE_DS_ERROR", "Failed to get 3DS challenge: \(error.localizedDescription)", error)
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// Note: TokenCollectedData, CollectedData, CardData, and other related models
|
|
667
|
+
// are provided by the YunoSDK framework (imported at the top).
|
|
668
|
+
// We don't need to redefine them here.
|
|
669
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LINKING_ERROR","Platform","select","ios","YunoSdkNative","NativeModules","YunoSdk","eventEmitter","NativeEventEmitter","NativeYunoPaymentMethodsView","requireNativeComponent","YunoPaymentMethods","checkoutSession","countryCode","onPaymentMethodSelected","onPaymentMethodError","style","testID","useEffect","console","warn","subscriptions","selectionListener","addListener","event","push","errorListener","forEach","sub","remove","createElement","exports"],"sourceRoot":"../../src","sources":["YunoPaymentMethods.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOsB,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAEtB;AACA;AACA;;AAMA;AACA;AACA;;AAMA;AACA;AACA;;AA2BA;;AAQA,MAAMkB,aAAa,GACjB,gHAAgH,GAChHC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,uBAAuB;EAAEZ,OAAO,EAAE;AAAG,CAAC,CAAC,GAC9D,sDAAsD,GACtD,+BAA+B,GAC/B,0CAA0C;;AAE5C;AACA,MAAMa,aAAa,GAAGC,0BAAa,CAACC,OAAO;;AAE3C;AACA,IAAIC,YAAuC,GAAG,IAAI;AAClD,IAAIH,aAAa,EAAE;EACjBG,YAAY,GAAG,IAAIC,+BAAkB,CAACJ,aAAa,CAAC;AACtD;;AAEA;AACA,MAAMK,4BAA4B,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LINKING_ERROR","Platform","select","ios","YunoSdkNative","NativeModules","YunoSdk","eventEmitter","NativeEventEmitter","NativeYunoPaymentMethodsView","requireNativeComponent","YunoPaymentMethods","checkoutSession","countryCode","onPaymentMethodSelected","onPaymentMethodError","style","testID","useEffect","console","warn","subscriptions","selectionListener","addListener","event","push","errorListener","forEach","sub","remove","createElement","exports"],"sourceRoot":"../../src","sources":["YunoPaymentMethods.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOsB,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,C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ACzBG,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC;AAACe,OAAA,CAAApB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/lib/commonjs/YunoSdk.js
CHANGED
|
@@ -74,10 +74,10 @@ class YunoSdk {
|
|
|
74
74
|
/**
|
|
75
75
|
* Marks the SDK as initialized without calling the native initialize method.
|
|
76
76
|
* This is useful when the SDK has been initialized from the native side (e.g., in MainActivity/YunoActivity).
|
|
77
|
-
*
|
|
77
|
+
*
|
|
78
78
|
* @param countryCode - ISO country code (e.g., 'US', 'BR', 'CO')
|
|
79
79
|
* @param language - Optional language setting (defaults to EN)
|
|
80
|
-
*
|
|
80
|
+
*
|
|
81
81
|
* @internal
|
|
82
82
|
*/
|
|
83
83
|
static markAsInitialized(countryCode = 'CO', language = _enums.YunoLanguage.EN) {
|
|
@@ -325,10 +325,10 @@ class YunoSdk {
|
|
|
325
325
|
/**
|
|
326
326
|
* Clears the last OTT tokens stored by the SDK.
|
|
327
327
|
* This is useful to ensure clean state before starting a new payment flow.
|
|
328
|
-
*
|
|
328
|
+
*
|
|
329
329
|
* Note: This is automatically called at the start of each payment/enrollment flow,
|
|
330
330
|
* but you can call it manually if needed.
|
|
331
|
-
*
|
|
331
|
+
*
|
|
332
332
|
* @example
|
|
333
333
|
* ```typescript
|
|
334
334
|
* // Clear OTT before starting a new payment
|
|
@@ -482,6 +482,87 @@ class YunoSdk {
|
|
|
482
482
|
}
|
|
483
483
|
return this.language;
|
|
484
484
|
}
|
|
485
|
+
|
|
486
|
+
// ==================== HEADLESS PAYMENT FLOW ====================
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Generate a one-time token (OTT) from collected payment data using the headless flow.
|
|
490
|
+
* This method allows you to tokenize payment information without using the UI components.
|
|
491
|
+
*
|
|
492
|
+
* @param tokenCollectedData The payment data to tokenize
|
|
493
|
+
* @param checkoutSession The checkout session ID
|
|
494
|
+
* @param countryCode The country code for the payment (optional, uses initialized value if not provided)
|
|
495
|
+
* @returns Promise resolving to the generated token or rejecting with an error
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```typescript
|
|
499
|
+
* import { YunoSdk, CardType } from '@yuno-payments/yuno-sdk-react-native';
|
|
500
|
+
*
|
|
501
|
+
* try {
|
|
502
|
+
* const result = await YunoSdk.generateToken({
|
|
503
|
+
* checkoutSession: '73ed16c5-4481-4dce-af42-404b68e21027',
|
|
504
|
+
* paymentMethod: {
|
|
505
|
+
* type: 'CARD',
|
|
506
|
+
* vaultedToken: null,
|
|
507
|
+
* card: {
|
|
508
|
+
* save: false,
|
|
509
|
+
* detail: {
|
|
510
|
+
* expirationMonth: 11,
|
|
511
|
+
* expirationYear: 25,
|
|
512
|
+
* number: '4000000000001091',
|
|
513
|
+
* securityCode: '123',
|
|
514
|
+
* holderName: 'John Doe',
|
|
515
|
+
* type: CardType.CREDIT,
|
|
516
|
+
* },
|
|
517
|
+
* },
|
|
518
|
+
* },
|
|
519
|
+
* }, 'checkoutSessionId', 'BR');
|
|
520
|
+
*
|
|
521
|
+
* console.log('Token:', result.token);
|
|
522
|
+
* } catch (error) {
|
|
523
|
+
* console.error('Token generation failed:', error);
|
|
524
|
+
* }
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
static async generateToken(tokenCollectedData, checkoutSession, countryCode) {
|
|
528
|
+
const native = getYunoNative();
|
|
529
|
+
const country = countryCode || this.getCountryCode();
|
|
530
|
+
return native.generateToken(tokenCollectedData, checkoutSession, country);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Get the 3D Secure challenge URL for a checkout session using the headless flow.
|
|
535
|
+
* This is typically called after successfully generating a token to handle 3DS verification.
|
|
536
|
+
*
|
|
537
|
+
* @param checkoutSession The checkout session ID
|
|
538
|
+
* @param countryCode The country code for the payment (optional, uses initialized value if not provided)
|
|
539
|
+
* @returns Promise resolving to the 3DS challenge response
|
|
540
|
+
*
|
|
541
|
+
* @example
|
|
542
|
+
* ```typescript
|
|
543
|
+
* import { YunoSdk } from '@yuno-payments/yuno-sdk-react-native';
|
|
544
|
+
*
|
|
545
|
+
* try {
|
|
546
|
+
* // First generate token
|
|
547
|
+
* const tokenResult = await YunoSdk.generateToken(paymentData, checkoutSession, 'BR');
|
|
548
|
+
*
|
|
549
|
+
* // Then get 3DS challenge URL if needed
|
|
550
|
+
* const challengeResult = await YunoSdk.getThreeDSecureChallenge(checkoutSession, 'BR');
|
|
551
|
+
*
|
|
552
|
+
* if (challengeResult.type === 'URL') {
|
|
553
|
+
* console.log('3DS URL:', challengeResult.data);
|
|
554
|
+
* // Open this URL in a WebView for the user to complete 3DS verification
|
|
555
|
+
* }
|
|
556
|
+
* } catch (error) {
|
|
557
|
+
* console.error('3DS challenge failed:', error);
|
|
558
|
+
* }
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
561
|
+
static async getThreeDSecureChallenge(checkoutSession, countryCode) {
|
|
562
|
+
const native = getYunoNative();
|
|
563
|
+
const country = countryCode || this.getCountryCode();
|
|
564
|
+
return native.getThreeDSecureChallenge(checkoutSession, country);
|
|
565
|
+
}
|
|
485
566
|
}
|
|
486
567
|
exports.YunoSdk = YunoSdk;
|
|
487
568
|
//# sourceMappingURL=YunoSdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_enums","LINKING_ERROR","Platform","select","ios","default","getYunoNative","native","NativeModules","YunoSdk","Error","getYunoEventEmitter","NativeEventEmitter","countryCode","language","isInitialized","markAsInitialized","YunoLanguage","EN","initialize","params","apiKey","yunoConfig","iosConfig","androidConfig","config","lang","cardFlow","CardFlow","ONE_STEP","saveCardEnabled","keepLoader","isDynamicViewEnabled","cardFormDeployed","enrollmentPayment","checkInitialized","args","getCountryCode","startPaymentLite","code","startPayment","showPaymentStatus","continuePayment","checkoutSession","startPaymentSeamlessLite","statusString","getLanguage","hideLoader","receiveDeeplink","url","OS","console","warn","getLastOneTimeToken","getLastOneTimeTokenInfo","clearLastOneTimeToken","clearLastPaymentStatus","onPaymentStatus","listener","emitter","subscription","addListener","remove","onEnrollmentStatus","onOneTimeToken","onOneTimeTokenInfo","exports"],"sourceRoot":"../../src","sources":["YunoSdk.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_enums","LINKING_ERROR","Platform","select","ios","default","getYunoNative","native","NativeModules","YunoSdk","Error","getYunoEventEmitter","NativeEventEmitter","countryCode","language","isInitialized","markAsInitialized","YunoLanguage","EN","initialize","params","apiKey","yunoConfig","iosConfig","androidConfig","config","lang","cardFlow","CardFlow","ONE_STEP","saveCardEnabled","keepLoader","isDynamicViewEnabled","cardFormDeployed","enrollmentPayment","checkInitialized","args","getCountryCode","startPaymentLite","code","startPayment","showPaymentStatus","continuePayment","checkoutSession","startPaymentSeamlessLite","statusString","getLanguage","hideLoader","receiveDeeplink","url","OS","console","warn","getLastOneTimeToken","getLastOneTimeTokenInfo","clearLastOneTimeToken","clearLastPaymentStatus","onPaymentStatus","listener","emitter","subscription","addListener","remove","onEnrollmentStatus","onOneTimeToken","onOneTimeTokenInfo","generateToken","tokenCollectedData","country","getThreeDSecureChallenge","exports"],"sourceRoot":"../../src","sources":["YunoSdk.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAaA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,aAAa,GACjB,sFAAsF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,uBAAuB;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GAC9D,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA,SAASC,aAAaA,CAAA,EAAQ;EAC5B,MAAMC,MAAM,GAAGC,0BAAa,CAACC,OAAO;EACpC,IAAI,CAACF,MAAM,EAAE;IACX,MAAM,IAAIG,KAAK,CAACT,aAAa,CAAC;EAChC;EACA,OAAOM,MAAM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
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CardType = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Headless Payment Flow Types
|
|
9
|
+
* These types mirror the native SDK's TokenCollectedData structure
|
|
10
|
+
*/
|
|
11
|
+
let CardType = exports.CardType = /*#__PURE__*/function (CardType) {
|
|
12
|
+
CardType["CREDIT"] = "CREDIT";
|
|
13
|
+
CardType["DEBIT"] = "DEBIT";
|
|
14
|
+
return CardType;
|
|
15
|
+
}({});
|
|
16
|
+
//# sourceMappingURL=HeadlessTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CardType","exports"],"sourceRoot":"../../../../src","sources":["core/types/HeadlessTypes.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAHA,IAKYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","requireNativeComponent","NativeModules","NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","YunoSdkNative","YunoSdk","eventEmitter","NativeYunoPaymentMethodsView","YunoPaymentMethods","checkoutSession","countryCode","onPaymentMethodSelected","onPaymentMethodError","style","testID","console","warn","subscriptions","selectionListener","addListener","event","push","errorListener","forEach","sub","remove","createElement"],"sourceRoot":"../../src","sources":["YunoPaymentMethods.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,
|
|
1
|
+
{"version":3,"names":["React","useEffect","requireNativeComponent","NativeModules","NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","YunoSdkNative","YunoSdk","eventEmitter","NativeYunoPaymentMethodsView","YunoPaymentMethods","checkoutSession","countryCode","onPaymentMethodSelected","onPaymentMethodError","style","testID","console","warn","subscriptions","selectionListener","addListener","event","push","errorListener","forEach","sub","remove","createElement"],"sourceRoot":"../../src","sources":["YunoPaymentMethods.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,sBAAsB,EACtBC,aAAa,EACbC,kBAAkB,EAGlBC,QAAQ,QACH,cAAc;;AAErB;AACA;AACA;;AAMA;AACA;AACA;;AAMA;AACA;AACA;;AA2BA;;AAQA,MAAMC,aAAa,GACjB,gHAAgH,GAChHD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,uBAAuB;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GAC9D,sDAAsD,GACtD,+BAA+B,GAC/B,0CAA0C;;AAE5C;AACA,MAAMC,aAAa,GAAGP,aAAa,CAACQ,OAAO;;AAE3C;AACA,IAAIC,YAAuC,GAAG,IAAI;AAClD,IAAIF,aAAa,EAAE;EACjBE,YAAY,GAAG,IAAIR,kBAAkB,CAACM,aAAa,CAAC;AACtD;;AAEA;AACA,MAAMG,4BAA4B,GAChCX,sBAAsB,CACpB,wBACF,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMY,kBAAqD,GAAGA,CAAC;EACpEC,eAAe;EACfC,WAAW;EACXC,uBAAuB;EACvBC,oBAAoB;EACpBC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ;EACAnB,SAAS,CAAC,MAAM;IACd,IAAI,CAACW,YAAY,EAAE;MACjBS,OAAO,CAACC,IAAI,CAAChB,aAAa,CAAC;MAC3B;IACF;IAEA,MAAMiB,aAAoB,GAAG,EAAE;;IAE/B;IACA,IAAIN,uBAAuB,EAAE;MAC3B,MAAMO,iBAAiB,GAAGZ,YAAY,CAACa,WAAW,CAChD,yBAAyB,EACxBC,KAAiC,IAAK;QACrCT,uBAAuB,CAACS,KAAK,CAAC;MAChC,CACF,CAAC;MACDH,aAAa,CAACI,IAAI,CAACH,iBAAiB,CAAC;IACvC;;IAEA;IACA,IAAIN,oBAAoB,EAAE;MACxB,MAAMU,aAAa,GAAGhB,YAAY,CAACa,WAAW,CAC5C,sBAAsB,EACrBC,KAA8B,IAAK;QAClCR,oBAAoB,CAACQ,KAAK,CAAC;MAC7B,CACF,CAAC;MACDH,aAAa,CAACI,IAAI,CAACC,aAAa,CAAC;IACnC;;IAEA;IACA,OAAO,MAAM;MACXL,aAAa,CAACM,OAAO,CAAEC,GAAG,IAAK;QAC7B,IAAIA,GAAG,IAAIA,GAAG,CAACC,MAAM,EAAE;UACrBD,GAAG,CAACC,MAAM,CAAC,CAAC;QACd;MACF,CAAC,CAAC;IACJ,CAAC;EACH,CAAC,EAAE,CAACd,uBAAuB,EAAEC,oBAAoB,CAAC,CAAC;EAEnD,oBACElB,KAAA,CAAAgC,aAAA,CAACnB,4BAA4B;IAC3BO,MAAM,EAAEA,MAAO;IACfL,eAAe,EAAEA,eAAgB;IACjCC,WAAW,EAAEA,WAAY;IACzBG,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
|
package/lib/module/YunoSdk.js
CHANGED
|
@@ -68,10 +68,10 @@ export class YunoSdk {
|
|
|
68
68
|
/**
|
|
69
69
|
* Marks the SDK as initialized without calling the native initialize method.
|
|
70
70
|
* This is useful when the SDK has been initialized from the native side (e.g., in MainActivity/YunoActivity).
|
|
71
|
-
*
|
|
71
|
+
*
|
|
72
72
|
* @param countryCode - ISO country code (e.g., 'US', 'BR', 'CO')
|
|
73
73
|
* @param language - Optional language setting (defaults to EN)
|
|
74
|
-
*
|
|
74
|
+
*
|
|
75
75
|
* @internal
|
|
76
76
|
*/
|
|
77
77
|
static markAsInitialized(countryCode = 'CO', language = YunoLanguage.EN) {
|
|
@@ -319,10 +319,10 @@ export class YunoSdk {
|
|
|
319
319
|
/**
|
|
320
320
|
* Clears the last OTT tokens stored by the SDK.
|
|
321
321
|
* This is useful to ensure clean state before starting a new payment flow.
|
|
322
|
-
*
|
|
322
|
+
*
|
|
323
323
|
* Note: This is automatically called at the start of each payment/enrollment flow,
|
|
324
324
|
* but you can call it manually if needed.
|
|
325
|
-
*
|
|
325
|
+
*
|
|
326
326
|
* @example
|
|
327
327
|
* ```typescript
|
|
328
328
|
* // Clear OTT before starting a new payment
|
|
@@ -476,5 +476,86 @@ export class YunoSdk {
|
|
|
476
476
|
}
|
|
477
477
|
return this.language;
|
|
478
478
|
}
|
|
479
|
+
|
|
480
|
+
// ==================== HEADLESS PAYMENT FLOW ====================
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Generate a one-time token (OTT) from collected payment data using the headless flow.
|
|
484
|
+
* This method allows you to tokenize payment information without using the UI components.
|
|
485
|
+
*
|
|
486
|
+
* @param tokenCollectedData The payment data to tokenize
|
|
487
|
+
* @param checkoutSession The checkout session ID
|
|
488
|
+
* @param countryCode The country code for the payment (optional, uses initialized value if not provided)
|
|
489
|
+
* @returns Promise resolving to the generated token or rejecting with an error
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```typescript
|
|
493
|
+
* import { YunoSdk, CardType } from '@yuno-payments/yuno-sdk-react-native';
|
|
494
|
+
*
|
|
495
|
+
* try {
|
|
496
|
+
* const result = await YunoSdk.generateToken({
|
|
497
|
+
* checkoutSession: '73ed16c5-4481-4dce-af42-404b68e21027',
|
|
498
|
+
* paymentMethod: {
|
|
499
|
+
* type: 'CARD',
|
|
500
|
+
* vaultedToken: null,
|
|
501
|
+
* card: {
|
|
502
|
+
* save: false,
|
|
503
|
+
* detail: {
|
|
504
|
+
* expirationMonth: 11,
|
|
505
|
+
* expirationYear: 25,
|
|
506
|
+
* number: '4000000000001091',
|
|
507
|
+
* securityCode: '123',
|
|
508
|
+
* holderName: 'John Doe',
|
|
509
|
+
* type: CardType.CREDIT,
|
|
510
|
+
* },
|
|
511
|
+
* },
|
|
512
|
+
* },
|
|
513
|
+
* }, 'checkoutSessionId', 'BR');
|
|
514
|
+
*
|
|
515
|
+
* console.log('Token:', result.token);
|
|
516
|
+
* } catch (error) {
|
|
517
|
+
* console.error('Token generation failed:', error);
|
|
518
|
+
* }
|
|
519
|
+
* ```
|
|
520
|
+
*/
|
|
521
|
+
static async generateToken(tokenCollectedData, checkoutSession, countryCode) {
|
|
522
|
+
const native = getYunoNative();
|
|
523
|
+
const country = countryCode || this.getCountryCode();
|
|
524
|
+
return native.generateToken(tokenCollectedData, checkoutSession, country);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Get the 3D Secure challenge URL for a checkout session using the headless flow.
|
|
529
|
+
* This is typically called after successfully generating a token to handle 3DS verification.
|
|
530
|
+
*
|
|
531
|
+
* @param checkoutSession The checkout session ID
|
|
532
|
+
* @param countryCode The country code for the payment (optional, uses initialized value if not provided)
|
|
533
|
+
* @returns Promise resolving to the 3DS challenge response
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* ```typescript
|
|
537
|
+
* import { YunoSdk } from '@yuno-payments/yuno-sdk-react-native';
|
|
538
|
+
*
|
|
539
|
+
* try {
|
|
540
|
+
* // First generate token
|
|
541
|
+
* const tokenResult = await YunoSdk.generateToken(paymentData, checkoutSession, 'BR');
|
|
542
|
+
*
|
|
543
|
+
* // Then get 3DS challenge URL if needed
|
|
544
|
+
* const challengeResult = await YunoSdk.getThreeDSecureChallenge(checkoutSession, 'BR');
|
|
545
|
+
*
|
|
546
|
+
* if (challengeResult.type === 'URL') {
|
|
547
|
+
* console.log('3DS URL:', challengeResult.data);
|
|
548
|
+
* // Open this URL in a WebView for the user to complete 3DS verification
|
|
549
|
+
* }
|
|
550
|
+
* } catch (error) {
|
|
551
|
+
* console.error('3DS challenge failed:', error);
|
|
552
|
+
* }
|
|
553
|
+
* ```
|
|
554
|
+
*/
|
|
555
|
+
static async getThreeDSecureChallenge(checkoutSession, countryCode) {
|
|
556
|
+
const native = getYunoNative();
|
|
557
|
+
const country = countryCode || this.getCountryCode();
|
|
558
|
+
return native.getThreeDSecureChallenge(checkoutSession, country);
|
|
559
|
+
}
|
|
479
560
|
}
|
|
480
561
|
//# sourceMappingURL=YunoSdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","YunoLanguage","CardFlow","LINKING_ERROR","select","ios","default","getYunoNative","native","YunoSdk","Error","getYunoEventEmitter","countryCode","language","isInitialized","markAsInitialized","EN","initialize","params","apiKey","yunoConfig","iosConfig","androidConfig","config","lang","cardFlow","ONE_STEP","saveCardEnabled","keepLoader","isDynamicViewEnabled","cardFormDeployed","enrollmentPayment","checkInitialized","args","getCountryCode","startPaymentLite","code","startPayment","showPaymentStatus","continuePayment","checkoutSession","startPaymentSeamlessLite","statusString","getLanguage","hideLoader","receiveDeeplink","url","OS","console","warn","getLastOneTimeToken","getLastOneTimeTokenInfo","clearLastOneTimeToken","clearLastPaymentStatus","onPaymentStatus","listener","emitter","subscription","addListener","remove","onEnrollmentStatus","onOneTimeToken","onOneTimeTokenInfo"],"sourceRoot":"../../src","sources":["YunoSdk.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","YunoLanguage","CardFlow","LINKING_ERROR","select","ios","default","getYunoNative","native","YunoSdk","Error","getYunoEventEmitter","countryCode","language","isInitialized","markAsInitialized","EN","initialize","params","apiKey","yunoConfig","iosConfig","androidConfig","config","lang","cardFlow","ONE_STEP","saveCardEnabled","keepLoader","isDynamicViewEnabled","cardFormDeployed","enrollmentPayment","checkInitialized","args","getCountryCode","startPaymentLite","code","startPayment","showPaymentStatus","continuePayment","checkoutSession","startPaymentSeamlessLite","statusString","getLanguage","hideLoader","receiveDeeplink","url","OS","console","warn","getLastOneTimeToken","getLastOneTimeTokenInfo","clearLastOneTimeToken","clearLastPaymentStatus","onPaymentStatus","listener","emitter","subscription","addListener","remove","onEnrollmentStatus","onOneTimeToken","onOneTimeTokenInfo","generateToken","tokenCollectedData","country","getThreeDSecureChallenge"],"sourceRoot":"../../src","sources":["YunoSdk.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAa1E,SAAqBC,YAAY,EAAEC,QAAQ,QAAQ,cAAc;AAEjE,MAAMC,aAAa,GACjB,sFAAsF,GACtFH,QAAQ,CAACI,MAAM,CAAC;EAAEC,GAAG,EAAE,uBAAuB;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GAC9D,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA,SAASC,aAAaA,CAAA,EAAQ;EAC5B,MAAMC,MAAM,GAAGV,aAAa,CAACW,OAAO;EACpC,IAAI,CAACD,MAAM,EAAE;IACX,MAAM,IAAIE,KAAK,CAACP,aAAa,CAAC;EAChC;EACA,OAAOK,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA,SAASG,mBAAmBA,CAAA,EAAuB;EACjD,MAAMH,MAAM,GAAGD,aAAa,CAAC,CAAC;EAC9B,OAAO,IAAIR,kBAAkB,CAACS,MAAM,CAAC;AACvC;;AAEA;AACA;AACA;;AAQA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,CAAC;EACnB,OAAeG,WAAW,GAAkB,IAAI;EAChD,OAAeC,QAAQ,GAAwB,IAAI;EACnD,OAAeC,aAAa,GAAY,KAAK;;E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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,aAAakD,aAAaA,CACxBC,kBAAsC,EACtCxB,eAAuB,EACvB5B,WAAoB,EACY;IAChC,MAAMJ,MAAM,GAAGD,aAAa,CAAC,CAAC;IAC9B,MAAM0D,OAAO,GAAGrD,WAAW,IAAI,IAAI,CAACsB,cAAc,CAAC,CAAC;IAEpD,OAAO1B,MAAM,CAACuD,aAAa,CAACC,kBAAkB,EAAExB,eAAe,EAAEyB,OAAO,CAAC;EAC3E;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,aAAaC,wBAAwBA,CACnC1B,eAAuB,EACvB5B,WAAoB,EACoB;IACxC,MAAMJ,MAAM,GAAGD,aAAa,CAAC,CAAC;IAC9B,MAAM0D,OAAO,GAAGrD,WAAW,IAAI,IAAI,CAACsB,cAAc,CAAC,CAAC;IAEpD,OAAO1B,MAAM,CAAC0D,wBAAwB,CAAC1B,eAAe,EAAEyB,OAAO,CAAC;EAClE;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless Payment Flow Types
|
|
3
|
+
* These types mirror the native SDK's TokenCollectedData structure
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export let CardType = /*#__PURE__*/function (CardType) {
|
|
7
|
+
CardType["CREDIT"] = "CREDIT";
|
|
8
|
+
CardType["DEBIT"] = "DEBIT";
|
|
9
|
+
return CardType;
|
|
10
|
+
}({});
|
|
11
|
+
//# sourceMappingURL=HeadlessTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CardType"],"sourceRoot":"../../../../src","sources":["core/types/HeadlessTypes.ts"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,WAAYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuno-payments/yuno-sdk-react-native",
|
|
3
|
-
"version": "1.0.17-rc.
|
|
3
|
+
"version": "1.0.17-rc.2",
|
|
4
4
|
"description": "Yuno React Native SDK empowers you to create seamless payment experiences in your native Android and iOS apps built with React Native.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
requireNativeComponent,
|
|
4
4
|
NativeModules,
|
|
@@ -78,9 +78,10 @@ if (YunoSdkNative) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// Require the native component
|
|
81
|
-
const NativeYunoPaymentMethodsView =
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
const NativeYunoPaymentMethodsView =
|
|
82
|
+
requireNativeComponent<NativeYunoPaymentMethodsProps>(
|
|
83
|
+
'YunoPaymentMethodsView'
|
|
84
|
+
);
|
|
84
85
|
|
|
85
86
|
/**
|
|
86
87
|
* YunoPaymentMethods Component
|
|
@@ -195,4 +196,3 @@ export const YunoPaymentMethods: React.FC<YunoPaymentMethodsProps> = ({
|
|
|
195
196
|
/>
|
|
196
197
|
);
|
|
197
198
|
};
|
|
198
|
-
|
package/src/YunoSdk.ts
CHANGED
|
@@ -7,6 +7,9 @@ import type {
|
|
|
7
7
|
StartPayment,
|
|
8
8
|
SeamlessArguments,
|
|
9
9
|
OneTimeTokenInfo,
|
|
10
|
+
TokenCollectedData,
|
|
11
|
+
HeadlessTokenResponse,
|
|
12
|
+
ThreeDSecureChallengeResponse,
|
|
10
13
|
} from './core/types';
|
|
11
14
|
import { YunoStatus, YunoLanguage, CardFlow } from './core/enums';
|
|
12
15
|
|
|
@@ -89,13 +92,16 @@ export class YunoSdk {
|
|
|
89
92
|
/**
|
|
90
93
|
* Marks the SDK as initialized without calling the native initialize method.
|
|
91
94
|
* This is useful when the SDK has been initialized from the native side (e.g., in MainActivity/YunoActivity).
|
|
92
|
-
*
|
|
95
|
+
*
|
|
93
96
|
* @param countryCode - ISO country code (e.g., 'US', 'BR', 'CO')
|
|
94
97
|
* @param language - Optional language setting (defaults to EN)
|
|
95
|
-
*
|
|
98
|
+
*
|
|
96
99
|
* @internal
|
|
97
100
|
*/
|
|
98
|
-
static markAsInitialized(
|
|
101
|
+
static markAsInitialized(
|
|
102
|
+
countryCode: string = 'CO',
|
|
103
|
+
language: YunoLanguage = YunoLanguage.EN
|
|
104
|
+
): void {
|
|
99
105
|
this.countryCode = countryCode;
|
|
100
106
|
this.language = language;
|
|
101
107
|
this.isInitialized = true;
|
|
@@ -255,7 +261,11 @@ export class YunoSdk {
|
|
|
255
261
|
): Promise<void> {
|
|
256
262
|
this.checkInitialized();
|
|
257
263
|
const code = countryCode ?? this.getCountryCode();
|
|
258
|
-
return getYunoNative().continuePayment(
|
|
264
|
+
return getYunoNative().continuePayment(
|
|
265
|
+
checkoutSession,
|
|
266
|
+
code,
|
|
267
|
+
showPaymentStatus
|
|
268
|
+
);
|
|
259
269
|
}
|
|
260
270
|
|
|
261
271
|
/**
|
|
@@ -373,10 +383,10 @@ export class YunoSdk {
|
|
|
373
383
|
/**
|
|
374
384
|
* Clears the last OTT tokens stored by the SDK.
|
|
375
385
|
* This is useful to ensure clean state before starting a new payment flow.
|
|
376
|
-
*
|
|
386
|
+
*
|
|
377
387
|
* Note: This is automatically called at the start of each payment/enrollment flow,
|
|
378
388
|
* but you can call it manually if needed.
|
|
379
|
-
*
|
|
389
|
+
*
|
|
380
390
|
* @example
|
|
381
391
|
* ```typescript
|
|
382
392
|
* // Clear OTT before starting a new payment
|
|
@@ -535,4 +545,94 @@ export class YunoSdk {
|
|
|
535
545
|
}
|
|
536
546
|
return this.language;
|
|
537
547
|
}
|
|
548
|
+
|
|
549
|
+
// ==================== HEADLESS PAYMENT FLOW ====================
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Generate a one-time token (OTT) from collected payment data using the headless flow.
|
|
553
|
+
* This method allows you to tokenize payment information without using the UI components.
|
|
554
|
+
*
|
|
555
|
+
* @param tokenCollectedData The payment data to tokenize
|
|
556
|
+
* @param checkoutSession The checkout session ID
|
|
557
|
+
* @param countryCode The country code for the payment (optional, uses initialized value if not provided)
|
|
558
|
+
* @returns Promise resolving to the generated token or rejecting with an error
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```typescript
|
|
562
|
+
* import { YunoSdk, CardType } from '@yuno-payments/yuno-sdk-react-native';
|
|
563
|
+
*
|
|
564
|
+
* try {
|
|
565
|
+
* const result = await YunoSdk.generateToken({
|
|
566
|
+
* checkoutSession: '73ed16c5-4481-4dce-af42-404b68e21027',
|
|
567
|
+
* paymentMethod: {
|
|
568
|
+
* type: 'CARD',
|
|
569
|
+
* vaultedToken: null,
|
|
570
|
+
* card: {
|
|
571
|
+
* save: false,
|
|
572
|
+
* detail: {
|
|
573
|
+
* expirationMonth: 11,
|
|
574
|
+
* expirationYear: 25,
|
|
575
|
+
* number: '4000000000001091',
|
|
576
|
+
* securityCode: '123',
|
|
577
|
+
* holderName: 'John Doe',
|
|
578
|
+
* type: CardType.CREDIT,
|
|
579
|
+
* },
|
|
580
|
+
* },
|
|
581
|
+
* },
|
|
582
|
+
* }, 'checkoutSessionId', 'BR');
|
|
583
|
+
*
|
|
584
|
+
* console.log('Token:', result.token);
|
|
585
|
+
* } catch (error) {
|
|
586
|
+
* console.error('Token generation failed:', error);
|
|
587
|
+
* }
|
|
588
|
+
* ```
|
|
589
|
+
*/
|
|
590
|
+
static async generateToken(
|
|
591
|
+
tokenCollectedData: TokenCollectedData,
|
|
592
|
+
checkoutSession: string,
|
|
593
|
+
countryCode?: string
|
|
594
|
+
): Promise<HeadlessTokenResponse> {
|
|
595
|
+
const native = getYunoNative();
|
|
596
|
+
const country = countryCode || this.getCountryCode();
|
|
597
|
+
|
|
598
|
+
return native.generateToken(tokenCollectedData, checkoutSession, country);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Get the 3D Secure challenge URL for a checkout session using the headless flow.
|
|
603
|
+
* This is typically called after successfully generating a token to handle 3DS verification.
|
|
604
|
+
*
|
|
605
|
+
* @param checkoutSession The checkout session ID
|
|
606
|
+
* @param countryCode The country code for the payment (optional, uses initialized value if not provided)
|
|
607
|
+
* @returns Promise resolving to the 3DS challenge response
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* ```typescript
|
|
611
|
+
* import { YunoSdk } from '@yuno-payments/yuno-sdk-react-native';
|
|
612
|
+
*
|
|
613
|
+
* try {
|
|
614
|
+
* // First generate token
|
|
615
|
+
* const tokenResult = await YunoSdk.generateToken(paymentData, checkoutSession, 'BR');
|
|
616
|
+
*
|
|
617
|
+
* // Then get 3DS challenge URL if needed
|
|
618
|
+
* const challengeResult = await YunoSdk.getThreeDSecureChallenge(checkoutSession, 'BR');
|
|
619
|
+
*
|
|
620
|
+
* if (challengeResult.type === 'URL') {
|
|
621
|
+
* console.log('3DS URL:', challengeResult.data);
|
|
622
|
+
* // Open this URL in a WebView for the user to complete 3DS verification
|
|
623
|
+
* }
|
|
624
|
+
* } catch (error) {
|
|
625
|
+
* console.error('3DS challenge failed:', error);
|
|
626
|
+
* }
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
629
|
+
static async getThreeDSecureChallenge(
|
|
630
|
+
checkoutSession: string,
|
|
631
|
+
countryCode?: string
|
|
632
|
+
): Promise<ThreeDSecureChallengeResponse> {
|
|
633
|
+
const native = getYunoNative();
|
|
634
|
+
const country = countryCode || this.getCountryCode();
|
|
635
|
+
|
|
636
|
+
return native.getThreeDSecureChallenge(checkoutSession, country);
|
|
637
|
+
}
|
|
538
638
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless Payment Flow Types
|
|
3
|
+
* These types mirror the native SDK's TokenCollectedData structure
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export enum CardType {
|
|
7
|
+
CREDIT = 'CREDIT',
|
|
8
|
+
DEBIT = 'DEBIT',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Detail {
|
|
12
|
+
expirationMonth?: number;
|
|
13
|
+
expirationYear?: number;
|
|
14
|
+
number?: string;
|
|
15
|
+
securityCode?: string;
|
|
16
|
+
holderName?: string;
|
|
17
|
+
type?: CardType;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Installment {
|
|
21
|
+
id: string;
|
|
22
|
+
value: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CardData {
|
|
26
|
+
save?: boolean;
|
|
27
|
+
detail?: Detail;
|
|
28
|
+
installment?: Installment;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface Document {
|
|
32
|
+
type: string;
|
|
33
|
+
number: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface Phone {
|
|
37
|
+
countryCode: string;
|
|
38
|
+
number: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface Address {
|
|
42
|
+
street?: string;
|
|
43
|
+
number?: string;
|
|
44
|
+
complement?: string;
|
|
45
|
+
neighborhood?: string;
|
|
46
|
+
city?: string;
|
|
47
|
+
state?: string;
|
|
48
|
+
zipCode?: string;
|
|
49
|
+
country?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface Customer {
|
|
53
|
+
id: string;
|
|
54
|
+
merchantCustomerId: string;
|
|
55
|
+
firstName?: string;
|
|
56
|
+
lastName?: string;
|
|
57
|
+
dateOfBirth?: string;
|
|
58
|
+
email?: string;
|
|
59
|
+
country?: string;
|
|
60
|
+
createdAt?: string;
|
|
61
|
+
updatedAt?: string;
|
|
62
|
+
document?: Document;
|
|
63
|
+
phone?: Phone;
|
|
64
|
+
billingAddress?: Address;
|
|
65
|
+
shippingAddress?: Address;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface PaymentMethod {
|
|
69
|
+
type: string;
|
|
70
|
+
vaultedToken?: string | null;
|
|
71
|
+
card?: CardData;
|
|
72
|
+
customer?: Customer;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface TokenCollectedData {
|
|
76
|
+
checkoutSession?: string;
|
|
77
|
+
customerSession?: string;
|
|
78
|
+
paymentMethod: PaymentMethod;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface ThreeDSecureChallengeResponse {
|
|
82
|
+
type: string;
|
|
83
|
+
data: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface HeadlessTokenResponse {
|
|
87
|
+
token?: string;
|
|
88
|
+
error?: string;
|
|
89
|
+
}
|
package/src/core/types/index.ts
CHANGED
|
@@ -5,3 +5,17 @@ export type { EnrollmentArguments } from './EnrollmentArguments';
|
|
|
5
5
|
export type { StartPayment, MethodSelected } from './StartPayment';
|
|
6
6
|
export type { SeamlessArguments } from './SeamlessArguments';
|
|
7
7
|
export type { OneTimeTokenInfo } from './OneTimeTokenInfo';
|
|
8
|
+
export type {
|
|
9
|
+
TokenCollectedData,
|
|
10
|
+
PaymentMethod,
|
|
11
|
+
CardData,
|
|
12
|
+
Detail,
|
|
13
|
+
Installment,
|
|
14
|
+
Customer,
|
|
15
|
+
Document,
|
|
16
|
+
Phone,
|
|
17
|
+
Address,
|
|
18
|
+
CardType,
|
|
19
|
+
ThreeDSecureChallengeResponse,
|
|
20
|
+
HeadlessTokenResponse,
|
|
21
|
+
} from './HeadlessTypes';
|