react-native-test-payment-gateway-new 0.1.1 → 0.1.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.
Files changed (26) hide show
  1. package/TestPaymentGatewayNew.podspec +1 -0
  2. package/ios/CCAvenueSDK.xcframework/Info.plist +43 -0
  3. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/CCAvenueSDK +0 -0
  4. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/Headers/CCAvenueSDK-Swift.h +452 -0
  5. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/Headers/CCAvenueSDK.h +19 -0
  6. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/Info.plist +0 -0
  7. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/Modules/CCAvenueSDK.swiftmodule/arm64-apple-ios.abi.json +17375 -0
  8. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/Modules/CCAvenueSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +392 -0
  9. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/Modules/CCAvenueSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  10. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/Modules/CCAvenueSDK.swiftmodule/arm64-apple-ios.swiftinterface +392 -0
  11. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/Modules/module.modulemap +11 -0
  12. package/ios/CCAvenueSDK.xcframework/ios-arm64/CCAvenueSDK.framework/getUpiOptions.json +155 -0
  13. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/CCAvenueSDK +0 -0
  14. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/Headers/CCAvenueSDK-Swift.h +452 -0
  15. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/Headers/CCAvenueSDK.h +19 -0
  16. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/Info.plist +0 -0
  17. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/Modules/CCAvenueSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +17375 -0
  18. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/Modules/CCAvenueSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +392 -0
  19. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/Modules/CCAvenueSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  20. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/Modules/CCAvenueSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +392 -0
  21. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/Modules/module.modulemap +11 -0
  22. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/_CodeSignature/CodeResources +201 -0
  23. package/ios/CCAvenueSDK.xcframework/ios-x86_64-simulator/CCAvenueSDK.framework/getUpiOptions.json +155 -0
  24. package/ios/CCavenueModule.swift +227 -0
  25. package/ios/TestPaymentGatewayNew.mm +64 -8
  26. package/package.json +1 -1
