Skip to content

Commit 4a1f63a

Browse files
committed
Ghana Money
1 parent baf70b1 commit 4a1f63a

File tree

12 files changed

+62
-131
lines changed

12 files changed

+62
-131
lines changed

Example/FlutterwaveSDK.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@
514514
INFOPLIST_FILE = FlutterwaveSDK/Info.plist;
515515
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
516516
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
517-
MARKETING_VERSION = 1.2.7;
517+
MARKETING_VERSION = 1.2.8;
518518
MODULE_NAME = ExampleApp;
519519
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
520520
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -535,7 +535,7 @@
535535
INFOPLIST_FILE = FlutterwaveSDK/Info.plist;
536536
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
537537
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
538-
MARKETING_VERSION = 1.2.7;
538+
MARKETING_VERSION = 1.2.8;
539539
MODULE_NAME = ExampleApp;
540540
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
541541
PRODUCT_NAME = "$(TARGET_NAME)";

Example/FlutterwaveSDK/ViewController.swift

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,31 @@ class ViewController: UIViewController, FlutterwavePayProtocol {
3030
let launchButton = UIButton(type: .system)
3131

3232

33+
3334
@objc func showExample(){
34-
35-
let config = FlutterwaveConfig.sharedConfig()
36-
37-
config.paymentOptionsToExclude = []
38-
config.currencyCode = "NGN" // This is the specified currency to charge in.
39-
config.email = "[email protected]" // This is the email address of the customer
40-
config.isStaging = false // Toggle this for staging and live environment
41-
config.phoneNumber = "07067783334" //Phone number
42-
config.transcationRef = "IOS-TEST" // This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction.
43-
config.firstName = "Yemi" // This is the customers first name.
44-
config.lastName = "Desola" //This is the customers last name.
45-
config.meta = [["metaname":"sdk", "metavalue":"ios"]] //This is used to include additional payment information
46-
config.narration = "simplifying payments for endless possibilities"
47-
config.publicKey = "[PUB_KEY]" //Public key
48-
config.encryptionKey = "[ENCRYPTION_KEY]" //Encryption key
49-
config.isPreAuth = false // This should be set to true for preauthoize card transactions
50-
let controller = FlutterwavePayViewController()
51-
let nav = UINavigationController(rootViewController: controller)
52-
controller.amount = "[Amount]" // This is the amount to be charged.
53-
controller.delegate = self
54-
self.present(nav, animated: true)
55-
56-
}
35+
36+
let config = FlutterwaveConfig.sharedConfig()
37+
38+
config.paymentOptionsToExclude = []
39+
config.currencyCode = "NGN" // This is the specified currency to charge in.
40+
config.email = "[email protected]" // This is the email address of the customer
41+
config.isStaging = false // Toggle this for staging and live environment
42+
config.phoneNumber = "[PHONENUMBER]" //Phone number
43+
config.transcationRef = "[REF]" // This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction.
44+
config.firstName = "Yemi" // This is the customers first name.
45+
config.lastName = "Desola" //This is the customers last name.
46+
config.meta = [["metaname":"sdk", "metavalue":"ios"]] //This is used to include additional payment information
47+
config.narration = "simplifying payments for endless possibilities"
48+
config.publicKey = "[PUB_KEY]" //Public key
49+
config.encryptionKey = "[ENCRYPTION_KEY]" //Encryption key
50+
config.isPreAuth = false // This should be set to true for preauthoize card transactions
51+
let controller = FlutterwavePayViewController()
52+
let nav = UINavigationController(rootViewController: controller)
53+
controller.amount = "[Amount]" // This is the amount to be charged.
54+
controller.delegate = self
55+
self.present(nav, animated: true)
56+
57+
}
5758

5859

