-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e84d3d
commit c88d75e
Showing
16 changed files
with
735 additions
and
66 deletions.
There are no files selected for viewing
Binary file modified
BIN
+25.7 KB
(320%)
...code/package.xcworkspace/xcuserdata/osamarabie.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-10.2 KB
(93%)
...proj/project.xcworkspace/xcuserdata/osamarabie.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,75 +15,64 @@ class PayButtonExample: UIViewController { | |
|
||
@IBOutlet weak var refreshButton: UIButton! | ||
|
||
var selectedButtonType:PayButtonTypeEnum = .BenefitPay | ||
var selectedButtonType:PayButtonTypeEnum = .GooglePay | ||
var dictConfig:[String:Any] = [ | ||
"operator": ["publicKey": "pk_test_YhUjg9PNT8oDlKJ1aE2fMRz7"], | ||
"scope": "AuthenticatedToken", | ||
"purpose": "Transaction", | ||
"operator": ["publicKey": "pk_test_6jdl4Qo0FYOSXmrZTR1U5EHp", "hashString": ""], | ||
"scope": "charge", | ||
"transaction": [ | ||
"authentication": true, | ||
"authorize": [ | ||
"type": "VOID", | ||
"time": 12, | ||
], | ||
"paymentAgreement": [ | ||
"id": "", | ||
"contract": ["id": ""], | ||
] | ||
], | ||
"reference": "trx", | ||
"metadata": [:], | ||
], | ||
"order": [ | ||
"id": "", | ||
"amount": 1, | ||
"currency": "SAR", | ||
"amount": 0.1, | ||
"currency": "KWD", | ||
"description": "Authentication description", | ||
"reference": "", | ||
"metadata": ["key": "value"], | ||
"reference": "ordRef", | ||
"metadata": [:], | ||
], | ||
"invoice": ["id": ""], | ||
"merchant": ["id": ""], | ||
"customer": [ | ||
"id": "", | ||
"name": [["lang": "en", "first": "TAP", "middle": "", "last": "PAYMENTS"]], | ||
"nameOnCard": "TAP PAYMENTS", | ||
"editable": true, | ||
"contact": [ | ||
"email": "[email protected]", | ||
"phone": ["countryCode": "+965", "number": "88888888"], | ||
], | ||
], | ||
"features": [ | ||
"alternativeCardInputs": [ | ||
"cardScanner": true, | ||
"cardNFC": false, | ||
], | ||
"acceptanceBadge": true, | ||
"customerCards": [ | ||
"saveCard": false, | ||
"autoSaveCard": false, | ||
], | ||
|
||
], | ||
"acceptance": [ | ||
"supportedSchemes": ["AMERICAN_EXPRESS", "VISA", "MASTERCARD", "OMANNET", "MADA"], | ||
"supportedFundSource": ["CREDIT", "DEBIT"], | ||
"supportedPaymentAuthentications": ["3DS"], | ||
], | ||
"fieldVisibility": [ | ||
"card": [ | ||
"cvv": true, | ||
"cardHolder": true, | ||
] | ||
], | ||
"supportedSchemes": ["AMERICAN_EXPRESS", "VISA", "MASTERCARD", "OMANNET", "MADA"], | ||
"supportedFundSource": ["CREDIT", "DEBIT"], | ||
"supportedPaymentAuthentications": ["3DS"], | ||
], | ||
"interface": [ | ||
"locale": "en", | ||
"theme": UIView().traitCollection.userInterfaceStyle == .dark ? "dark" : "light", | ||
"edges": "curved", | ||
"cardDirection": "dynamic", | ||
"powered": true, | ||
"colorStyle": UIView().traitCollection.userInterfaceStyle == .dark | ||
? "monochrome" : "colored", | ||
"loader": true, | ||
"colorStyle": UIView().traitCollection.userInterfaceStyle == .dark ? "monochrome" : "colored", | ||
"powered":true | ||
], | ||
"post": ["url": ""], | ||
] | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
setupPayButton() | ||
if let jsonData = try? JSONSerialization.data(withJSONObject: dictConfig, options: .prettyPrinted) { | ||
print(String(decoding: jsonData, as: UTF8.self)) | ||
} | ||
} | ||
|
||
@IBAction func refreshButtonClicked(_ sender: Any) { | ||
|
@@ -149,6 +138,8 @@ class PayButtonExample: UIViewController { | |
let signature = HMAC<SHA256>.authenticationCode(for: Data(toBeHashed.utf8), using: key) | ||
let hashedString = Data(signature).map { String(format: "%02hhx", $0) }.joined() | ||
return hashedString | ||
|
||
|
||
} | ||
|
||
/*func setConfig(config: CardWebSDKConfig) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...on-iOS/Logic/SdkBasedButtons/GooglePay/private/extensions/TapGooglePay + SwiftEntry.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Osama Rabie on 02/11/2023. | ||
// | ||
|
||
import Foundation | ||
import WebKit | ||
|
||
internal extension GooglePayButton { | ||
|
||
|
||
/// Will create a view that contains a full screen web view to display within the google pay modal popup | ||
func createGooglePayPopUpView() -> UIViewController { | ||
// The container iew | ||
let view:UIView = .init() | ||
view.backgroundColor = .clear | ||
|
||
//webView.isHidden = true | ||
webView.removeFromSuperview() | ||
view.addSubview(webView) | ||
|
||
// Define the constrains of the web view to be full screen | ||
let top = webView.topAnchor.constraint(equalTo: view.topAnchor) | ||
let left = webView.leftAnchor.constraint(equalTo: view.leftAnchor) | ||
let right = webView.rightAnchor.constraint(equalTo: view.rightAnchor) | ||
let bottom = webView.bottomAnchor.constraint(equalTo: view.bottomAnchor) | ||
|
||
// Activate the constraints | ||
NSLayoutConstraint.activate([left, right, top, bottom]) | ||
|
||
self.webView.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
|
||
let ctr:UIViewController = .init() | ||
ctr.view.backgroundColor = .clear | ||
ctr.modalPresentationStyle = .overCurrentContext | ||
ctr.view.addSubview(view) | ||
ctr.restorationIdentifier = "GooglePayVC" | ||
view.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
let vtop = view.topAnchor.constraint(equalTo: ctr.view.topAnchor) | ||
let vleft = view.leftAnchor.constraint(equalTo: ctr.view.leftAnchor) | ||
let vright = view.rightAnchor.constraint(equalTo: ctr.view.rightAnchor) | ||
let vbottom = view.bottomAnchor.constraint(equalTo: ctr.view.bottomAnchor,constant: 60) | ||
|
||
// Activate the constraints | ||
NSLayoutConstraint.activate([left, right, top, bottom, vtop, vleft, vright, vbottom]) | ||
|
||
return ctr | ||
} | ||
|
||
} |
Oops, something went wrong.