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:
Yun Cheng
2025-12-11 12:54:37 -05:00
committed by GitHub
parent bc1f2b1dd1
commit ab89162e3f
2 changed files with 23 additions and 0 deletions

View File

@@ -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 {

View File

@@ -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)
}
}