Skip to content
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

Payment methods #597

Merged
merged 37 commits into from Feb 15, 2019
Merged

Payment methods #597

merged 37 commits into from Feb 15, 2019

Conversation

justinswart
Copy link
Contributor

📲 What

This PR represents a larger body of work to bring payment methods to settings.

🤔 Why

This allows users to add/edit/delete payment methods in the app.

🛠 How

https://github.com/kickstarter/ios-oss/pulls?utf8=%E2%9C%93&q=is%3Apr+payment-methods+

cdolm92 and others added 30 commits November 8, 2018 10:40
* add card view controller

* transition to add new card and uibarbuttons

* settings style applied to add new card screen

* changed keyboard style for textfields

* view controller tests

* placeholder for cardholder name textfield

* Record new screenshots

* new strings, added strings as place holder and text label

* pr feedback - inferring type for cancel button tintcolor

* pr feedback - keypath, no more lenses

* swiftlint fix

* new snapshots
* New card screen ui (#471)

* add card view controller

* transition to add new card and uibarbuttons

* settings style applied to add new card screen

* changed keyboard style for textfields

* view controller tests

* placeholder for cardholder name textfield

* Record new screenshots

* new strings, added strings as place holder and text label

* pr feedback - inferring type for cancel button tintcolor

* pr feedback - keypath, no more lenses

* swiftlint fix

* new snapshots

* new stppaymentcardtextfield showing

* wip - placeholder colors

* snapshot tests

* Email undeliverable/unverified (#478)

* Adding emailIsVerified

* Renaming GraphUserEmail

* ViewModel tests

* ChangeEmailViewController tests

* Strings, swiftlint

* Strings & new screenshots

* Cleanup

* PR comments

* PR updates

* Test naming

* pr feedback

* new snapshots

* new placeholder colors

* new snapshots
* Add payment method deletion

* Test datasource

* Test view model

* Clean-up and address PR feedback

* Rename credit card -> payment method

* Fix test
* Email undeliverable/unverified (#478)

* Adding emailIsVerified

* Renaming GraphUserEmail

* ViewModel tests

* ChangeEmailViewController tests

* Strings, swiftlint

* Strings & new screenshots

* Cleanup

* PR comments

* PR updates

* Test naming

* Use correct function to log events in crash logs (#481)

* Use correct function to log events in crash logs

* Fix indentation

* changed ui colors for textfield text and font size of text label

* vm and work on enabling save

* wip- get stripe token

* wip- payment source mutation

* wip- keyboard response

* wip- getting a stripe error here

* wip- error fix w/ publishable key, error banner showing

* wip- saving with error and keyboard functionality

* wip- updating card immediately

* wip

* wip - ACs met

* wip - refactor in view model, made IDs testable, begane VM tests

* wip -refactor on vm/vmtest

* wip -refactor deleted comments on vmt

* wip -snapshot tests

* swiftlint fixes

* renaming/refactor, corrected paymentmethodstests

* pr feedback

* swiftlint fixes

* changed function name

* indentation
* Viewmodel logic for unsupported cards

* Tests and accessibility fixes

* Simplify add card button

* Screenshots and string updates

* Cleanup design and remove logs

* Improving comment message

* Removing filter debug builds

* Addressing PR comments

* Updating payment methods screenshots

* Screenshots

* Possible fix for alignment issues

* Moving iOS 10 handling to output signal closure

* Remove line

* Renaming

* Last cleanup

* Strings & Asset update

* Switching from unsupported to supported
* Viewmodel logic for unsupported cards

* Tests and accessibility fixes

* Simplify add card button

* Screenshots and string updates

* Cleanup design and remove logs

* Improving comment message

* Removing filter debug builds

* Addressing PR comments

* Updating payment methods screenshots

* Screenshots

* Possible fix for alignment issues

* Moving iOS 10 handling to output signal closure

* Remove line

* Renaming

* Last cleanup

* Shared styled form field

* Adding functionality for zipcode form field

* More functionality

* View model & screenshot tests

* Swiftlint

* Cleanup

* Improving test and cleanup

* PR feedback and autocapitalizing zipcode
…feature-payment-methods

# Conflicts:
#	Kickstarter-iOS/Views/Storyboards/Settings.storyboard
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_de_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_de_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_de_device_phone4inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_de_device_phone5_5inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_de_device_phone5_8inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_en_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_en_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_en_device_phone4inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_en_device_phone5_5inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_en_device_phone5_8inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_es_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_es_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_es_device_phone4inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_es_device_phone5_5inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_es_device_phone5_8inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_fr_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_fr_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_fr_device_phone4inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_fr_device_phone5_5inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_fr_device_phone5_8inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_ja_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_ja_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_ja_device_phone4inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_ja_device_phone5_5inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ChangePasswordViewControllerTests/testChangePassword_lang_ja_device_phone5_8inch@2x.png
* wip

* wip

* wip

* wip-swiftlint

* moved CreatePaymentSourceEnvelope to its own file, Mockservice

* swiftlint fix

* deleted unnecesary debugging code

* new paymentsource temploate and vm tests

* swiftlint fix

* fixed vm test

* PR feedback

* update schema
* tableViewIsEditing false and show banner after dismiss

* Swiftlint

* Adding StripePublishableKey to example file

* Update publishableKey test

* Spacing

* Point-free helper
* Update padding and image view size

* Update stack view's spacing

* Update snapshots

* Use layoutMargins to set the padding
* Adding custom UITableViewHeader and always calling reload data on viewDidLoad

* Updating screenshots

* Cleanup autolayout warnings

* Screenshots

* PR comments

* No autolayout for footer view

* Cleanup

* Remove intrinsicContentSize

* Tableview appears without delay fix (#587)

* Fix header/footer auto sizing

* Update header background color

* Update snapshots

* Screenshots again

* Updating constraint priority to resolve ambiguity
* Refresh payment methods table view properly

* Remove reference to weak self

* Rename delegate methods
…y (by delegate) (#591)

* Do not refresh on viewWillAppear

* Use optional string to avoid unnecessary initializer

* Bring back viewWillAppear signal to better reflect view controller's lifecycle state
* Add card name to the a11y label

* Add comment
* Design fixes

* Fresh screenshots ✨

* Remove recordMode

* Deleting stale screenshots

* Re-add accidentally deleted line
justinswart and others added 7 commits February 14, 2019 15:16
# Conflicts:
#	Kickstarter-iOS/Locales/fr.lproj/Localizable.strings
#	Kickstarter-iOS/Locales/ja.lproj/Localizable.strings
#	Library/Strings.swift
…ayment methods (#596)

* Optional card type, payment methods load error

* Optional support for imageName

* Fix accessibility label

* Fix merge conflict spacing

* Swiftlint

* Implementing PR suggestions
* error message present and return key to done

* removed error message banner for incomplete payment details

* new snapshots for correct insets
…#589)

* Disable edit button optimistically, use stored cards in result from card deletion

* Fix issue where edit button is not re-enabled upon the failed deletion of the last card.

* Remove unnecessary .init

* Add skipRepeats() to editButtonIsEnabled signal.
case let (cell as CreditCardCell, value as GraphUserCreditCard.CreditCard):
cell.configureWith(value: value)
default:
assertionFailure("Unrecognized (cell, viewModel) combo.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We sure we want to crash if something goes wrong?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone double check that we're not currently testing this behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in all of our data sources, there isn't really an alternative 🤷‍♂️ . Will assertionFailure crash in production though? Thought asserts are ignored if not running in debug.

import KsApi
import Library
import Prelude
import ReactiveSwift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this import is not necessary. Maybe we can remove it in the future (should not block the release)

import KsApi
import Library
import Prelude
import ReactiveSwift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

}
"""

let data = jsonString.data(using: .utf8)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In future we should try to replace these with the non-failable initializer:

let data = Data(bytes: jsonString.utf8)

Then we won't need the force unwraps.


private let stripeTokenProperty = MutableProperty<(String, String)?>(nil)
public func stripeCreated(_ token: String?, stripeID: String?) {
if let token = token, let stripeID = stripeID {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our inputs should not contain any logic.

@justinswart justinswart changed the title [WIP] Payment methods Payment methods Feb 15, 2019
Copy link
Contributor

@ifbarrera ifbarrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@justinswart justinswart merged commit ccfdcaa into master Feb 15, 2019
@justinswart justinswart deleted the feature-payment-methods branch February 15, 2019 19:17
let data = jsonString.data(using: .utf8)

do {
//swiftlint:disable force_unwrapping
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a lot of these disables we do not re-enable them after the interested scope. This applies to some of the other rules in this PR. Should we use <disable><enable> or <disable-next-line>?

@justinswart justinswart restored the feature-payment-methods branch February 15, 2019 21:23
@dusi dusi deleted the feature-payment-methods branch February 25, 2019 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants