-
Notifications
You must be signed in to change notification settings - Fork 657
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch available incentives after linking bank account
- Loading branch information
1 parent
ab9e133
commit 3be015b
Showing
14 changed files
with
131 additions
and
10 deletions.
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
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
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
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
14 changes: 14 additions & 0 deletions
14
payments-model/src/main/java/com/stripe/android/model/UpdateAvailableIncentives.kt
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.stripe.android.model | ||
|
||
import androidx.annotation.RestrictTo | ||
import com.stripe.android.core.model.StripeModel | ||
import kotlinx.parcelize.Parcelize | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
@Parcelize | ||
@Serializable | ||
data class UpdateAvailableIncentives( | ||
@SerialName("data") val data: List<LinkConsumerIncentive>, | ||
) : StripeModel |
22 changes: 22 additions & 0 deletions
22
...del/src/main/java/com/stripe/android/model/parsers/UpdateAvailableIncentivesJsonParser.kt
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.stripe.android.model.parsers | ||
|
||
import androidx.annotation.RestrictTo | ||
import com.stripe.android.core.model.parsers.ModelJsonParser | ||
import com.stripe.android.model.UpdateAvailableIncentives | ||
import org.json.JSONObject | ||
|
||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
object UpdateAvailableIncentivesJsonParser : ModelJsonParser<UpdateAvailableIncentives> { | ||
|
||
override fun parse(json: JSONObject): UpdateAvailableIncentives? { | ||
val incentives = json.optJSONArray("data")?.let { data -> | ||
List(data.length()) { index -> | ||
LinkConsumerIncentiveJsonParser.parse(data.getJSONObject(index)) | ||
} | ||
} | ||
|
||
return incentives?.let { | ||
UpdateAvailableIncentives(data = it.filterNotNull()) | ||
} | ||
} | ||
} |
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