-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathViewController.swift
More file actions
68 lines (51 loc) · 2.52 KB
/
ViewController.swift
File metadata and controls
68 lines (51 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
//
// ViewController.swift
// FlutterwaveSDK
//
// Created by texyz on 10/02/2020.
// Copyright (c) 2020 texyz. All rights reserved.
//
import FlutterwaveSDK
import UIKit
class ViewController: UIViewController, FlutterwavePayProtocol {
func onDismiss() {
print("View controller was dimissed ")
}
func tranasctionSuccessful(flwRef: String?, responseData: FlutterwaveDataResponse?) {
print("DATA Returned \(responseData?.flwRef ?? "Failed to return data")")
}
func tranasctionFailed(flwRef: String?, responseData: FlutterwaveDataResponse?) {
print( "Failed to return data with FlwRef \(flwRef.orEmpty())")
}
let flutterLabel = UILabel()
let exampleLabel = UILabel()
let underLineView = UIView()
let launchButton = UIButton(type: .system)
@objc func showExample(){
let config = FlutterwaveConfig.sharedConfig()
config.paymentOptionsToExclude = []
config.currencyCode = "NGN" // This is the specified currency to charge in.
config.email = "user@flw.com" // This is the email address of the customer
config.isStaging = false // Toggle this for staging and live environment
config.phoneNumber = "07067783334" //Phone number
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.
config.firstName = "Yemi" // This is the customers first name.
config.lastName = "Desola" //This is the customers last name.
config.meta = [["metaname":"sdk", "metavalue":"ios"]] //This is used to include additional payment information
config.narration = "simplifying payments for endless possibilities"
config.publicKey = "[PUB_KEY]" //Public key
config.encryptionKey = "[ENCRYPTION_KEY]" //Encryption key
config.isPreAuth = false // This should be set to true for preauthoize card transactions
config.allowSaveCard = true // flag to hide/show save card feature
let controller = FlutterwavePayViewController()
let nav = UINavigationController(rootViewController: controller)
controller.amount = "[Amount]" // This is the amount to be charged.
controller.delegate = self
self.present(nav, animated: true)
}
override func viewDidLoad() {
super.viewDidLoad()
setUpConstraintsAndProperties()
showExample()
}
}