mirror of
https://github.com/kickstarter/android-oss.git
synced 2026-03-13 09:11:01 +08:00
MBL-2826 Parse the actual field backend sends us for orders: pledge_manager_path (#2459)
* MBL-2826 Parse the actual field backend sends us for orders: pledge_manager_path * Add serialized name to class
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.kickstarter.services.apiresponses
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import com.kickstarter.models.SurveyResponse.Urls
|
||||
import com.kickstarter.models.SurveyResponse.Urls.Web
|
||||
import com.kickstarter.models.pushdata.Activity
|
||||
@@ -274,6 +275,7 @@ class PushNotificationEnvelope private constructor(
|
||||
@Parcelize
|
||||
class PledgeRedemption private constructor(
|
||||
private val id: Long,
|
||||
@SerializedName("pledge_manager_path")
|
||||
private val pledgeRedemptionPath: String?
|
||||
) : Parcelable {
|
||||
fun id() = this.id
|
||||
@@ -282,6 +284,8 @@ class PushNotificationEnvelope private constructor(
|
||||
@Parcelize
|
||||
data class Builder(
|
||||
private var id: Long = 0L,
|
||||
|
||||
@SerializedName("pledge_manager_path")
|
||||
private var pledgeRedemptionPath: String? = null
|
||||
|
||||
) : Parcelable {
|
||||
|
||||
@@ -379,4 +379,23 @@ class PushNotificationEnvelopeTest : KSRobolectricTestCase() {
|
||||
|
||||
assertTrue(isSurvey)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testPushNotificationEnvelope_isPledgeManagerPushNotif() {
|
||||
val pushNotificationEnvelope = PushNotificationEnvelope.builder().build()
|
||||
|
||||
assertFalse(pushNotificationEnvelope.isPledgeRedemption())
|
||||
|
||||
val pledgeRedemption = PushNotificationEnvelope.PledgeRedemption.builder()
|
||||
.id(12L)
|
||||
.pledgeRedemptionPath("/projects/blaft/india-street-lettering-a-book/backing/redeem")
|
||||
.build()
|
||||
|
||||
val isPledgeRedemption = pushNotificationEnvelope.toBuilder()
|
||||
.pledgeRedemption(pledgeRedemption)
|
||||
.build()
|
||||
.isPledgeRedemption()
|
||||
|
||||
assertTrue(isPledgeRedemption)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user