Skip to content

Commit

Permalink
Merge pull request #24 from payfort/Release-feature
Browse files Browse the repository at this point in the history
Release feature
  • Loading branch information
cetozgen authored Jan 10, 2024
2 parents 744ca09 + 054a03c commit 8d39bed
Show file tree
Hide file tree
Showing 28 changed files with 687 additions and 243 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file modified SampleApp/.DS_Store
Binary file not shown.
10 changes: 10 additions & 0 deletions SampleApp/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ target 'SampleApp' do
end

end

post_install do |installer|
installer.pods_project.targets.each do |target|
if ['PayFortSDK'].include? target.name
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
end
27 changes: 27 additions & 0 deletions SampleApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
PODS:
- IQKeyboardManagerSwift (6.5.16)
- MBProgressHUD (1.2.0)
- PayFortSDK (3.2.0)

DEPENDENCIES:
- IQKeyboardManagerSwift
- MBProgressHUD
- PayFortSDK (from `/Users/cetozgen/gitprivaterepos/fort-ios-sdk-localtest/`)

SPEC REPOS:
trunk:
- IQKeyboardManagerSwift
- MBProgressHUD

EXTERNAL SOURCES:
PayFortSDK:
:path: "/Users/cetozgen/gitprivaterepos/fort-ios-sdk-localtest/"

SPEC CHECKSUMS:
IQKeyboardManagerSwift: 12d89768845bb77b55cc092ecc2b1f9370f06b76
MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
PayFortSDK: 92d7df56734bd520241250ebc9b93987782b33b9

PODFILE CHECKSUM: 8037295a3735c99e78f5a1b1d37cac6edcee2814

COCOAPODS: 1.14.3
Binary file added SampleApp/Pods/.DS_Store
Binary file not shown.
117 changes: 66 additions & 51 deletions SampleApp/SampleApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1520"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>SampleApp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
</dict>
</dict>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file added SampleApp/SampleApp/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion SampleApp/SampleApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
IQKeyboardManager.shared.enable = true
GlobalClass.setDefualtValueToUserDefaults()
IQKeyboardManager.shared.enable = true

return true
}
Expand Down
Binary file added SampleApp/SampleApp/Assets.xcassets/.DS_Store
Binary file not shown.
537 changes: 432 additions & 105 deletions SampleApp/SampleApp/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions SampleApp/SampleApp/Common/GlobalClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ enum UserDefaultsKeys: String, CaseIterable {
case countryCode
case grandTotal
case currencyCode

}

class GlobalClass: NSObject {
Expand Down Expand Up @@ -61,8 +60,7 @@ class GlobalClass: NSObject {
GlobalClass.setUserDefaults(key: UserDefaultsKeys.currencyCode.rawValue, value: "USD")
}
}



static func returnParamsArray() -> [ExtraParam] {
var arr : [ExtraParam] = []

Expand Down
2 changes: 1 addition & 1 deletion SampleApp/SampleApp/Common/TableViewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TableViewDataSource<CellType, Model>: NSObject, UITableViewDataSource wher

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: self.cellIdenitfier, for: indexPath) as? CellType else {
fatalError("cell not found")
fatalError("weather cell not found")
}

let vm = items[indexPath.row]
Expand Down
Binary file modified SampleApp/SampleApp/Controllers/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit

import PayFortSDK
import MBProgressHUD
//import MBProgressHUD

