@@ -19,34 +19,43 @@ extension FlutterwavePayViewController : UITextFieldDelegate,CardSelect,UIPicker
19
19
if let card = flutterwaveCardClient. selectedCard{
20
20
//LoadingHUD.shared().show()
21
21
CardViewModel . sharedViewModel. sendCardOtp ( cardHash: card. cardHash ?? " " )
22
- // flutterwaveCardClient.sendOTP(card: card)
22
+ // flutterwaveCardClient.sendOTP(card: card)
23
23
}
24
24
}
25
25
26
+
27
+
26
28
@objc func textFieldDidChange( textField: UITextField ) {
27
- if ( textField == pinViewContainer. hiddenPinTextField) {
28
- pinViewContainer. pins. forEach { ( item) in
29
- item. backgroundColor = . white
30
- }
31
-
32
- for (index, _) in ( textField. text? . enumerated ( ) ) !{
33
- pinViewContainer. pins [ index] . backgroundColor = . gray
34
- }
35
- if ( ( textField. text? . count) ! == 4 ) {
36
- textField. resignFirstResponder ( )
37
- }
38
-
39
- }
40
- if ( textField == debitCardView. cardNumberTextField) {
41
- if let count = textField. text? . count {
42
- if count == 6 {
29
+ if ( textField == pinViewContainer. hiddenPinTextField) {
30
+ pinViewContainer. pins. forEach { ( item) in
31
+ item. backgroundColor = . white
32
+ }
33
+
34
+ for (index, _) in ( textField. text? . enumerated ( ) ) !{
35
+ pinViewContainer. pins [ index] . backgroundColor = . gray
36
+ }
37
+ if ( ( textField. text? . count) ! == 4 ) {
38
+ textField. resignFirstResponder ( )
39
+ }
40
+
41
+ }
42
+ if ( textField == debitCardView. cardNumberTextField) {
43
+ if let count = textField. text? . count {
44
+ if count == 6 {
43
45
flutterwaveCardClient. amount = self . amount
44
- flutterwaveCardClient. cardfirst6 = textField. text
46
+ flutterwaveCardClient. cardfirst6 = textField. text
45
47
46
- }
47
- }
48
- }
49
- }
48
+ }
49
+ }
50
+ }
51
+ }
52
+
53
+ //Disable textfield interactions
54
+ public func textField( _ textField: UITextField , shouldChangeCharactersIn range: NSRange , replacementString string: String ) -> Bool {
55
+ self . resignFirstResponder ( )
56
+ return false
57
+ }
58
+
50
59
51
60
public func textFieldDidBeginEditing( _ textField: UITextField ) {
52
61
textField. layer. borderWidth = 0
@@ -55,8 +64,29 @@ extension FlutterwavePayViewController : UITextFieldDelegate,CardSelect,UIPicker
55
64
bankPicker. selectRow ( 0 , inComponent: 0 , animated: true )
56
65
self . pickerView ( bankPicker, didSelectRow: 0 , inComponent: 0 )
57
66
}
67
+ } else if textField == mobileMoneyContentView. mobileMoneyChooseNetwork{
68
+
69
+ ghsMobileMoneyPicker. selectRow ( 0 , inComponent: 0 , animated: true )
70
+ self . pickerView ( ghsMobileMoneyPicker, didSelectRow: 0 , inComponent: 0 )
71
+
72
+ } else if textField == selectUssdBankView. otherBanksTextField{
73
+
74
+ ussdBankPicker. selectRow ( 0 , inComponent: 0 , animated: true )
75
+ self . pickerView ( ussdBankPicker, didSelectRow: 0 , inComponent: 0 )
76
+
77
+ } else if textField == mobileMoneyFRContentContainer. mobileMoneyFRCountry{
78
+ francoCountryPicker. selectRow ( 0 , inComponent: 0 , animated: true )
79
+ self . pickerView ( francoCountryPicker, didSelectRow: 0 , inComponent: 0 )
80
+
81
+ } else if textField == mobileMoneyZMContentContainer. mobileMoneyChooseNetwork{
82
+ zambiaMobileMoneyPicker. selectRow ( 0 , inComponent: 0 , animated: true )
83
+ self . pickerView ( zambiaMobileMoneyPicker, didSelectRow: 0 , inComponent: 0 )
84
+
58
85
}
86
+
59
87
}
88
+
89
+
60
90
61
91
public func textFieldDidEndEditing( _ textField: UITextField ) {
62
92
guard let bankCode = selectedBankCode else {
@@ -223,7 +253,7 @@ extension FlutterwavePayViewController : UITextFieldDelegate,CardSelect,UIPicker
223
253
}
224
254
func showWebView( url: String ? , ref: String ? ) {
225
255
//Collapse opened Tabs
226
- // self.handelCloseOrExpandSection(section: 0)
256
+ // self.handelCloseOrExpandSection(section: 0)
227
257
//Show web view
228
258
//let storyBoard = UIStoryboard(name: "Rave", bundle: nil)
229
259
let controller = RavePayWebViewController ( )
@@ -276,19 +306,19 @@ extension FlutterwavePayViewController : UITextFieldDelegate,CardSelect,UIPicker
276
306
}
277
307
case . bank:
278
308
print ( " " )
279
- // accountOtpContentContainer.alpha = 0
280
- // accountOtpContentContainer.otpMessage.text = message
281
- // accountOtpContentContainer.otpTextField.text = ""
282
- // accountOtpContentContainer.otpButton.addTarget(self, action: #selector(accountOTPButtonTapped), for: .touchUpInside)
283
- // raveAccountClient.transactionReference = flwRef
284
- // UIView.animate(withDuration: 0.6, animations: {
285
- // self.accountOtpContentContainer.alpha = 1
286
- // self.accountFormContainer.alpha = 0
287
- // self.selectBankAccountView.alpha = 0
288
- // }) { (success) in
289
- // self.accountFormContainer.isHidden = true
290
- // self.selectBankAccountView.isHidden = true
291
- // }
309
+ // accountOtpContentContainer.alpha = 0
310
+ // accountOtpContentContainer.otpMessage.text = message
311
+ // accountOtpContentContainer.otpTextField.text = ""
312
+ // accountOtpContentContainer.otpButton.addTarget(self, action: #selector(accountOTPButtonTapped), for: .touchUpInside)
313
+ // raveAccountClient.transactionReference = flwRef
314
+ // UIView.animate(withDuration: 0.6, animations: {
315
+ // self.accountOtpContentContainer.alpha = 1
316
+ // self.accountFormContainer.alpha = 0
317
+ // self.selectBankAccountView.alpha = 0
318
+ // }) { (success) in
319
+ // self.accountFormContainer.isHidden = true
320
+ // self.selectBankAccountView.isHidden = true
321
+ // }
292
322
}
293
323
}
294
324
@objc func accountOTPButtonTapped( ) {
@@ -320,7 +350,7 @@ extension FlutterwavePayViewController : UITextFieldDelegate,CardSelect,UIPicker
320
350
guard let otp = otpContentContainer. otpTextField. text, otp != " " else {
321
351
return
322
352
}
323
- // LoadingHUD.shared().show()
353
+ // LoadingHUD.shared().show()
324
354
flutterwaveCardClient. otp = otp
325
355
flutterwaveCardClient. isSaveCardCharge = " 1 "
326
356
flutterwaveCardClient. saveCardPayment = " saved-card "
@@ -331,15 +361,15 @@ extension FlutterwavePayViewController : UITextFieldDelegate,CardSelect,UIPicker
331
361
self . pinAction ( )
332
362
}
333
363
334
-
364
+
335
365
func pinAction( ) {
336
- self . view. endEditing ( true )
337
- guard let pin = self . pinViewContainer. hiddenPinTextField. text else { return }
338
- flutterwaveCardClient. bodyParam? . merge ( [ " authorization " :
339
- [ " mode " : " pin " , " pin " : pin]
340
- ] )
341
- flutterwaveCardClient. chargeCard ( )
342
- }
366
+ self . view. endEditing ( true )
367
+ guard let pin = self . pinViewContainer. hiddenPinTextField. text else { return }
368
+ flutterwaveCardClient. bodyParam? . merge ( [ " authorization " :
369
+ [ " mode " : " pin " , " pin " : pin]
370
+ ] )
371
+ flutterwaveCardClient. chargeCard ( )
372
+ }
343
373
344
374
@objc func billAddressButtonTapped( ) {
345
375
@@ -359,21 +389,23 @@ extension FlutterwavePayViewController : UITextFieldDelegate,CardSelect,UIPicker
359
389
func billAddressAction( ) {
360
390
self . view. endEditing ( true )
361
391
guard let zip = self . billingAddressContainer. zipCodeTextField. text, let city = self . billingAddressContainer. cityTextField. text,
362
- let address = self . billingAddressContainer. billingAddressTextField. text, let country = self . billingAddressContainer. countryTextField. text , let state = self . billingAddressContainer. stateTextField. text else { return }
392
+ let address = self . billingAddressContainer. billingAddressTextField. text, let country = self . billingAddressContainer. countryTextField. text , let state = self . billingAddressContainer. stateTextField. text else { return }
363
393
364
394
flutterwaveCardClient. bodyParam? . merge ( [ " authorization " :
365
- [ " mode " : " avs_noauth " , " city " : city, " address " : address, " state " : state, " country " : country, " zipcode " : zip]
395
+ [ " mode " : " avs_noauth " , " city " : city, " address " : address, " state " : state, " country " : country, " zipcode " : zip]
366
396
] )
367
397
368
398
flutterwaveCardClient. chargeCard ( )
369
399
}
370
400
401
+
402
+ //TODO
371
403
public func pickerView( _ pickerView: UIPickerView , numberOfRowsInComponent component: Int ) -> Int {
372
404
let ussdBanks = getUssdBanks ( )
373
405
let francophoneCountries = getFrancophoneCountries ( countryCode: FlutterwaveConfig . sharedConfig ( ) . currencyCode)
374
- // print("Current PickerView Tag \(pickerView.tag)")
406
+ // print("Current PickerView Tag \(pickerView.tag)")
375
407
if pickerView. tag == 12 {
376
- // print("Country Code logic")
408
+ // print("Country Code logic")
377
409
if let count = self . banks? . count{
378
410
return count
379
411
} else {
0 commit comments