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

mapFromShippingMethod on iOS produces a a dictionary with invalid types #1196

Closed
jonasbark opened this issue Nov 10, 2022 · 1 comment · Fixed by #1227
Closed

mapFromShippingMethod on iOS produces a a dictionary with invalid types #1196

jonasbark opened this issue Nov 10, 2022 · 1 comment · Fixed by #1227

Comments

@jonasbark
Copy link
Collaborator

"type": shippingMethod.type,

I'm not sure what magic is involved for this to serialize correctly on React Native but it will fail on Flutter which uses JSONSerialization.data(withJSONObject... internally and fails with:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (__SwiftValue)'
terminating with uncaught exception of type NSException
2022-11-10 13:42:08.015484+0100 Runner[22220:691507] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (__SwiftValue)'

The culprit is the line linked above where the type is serialized:

(lldb) po body
▿ 1 element
  ▿ 0 : 2 elements
    - key : "shippingMethod"
    ▿ value : 5 elements
      ▿ 0 : 2 elements
        - key : amount
        - value : 3.21
      ▿ 1 : 2 elements
        - key : label
        - value : Standard Shipping
      ▿ 2 : 2 elements
        - key : detail
        - value : Arrives by June 29
      ▿ 3 : 2 elements
        - key : identifier
        - value : standard
      ▿ 4 : 2 elements
        - key : type
        - value : __C.PKPaymentSummaryItemType(rawValue: 0)

should the line be adjusted to return type.rawValue instead?

@charliecruzan-stripe
Copy link
Collaborator

Fixed in v0.22.1 ✅

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 a pull request may close this issue.

2 participants