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

[πŸ’³] NT-1122 Initial card selection #824

Merged
merged 4 commits into from
Apr 8, 2020
Merged

[πŸ’³] NT-1122 Initial card selection #824

merged 4 commits into from
Apr 8, 2020

Conversation

eoji
Copy link
Contributor

@eoji eoji commented Apr 7, 2020

πŸ“² What

Automatically selecting a logged in user's first card or the card used to pledge.

πŸ€” Why

To make it easier for users to pledge.

πŸ›  How

  • The new footer pledge button pledge_footer_pledge_button now accepts clicks (meaning you can actually pledge and update your payment method with it)
    • (The Update Pledge button will be removed in another PR to keep this one small)

RewardCardUnselectedViewHolder

  • Renamed Delegate.selectCardButtonClicked to cardSelected that takes in the StoredCard along with its position
  • Added output notifyDelegateCardSelected that emits a <Pair<StoredCard, Int>> of the selected card and its position

PledgeFragmentViewModel

  • Input pledgeButtonClicked no longer takes in the card ID String
    • When it emits a backing is created/updated
  • Input selectCardButtonClicked is now cardSelected that takes in a StoredCard and its position
  • Added helper initialCardSelection method to figure out what the initial selected card should be
  • The Testsβ„’
    • These small changes broke almost 20 tests 😒
    • Added tests for asserting the correct card was selected
    • Created TestData data class to help set up situations like updating a pledge with or without shipping
    • Added helper methods setUpBackedShippableRewardTestData and setUpBackedNoRewardTestData and used them to clean up a few tests

Deletions

BaseRewardCardViewHolderViewModel

πŸ‘€ See

New pledge πŸ†• Updating payment method ⬆️
device-2020-04-07-185646 2020-04-07 19_00_44 device-2020-04-07-185919 2020-04-07 19_00_37

πŸ“‹ QA

Smash that pledge button.

Story πŸ“–

NT-1122

val defaultIndex = 0
val backingPaymentSourceIndex = storedCards.indexOfFirst { it.id() == project.backing()?.paymentSource()?.id() }
return when {
backingPaymentSourceIndex != -1 -> Pair(storedCards[backingPaymentSourceIndex], backingPaymentSourceIndex)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the backingPaymentSourceIndex set to -1 if indexOfFirst doesn't find something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eoji eoji merged commit 27078fb into NT-1103 Apr 8, 2020
@eoji eoji deleted the NT-1122 branch April 8, 2020 16:50
eoji added a commit that referenced this pull request Apr 20, 2020
* [🦢🏾] NT-1104 Add Pledge screen footer (#817)
* [⬇] NT-1120 Vertical payment methods in Pledge screen (#821)
* [πŸ”¨] NT-1121 Stored cards redesign (#822)
* [πŸ›’] NT-1105 Kickstarter is not a store redesign (#823)
* [πŸ’³] NT-1122 Initial card selection (#824)
* [⏳] NT-1124 Loading state for payment methods (#825)
* [βž•] NT-1125 New card CTA (#828)
* [πŸ’³] NT-1123 Last four digits copy (#826)
* [πŸ’³] NT-1123 Card not allowed copy (#827)
* [🎨] NT-1111 Adding 2 buttons in the new pledge footer (#830)
* [πŸ”Œ] NT-1129 Adding progress state for pledging (#831)
* [πŸ—£] NT-1126 Payment methods a11y (#829)
* [πŸ‘·πŸΎβ€β™€οΈ] NT-1128 Moved continue button in Pledge screen to footer (#833)
* [⚠️] NT-1131 Pledge error Toasts (#832)
* [␑] NT-1127 Removing Update pledge button (#834)
* [πŸ“] NT-1130 Pledge button CTA (#835)
* [βœ…] NT-1133 Enabling pledge button only when all fields are valid (#836)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants