-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat(Bonus Pagamenti Digitali): [#175683801] When credit card has been added, join BPD or enroll the new method to BPD #2399
Merged
fabriziofff
merged 15 commits into
master
from
175683801-enroll-cashback-after-payment-method
Nov 19, 2020
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4034188
[#175683801] wip
Undermaken 816862a
[#175683801] refactoring
Undermaken f3033fc
[#175683801] add comment
Undermaken cd3be0c
Merge branch 'master' into 175683801-enroll-cashback-after-payment-me…
fabriziofff f90709d
Merge branch 'master' into 175683801-enroll-cashback-after-payment-me…
Undermaken a365471
Merge branch 'master' into 175683801-enroll-cashback-after-payment-me…
Undermaken b40f05a
[#175683801] refactoring
Undermaken 20da673
[#175683801] restore code
Undermaken 9f9c143
[#175683801] fix typo
Undermaken 68c3439
[#175683801] log the AuthorizationCode
Undermaken fc4e0a2
[#175683801] revert
Undermaken 16938ed
Merge branch 'master' into 175683801-enroll-cashback-after-payment-me…
Undermaken 82a532e
Merge branch 'master' into 175683801-enroll-cashback-after-payment-me…
fabriziofff 8a1d920
Merge branch 'master' into 175683801-enroll-cashback-after-payment-me…
fabriziofff f922f30
Merge branch 'master' into 175683801-enroll-cashback-after-payment-me…
Undermaken 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
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 |
---|---|---|
|
@@ -95,6 +95,7 @@ import { isProfileEmailValidatedSelector } from "../store/reducers/profile"; | |
import { GlobalState } from "../store/reducers/types"; | ||
|
||
import { | ||
EnableableFunctionsTypeEnum, | ||
NullableWallet, | ||
PaymentManagerToken, | ||
PayRequest | ||
|
@@ -126,6 +127,14 @@ import { | |
} from "./wallet/pagopaApis"; | ||
import { getTransactionsRead } from "../store/reducers/entities/readTransactions"; | ||
import _ from "lodash"; | ||
import { hasFunctionEnabled } from "../utils/walletv2"; | ||
import { bpdEnabledSelector } from "../features/bonus/bpd/store/reducers/details/activation"; | ||
import { isReady } from "../features/bonus/bpd/model/RemoteValue"; | ||
import { | ||
navigateToActivateBpdOnNewMethod, | ||
navigateToSuggestBpdActivation | ||
} from "../features/wallet/onboarding/bancomat/navigation/action"; | ||
import { navigationHistoryPop } from "../store/actions/navigationHistory"; | ||
|
||
/** | ||
* Configure the max number of retries and delay between retries when polling | ||
|
@@ -298,7 +307,36 @@ function* startOrResumeAddCreditCardSaga( | |
const maybeAddedWallet = updatedWallets.find( | ||
_ => _.idWallet === idWallet | ||
); | ||
// if the new method has been added | ||
if (maybeAddedWallet !== undefined) { | ||
const bpdEnroll: ReturnType<typeof bpdEnabledSelector> = yield select( | ||
bpdEnabledSelector | ||
); | ||
// check if the new method is compliant with bpd | ||
if (bpdEnabled && maybeAddedWallet.v2) { | ||
const hasBpdFeature = hasFunctionEnabled( | ||
maybeAddedWallet.v2, | ||
EnableableFunctionsTypeEnum.BPD | ||
); | ||
// if the method is bpd compliant check if we have info about bpd activation | ||
if (hasBpdFeature && isReady(bpdEnroll)) { | ||
// if bdp is active navigate to a screen where it asked to enroll that method in bpd | ||
// otherwise navigate to a screen where is asked to join bpd | ||
if (bpdEnroll.value) { | ||
yield put( | ||
navigateToActivateBpdOnNewMethod({ | ||
newAddedMethods: [maybeAddedWallet.v2] | ||
}) | ||
); | ||
} else { | ||
yield put(navigateToSuggestBpdActivation()); | ||
} | ||
// remove these screen from the navigation stack: method choice, credit card form, credit card resume | ||
yield put(navigationHistoryPop(3)); | ||
return; | ||
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. This could be a problem because we have a story that ask us to add a credit card without the method choice https://www.pivotaltracker.com/story/show/175757212 |
||
} | ||
} | ||
|
||
// dispatch the action: a new card has been added | ||
yield put(addWalletNewCreditCardSuccess()); | ||
if (action.payload.setAsFavorite === true) { | ||
|
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.
In order to be ready for the next payments methods, would be nice to transform
ActivateBpdOnNewBancomatScreen
->ActivateBpdOnNewPaymentMethodScreen
, a component that accepts as props:paymentMethods: ReadonlyArray<PatchedWalletV2>
and than add:In this way we can reuse the
ActivateBpdOnNewPaymentMethodScreen
also for future payments type that can be read from store or from navigation props.What you think?
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.
update within b40f05a