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

MobilePay Purchase flow fails - State is null #350

Closed
duckth opened this issue Oct 11, 2022 · 3 comments · Fixed by #352
Closed

MobilePay Purchase flow fails - State is null #350

duckth opened this issue Oct 11, 2022 · 3 comments · Fixed by #352
Labels
bug Something isn't working

Comments

@duckth
Copy link
Member

duckth commented Oct 11, 2022

MobilePay purchase flow fails when trying to create MobilePayPaymentDetails object after geting response from PurchaseRepository
PurchaseRepository.initiatePurchase returns a response with state = null and causes an exception:
CastError (type 'Null' is not a subtype of type 'String' in type cast)

@duckth duckth added the bug Something isn't working label Oct 11, 2022
@TTA777
Copy link
Member

TTA777 commented Oct 11, 2022

Just to add to this, in my older version of the generated code, state is correctly marked as nullable. Whether this change is caused by a change in the library that generate the httpClient code, or the OpenApiSpec I'm not sure of yet

@TTA777
Copy link
Member

TTA777 commented Oct 11, 2022

Looked at this a bit more, findings so far:

  • Unable to reproduce on my environment with my current versions of flutter (3.0.1), dart (2.12.2), and swagger_dart_code_generator (http client generator, 2.5.2)
  • Upgrading swagger_dart_code_generator to 2.7.0 reproduces error on my machine, without updating flutter or dart
  • By adding "nullable": true, to the state property in the OpenApiSpec, it is correctly marked as nullable in the generated code, though this causes other issues on my machine

Conclusion so far:
It seems the package we use to generate the code has received an update where it is now following the spec more closely. Previously it was marking all the properties as being nullable in this class, which was not in accordance to the spec. The source of the problem then appears to be from the backend not generating the OpenApiSpec correctly, since state is not marked as Nullable, despite being it.

However, it does appear that some updates will be required on the app side as well to accommodate this change in the generated code. Those of us using older versions of flutter/ dart might also need to update in order to get everyone's dev environment inline with the rest.

@jonasanker
Copy link
Member

Bug is introduced in the package upgrade of swagger_dart_code_generator to 2.7.8 in Pull Request #348

Analog Core does not support nullability officially yet. This requires an update of the codebase. See issue AnalogIO/analog-core#82

Probably is it the best to rollback the package to the old version for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants