-
Notifications
You must be signed in to change notification settings - Fork 19
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
PE-4565: Address the tech debt created by Turbo Promo Code #1370
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3a31041
chore(payment service): updates log statements PE-4565
matibat 7552e39
chore(payment service): split big method into smaller pieces PE-4565
matibat 628b8c6
chore(payment form bloc): renames variable PE-4565
matibat f5f546e
chore(payment): DRYes repeated code; removes unused methods PE-4565
matibat cde0e1d
chore(topup estimation bloc): corrects log message PE-4565
matibat 40bc7f8
chore(topup estimation bloc): removes redundant try..catch block PE-4565
matibat 49f715f
chore(topup): track hasPromoCodeApplied in the state PE-4565
matibat 221e5d6
chore(topup): track humanReadableDiscountPercentage in the state PE-4565
matibat eafaa33
chore(topup): track paymentAmount and winstonCredits in the state PE-…
matibat ce4440b
feat(payment service): pass missing arg PE-4565
matibat 4bcb2c3
chore(payment service): makes the param be required PE-4565
matibat c78f9aa
feat(payment service): corrects unawaited futures PE-4565
matibat 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,12 @@ abstract class PaymentFormState extends Equatable { | |
final PriceEstimate priceEstimate; | ||
final int quoteExpirationTimeInSeconds; | ||
|
||
bool get hasPromoCodeApplied => priceEstimate.hasPromoCodeApplied; | ||
String? get humanReadableDiscountPercentage => | ||
priceEstimate.humanReadableDiscountPercentage; | ||
String get paymentAmount => priceEstimate.paymentAmount.toStringAsFixed(2); | ||
BigInt get winstonCredits => priceEstimate.winstonCredits; | ||
|
||
@override | ||
List<Object> get props => [ | ||
priceEstimate, | ||
|
@@ -36,21 +42,6 @@ class PaymentFormLoaded extends PaymentFormState { | |
final bool isFetchingPromoCode; | ||
final bool errorFetchingPromoCode; | ||
|
||
double? get promoDiscountFactor { | ||
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. For the reviewer - this code was being unused. |
||
if (priceEstimate.estimate.adjustments.isEmpty) { | ||
return null; | ||
} | ||
|
||
final adjustment = priceEstimate.estimate.adjustments.first; | ||
final adjustmentMagnitude = adjustment.operatorMagnitude; | ||
|
||
// Multiplying by 100 and then dividing by 100 is a workaround for | ||
/// floating point precision issues. | ||
final factor = (100 - (adjustmentMagnitude * 100)) / 100; | ||
|
||
return factor; | ||
} | ||
|
||
const PaymentFormLoaded( | ||
super.priceEstimate, | ||
super.quoteExpirationTime, | ||
|
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.
For the reviewer - I just split the method into smaller ones. I've set the nullable parameters to be required so I don't miss passing the argument.