@@ -0,0 +1,155 @@
1
+ {
2
+ "OPTUPI": [{
3
+ "pay_opt_type": "OPTUPI",
4
+ "pay_opt_desc": "Unified Payments",
5
+ "card_type": "UPI",
6
+ "card_name": "BHIM",
7
+ "account_data_at": "CCAvenue",
8
+ "account_status": "ACTI",
9
+ "pay_opt_disp_order": "15",
10
+ "card_status_message": "",
11
+ "card_disp_order": "20",
12
+ "account_si": "N",
13
+ "gtw_integration": "",
14
+ "account_upiqr": "N",
15
+ "account_otp": "N",
16
+ "optim_flag": "N",
17
+ "gtw_id": "BHIM",
18
+ "whereToFindUPI": "1. Open BHIM app.\n2. Tap on \"Profile\" tab below my information.\n3. Your \"UPI ID\" is below QR Code",
19
+ "upiHandler": ["@upi", "Other UPI"]
20
+ },
21
+ {
22
+ "pay_opt_type": "OPTUPI",
23
+ "pay_opt_desc": "Unified Payments",
24
+ "card_type": "UPI",
25
+ "card_name": "Cred",
26
+ "account_data_at": "CCAvenue",
27
+ "account_status": "ACTI",
28
+ "pay_opt_disp_order": "15",
29
+ "card_status_message": "",
30
+ "card_disp_order": "20",
31
+ "account_si": "N",
32
+ "gtw_integration": "",
33
+ "account_upiqr": "N",
34
+ "account_otp": "N",
35
+ "optim_flag": "N",
36
+ "gtw_id": "cred",
37
+ "whereToFindUPI": "1. Open \"Cred\" app.\n2. Tap on \"Profile\" tab below my information.\n3. Your \"UPI ID\" is next to the QR Code.",
38
+ "upiHandler": ["@ybl", "Other UPI"]
39
+ },
40
+ {
41
+ "pay_opt_type": "OPTUPI",
42
+ "pay_opt_desc": "Unified Payments",
43
+ "card_type": "UPI",
44
+ "card_name": "Airtel",
45
+ "account_data_at": "CCAvenue",
46
+ "account_status": "ACTI",
47
+ "pay_opt_disp_order": "15",
48
+ "card_status_message": "",
49
+ "card_disp_order": "20",
50
+ "account_si": "N",
51
+ "gtw_integration": "",
52
+ "account_upiqr": "Y",
53
+ "account_otp": "N",
54
+ "optim_flag": "N",
55
+ "gtw_id": "Payrtm",
56
+ "whereToFindUPI": "1. Open \"Airtel\" app.\n2. Tap on \"Profile\" tab below my information.\n3. Tap on \"Bank Profile\" icon. \n4. Your \"UPI ID\" is next to the QR Code.",
57
+ "upiHandler": ["@airtel", "Other UPI"]
58
+ },
59
+ {
60
+ "pay_opt_type": "OPTUPI",
61
+ "pay_opt_desc": "Unified Payments",
62
+ "card_type": "UPI",
63
+ "card_name": "PhonePe",
64
+ "account_data_at": "CCAvenue",
65
+ "account_status": "ACTI",
66
+ "pay_opt_disp_order": "15",
67
+ "card_status_message": "",
68
+ "card_disp_order": "20",
69
+ "account_si": "N",
70
+ "gtw_integration": "",
71
+ "account_upiqr": "N",
72
+ "account_otp": "N",
73
+ "optim_flag": "N",
74
+ "gtw_id": "PhonePe",
75
+ "whereToFindUPI": "1. Open PhonePe app.\n2. Tap on \"My Accounut\" in navigation bar.\n3. Then tap on \"BHIM UPI ID\"",
76
+ "upiHandler": ["@ybl", "Other UPI"]
77
+ },
78
+ {
79
+ "pay_opt_type": "OPTUPI",
80
+ "pay_opt_desc": "Unified Payments",
81
+ "card_type": "UPI",
82
+ "card_name": "Google Pay",
83
+ "account_data_at": "CCAvenue",
84
+ "account_status": "ACTI",
85
+ "pay_opt_disp_order": "15",
86
+ "card_status_message": "",
87
+ "card_disp_order": "20",
88
+ "account_si": "N",
89
+ "gtw_integration": "",
90
+ "account_upiqr": "Y",
91
+ "account_otp": "N",
92
+ "optim_flag": "N",
93
+ "gtw_id": "GooglePay",
94
+ "whereToFindUPI": "1. Open \"Google Pay\" (Tez) app.\n2. Tap on your name on the top left.\n3. Your \"UPI ID\" is below your email ID or mobile number.",
95
+ "upiHandler": ["@okhdfcbank", "@oksbi", "@okaxis", "@okicici", "Other UPI"]
96
+ },
97
+ {
98
+ "pay_opt_type": "OPTUPI",
99
+ "pay_opt_desc": "Unified Payments",
100
+ "card_type": "UPI",
101
+ "card_name": "Paytm",
102
+ "account_data_at": "CCAvenue",
103
+ "account_status": "ACTI",
104
+ "pay_opt_disp_order": "15",
105
+ "card_status_message": "",
106
+ "card_disp_order": "20",
107
+ "account_si": "N",
108
+ "gtw_integration": "",
109
+ "account_upiqr": "Y",
110
+ "account_otp": "N",
111
+ "optim_flag": "N",
112
+ "gtw_id": "Payrtm",
113
+ "whereToFindUPI": "1. Open \"Paytm\" app.\n2. Tap on \"BHIM UPI\" in top navigation bar.\n3. Your \"UPI ID\" is next to the QR Code.",
114
+ "upiHandler": ["@paytm", "Other UPI"]
115
+ },
116
+ {
117
+ "pay_opt_type": "OPTUPI",
118
+ "pay_opt_desc": "Unified Payments",
119
+ "card_type": "UPI",
120
+ "card_name": "WhatsApp",
121
+ "account_data_at": "CCAvenue",
122
+ "account_status": "ACTI",
123
+ "pay_opt_disp_order": "15",
124
+ "card_status_message": "",
125
+ "card_disp_order": "20",
126
+ "account_si": "N",
127
+ "gtw_integration": "",
128
+ "account_upiqr": "Y",
129
+ "account_otp": "N",
130
+ "optim_flag": "N",
131
+ "gtw_id": "WhatsApp",
132
+ "whereToFindUPI": "1. Open \"WhatsApp\" app.\n2. Tap on \"Payments\" in your menu/settings.\n3. Tap on your \"Bank Account\".\n4. Your \"UPI ID\" is below your bank account.",
133
+ "upiHandler": ["@icici", "@waaxis", "@wahdfcbank", "@wasbi", "Other UPI"]
134
+ },
135
+ {
136
+ "pay_opt_type": "OPTUPI",
137
+ "pay_opt_desc": "Unified Payments",
138
+ "card_type": "UPI",
139
+ "card_name": "OtherUPI",
140
+ "account_data_at": "CCAvenue",
141
+ "account_status": "ACTI",
142
+ "pay_opt_disp_order": "15",
143
+ "card_status_message": "",
144
+ "card_disp_order": "20",
145
+ "account_si": "N",
146
+ "gtw_integration": "",
147
+ "account_upiqr": "Y",
148
+ "account_otp": "N",
149
+ "optim_flag": "N",
150
+ "gtw_id": "other",
151
+ "whereToFindUPI": "",
152
+ "upiHandler": []
153
+ }
154
+ ]
155
+ }
@@ -0,0 +1,227 @@
1
+ import Foundation
2
+ import React
3
+ import UIKit
4
+ #if canImport(CCAvenueSDK)
5
+ import CCAvenueSDK
6
+ #endif
7
+
8
+ #if !canImport(CCAvenueSDK)
9
+ // Fallback shims so the project compiles without the CCAvenueSDK available at build time.
10
+ protocol MainViewControllerDelegate: AnyObject {
11
+ func getResponse(_ jsonResponse: [AnyHashable : Any]?)
12
+ }
13
+
14
+ class MainViewController: UIViewController {
15
+ weak var delegate: MainViewControllerDelegate?
16
+ init(ccRequestDictionary: [String: Any]) {
17
+ super.init(nibName: nil, bundle: nil)
18
+ }
19
+ required init?(coder: NSCoder) { super.init(coder: coder) }
20
+ }
21
+ #endif
22
+
23
+ @objc(PaymentGatewayHelper)
24
+ public class PaymentGatewayHelper: NSObject, MainViewControllerDelegate {
25
+
26
+ // Static method to create instance - easier to call from Objective-C
27
+ @objc public static func createInstance() -> PaymentGatewayHelper {
28
+ return PaymentGatewayHelper()
29
+ }
30
+
31
+ var resolveBlock: RCTPromiseResolveBlock?
32
+ var rejectBlock: RCTPromiseRejectBlock?
33
+ var paymentController: MainViewController?
34
+
35
+ // The signature here must match the RCT_EXTERN_METHOD in the .m file
36
+ @objc public func payTestPaymentGatewayNew(_ data: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
37
+ print("🔵 [PaymentGatewayHelper] payTestPaymentGatewayNew called")
38
+ print("🔵 [CCAvenueModule] Received data keys: \(data.allKeys)")
39
+
40
+ self.resolveBlock = resolve
41
+ self.rejectBlock = reject
42
+
43
+ print("🔵 [CCAvenueModule] Starting payment with data: \(data)")
44
+
45
+ DispatchQueue.main.async {
46
+ do {
47
+ print("🔵 [CCAvenueModule] Converting data to request dictionary")
48
+ let requestDict = self.getRequest(from: data)
49
+ print("🔵 [CCAvenueModule] Request dictionary keys: \(requestDict.keys)")
50
+ print("🔵 [CCAvenueModule] Final Request Dictionary for SDK: \(requestDict)")
51
+
52
+ print("🔵 [CCAvenueModule] Initializing MainViewController")
53
+ // Initialize the India SDK View Controller
54
+ self.paymentController = MainViewController(ccRequestDictionary: requestDict)
55
+
56
+ guard self.paymentController != nil else {
57
+ print("🔴 [CCAvenueModule] Failed to initialize MainViewController")
58
+ reject("INIT_ERROR", "MainViewController initialization returned nil", nil)
59
+ return
60
+ }
61
+
62
+ print("🔵 [CCAvenueModule] MainViewController initialized successfully")
63
+ self.paymentController?.delegate = self
64
+ self.paymentController?.modalPresentationStyle = .fullScreen
65
+
66
+ print("🔵 [CCAvenueModule] Looking for root view controller")
67
+ if let rootViewController = UIApplication.shared.delegate?.window??.rootViewController {
68
+ print("🔵 [CCAvenueModule] Root view controller found: \(type(of: rootViewController))")
69
+ print("🔵 [CCAvenueModule] Presenting payment controller")
70
+ rootViewController.present(self.paymentController!, animated: true) {
71
+ print("🟢 [CCAvenueModule] Payment controller presented successfully")
72
+ }
73
+ } else {
74
+ print("🔴 [CCAvenueModule] Could not find root view controller")
75
+ reject("NO_ROOT_VIEW", "Could not find root view controller", nil)
76
+ }
77
+
78
+ } catch let error as NSError {
79
+ print("🔴 [CCAvenueModule] Error caught: \(error)")
80
+ print("🔴 [CCAvenueModule] Error domain: \(error.domain)")
81
+ print("🔴 [CCAvenueModule] Error code: \(error.code)")
82
+ print("🔴 [CCAvenueModule] Error description: \(error.localizedDescription)")
83
+ reject("SDK_ERROR", "Failed to initialize SDK: \(error.localizedDescription)", error)
84
+ } catch {
85
+ print("🔴 [CCAvenueModule] Unknown error: \(error)")
86
+ reject("SDK_ERROR", "Failed to initialize SDK: \(error.localizedDescription)", error)
87
+ }
88
+ }
89
+ }
90
+
91
+ // MARK: - Helper Methods
92
+
93
+ private func getRequest(from arguments: NSDictionary) -> [String: Any] {
94
+ print("🔵 [CCAvenueModule] Building request dictionary")
95
+ var request: [String: Any] = [:]
96
+
97
+ // Basic payment info
98
+ request["customer_id"] = stringValue(for: "customer_id", from: arguments)
99
+ request["access_code"] = stringValue(for: "accessCode", from: arguments)
100
+ request["amount"] = stringValue(for: "amount", from: arguments)
101
+ request["currency"] = stringValue(for: "currency", from: arguments)
102
+ request["merchant_id"] = stringValue(for: "mId", from: arguments)
103
+ request["order_id"] = stringValue(for: "order_id", from: arguments)
104
+
105
+ print("🔵 [CCAvenueModule] Basic info - merchant_id: \(request["merchant_id"] ?? "nil"), access_code: \(request["access_code"] ?? "nil"), amount: \(request["amount"] ?? "nil"), order_id: \(request["order_id"] ?? "nil")")
106
+
107
+ // India SDK specific keys
108
+ request["trackingId"] = stringValue(for: "tracking_id", from: arguments)
109
+ request["requestHash"] = stringValue(for: "request_hash", from: arguments)
110
+
111
+ print("🔵 [CCAvenueModule] SDK specific - trackingId: \(request["trackingId"] ?? "nil"), requestHash: \(String(describing: request["requestHash"]).prefix(20))...")
112
+
113
+ request["promo_code"] = stringValue(for: "promo", from: arguments)
114
+ request["payment_enviroment"] = stringValue(for: "payment_enviroment", from: arguments)
115
+
116
+ print("🔵 [CCAvenueModule] Payment environment: \(request["payment_enviroment"] ?? "nil")")
117
+
118
+ // Billing information
119
+ request["billing_name"] = stringValue(for: "billing_name", from: arguments)
120
+ request["billing_address"] = stringValue(for: "billing_address", from: arguments)
121
+ request["billing_city"] = stringValue(for: "billing_city", from: arguments)
122
+ request["billing_country"] = stringValue(for: "billing_country", from: arguments)
123
+ request["billing_State"] = stringValue(for: "billing_state", from: arguments)
124
+ request["billing_zipCode"] = stringValue(for: "billing_zip", from: arguments) // ✅ ADD THIS
125
+ request["billing_tel"] = stringValue(for: "billing_telephone", from: arguments)
126
+ request["billing_email"] = stringValue(for: "billing_email", from: arguments)
127
+
128
+
129
+
130
+ print("🔵 [CCAvenueModule] Billing - name: \(request["billing_name"] ?? "nil"), email: \(request["billing_email"] ?? "nil")")
131
+
132
+ // Shipping information (Mapped to 'delivery_' keys for India SDK)
133
+ // Delivery information (MATCH FLUTTER 1:1)
134
+ request["delivery_name"] = stringValue(for: "delivery_name", from: arguments)
135
+ request["delivery_address"] = stringValue(for: "delivery_address", from: arguments)
136
+ request["delivery_city"] = stringValue(for: "delivery_city", from: arguments)
137
+ request["delivery_state"] = stringValue(for: "delivery_state", from: arguments)
138
+ request["delivery_country"] = stringValue(for: "delivery_country", from: arguments)
139
+ request["delivery_zipCode"] = stringValue(for: "delivery_zip", from: arguments)
140
+ request["delivery_tel"] = stringValue(for: "delivery_telephone", from: arguments)
141
+
142
+
143
+
144
+
145
+ print("🔵 [CCAvenueModule] Delivery info added")
146
+
147
+ // Merchant parameters
148
+ request["merchant_param1"] = stringValue(for: "merchantParam1", from: arguments)
149
+ request["merchant_param2"] = stringValue(for: "merchantParam2", from: arguments)
150
+ request["merchant_param3"] = stringValue(for: "merchantParam3", from: arguments)
151
+ request["merchant_param4"] = stringValue(for: "merchantParam4", from: arguments)
152
+ request["merchant_param5"] = stringValue(for: "merchantParam5", from: arguments)
153
+
154
+ // URLs and settings
155
+ request["redirect_url"] = stringValue(for: "redirect_url", from: arguments)
156
+ request["cancel_url"] = stringValue(for: "cancel_url", from: arguments)
157
+ request["payment_type"] = "All"
158
+ request["display_promo"] = "Y"
159
+
160
+ print("🔵 [CCAvenueModule] URLs - redirect: \(request["redirect_url"] ?? "nil"), cancel: \(request["cancel_url"] ?? "nil")")
161
+ print("🔵 [CCAvenueModule] Request dictionary completed with \(request.count) keys")
162
+
163
+ return request
164
+ }
165
+
166
+ private func stringValue(for key: String, from dict: NSDictionary) -> String {
167
+ if let value = dict[key] as? String {
168
+ return value
169
+ } else if let value = dict[key] as? NSNumber {
170
+ return value.stringValue
171
+ }
172
+ return ""
173
+ }
174
+
175
+ // MARK: - MainViewControllerDelegate
176
+
177
+ public func getResponse(_ jsonResponse: [AnyHashable : Any]?) {
178
+ print("🔵 [CCAvenueModule] getResponse called")
179
+ print("🔵 [CCAvenueModule] Response received: \(String(describing: jsonResponse))")
180
+
181
+ DispatchQueue.main.async {
182
+ do {
183
+ print("🔵 [CCAvenueModule] Dismissing payment controller")
184
+ // Dismiss the payment controller
185
+ self.paymentController?.dismiss(animated: true, completion: {
186
+ print("🔵 [CCAvenueModule] Payment controller dismissed")
187
+ self.paymentController = nil
188
+ })
189
+
190
+ if let response = jsonResponse {
191
+ print("🟢 [CCAvenueModule] Payment Response received with \(response.count) keys")
192
+
193
+ // Log specific response fields
194
+ if let status = response["order_status"] as? String {
195
+ print("🔵 [CCAvenueModule] Order status: \(status)")
196
+ }
197
+ if let orderId = response["order_id"] as? String {
198
+ print("🔵 [CCAvenueModule] Order ID: \(orderId)")
199
+ }
200
+ if let trackingId = response["tracking_id"] as? String {
201
+ print("🔵 [CCAvenueModule] Tracking ID: \(trackingId)")
202
+ }
203
+
204
+ print("🟢 [CCAvenueModule] Resolving promise with response")
205
+ self.resolveBlock?(response)
206
+ } else {
207
+ print("🔴 [CCAvenueModule] No response received from SDK")
208
+ self.rejectBlock?("PAYMENT_FAILED", "No response received from SDK", nil)
209
+ }
210
+
211
+ } catch let error as NSError {
212
+ print("🔴 [CCAvenueModule] Error in getResponse: \(error)")
213
+ print("🔴 [CCAvenueModule] Error domain: \(error.domain)")
214
+ print("🔴 [CCAvenueModule] Error code: \(error.code)")
215
+ self.rejectBlock?("RESPONSE_ERROR", "Error processing response: \(error.localizedDescription)", error)
216
+ } catch {
217
+ print("🔴 [CCAvenueModule] Unknown error in getResponse: \(error)")
218
+ self.rejectBlock?("RESPONSE_ERROR", "Error processing response: \(error.localizedDescription)", error)
219
+ }
220
+
221
+ print("🔵 [CCAvenueModule] Clearing promise blocks")
222
+ self.resolveBlock = nil
223
+ self.rejectBlock = nil
224
+ }
225
+ }
226
+ }
227
+
@@ -1,20 +1,76 @@
1
1
  #import "TestPaymentGatewayNew.h"
