From b6ab5da8d28b551f3490e7028fe5fde328e36437 Mon Sep 17 00:00:00 2001 From: jlplks Date: Thu, 30 Jan 2025 09:46:49 -0800 Subject: [PATCH] MBL-2052 PLOT projects not working after scheme change on BE (#2215) * Remove 'projectIsPledgeOverTimeAllowed' from the project * fix showPlotWidget --------- Co-authored-by: Isabel Martin Co-authored-by: Leigh Douglas --- app/src/main/graphql/project.graphql | 1 - app/src/main/graphql/schema.graphqls | 72 +++++++++++++------ .../mock/factories/PaymentPlanFactory.kt | 4 -- .../com/kickstarter/models/PaymentPlan.kt | 9 +-- .../transformers/GraphQLTransformers.kt | 1 - .../projectpage/CrowdfundCheckoutViewModel.kt | 2 +- 6 files changed, 52 insertions(+), 37 deletions(-) diff --git a/app/src/main/graphql/project.graphql b/app/src/main/graphql/project.graphql index 7de1f44eb7..a6c32de828 100644 --- a/app/src/main/graphql/project.graphql +++ b/app/src/main/graphql/project.graphql @@ -203,7 +203,6 @@ mutation CreateFlagging($contentId: ID!, $details: String, $kind: NonDeprecatedF query BuildPaymentPlan($slug: String!, $amount: String!) { project(slug: $slug) { paymentPlan(amount: $amount) { - projectIsPledgeOverTimeAllowed amountIsPledgeOverTimeEligible paymentIncrements { amount { diff --git a/app/src/main/graphql/schema.graphqls b/app/src/main/graphql/schema.graphqls index 6cdf633fbc..b69fef4461 100644 --- a/app/src/main/graphql/schema.graphqls +++ b/app/src/main/graphql/schema.graphqls @@ -760,18 +760,12 @@ enum Feature { reset_backer_survey_2024 - disable_shipping_at_pledge - pledge_projects_overview_2024 pledge_projects_overview_ios_2024 copy_rewards - pledge_redemption_v1 - - pledge_redemption_vat - survey_reward_questions_2024 address_collection_for_digital_rewards_2024 @@ -796,10 +790,6 @@ enum Feature { notification_banner_update_2024 - multiple_shipfrom_locations_2024 - - pledge_redemption_unified_creator_ui - react_backed_projects copy_addons @@ -807,6 +797,12 @@ enum Feature { KDS_messages_app pledge_management_refunds + + discover_ui_2025 + + pledge_management_beta + + creator_experience_2025 } """ @@ -1766,6 +1762,11 @@ type Project implements Node & Commentable { """ profile: ProjectProfile + """ + The text of the currently applied project notice, empty if there is no notice + """ + projectNotice: String + """ When this project was Project of the Day. """ @@ -5055,19 +5056,24 @@ A hash containing the original, refunded, and remaining amounts. """ type AdjustmentAmount { """ - the original total amount + original total amount """ originalTotal: Int! """ - the refunded total amount + amount that has been refunded after all adjustments are applied """ refundedTotal: Int! """ - the remaining total amount + amount remaining after all adjustments are applied """ remainingTotal: Int! + + """ + whether the reward has been removed from the backing + """ + removed: Boolean } """ @@ -5075,10 +5081,15 @@ A reward that is modified by an adjustment. """ type AdjustmentReward { """ - original total for reward + original total amount """ originalTotal: Int! + """ + uuid for the refund item + """ + refundItemId: ID! + """ amount that has been refunded after all adjustments are applied """ @@ -5089,10 +5100,15 @@ type AdjustmentReward { """ remainingTotal: Int! + """ + whether the reward has been removed from the backing + """ + removed: Boolean + """ graphql id of reward to be refunded """ - rewardId: ID! + rewardId: String! } """ @@ -7081,6 +7097,11 @@ enum FlaggingKind { """ PROTOTYPE_MISREPRESENTATION + """ + undisclosed-ai-use + """ + UNDISCLOSED_AI_USE + """ misrep-support-impersonation """ @@ -8441,11 +8462,6 @@ type PaymentPlan { amountIsPledgeOverTimeEligible: Boolean! paymentIncrements: [PaymentIncrement!] - - """ - Whether the project permits pledge over time pledges - """ - projectIsPledgeOverTimeAllowed: Boolean! } """ @@ -9108,6 +9124,8 @@ enum UserRestrictionKind { edit_spotlight_pages phone + + prelaunch_early } """ @@ -14516,10 +14534,15 @@ input AdjustmentInput { An object removed as part of an adjustment """ input RemovalInput { + """ + id of the reward associated with the removal + """ + rewardId: Int! + """ id of object to be removed """ - id: Int! + refundItemId: ID! """ type of object to be removed (reward, reward item, or order item) @@ -14534,7 +14557,7 @@ input RefundInput { """ id of object to be refunded """ - id: Int + refundItemId: ID """ type of refund @@ -14965,6 +14988,11 @@ enum NonDeprecatedFlaggingKind { """ PROTOTYPE_MISREPRESENTATION + """ + undisclosed-ai-use + """ + UNDISCLOSED_AI_USE + """ misrep-support-impersonation """ diff --git a/app/src/main/java/com/kickstarter/mock/factories/PaymentPlanFactory.kt b/app/src/main/java/com/kickstarter/mock/factories/PaymentPlanFactory.kt index badb38c8ed..6086b4ad16 100644 --- a/app/src/main/java/com/kickstarter/mock/factories/PaymentPlanFactory.kt +++ b/app/src/main/java/com/kickstarter/mock/factories/PaymentPlanFactory.kt @@ -10,12 +10,10 @@ class PaymentPlanFactory { fun paymentPlan( paymentIncrements: List?, amountIsPledgeOverTimeEligible: Boolean, - projectIsPledgeOverTimeAllowed: Boolean, ): PaymentPlan { return builder() .paymentIncrements(paymentIncrements) .amountIsPledgeOverTimeEligible(amountIsPledgeOverTimeEligible) - .projectIsPledgeOverTimeAllowed(projectIsPledgeOverTimeAllowed) .build() } @@ -23,7 +21,6 @@ class PaymentPlanFactory { return this.paymentPlan( paymentIncrements = paymentIncrements, amountIsPledgeOverTimeEligible = true, - projectIsPledgeOverTimeAllowed = true ) } @@ -31,7 +28,6 @@ class PaymentPlanFactory { return this.paymentPlan( paymentIncrements = null, amountIsPledgeOverTimeEligible = false, - projectIsPledgeOverTimeAllowed = true ) } } diff --git a/app/src/main/java/com/kickstarter/models/PaymentPlan.kt b/app/src/main/java/com/kickstarter/models/PaymentPlan.kt index aef4571e18..9e41ef653d 100644 --- a/app/src/main/java/com/kickstarter/models/PaymentPlan.kt +++ b/app/src/main/java/com/kickstarter/models/PaymentPlan.kt @@ -7,25 +7,20 @@ import kotlinx.parcelize.Parcelize data class PaymentPlan( val amountIsPledgeOverTimeEligible: Boolean, val paymentIncrements: List?, - val projectIsPledgeOverTimeAllowed: Boolean, ) : Parcelable { fun amountIsPledgeOverTimeEligible() = this.amountIsPledgeOverTimeEligible fun paymentIncrements() = this.paymentIncrements - fun projectIsPledgeOverTimeAllowed() = this.projectIsPledgeOverTimeAllowed @Parcelize data class Builder( var amountIsPledgeOverTimeEligible: Boolean = false, var paymentIncrements: List? = null, - var projectIsPledgeOverTimeAllowed: Boolean = false, ) : Parcelable { fun amountIsPledgeOverTimeEligible(amountIsPledgeOverTimeEligible: Boolean) = apply { this.amountIsPledgeOverTimeEligible = amountIsPledgeOverTimeEligible } fun paymentIncrements(paymentIncrements: List?) = apply { this.paymentIncrements = paymentIncrements } - fun projectIsPledgeOverTimeAllowed(projectIsPledgeOverTimeAllowed: Boolean) = apply { this.projectIsPledgeOverTimeAllowed = projectIsPledgeOverTimeAllowed } fun build() = PaymentPlan( amountIsPledgeOverTimeEligible = amountIsPledgeOverTimeEligible, paymentIncrements = paymentIncrements, - projectIsPledgeOverTimeAllowed = projectIsPledgeOverTimeAllowed, ) } @@ -36,15 +31,13 @@ data class PaymentPlan( fun toBuilder() = Builder( amountIsPledgeOverTimeEligible = amountIsPledgeOverTimeEligible, paymentIncrements = paymentIncrements, - projectIsPledgeOverTimeAllowed = projectIsPledgeOverTimeAllowed, ) override fun equals(other: Any?): Boolean { var equals = super.equals(other) if (other is PaymentPlan) { equals = amountIsPledgeOverTimeEligible() == other.amountIsPledgeOverTimeEligible() && - paymentIncrements() == other.paymentIncrements() && - projectIsPledgeOverTimeAllowed() == other.projectIsPledgeOverTimeAllowed() + paymentIncrements() == other.paymentIncrements() } return equals } diff --git a/app/src/main/java/com/kickstarter/services/transformers/GraphQLTransformers.kt b/app/src/main/java/com/kickstarter/services/transformers/GraphQLTransformers.kt index 8021be249d..5a4b95e5cb 100644 --- a/app/src/main/java/com/kickstarter/services/transformers/GraphQLTransformers.kt +++ b/app/src/main/java/com/kickstarter/services/transformers/GraphQLTransformers.kt @@ -1057,7 +1057,6 @@ fun paymentPlanTransformer(buildPaymentPlanResponse: BuildPaymentPlanQuery.Payme return PaymentPlan.builder() .paymentIncrements(paymentIncrements) .amountIsPledgeOverTimeEligible(buildPaymentPlanResponse.amountIsPledgeOverTimeEligible) - .projectIsPledgeOverTimeAllowed(buildPaymentPlanResponse.projectIsPledgeOverTimeAllowed) .build() } diff --git a/app/src/main/java/com/kickstarter/viewmodels/projectpage/CrowdfundCheckoutViewModel.kt b/app/src/main/java/com/kickstarter/viewmodels/projectpage/CrowdfundCheckoutViewModel.kt index cbca01a2fd..a4ae2527c2 100644 --- a/app/src/main/java/com/kickstarter/viewmodels/projectpage/CrowdfundCheckoutViewModel.kt +++ b/app/src/main/java/com/kickstarter/viewmodels/projectpage/CrowdfundCheckoutViewModel.kt @@ -277,7 +277,7 @@ class CrowdfundCheckoutViewModel(val environment: Environment, bundle: Bundle? = emitCurrentState(isLoading = false) } .collectLatest { - showPlotWidget = it.projectIsPledgeOverTimeAllowed + showPlotWidget = project.isPledgeOverTimeAllowed() == true plotEligible = it.amountIsPledgeOverTimeEligible paymentIncrements = it.paymentIncrements emitCurrentState(isLoading = false)