5960
override func viewDidLoad() {

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- FlutterwaveSDK (1.2.7):
2+
- FlutterwaveSDK (1.2.8):
33
- IQKeyboardManagerSwift
44
- lottie-ios
55
- "MaterialComponents/TextControls+OutlinedTextAreas"
@@ -78,7 +78,7 @@ EXTERNAL SOURCES:
7878
:path: "../"
7979

8080
SPEC CHECKSUMS:
81-
FlutterwaveSDK: c32c4023019a6099d460b52ac9175aee7c28484a
81+
FlutterwaveSDK: 696a8fcd165b59e232d1b98e5e42eb86da351047
8282
IQKeyboardManagerSwift: c7df9d2deb356c04522f5c4b7b6e4ce4d8ed94fe
8383
lottie-ios: c38c3178ae8c4a8f200661aa5f80b9f1ca7f56b3
8484
MaterialComponents: e4a7c8b5eabe7856ef58f632fb5800a229bda5be

Example/Pods/Local Podspecs/FlutterwaveSDK.podspec.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Manifest.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/FlutterwaveSDK/FlutterwaveSDK-Info.plist

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FlutterwaveSDK.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'FlutterwaveSDK'
11-
s.version = '1.2.7'
11+
s.version = '1.2.8'
1212
s.summary = 'FlutterwaveSDK'
1313

1414
# This description is used to generate tags and improve search results.
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
2525
s.screenshots = 'https://github.com/Flutterwave/FlutterwaveSDK/blob/master/FlutterwaveSDK/Assets/Assets.xcassets/FlutterwaveScreenshot.imageset/FlutterwaveScreenshot.png'
2626
s.license = { :type => 'MIT', :file => 'LICENSE' }
2727
s.author = { 'Flutterwave Developers' => '[email protected]' }
28-
s.source = { :git => 'https://github.com/Flutterwave/FlutterwaveSDK.git', :tag => '1.2.7'}
28+
s.source = { :git => 'https://github.com/Flutterwave/FlutterwaveSDK.git', :tag => '1.2.8'}
2929
s.social_media_url = 'https://twitter.com/FlutterwaveEng'
3030

3131
s.ios.deployment_target = '11.0'

FlutterwaveSDK/Classes/App/RaveCardClient.swift

Lines changed: 8 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -140,87 +140,15 @@ class FlutterwaveCardClient{
140140
let base64String = data?.base64EncodedString()
141141

142142

143-
let reqbody = [
144-
"PBFPubKey": pubkey,
145-
"client": base64String!, // Encrypted $data payload here.
146-
"alg": "3DES-24"
147-
]
148-
print("first-of-all")
149-
print(reqbody)
143+
// let reqbody = [
144+
// "PBFPubKey": pubkey,
145+
// "client": base64String!, // Encrypted $data payload here.
146+
// "alg": "3DES-24"
147+
// ]
148+
// print("first-of-all")
149+
// print(reqbody)
150150
CardViewModel.sharedViewModel.chargeSavedCard(client: base64String!)
151-
// FlutterwavePayService.charge(reqbody, resultCallback: { [weak self] (res) in
152-
// guard let strongSelf = self else {return}
153-
// if let status = res?["status"] as? String{
154-
// if status == "success"{
155-
// let result = res?["data"] as? Dictionary<String,AnyObject>
156-
// let flwRef = result?["flwRef"] as? String?
157-
// let authURL = result?["authurl"] as? String
158-
//
159-
// let flutterWaveData = FlutterwaveDataResponse(txRef: nil, flwRef:flwRef?.orEmpty(), deviceFingerprint: nil, amount: nil, chargedAmount: nil, appFee: nil, merchantFee: nil, processorResponse: nil, authModel: nil, currency: nil, ip: nil, narration: nil, status: nil, authURL: authURL, paymentType: nil, fraudStatus: nil, chargeType: nil, createdAt: nil, plan: nil, id: nil, accountID: nil, customer: nil, card: nil)
160-
// if let suggestedAuth = result?["suggested_auth"] as? String{
161-
// var authModel:SuggestedAuthModel = .NONE
162-
// switch suggestedAuth {
163-
// case "PIN":
164-
// authModel = .PIN
165-
// case "AVS_VBVSECURECODE":
166-
// authModel = .AVS_VBVSECURECODE
167-
// case "VBVSECURECODE":
168-
// authModel = .VBVSECURECODE
169-
// case "NOAUTH_INTERNATIONAL":
170-
// authModel = .NOAUTH_INTERNATIONAL
171-
// case "GTB_OTP":
172-
// authModel = .GTB_OTP
173-
// default:
174-
// authModel = .NONE
175-
// }
176-
//
177-
// strongSelf.chargeSuggestedAuth?(authModel,result!,authURL)
178-
//
179-
// }else{
180-
// if let chargeResponse = result?["chargeResponseCode"] as? String{
181-
// switch chargeResponse{
182-
// case "00":
183-
// let flwTransactionRef = result?["flwRef"] as? String
184-
// strongSelf.chargeSuccess?(flwTransactionRef,flutterWaveData)
185-
// case "02":
186-
// let flwTransactionRef = result?["flwRef"] as? String
187-
// var _instruction:String? = result?["chargeResponseMessage"] as? String
188-
// if let instruction = result?["validateInstruction"] as? String{
189-
// _instruction = instruction
190-
// }else{
191-
// if let instruction = result?["validateInstructions"] as? [String:AnyObject]{
192-
// if let _inst = instruction["instruction"] as? String{
193-
// if _inst != ""{
194-
// _instruction = _inst
195-
// }
196-
// }
197-
// }
198-
// }
199-
// if let authURL = result?["authurl"] as? String, authURL != "NO-URL", authURL != "N/A" {
200-
// // Show Web View
201-
// strongSelf.chargeWebAuth?(flwTransactionRef!,authURL)
202-
// }else{
203-
// if let flwRef = flwTransactionRef{
204-
// // Show OTP Screen
205-
// strongSelf.chargeOTPAuth?(flwRef, _instruction ?? "Pending OTP Validation")
206-
// }
207-
// }
208-
// default:
209-
// break
210-
// }
211-
// }
212-
//
213-
// }
214-
// }else{
215-
// if let message = res?["message"] as? String{
216-
// strongSelf.error?(message,nil)
217-
// }
218-
// }
219-
// }
220-
// }) {[weak self] (err) in
221-
// guard let strongSelf = self else {return}
222-
// strongSelf.error?(err,nil)
223-
// }
151+
224152
}
225153
}
226154
//MARK: Charge Card