class CustomCardViewController: UIViewController {

Expand Down Expand Up @@ -37,7 +37,7 @@ class CustomCardViewController: UIViewController {
let builder = PayComponents(cardNumberView: cardNumberView, expiryDateView: expiryDateView, cvcNumberView: cvcNumberView, holderNameView: holderNameView, rememberMe: saveCardSwitch.isOn, language: "ar")

payButton.setup(with: request, enviroment: enviroment, payButtonBuilder: builder, viewController: self) {
MBProgressHUD.showAdded(to: self.view, animated: true)
//MBProgressHUD.showAdded(to: self.view, animated: true)
} success: { (requestDic, responeDic) in
print("--success--")
print("--requestDic--\(requestDic)")
Expand All @@ -58,7 +58,7 @@ class CustomCardViewController: UIViewController {
}

func hide(response: [String:String]) {
MBProgressHUD.hide(for: self.view, animated: true)
//MBProgressHUD.hide(for: self.view, animated: true)
GlobalClass.openResponseViewController(from: self, response: response)
}
}
27 changes: 24 additions & 3 deletions SampleApp/SampleApp/Controllers/Main/DirectPayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit
import PayFortSDK
import MBProgressHUD
//import MBProgressHUD

class DirectPayViewController: UIViewController {

Expand All @@ -26,7 +26,7 @@ class DirectPayViewController: UIViewController {
super.viewDidLoad()

directPayButton.setup(with: request, enviroment: enviroment, viewController: self) {
MBProgressHUD.showAdded(to: self.view, animated: true)
//MBProgressHUD.showAdded(to: self.view, animated: true)
} success: { (requestDic, responeDic) in
print("--success--")
print("--requestDic--\(requestDic)")
Expand All @@ -43,9 +43,30 @@ class DirectPayViewController: UIViewController {


func hide(response: [String:String]) {
MBProgressHUD.hide(for: self.view, animated: true)
//MBProgressHUD.hide(for: self.view, animated: true)
GlobalClass.openResponseViewController(from: self, response: response)
}

@IBAction func validateButtonTapped(_ sender: Any) {

payFortController.callValidateAPI(with: request) {
print("--ShowLoader--")
//MBProgressHUD.showAdded(to: self.view, animated: true)

} success: { (requestDic) in
print("--success--")
print("--requestDic--\(requestDic)")
self.hide(response: ["status":"success"])

} faild: { (requestDic, responeDic, message) in
print("--Faild--")
print("--requestDic--\(requestDic)")
print("--responeDic--\(responeDic)")
print("--message--\(message)")
self.hide(response: responeDic)

}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit

import PayFortSDK
import MBProgressHUD
//import MBProgressHUD

class HalfCardViewController: UIViewController {

Expand All @@ -35,8 +35,8 @@ class HalfCardViewController: UIViewController {
expiryDateView.errorLabel = expiryDateErrorLabel

let property = Property()
property.textColor = .blue
property.backgroundColor = .white
property.textColor = .yellow
property.backgroundColor = .green
property.errorTextColor = .green
property.titleTextColor = .black

Expand All @@ -45,7 +45,7 @@ class HalfCardViewController: UIViewController {
let builder = PayComponents(cardNumberView: cardNumberView, expiryDateView: expiryDateView, cvcNumberView: cvcNumberView, holderNameView: holderNameView, rememberMe: saveCardSwitch.isOn, language: "en")

payButton.setup(with: request, enviroment: enviroment, payButtonBuilder: builder, viewController: self) {
MBProgressHUD.showAdded(to: self.view, animated: true)
//MBProgressHUD.showAdded(to: self.view, animated: true)
} success: { (requestDic, responeDic) in
print("--success--")
print("--requestDic--\(requestDic)")
Expand All @@ -70,7 +70,7 @@ class HalfCardViewController: UIViewController {
dismiss(animated: true, completion: nil)
}
func hide(response: [String:String]) {
MBProgressHUD.hide(for: self.view, animated: true)
//MBProgressHUD.hide(for: self.view, animated: true)
let vc = (self.storyboard?.instantiateViewController(identifier: "ResponsePageViewController"))! as ResponsePageViewController
vc.request = response
vc.isFromPresent = true
Expand Down
26 changes: 11 additions & 15 deletions SampleApp/SampleApp/Controllers/Main/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class MainViewController: UIViewController {
@IBOutlet weak private var tableView: UITableView!

var payFortController = PayFortController.init(enviroment: .sandBox)

var stcController = STCPayViewController.init(enviroment: .sandBox)

// MARK: - Properties

var enviroment = PayFortEnviroment.sandBox
var paramsArr = GlobalClass.returnParamsArray()

var fruadParam = GlobalClass.shared.showFraudExtraParam

private var extraParamDataSource: TableViewDataSource<ExtraParamCell, ExtraParam>!
Expand All @@ -40,10 +40,6 @@ class MainViewController: UIViewController {
}
}

@IBAction func copyUUID(_ sender: Any) {
UIPasteboard.general.string = payFortController.getUDID()
}

private func setupTableView() {


Expand All @@ -59,6 +55,12 @@ class MainViewController: UIViewController {

}

@IBAction private func createTokenAction(_ sender: Any) {

UIPasteboard.general.string = payFortController.getUDID()
print(payFortController.getUDID())

}

@IBAction func enviromentValueChanged(_ sender: UISegmentedControl) {

Expand All @@ -74,6 +76,7 @@ class MainViewController: UIViewController {
}

payFortController = PayFortController.init(enviroment: enviroment)
stcController = STCPayViewController.init(enviroment: enviroment)
}

@IBAction func commandValueChanged(_ sender: UISegmentedControl) {
Expand Down Expand Up @@ -102,6 +105,8 @@ class MainViewController: UIViewController {
}else {
payFortController.setPayFortCustomViewNib("")
}
print(extractExtraParam())
return
payFortController.callPayFort(withRequest: extractExtraParam(),
currentViewController: self) { (requestDic, responeDic) in
print("--success--")
Expand All @@ -123,15 +128,6 @@ class MainViewController: UIViewController {
GlobalClass.openResponseViewController(from: self, response: responeDic)

}

// payFortController.callPayFortWithRequest(extractExtraParam(), currentViewController: self) { result in
// switch result {
// case .failure(let error):
// print("--error-->\(error.errorDescription)")
// case .success: break
//
// }
// }

}

Expand Down
33 changes: 33 additions & 0 deletions SampleApp/SampleApp/Controllers/Main/STCPay.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// STCPay.swift
// SampleApp
//
// Created by Cetinkaya, Ozgen on 3/14/23.
// Copyright © 2023 PayFort. All rights reserved.
//

import Foundation
import PayFortSDK

let vc = STCPayViewController.init(enviroment: .sandBox)

extension MainViewController {
@IBAction func STCPayAction(_ sender: Any) {

let params = extractExtraParam()

vc.openPaymentPage(with: params,
currentViewController: self) { requestDic, responeDic in
print(requestDic)
print(responeDic)
GlobalClass.openResponseViewController(from: self, response: responeDic)
} faild: { requestDic, responeDic, message in
print("request failed")
print(requestDic)
print(responeDic)
GlobalClass.openResponseViewController(from: self, response: responeDic)
} canceled: { requestDic, responeDic in
print("request cancelled")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,15 @@ import UIKit

class SdkTokenSettingViewController: UIViewController {

@IBOutlet weak var merchantIdentifierTextField: UITextField!
@IBOutlet weak var accessCodeTextField: UITextField!
@IBOutlet weak var languageTextField: UITextField!
@IBOutlet weak var passphraseText: UITextField!

override func viewDidLoad() {
super.viewDidLoad()
merchantIdentifierTextField.text = GlobalClass.returnUserDefaultsValue(key: UserDefaultsKeys.merchantIdentifier.rawValue)
accessCodeTextField.text = GlobalClass.returnUserDefaultsValue(key: UserDefaultsKeys.accessCode.rawValue)
languageTextField.text = GlobalClass.returnUserDefaultsValue(key: UserDefaultsKeys.sdkLanguage.rawValue)
passphraseText.text = GlobalClass.returnUserDefaultsValue(key: UserDefaultsKeys.passphrase.rawValue)
}

@IBAction func saveAction(_ sender: Any) {
GlobalClass.setUserDefaults(key: UserDefaultsKeys.merchantIdentifier.rawValue, value: merchantIdentifierTextField.text!)
GlobalClass.setUserDefaults(key: UserDefaultsKeys.accessCode.rawValue, value: accessCodeTextField.text!)
GlobalClass.setUserDefaults(key: UserDefaultsKeys.sdkLanguage.rawValue, value: languageTextField.text!)
GlobalClass.setUserDefaults(key: UserDefaultsKeys.passphrase.rawValue, value: passphraseText.text!)
navigationController?.popViewController(animated: true)
}

Expand Down
Loading

0 comments on commit 8d39bed

Please sign in to comment.