-
Notifications
You must be signed in to change notification settings - Fork 662
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 (#9735)
* Fetch available incentives after linking bank account * Update tests * Update API * Remove unused `Serializable` annotation * Make minor code tweak * Propagate `Result<T>` to call-site
- Loading branch information
1 parent
0087322
commit b67e9c7
Showing
17 changed files
with
210 additions
and
11 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
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
11 changes: 11 additions & 0 deletions
11
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,11 @@ | ||
package com.stripe.android.model | ||
|
||
import androidx.annotation.RestrictTo | ||
import com.stripe.android.core.model.StripeModel | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
@Parcelize | ||
data class UpdateAvailableIncentives( | ||
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()) | ||
} | ||
} | ||
} |
Oops, something went wrong.