FlutterwaveSDK/Classes/Services/VersionTwoApi.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extension VersionTwoServicesApi:EndpointType{
4141
case .chargeSavedCard:
4242
return "flwv3-pug/getpaidx/api/charge"
4343
}
44-
44+
4545

4646
}
4747
}

FlutterwaveSDK/Classes/UI/FlutterwavePayViewController.swift

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ public class FlutterwavePayViewController: BaseViewController {
308308
let flutterwaveMpesaClient = FlutterwaveMpesaClient()
309309
let flutterwaveMobileMoney = FlutterwaveMobileMoneyClient()
310310
let flutterwaveMobileMoneyUganda = FlutterwaveMobileMoneyClient()
311+
let flutterwaveMobileMoneyGhana = FlutterwaveMobileMoneyClient()
311312
let flutterMobileMoneyRW = FlutterwaveMobileMoneyClient()
312313
let flutterwaveMobileMoneyFR = FlutterwaveMobileMoneyClient()
313314
let flutterwaveMoneyZM = FlutterwaveMobileMoneyClient()
@@ -877,7 +878,7 @@ public class FlutterwavePayViewController: BaseViewController {
877878

878879
mobileMoneyContentView.mobileMoneyPay.layer.cornerRadius = 5
879880
mobileMoneyContentView.mobileMoneyPay.setTitle("Pay \(self.amount?.toCountryCurrency(code: FlutterwaveConfig.sharedConfig().currencyCode) ?? "")", for: .normal)
880-
mobileMoneyContentView.mobileMoneyPay.addTarget(self, action: #selector(mobileMoneyPayAction), for: .touchUpInside)
881+
mobileMoneyContentView.mobileMoneyPay.addTarget(self, action: #selector(mobileMoneyGhanaPayAction), for: .touchUpInside)
881882

882883
flutterwaveMobileMoney.amount = self.amount
883884
flutterwaveMobileMoney.email = FlutterwaveConfig.sharedConfig().email
@@ -988,7 +989,7 @@ public class FlutterwavePayViewController: BaseViewController {
988989
}
989990
}
990991

991-
@objc func mobileMoneyPayAction(){
992+
@objc func mobileMoneyGhanaPayAction(){
992993
self.view.endEditing(true)
993994
flutterwaveMobileMoney.network = mobileMoneyContentView.mobileMoneyChooseNetwork.text
994995
flutterwaveMobileMoney.voucher = mobileMoneyContentView.mobileMoneyVoucher.text
@@ -1014,7 +1015,8 @@ public class FlutterwavePayViewController: BaseViewController {
10141015
return
10151016
}
10161017
}
1017-
MobileMoneyViewModel.sharedViewModel.rwandaMoney(amount: self.amount ?? "", network: "", phoneNumber: flutterMobileMoneyRW.phoneNumber ?? "")
1018+
1019+
MobileMoneyViewModel.sharedViewModel.ghanaMoney(amount: self.amount.orEmpty(), voucher: flutterwaveMobileMoney.voucher.orEmpty(), network: flutterwaveMobileMoney.network.orEmpty(), phoneNumber: flutterwaveMobileMoney.phoneNumber.orEmpty())
10181020

10191021
}
10201022

@@ -1025,9 +1027,10 @@ public class FlutterwavePayViewController: BaseViewController {
10251027

10261028
let phoneValid = self.mobileMoneyUgandaContentContainer.mobileMoneyUgandaPhone.validateAndShowError(validationType: ValidatorType.requiredField(field: "phone number"))
10271029

1030+
MobileMoneyViewModel.sharedViewModel.ugandaMoney(amount: self.amount.orEmpty(), phoneNumber: flutterwaveMobileMoneyUganda.phoneNumber.orEmpty())
10281031

10291032
if (phoneValid){
1030-
MobileMoneyViewModel.sharedViewModel.rwandaMoney(amount: self.amount ?? "", network: "", phoneNumber: flutterwaveMobileMoneyUganda.phoneNumber ?? "")
1033+
MobileMoneyViewModel.sharedViewModel.ugandaMoney(amount: self.amount.orEmpty(), phoneNumber: flutterwaveMobileMoneyUganda.phoneNumber.orEmpty())
10311034
}
10321035
}
10331036

@@ -1040,7 +1043,7 @@ public class FlutterwavePayViewController: BaseViewController {
10401043

10411044

10421045
if(phoneValid ){
1043-
MobileMoneyViewModel.sharedViewModel.rwandaMoney(amount: self.amount ?? "", network: "", phoneNumber: flutterMobileMoneyRW.phoneNumber ?? "")
1046+
MobileMoneyViewModel.sharedViewModel.rwandaMoney(amount: self.amount.orEmpty(), network: flutterMobileMoneyRW.network.orEmpty(), phoneNumber: flutterMobileMoneyRW.phoneNumber.orEmpty())
10441047
}
10451048

10461049

@@ -1060,7 +1063,7 @@ public class FlutterwavePayViewController: BaseViewController {
10601063

10611064

10621065
if(phoneValid && countryValid ){
1063-
MobileMoneyViewModel.sharedViewModel.francoPhoneMoney(amount: self.amount ?? "", phoneNumber: flutterwaveMobileMoneyFR.phoneNumber ?? "", country: selectedFrancophoneCountryCode.orEmpty())
1066+
MobileMoneyViewModel.sharedViewModel.francoPhoneMoney(amount: self.amount.orEmpty(), phoneNumber: flutterwaveMobileMoneyFR.phoneNumber.orEmpty(), country: selectedFrancophoneCountryCode.orEmpty())
10641067
}
10651068

10661069

@@ -1077,17 +1080,11 @@ public class FlutterwavePayViewController: BaseViewController {
10771080
flutterwaveMoneyZM.phoneNumber = mobileMoneyZMContentContainer.mobileMoneyPhoneNumber.text.orEmpty().components(separatedBy: CharacterSet.decimalDigits.inverted).joined()
10781081

10791082
if phoneValid && networkValid {
1080-
MobileMoneyViewModel.sharedViewModel.zambiaMoney(amount: self.amount ?? "", phoneNumber: flutterwaveMoneyZM.phoneNumber ?? "", network: flutterwaveMoneyZM.network ?? "")
1083+
MobileMoneyViewModel.sharedViewModel.zambiaMoney(amount: self.amount.orEmpty(), phoneNumber: flutterwaveMoneyZM.phoneNumber.orEmpty(), network: flutterwaveMoneyZM.network.orEmpty())
10811084
}
10821085
}
10831086

1084-
// @objc func dobPickerValueChanged(_ sender: UIDatePicker){
1085-
// let dateFormatter: DateFormatter = DateFormatter()
1086-
// dateFormatter.dateFormat = "ddMMyyyy"
1087-
// let selectedDate: String = dateFormatter.string(from: sender.date)
1088-
//// self.accountFormContainer.dobTextField.text = selectedDate
1089-
// }
1090-
1087+
10911088
@objc func accountPayButtonTapped(){
10921089

10931090
let phoneValid = self.accountFormContainer.phoneNumberTextField.validateAndShowError(validationType: ValidatorType.requiredField(field: "phone number"))

FlutterwaveSDK/Classes/UI/NewExtraFlutterwave/Flutterwave+Observers.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ extension FlutterwavePayViewController {
5555
setUpMoveToWebView(baseViewModel: BankViewModel.sharedViewModel, action: {url,ref in
5656
self.showWebView(url: url,ref:ref)
5757
})
58+
5859
CardViewModel.sharedViewModel.chargeSavedCardResponse.subscribe(onNext: {response in
59-
self.showWebView(url: response.data?.authurl,ref:response.data?.flwRef)
60+
if response.data?.authurl == "N/A" {
61+
PaymentServicesViewModel.sharedViewModel.mpesaVerify(flwRef: response.data?.flwRef ?? "")
62+
}else {
63+
self.showWebView(url: response.data?.authurl,ref:response.data?.flwRef)
64+
}
6065
} ).disposed(by: disposeBag)
6166
}
6267
func setUpLoading(){

FlutterwaveSDK/Classes/Utils/RaveConstants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class RaveConstants: NSObject {
2525

2626
}
2727

28-
static let flutterWaveVersion = "1.2.7"
28+
static let flutterWaveVersion = "1.2.8"
2929
static let flutterColor = UIColor(hex: "#F5A623")
3030

3131
static let bankStyle = [(code:"044",color:"#143f89",image:"rave_access2"),

0 commit comments

Comments
 (0)