@jimrising/easymerchantsdk-react-native 1.3.4 → 1.3.6
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/README.md +11 -4
- package/android/.gradle/8.10/checksums/checksums.lock +0 -0
- package/android/.gradle/8.10/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.10/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.10/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.10/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.10/gc.properties +0 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/nb-cache/trust/0B5D6BE682AD6AEE9815EC13516BF075752CAE5AD5BECDCC00315C37622C2FD3 +1 -0
- package/android/.gradle/nb-cache/trust/23843E1876B2E51C07E80AB52D1E797E5D8053D8097EEEB15FB63DD903195C14 +1 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +2 -0
- package/ios/Classes/EasyMerchantSdk.m +43 -28
- package/ios/Classes/EasyMerchantSdk.swift +68 -9
- package/ios/CustomComponents/PlanSelector.swift +28 -30
- package/ios/EnvironmentConfig.swift +30 -30
- package/ios/Example/ViewController.swift +47 -51
- package/ios/Models/AdditionalInfo.swift +43 -6
- package/ios/Models/BillingInfo.swift +50 -6
- package/ios/Models/RecurringIntervals.swift +34 -0
- package/ios/Models/RecurringStartDateType.swift +13 -0
- package/ios/Models/Request.swift +120 -11
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +609 -79
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +72 -25
- package/ios/Pods/ViewControllers/EmailVerificationVC.swift +14 -0
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +459 -42
- package/ios/Pods/ViewControllers/PaymentDoneVC.swift +16 -2
- package/ios/Pods/ViewControllers/PaymentErrorVC.swift +0 -2
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +1553 -372
- package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +6 -2
- package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +6 -1
- package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +105 -0
- package/ios/easymerchantsdk.podspec +1 -1
- package/ios/easymerchantsdk.storyboard +554 -57
- package/package.json +2 -2
- package/.idea/caches/deviceStreaming.xml +0 -571
- package/.idea/em-MobileCheckoutSDK-ReactNative.iml +0 -9
- package/.idea/misc.xml +0 -5
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ To add the path of sdk in your project. Open your `package.json` file and inside
|
|
|
7
7
|
|
|
8
8
|
```json
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@jimrising/easymerchantsdk-react-native": "^1.3.
|
|
10
|
+
"@jimrising/easymerchantsdk-react-native": "^1.3.5"
|
|
11
11
|
},
|
|
12
12
|
```
|
|
13
13
|
|
|
@@ -162,7 +162,7 @@ const App = () => {
|
|
|
162
162
|
};
|
|
163
163
|
|
|
164
164
|
const handleBilling = async () => {
|
|
165
|
-
const amount = '
|
|
165
|
+
const amount = '72';
|
|
166
166
|
const billingInfo = {
|
|
167
167
|
address: 'Test',
|
|
168
168
|
country: 'test',
|
|
@@ -172,7 +172,7 @@ const App = () => {
|
|
|
172
172
|
additional_info: {
|
|
173
173
|
name: 'Test User',
|
|
174
174
|
email: 'test@gmail.com',
|
|
175
|
-
phone_number: '
|
|
175
|
+
phone_number: '7888821587',
|
|
176
176
|
country_code: '91',
|
|
177
177
|
description: 'SDK Test',
|
|
178
178
|
},
|
|
@@ -218,7 +218,13 @@ const App = () => {
|
|
|
218
218
|
false, // saveCard
|
|
219
219
|
false, // saveAccount
|
|
220
220
|
true, // authenticatedACH
|
|
221
|
-
authConfig
|
|
221
|
+
authConfig,
|
|
222
|
+
"Submit",
|
|
223
|
+
true,
|
|
224
|
+
['weekly', 'monthly'],
|
|
225
|
+
'custom',
|
|
226
|
+
"05/30/2025",
|
|
227
|
+
true
|
|
222
228
|
);
|
|
223
229
|
|
|
224
230
|
console.log("Billing success:", result);
|
|
@@ -279,6 +285,7 @@ const styles = StyleSheet.create({
|
|
|
279
285
|
|
|
280
286
|
|
|
281
287
|
|
|
288
|
+
|
|
282
289
|
```
|
|
283
290
|
|
|
284
291
|
You can send `null` if billing info not available.
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
14CECFB310D8C466291C81DD53127CB2C5FDEED791047216FAF15D765467001D
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7B4711EF5BD8AAFCB0F97ED30C712B87657E9522834D63197B63D19F2590EA9F
|
|
File without changes
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#import "EasyMerchantSdk.h"
|
|
2
2
|
#import <React/RCTLog.h>
|
|
3
3
|
#import <React/RCTBridgeModule.h>
|
|
4
|
-
#import <easymerchantsdk-Swift.h>
|
|
4
|
+
#import <easymerchantsdk/easymerchantsdk-Swift.h>
|
|
5
|
+
|
|
6
|
+
// #import <easymerchantsdk-Swift.h>
|
|
5
7
|
|
|
6
8
|
@interface EasyMerchantSdk()
|
|
7
9
|
@property (nonatomic, strong) EasyMerchantSdkPlugin *sdkPluginInstance;
|
|
@@ -22,17 +24,23 @@ RCT_EXPORT_METHOD(configureEnvironment:(NSString *)env
|
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
RCT_EXPORT_METHOD(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
billing:(NSString *)amount
|
|
28
|
+
billingInfo:(NSString *)billingInfo
|
|
29
|
+
paymentMethods:(NSArray *)paymentMethods
|
|
30
|
+
themeConfiguration:(NSDictionary *)themeConfiguration
|
|
31
|
+
tokenOnly:(BOOL)tokenOnly
|
|
32
|
+
saveCard:(BOOL)saveCard
|
|
33
|
+
saveAccount:(BOOL)saveAccount
|
|
34
|
+
authenticatedACH:(BOOL)authenticatedACH
|
|
35
|
+
grailPayParams:(NSDictionary *)grailPayParams
|
|
36
|
+
submitButtonText:(NSString *)submitButtonText
|
|
37
|
+
isRecurring:(BOOL)isRecurring
|
|
38
|
+
recurringIntervals:(NSArray *)recurringIntervals
|
|
39
|
+
recurringStartDateType:(NSString *)recurringStartDateType
|
|
40
|
+
recurringStartDate:(NSString *)recurringStartDate
|
|
41
|
+
enable3DS:(BOOL)enable3DS
|
|
42
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
43
|
+
rejecter:(RCTPromiseRejectBlock)reject
|
|
36
44
|
)
|
|
37
45
|
{
|
|
38
46
|
if (!self.sdkPluginInstance) {
|
|
@@ -40,27 +48,34 @@ RCT_EXPORT_METHOD(
|
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
[self.sdkPluginInstance billing:amount
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
billinginfo:billingInfo
|
|
52
|
+
paymentMethods:paymentMethods
|
|
53
|
+
themeConfiguration:themeConfiguration
|
|
54
|
+
tokenOnly:tokenOnly
|
|
55
|
+
saveCard:saveCard
|
|
56
|
+
saveAccount:saveAccount
|
|
57
|
+
authenticatedACH:authenticatedACH
|
|
58
|
+
grailPayParams:grailPayParams
|
|
59
|
+
submitButtonText:submitButtonText
|
|
60
|
+
isRecurring:isRecurring
|
|
61
|
+
recurringIntervals:recurringIntervals
|
|
62
|
+
recurringStartDateType:recurringStartDateType
|
|
63
|
+
recurringStartDate:recurringStartDate
|
|
64
|
+
enable3DS:enable3DS
|
|
65
|
+
resolver:^(id result) {
|
|
66
|
+
resolve(result);
|
|
67
|
+
self.sdkPluginInstance = nil;
|
|
68
|
+
}
|
|
69
|
+
rejecter:^(NSString *code, NSString *message, NSError *error) {
|
|
70
|
+
reject(code, message, error);
|
|
71
|
+
self.sdkPluginInstance = nil;
|
|
72
|
+
}];
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
|
|
62
76
|
|
|
63
77
|
|
|
78
|
+
|
|
64
79
|
RCT_REMAP_METHOD(setViewController,
|
|
65
80
|
setViewControllerWithResolver:(RCTPromiseResolveBlock)resolve
|
|
66
81
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
@@ -4,23 +4,26 @@ import React
|
|
|
4
4
|
|
|
5
5
|
@objc(EasyMerchantSdkPlugin)
|
|
6
6
|
public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
7
|
+
|
|
8
|
+
// MARK: - React Native Module Setup
|
|
7
9
|
public static func moduleName() -> String { "EasyMerchantSdk" }
|
|
8
10
|
public static func requiresMainQueueSetup() -> Bool { true }
|
|
9
11
|
|
|
10
12
|
public var bridge: RCTBridge?
|
|
11
13
|
|
|
14
|
+
// MARK: - Private Properties
|
|
12
15
|
private var viewController: UIViewController?
|
|
13
16
|
private let viewControllerQueue = DispatchQueue(label: "com.easymerchantsdk.viewController")
|
|
14
17
|
|
|
15
18
|
private var billingResolver: RCTPromiseResolveBlock?
|
|
16
19
|
private var billingRejecter: RCTPromiseRejectBlock?
|
|
17
20
|
|
|
18
|
-
//
|
|
21
|
+
// MARK: - Initializer
|
|
19
22
|
@objc public override init() {
|
|
20
23
|
super.init()
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
//
|
|
26
|
+
// Called when the bridge finishes loading
|
|
24
27
|
public func bridgeDidFinishLoading() {
|
|
25
28
|
if self.bridge != nil {
|
|
26
29
|
print("Bridge has been initialized successfully.")
|
|
@@ -29,6 +32,7 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
// MARK: - Set ViewController (for presenting modal)
|
|
32
36
|
@objc public func setViewController(_ viewController: UIViewController) {
|
|
33
37
|
viewControllerQueue.sync {
|
|
34
38
|
self.viewController = viewController
|
|
@@ -36,6 +40,7 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
36
40
|
print("ViewController set: \(String(describing: self.viewController))")
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
// MARK: - Billing method exposed to React Native
|
|
39
44
|
@objc public func billing(
|
|
40
45
|
_ amount: String,
|
|
41
46
|
billinginfo: String?,
|
|
@@ -46,31 +51,41 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
46
51
|
saveAccount: Bool,
|
|
47
52
|
authenticatedACH: Bool,
|
|
48
53
|
grailPayParams: [String: Any]?,
|
|
54
|
+
submitButtonText: String?,
|
|
55
|
+
isRecurring: Bool,
|
|
56
|
+
recurringIntervals: [String]?,
|
|
57
|
+
recurringStartDateType: String?,
|
|
58
|
+
recurringStartDate: String?,
|
|
59
|
+
enable3DS: Bool,
|
|
49
60
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
50
61
|
rejecter: @escaping RCTPromiseRejectBlock
|
|
51
62
|
) {
|
|
63
|
+
// Validate amount
|
|
52
64
|
guard let amountValue = Double(amount), amountValue > 0 else {
|
|
53
65
|
rejecter("INVALID_AMOUNT", "Amount must be a positive number", nil)
|
|
54
66
|
return
|
|
55
67
|
}
|
|
56
68
|
|
|
69
|
+
// Validate billinginfo JSON if present
|
|
57
70
|
if let billinginfo = billinginfo {
|
|
58
71
|
guard let billingInfoData = billinginfo.data(using: .utf8),
|
|
59
|
-
|
|
72
|
+
(try? JSONSerialization.jsonObject(with: billingInfoData, options: [])) != nil else {
|
|
60
73
|
rejecter("INVALID_BILLING_INFO", "Billing info must be valid JSON", nil)
|
|
61
74
|
return
|
|
62
75
|
}
|
|
63
76
|
}
|
|
64
77
|
|
|
78
|
+
// Map payment method strings to enum cases
|
|
65
79
|
let methods: [PaymentMethod] = paymentMethods.compactMap {
|
|
66
80
|
switch $0.lowercased() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
case "card": return .Card
|
|
82
|
+
case "bank": return .Bank
|
|
83
|
+
case "crypto": return .Crypto
|
|
84
|
+
default: return nil
|
|
71
85
|
}
|
|
72
86
|
}
|
|
73
87
|
|
|
88
|
+
// Setup GrailPayRequest if authenticatedACH is true
|
|
74
89
|
var grailParams: GrailPayRequest? = nil
|
|
75
90
|
if authenticatedACH, let params = grailPayParams {
|
|
76
91
|
grailParams = GrailPayRequest(
|
|
@@ -85,6 +100,7 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
85
100
|
)
|
|
86
101
|
}
|
|
87
102
|
|
|
103
|
+
// Setup Theme Configuration with default fallbacks
|
|
88
104
|
let themeConfig = ThemeConfiguration(
|
|
89
105
|
bodyBackgroundColor: themeConfiguration["bodyBackgroundColor"] as? String ?? "#EBF8FF",
|
|
90
106
|
containerBackgroundColor: themeConfiguration["containerBackgroundColor"] as? String ?? "#FFFFFF",
|
|
@@ -100,8 +116,40 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
100
116
|
fontSize: themeConfiguration["fontSize"] as? String ?? "14"
|
|
101
117
|
)
|
|
102
118
|
|
|
119
|
+
// Prepare billing info data
|
|
103
120
|
let billingInfoData = billinginfo?.data(using: .utf8) ?? Data()
|
|
104
121
|
|
|
122
|
+
|
|
123
|
+
print("🔥 recurringIntervals raw from JS:", recurringIntervals as Any)
|
|
124
|
+
|
|
125
|
+
// Updated mapping to strip leading "." if present
|
|
126
|
+
let intervals = (recurringIntervals ?? []).compactMap { raw -> RecurringIntervals? in
|
|
127
|
+
// 1) Trim whitespace, lowercase
|
|
128
|
+
let cleaned = raw.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
|
|
129
|
+
// 2) If it starts with ".", drop that character
|
|
130
|
+
let noDot = cleaned.hasPrefix(".") ? String(cleaned.dropFirst()) : cleaned
|
|
131
|
+
// 3) Try to initialize your enum
|
|
132
|
+
return RecurringIntervals(rawValue: noDot)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
print("🔥 mapped intervals after stripping dots:", intervals)
|
|
136
|
+
|
|
137
|
+
guard !intervals.isEmpty else {
|
|
138
|
+
rejecter("NO_RECURRING_INTERVALS", "No recurring intervals available.", nil)
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
// 2) Map recurringStartDateType (assuming you have an enum for it)
|
|
144
|
+
let recurringStartDateTypeEnum: RecurringStartDateType = {
|
|
145
|
+
switch recurringStartDateType?.lowercased() {
|
|
146
|
+
case "custom": return .custom
|
|
147
|
+
case "fixed": return .fixed
|
|
148
|
+
default: return .custom
|
|
149
|
+
}
|
|
150
|
+
}()
|
|
151
|
+
|
|
152
|
+
// Create Request object with all parameters
|
|
105
153
|
let request = Request(
|
|
106
154
|
amount: amountValue,
|
|
107
155
|
billingInfoData: billingInfoData,
|
|
@@ -110,11 +158,17 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
110
158
|
tokenOnly: tokenOnly,
|
|
111
159
|
saveCard: saveCard,
|
|
112
160
|
saveAccount: saveAccount,
|
|
113
|
-
submitButtonText: "Submit",
|
|
161
|
+
submitButtonText: submitButtonText ?? "Submit",
|
|
114
162
|
authenticatedACH: authenticatedACH,
|
|
115
|
-
grailPayParams: authenticatedACH ? grailParams : nil
|
|
163
|
+
grailPayParams: authenticatedACH ? grailParams : nil,
|
|
164
|
+
is_recurring: isRecurring,
|
|
165
|
+
recurringIntervals: intervals,
|
|
166
|
+
recurringStartDateType: recurringStartDateTypeEnum,
|
|
167
|
+
recurringStartDate: recurringStartDate,
|
|
168
|
+
enable3DS: enable3DS
|
|
116
169
|
)
|
|
117
170
|
|
|
171
|
+
// Store resolve/reject callbacks for later
|
|
118
172
|
self.billingResolver = resolver
|
|
119
173
|
self.billingRejecter = rejecter
|
|
120
174
|
|
|
@@ -131,6 +185,7 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
131
185
|
}
|
|
132
186
|
}
|
|
133
187
|
|
|
188
|
+
// MARK: - Environment Configuration
|
|
134
189
|
@objc public func configureEnvironment(_ env: String, apiKey: String, apiSecret: String) {
|
|
135
190
|
switch env.lowercased() {
|
|
136
191
|
case "production":
|
|
@@ -143,6 +198,7 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
143
198
|
EnvironmentConfig.configure(apiKey: apiKey, apiSecret: apiSecret)
|
|
144
199
|
}
|
|
145
200
|
|
|
201
|
+
// MARK: - Platform Version
|
|
146
202
|
@objc public func getPlatformVersion(
|
|
147
203
|
_ resolver: @escaping RCTPromiseResolveBlock,
|
|
148
204
|
rejecter: @escaping RCTPromiseRejectBlock
|
|
@@ -150,12 +206,14 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
|
|
|
150
206
|
resolver("iOS \(UIDevice.current.systemVersion)")
|
|
151
207
|
}
|
|
152
208
|
|
|
209
|
+
// MARK: - Clear stored callbacks
|
|
153
210
|
private func clearResolvers() {
|
|
154
211
|
self.billingResolver = nil
|
|
155
212
|
self.billingRejecter = nil
|
|
156
213
|
}
|
|
157
214
|
}
|
|
158
215
|
|
|
216
|
+
// MARK: - EasyPayViewControllerDelegate Implementation
|
|
159
217
|
extension EasyMerchantSdkPlugin: EasyPayViewControllerDelegate {
|
|
160
218
|
public func easyPayController(_ controller: EasyPayViewController, didFinishWith result: Result) {
|
|
161
219
|
DispatchQueue.main.async {
|
|
@@ -181,3 +239,4 @@ extension EasyMerchantSdkPlugin: EasyPayViewControllerDelegate {
|
|
|
181
239
|
}
|
|
182
240
|
}
|
|
183
241
|
}
|
|
242
|
+
|
|
@@ -8,51 +8,49 @@
|
|
|
8
8
|
import UIKit
|
|
9
9
|
|
|
10
10
|
class PlanSelector {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
static func presentPlanOptions(
|
|
12
|
+
from viewController: UIViewController,
|
|
13
|
+
sourceView: UIView,
|
|
14
|
+
allowedPlans: [RecurringIntervals],
|
|
15
|
+
onSelection: @escaping (String) -> Void
|
|
16
|
+
) {
|
|
14
17
|
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
onSelection("Monthly")
|
|
18
|
+
|
|
19
|
+
for plan in allowedPlans {
|
|
20
|
+
let displayName = plan.displayName
|
|
21
|
+
let action = UIAlertAction(title: displayName, style: .default) { _ in
|
|
22
|
+
onSelection(displayName) // ✅ Return user-friendly display name
|
|
23
|
+
}
|
|
24
|
+
alertController.addAction(action)
|
|
23
25
|
}
|
|
24
|
-
|
|
26
|
+
|
|
25
27
|
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
|
|
26
|
-
|
|
27
|
-
alertController.addAction(weeklyAction)
|
|
28
|
-
alertController.addAction(monthlyAction)
|
|
29
28
|
alertController.addAction(cancelAction)
|
|
30
|
-
|
|
31
|
-
//
|
|
29
|
+
|
|
30
|
+
// Optional styling
|
|
32
31
|
if let secondaryColorHex = UserStoreSingleton.shared.secondary_font_col,
|
|
33
32
|
let secondaryColor = UIColor(hex: secondaryColorHex) {
|
|
34
|
-
let
|
|
33
|
+
let titleAttr = NSAttributedString(string: "Select Plan", attributes: [
|
|
35
34
|
.foregroundColor: secondaryColor,
|
|
36
35
|
.font: UIFont.systemFont(ofSize: 16, weight: .medium)
|
|
37
36
|
])
|
|
38
|
-
alertController.setValue(
|
|
37
|
+
alertController.setValue(titleAttr, forKey: "attributedTitle")
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
// Set title colors for actions using primary font color
|
|
39
|
+
|
|
42
40
|
if let buttonColorHex = UserStoreSingleton.shared.primary_btn_bg_col,
|
|
43
41
|
let buttonColor = UIColor(hex: buttonColorHex) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
alertController.actions.forEach {
|
|
43
|
+
if $0.title != "Cancel" {
|
|
44
|
+
$0.setValue(buttonColor, forKey: "titleTextColor")
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
popoverController.sourceRect = sourceView.bounds
|
|
49
|
+
if let popover = alertController.popoverPresentationController {
|
|
50
|
+
popover.sourceView = sourceView
|
|
51
|
+
popover.sourceRect = sourceView.bounds
|
|
53
52
|
}
|
|
54
|
-
|
|
53
|
+
|
|
55
54
|
viewController.present(alertController, animated: true)
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
|
-
|
|
@@ -39,34 +39,34 @@ public class EnvironmentConfig {
|
|
|
39
39
|
self.currentEnvironment = environment
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
42
|
+
public enum Endpoints {
|
|
43
|
+
case paymentIntent
|
|
44
|
+
case hostedCheckouts
|
|
45
|
+
case emailVerification
|
|
46
|
+
case verifyOtp
|
|
47
|
+
case getCards
|
|
48
|
+
case creditCharges
|
|
49
|
+
case account
|
|
50
|
+
case achCharge
|
|
51
|
+
case charges
|
|
52
|
+
case accountConnect
|
|
53
|
+
case threeDSecure
|
|
54
|
+
|
|
55
|
+
func path() -> String {
|
|
56
|
+
switch self {
|
|
57
|
+
case .paymentIntent: return "/api/v1/paymentintent"
|
|
58
|
+
case .hostedCheckouts: return "/api/v1/hostedcheckouts"
|
|
59
|
+
case .emailVerification: return "/api/v1/customer/send_otp"
|
|
60
|
+
case .verifyOtp: return "/api/v1/customer/verify_otp"
|
|
61
|
+
// case .getCards: return "/api/v1/customer/card"
|
|
62
|
+
case .getCards: return "/api/v1/card"
|
|
63
|
+
case .creditCharges: return "/api/v1/customer/charges"
|
|
64
|
+
case .account: return "/api/v1/ach/account"
|
|
65
|
+
case .achCharge: return "/api/v1/ach/charge"
|
|
66
|
+
case .charges: return "/api/v1/charges"
|
|
67
|
+
case .accountConnect: return "/api/v1/ach/account/connect"
|
|
68
|
+
case .threeDSecure: return "/api/v1/3dsecure"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
72
|
}
|