-
Notifications
You must be signed in to change notification settings - Fork 997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FPX to Basic Integration #1390
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5811a27
Add FPX to Basic Integration
davidme-stripe d1e9120
Fix comments and custom integration
davidme-stripe 111b12c
Fix entitlements
davidme-stripe 77a0ca6
Fix bank icons
davidme-stripe 97c9541
Fix test
davidme-stripe 7b561e0
Add analytics, fix up table view to handle 0 cards with APMs
davidme-stripe 84bb535
Fix CollectionView to not lose items on reload
davidme-stripe 4b6a8ec
Fix Apple Pay appearing when not supported
davidme-stripe 37b0300
Update based on feedback
davidme-stripe 4312a4c
Fix previous bad fix, the individual responsible has been sacked
davidme-stripe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -161,7 +161,7 @@ - (void)pay { | |
break; | ||
} | ||
}]; | ||
}]; | ||
} additionalParameters:nil]; | ||
} | ||
|
||
@end |
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
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 |
---|---|---|
|
@@ -11,10 +11,6 @@ import UIKit | |
struct Product { | ||
let emoji: String | ||
let price: Int | ||
|
||
var priceText: String { | ||
return "$\(price/100).00" | ||
} | ||
} | ||
|
||
class BrowseProductsViewController: UICollectionViewController { | ||
|
@@ -41,7 +37,7 @@ class BrowseProductsViewController: UICollectionViewController { | |
var shoppingCart = [Product]() { | ||
didSet { | ||
let price = shoppingCart.reduce(0) { result, product in result + product.price } | ||
buyButton.priceLabel.text = "$\(price/100).00" | ||
buyButton.priceLabel.text = numberFormatter.string(from: NSNumber(value: Float(price)/100))! | ||
let enabled = price > 0 | ||
if enabled == buyButton.isEnabled { | ||
return | ||
|
@@ -55,6 +51,13 @@ class BrowseProductsViewController: UICollectionViewController { | |
}, completion: nil) | ||
} | ||
} | ||
|
||
var numberFormatter : NumberFormatter = { | ||
let numberFormatter = NumberFormatter() | ||
numberFormatter.numberStyle = .currency | ||
numberFormatter.usesGroupingSeparator = true | ||
return numberFormatter | ||
}() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👏 |
||
|
||
let settingsVC = SettingsViewController() | ||
|
||
|
@@ -88,6 +91,8 @@ class BrowseProductsViewController: UICollectionViewController { | |
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "Products", style: .plain, target: nil, action: nil) | ||
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Settings", style: .plain, target: self, action: #selector(showSettings)) | ||
|
||
self.numberFormatter.locale = self.settingsVC.settings.currencyLocale | ||
|
||
collectionView?.register(EmojiCell.self, forCellWithReuseIdentifier: "Cell") | ||
collectionView?.allowsMultipleSelection = true | ||
|
||
|
@@ -127,6 +132,14 @@ class BrowseProductsViewController: UICollectionViewController { | |
self.navigationController?.navigationBar.titleTextAttributes = titleAttributes | ||
self.navigationItem.leftBarButtonItem?.setTitleTextAttributes(buttonAttributes, for: UIControl.State()) | ||
self.navigationItem.backBarButtonItem?.setTitleTextAttributes(buttonAttributes, for: UIControl.State()) | ||
|
||
self.numberFormatter.locale = self.settingsVC.settings.currencyLocale | ||
self.view.setNeedsLayout() | ||
let selectedItems = self.collectionView.indexPathsForSelectedItems ?? [] | ||
self.collectionView.reloadData() | ||
for item in selectedItems { | ||
self.collectionView.selectItem(at: item, animated: false, scrollPosition: []) | ||
} | ||
} | ||
|
||
@objc func showSettings() { | ||
|
@@ -168,7 +181,8 @@ extension BrowseProductsViewController: UICollectionViewDelegateFlowLayout { | |
} | ||
|
||
let product = self.productsAndPrices[indexPath.item] | ||
cell.configure(with: product) | ||
|
||
cell.configure(with: product, numberFormatter: self.numberFormatter) | ||
return cell | ||
} | ||
|
||
|
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to convert to swift strangely? I'd probalby expect
createPaymentIntentWithAdditionalParameters:(NSString * _Nullable)additionalParameters completion:(STPPaymentIntentCreationHandler)completion;
I'd also probably expect
additionalParameters
to be an NSDictionary but since this is sample backend code don't feel strongly on either of theseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that was roughly my feeling. It should take a dictionary and convert all the parameters properly, but this was a quick change to make an Objective-C-only sample app work, so meh. I'm more worried about how this additional parameter adds incremental complexity to our sample app.