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

Cw 657 new buy sell flow #1553

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open

Conversation

Serhii-Borodenko
Copy link
Contributor

Issue Number (if Applicable): Fixes #

Description

Please include a summary of the changes and which issue is fixed / feature is added.

Pull Request - Checklist

  • Initial Manual Tests Passed
  • Double check modified code and verify it with the feature/task requirements
  • Format code
  • Look for code duplication
  • Clear naming for variables and methods

Copy link
Contributor

@OmarHatem28 OmarHatem28 left a comment

Choose a reason for hiding this comment

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

Overall looks good,
I like the abstraction you added so that we can re-use the components for multiple purposes

just please make sure that it's passing the correct fields to the APIs cuz we have 2 cases, buy and sell, and we need to make sure we are passing the correct data for all providers

lib/buy/payment_method.dart Outdated Show resolved Hide resolved

ProviderRecommendation? getRecommendationFromString(String title) {
switch (title) {
case 'BEST RATE':
Copy link
Contributor

Choose a reason for hiding this comment

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

is this the expected value? the others are without spaces, so just making sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, this is what was in the Figma mockup

Copy link
Contributor

Choose a reason for hiding this comment

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

Figma? this is used for fetching the recommendations returned by onramper?!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, you were asking about the expected response value. From Onramper, we are getting ‘BestPrice’, but we ignore it anyway because we set the best rate ourselves here:
recommendations.insert(0, ProviderRecommendation.bestRate);
in the view model.

lib/buy/dfx/dfx_buy_provider.dart Show resolved Hide resolved
lib/buy/dfx/dfx_buy_provider.dart Show resolved Hide resolved
lib/buy/dfx/dfx_buy_provider.dart Show resolved Hide resolved
lib/view_model/buy/buy_sell_view_model.dart Show resolved Hide resolved

final queryParams = {
'applicationId': _applicationId,
'fiatCode': sourceCurrencyName,
Copy link
Contributor

Choose a reason for hiding this comment

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

this will be the currency in case of sell right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is an assetCode parameter missing, fixed.

lib/buy/moonpay/moonpay_provider.dart Show resolved Hide resolved
lib/buy/onramper/onramper_buy_provider.dart Show resolved Hide resolved
lib/buy/onramper/onramper_buy_provider.dart Outdated Show resolved Hide resolved
Copy link
Contributor

@OmarHatem28 OmarHatem28 left a comment

Choose a reason for hiding this comment

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

Since we already have a field for fiat currency and one for crypto currency, why confuse ourselves with sourceCurrency and destinationCurrency just make the parameters take Fiat and Crypto and pass them without confusion and we get to decide in each provider which one gets passed as which parameter in the request
too many unnecessary confusion

Comment on lines 168 to 170
if(!isBuyAction && destinationCurrency as FiatCurrency != FiatCurrency.eur) {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be in DFX
should be checking if destinationCurrency is Fiat or Crypto first
should be checking for EUR and CHF both are valid for DFX

Copy link
Contributor

Choose a reason for hiding this comment

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

changed it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There should be a fiat currency check as well. It appears that if Moonpay doesn't support the fiat for the sell action, it returns a quote for euros as default.I made the check a bit clearer.

currencyValueValidator: (value) {
return null;
},
addressTextFieldValidator: AddressValidator(type: buySellViewModel.cryptoCurrency),
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor
this is the fiat amount, why address validator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

currencyValueValidator: (value) {
return null;
},
addressTextFieldValidator: AddressValidator(type: CryptoCurrency.xmr),
Copy link
Contributor

Choose a reason for hiding this comment

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

only xmr?!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@Serhii-Borodenko
Copy link
Contributor Author

Replaced source and destination currency parameters with the corresponding fiat and crypto currency parameters.

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.

3 participants