2
2
 
3
+ @interface TestPaymentGatewayNew ()
4
+ @property(nonatomic, strong) id helper;
5
+ @end
6
+
3
7
  @implementation TestPaymentGatewayNew
4
- - (NSNumber *)multiply:(double)a b:(double)b {
5
- NSNumber *result = @(a * b);
6
8
 
7
- return result;
9
+ - (instancetype)init {
10
+ if (self = [super init]) {
11
+ // Try different module-qualified names for the Swift class
12
+ NSArray *possibleNames = @[
13
+ @"PaymentGatewayHelper", @"TestPaymentGatewayNew.PaymentGatewayHelper"
14
+ ];
15
+
16
+ for (NSString *className in possibleNames) {
17
+ Class helperClass = NSClassFromString(className);
18
+ if (helperClass) {
19
+ // Use the static factory method instead of alloc/init
20
+ SEL createSelector = NSSelectorFromString(@"createInstance");
21
+ if ([helperClass respondsToSelector:createSelector]) {
22
+ #pragma clang diagnostic push
23
+ #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
24
+ _helper = [helperClass performSelector:createSelector];
25
+ #pragma clang diagnostic pop
26
+ NSLog(@"✅ Successfully created Swift helper using: %@", className);
27
+ break;
28
+ }
29
+ }
30
+ }
31
+
32
+ if (!_helper) {
33
+ NSLog(@"⚠️ Warning: Could not create PaymentGatewayHelper instance");
34
+ }
35
+ }
36
+ return self;
37
+ }
38
+
39
+ - (void)payTestPaymentGatewayNew:(NSDictionary *)options
40
+ resolve:(RCTPromiseResolveBlock)resolve
41
+ reject:(RCTPromiseRejectBlock)reject {
42
+ if (self.helper) {
43
+ // Call the Swift method using NSInvocation
44
+ // Note: The Swift method is still defined as
45
+ // payTestPaymentGatewayNew:resolver:rejecter:
46
+ SEL selector =
47
+ NSSelectorFromString(@"payTestPaymentGatewayNew:resolver:rejecter:");
48
+ if ([self.helper respondsToSelector:selector]) {
49
+ NSMethodSignature *signature =
50
+ [self.helper methodSignatureForSelector:selector];
51
+ NSInvocation *invocation =
52
+ [NSInvocation invocationWithMethodSignature:signature];
53
+ [invocation setSelector:selector];
54
+ [invocation setTarget:self.helper];
55
+ [invocation setArgument:&options atIndex:2];
56
+ [invocation setArgument:&resolve atIndex:3];
57
+ [invocation setArgument:&reject atIndex:4];
58
+ [invocation invoke];
59
+ } else {
60
+ reject(@"METHOD_NOT_FOUND", @"Payment method not found in helper", nil);
61
+ }
62
+ } else {
63
+ reject(@"HELPER_NOT_INITIALIZED", @"Payment helper not initialized", nil);
64
+ }
8
65
  }
9
66
 
10
67
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
11
- (const facebook::react::ObjCTurboModule::InitParams &)params
12
- {
13
- return std::make_shared<facebook::react::NativeTestPaymentGatewayNewSpecJSI>(params);
68
+ (const facebook::react::ObjCTurboModule::InitParams &)params {
69
+ return std::make_shared<facebook::react::NativeTestPaymentGatewayNewSpecJSI>(
70
+ params);
14
71
  }
15
72
 
16
- + (NSString *)moduleName
17
- {
73
+ + (NSString *)moduleName {
18
74
  return @"TestPaymentGatewayNew";
19
75
  }
20
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-test-payment-gateway-new",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "payment gateway",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",