-
Notifications
You must be signed in to change notification settings - Fork 66
Migrate GraphQL serialization to kotlin serialization #351
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
37fe44e
- added GraphQLResponse, GraphQLRequest
kgangineni 503a631
fix uni tests
kgangineni ad72d7c
update API
kgangineni 48ee01c
change extensions to generic JSONObject
kgangineni 4b99008
update API
kgangineni e322d71
handle non 200 response from graphQL
kgangineni 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 hidden or 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 hidden or 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
79 changes: 79 additions & 0 deletions
79
CardPayments/src/main/java/com/paypal/android/cardpayments/api/UpdateSetupTokenRequest.kt
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| package com.paypal.android.cardpayments.api | ||
|
|
||
| import kotlinx.serialization.InternalSerializationApi | ||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| /** | ||
| * Data classes for Kotlin serialization of update vault setup token GraphQL request | ||
| */ | ||
| @InternalSerializationApi | ||
| @Serializable | ||
| internal data class UpdateSetupTokenVariables( | ||
| @SerialName("clientId") | ||
| val clientId: String, | ||
| @SerialName("vaultSetupToken") | ||
| val vaultSetupToken: String, | ||
| @SerialName("paymentSource") | ||
| val paymentSource: VaultPaymentSource | ||
| ) | ||
|
|
||
| @InternalSerializationApi | ||
| @Serializable | ||
| internal data class VaultPaymentSource( | ||
| val card: VaultCard | ||
| ) | ||
|
|
||
| @InternalSerializationApi | ||
| @Serializable | ||
| internal data class VaultCard( | ||
| val number: String, | ||
| val expiry: String, | ||
| val name: String? = null, | ||
| @SerialName("securityCode") | ||
| val securityCode: String, | ||
| @SerialName("billingAddress") | ||
| val billingAddress: VaultBillingAddress? = null | ||
| ) | ||
|
|
||
| @InternalSerializationApi | ||
| @Serializable | ||
| internal data class VaultBillingAddress( | ||
| @SerialName("addressLine1") | ||
| val addressLine1: String? = null, | ||
| @SerialName("addressLine2") | ||
| val addressLine2: String? = null, | ||
| @SerialName("adminArea1") | ||
| val adminArea1: String? = null, | ||
| @SerialName("adminArea2") | ||
| val adminArea2: String? = null, | ||
| @SerialName("postalCode") | ||
| val postalCode: String? = null, | ||
| @SerialName("countryCode") | ||
| val countryCode: String | ||
| ) | ||
|
|
||
| /** | ||
| * Data classes for update vault setup token GraphQL response | ||
| */ | ||
| @InternalSerializationApi | ||
| @Serializable | ||
| internal data class UpdateSetupTokenResponse( | ||
| @SerialName("updateVaultSetupToken") | ||
| val updateVaultSetupToken: SetupTokenData | ||
| ) | ||
|
|
||
| @InternalSerializationApi | ||
| @Serializable | ||
| internal data class SetupTokenData( | ||
| val id: String, | ||
| val status: String, | ||
| val links: List<LinkData>? = null | ||
| ) | ||
|
|
||
| @InternalSerializationApi | ||
| @Serializable | ||
| internal data class LinkData( | ||
| val rel: String, | ||
| val href: String | ||
| ) |
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
We don't have billingAddress for Card in iOS for vaulting.
I wonder if that's a requirement.
Maybe we need to add it as an optional field.
The endpoint works without it.
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.
it is an optional field, nullable in kotlin